2.8. CVE-2017-12635: Apache CouchDB Remote Privilege Escalation

    14.11.2017

    Affected

    All Versions of Apache CouchDB

    Severity

    Vendor

    The Apache Software Foundation

    Due to differences in CouchDB’s Erlang-based JSON parser and JavaScript-based JSON parser, it is possible 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.

    All users should upgrade to CouchDB or 2.1.1.

    Users on earlier versions, or users upgrading from 1.x to 2.x should consult with upgrade notes.

    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 authorisation for the newly created user. By design, users can not assign themselves roles. The vulnerability allows non-admin users to give themselves admin privileges.

    We addressed this issue by updating the way CouchDB parses JSON in Erlang, mimicking the JavaScript behaviour of picking the last key, if duplicates exist.

    This issue was discovered by .