2.8. CVE-2017-12635: Apache CouchDB Remote Privilege Escalation — Apache CouchDB® 3.2 Documentation

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

Date: | 14.11.2017
Affected: | All Versions of Apache CouchDB
Severity: | Critical
Vendor: | The Apache Software Foundation

## 2.8.1. Description

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.

## 2.8.2. Mitigation

All users should upgrade to CouchDB 1.7.1 or 2.1.1.

Upgrades from previous 1.x and 2.x versions in the same series should be seamless.

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

## 2.8.3. Example

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.

## 2.8.4. Credit

This issue was discovered by Max Justicz.