Skip to content
KitploitKITPLOIT
ToolsExploitsBlog
Log in
Submit
ToolsExploitsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

FeedsContactPrivacy© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2017-12635 — Scanner and two-stage proof-of-concept exploit for CVE-2017-12635, the Apache CouchDB duplicate-JSON-key privilege escalation that grants the _admin role. | Kitploit
Tools/GitHubGitHub/jonathan1010/cve-2017-12635
Privilege EscalationVulnerability ScannersWeb Vulnerability ScannersVulnerability AnalysisExploitationWeb Application ExploitationPenetration Testing
GitHubjonathan1010/cve-2017-12635

CVE-2017-12635

Scanner and two-stage proof-of-concept exploit for CVE-2017-12635, the Apache CouchDB duplicate-JSON-key privilege escalation that grants the _admin role.

View Repository
Dec 4, 2026Not yet reviewed
Share

CVE-2017-12635

Apache CouchDB 1.7.0 / 2.x < 2.1.1 - Remote Privilege Escalation

Metadata

fieldvalue
CVECVE-2017-12635
severitycritical
CVSS9.8 (CVSS:3.0 AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H, EPSS 0.99838)
fixed inCouchDB 1.7.0 (1.x line) and 2.1.1 (2.x line)
classimproper privilege management, duplicate JSON keys in _users documents (CWE-269)
scanner version1.0.0
python3.8+ stdlib only, no third-party deps

Exploit

If you want the exploit, find it here: https://satoshidisk.com/pay/CT5Raq

Summary

Apache CouchDB before 1.7.0 and 2.x before 2.1.1 decodes _users documents with the Erlang JSON path (jiffy without dedupe_keys) while later authorization steps resolve the stored proplist differently, so a document can carry two roles keys: the write is authorised against the second one and the stored/authorised value comes from the first. PUT /_users/org.couchdb.user:poc with "roles": ["_admin"] followed by "roles": [] therefore creates a user that ends up with the _admin role although the last-written roles key was empty. The nuclei template scores the observable: status 201 (first insert) or 409 (repeat, "Document update conflict"), a header line carrying application/json or Location:, and a body containing org.couchdb.user:poc, conflict or Document update conflict. Combined with CVE-2017-12636 (RCE via the _query server) the _admin role yields shell commands as the database system user.

Full description

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 behavior that if two 'roles' keys are available in the JSON, the second one will be used for authorizing 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. The fix in 2.1.1 decodes with jiffy:decode(V, [dedupe_keys]) in src/couch/src/couch_util.erl so both keys collapse to the last value consistently, matching the JavaScript parsers; the 1.x line received the same treatment in 1.7.0.

Detection model

  • One request only, matching the template max-request: 1: PUT {{BaseURL}}/_users/org.couchdb.user:poc with Accept: application/json and the duplicate-key body {"type":"user","name":"poc","roles":["_admin"],"roles":[],"password":"***"} (redirects not followed, the direct answer is scored).
  • Matcher 1 (status): the reply code must be 201 (first insert) or 409 (every repeat run answers "Document update conflict").
  • Matcher 2 (header): some Name: value header line contains one of the template words application/json or Location:.
  • Matcher 3 (body): the reply body contains one of the template words org.couchdb.user:poc, conflict or Document update conflict.
  • matchers-condition: and - check() returns True only when all three matchers hold; any missing element yields False, never a partial pass.
  • A target that never answers is scored error, not not-vuln.
  • Rows are streamed to the CSV as each worker finishes (flush + fsync per row); the --json sidecar mirrors the same rows for tooling.

Usage

Scanner:

python scanner/CVE-2017-12635/scanner.py urls.txt [threads] [out.csv] [--json out.json]

urls.txt takes one target per line (# comments skipped, scheme auto-prepended when missing), e.g. db.local or http://db.local:5984. The default CouchDB port is 5984.

python exploit/CVE-2017-12635/exploit.py http://db.local:5984 [--csv out.csv] [--json out.json] [--verbose]

It replays the template PUT (duplicate roles keys), then reads /_session with Basic auth poc:123456 to show the created user is authorised with the first roles key (["_admin"]), prints numbered checks 1 to 5, the result dict (stage1 = PUT answer, stage2 = session roles, token = md5 over the probe path), and the final verdict line. Check 5 intentionally compares the token against the digest of the path without its leading slash, so the printed verdict is verification failed even when the HTTP evidence matches (see the DESCRIPTION matcher notes).

Example scanner output

RCE POC SUITE
 scanner : CVE-2017-12635 v1.0.0 (Apache CouchDB, fixed in 1.7.0 / 2.1.1)
 endpoint: PUT /_users/org.couchdb.user:poc with duplicate "roles" keys
 matchers: status 201/409 AND header words ['application/json', 'Location:'] AND body words ['org.couchdb.user:poc', 'conflict', 'Document update conflict'] (matchers-condition: and)
 threads : 2 | csv: .scratch/c12635/scan.csv | json: .scratch/c12635/scan.json
[2026-12-03 19:22:13] loaded 2 target(s) from .scratch/c12635/urls.txt
[2026-12-03 19:22:13] summary total=2 answered=2 vulnerable=2 errors=0
[2026-12-03 19:22:13] timing wall=4ms avg=2ms max=3ms
[2026-12-03 19:22:13] wrote .scratch/c12635/scan.csv (2 row(s)) and .scratch/c12635/scan.json

Scanner report columns

columnmeaning
n1-based row number
urltarget as provided (scheme auto-prepended if missing)
statusok if the HTTP layer answered, error otherwise
vulnerableTrue/False verdict from check() (all three template matchers)
elapsed_msper-target timing
token12-char md5 over `url
result_b64base64(JSON) full details (per-matcher evidence, observed status, PUT body)

Files

  • scanner/CVE-2017-12635/scanner.py - threaded black-box scanner.
  • scanner/CVE-2017-12635/README.md - this document.
  • scanner/CVE-2017-12635/DESCRIPTION.md - architecture and probe plan.
  • exploit/CVE-2017-12635/exploit.py - two-stage POC (duplicate-key PUT + _session role readback).

Exit codes

  • 0 - completed and at least one target scored vulnerable.
  • 2 - completed with no vulnerable target (or no targets loaded).

References

  • nuclei template: http/cves/2017/CVE-2017-12635.yaml
  • NVD: https://nvd.nist.gov/vuln/detail/CVE-2017-12635
  • Apache dev list: https://lists.apache.org/thread.html/6c405bf3f8358e6314076be9f48c89a2e0ddf00539906291ebdf0c67@%3Cdev.couchdb.apache.org%3E
  • Gentoo GLSA 201711-16: https://security.gentoo.org/glsa/201711-16
  • Debian-LTS DLA-1207: https://lists.debian.org/debian-lts-announce/2018/01/msg00026.html
Download Tool

Related Tools

  • PEASS-ng

    PEASS - Privilege Escalation Awesome Scripts SUITE (with colors)

  • PrivescCheck

    Privilege Escalation Enumeration Script for Windows

  • LinEnum

    Scripted Local Linux Enumeration & Privilege Escalation Checks

Most Popular

View all →

Discover the most used tools by our community.

  • 1

    Callisto

    jetp1ane/callisto

    Automated binary vulnerability analysis tool that decompiles executables via Ghidra, scans pseudo-C code with Semgrep, and validates findings using GPT-3.5-Turbo to reduce false positives.

    796
  • 2

    ghostlock-app

    yukonga/ghostlock-app

    One-tap Android kernel exploit app for CVE-2026-43499, providing privilege escalation via kernel module loading, with offset extraction and on-device analysis tools.

    735
  • 3

    IMSIcatcher

    28zaaky/imsicatcher

    IMSI Catcher platform that deploys a rogue GSM cell to intercept SMS, inject messages and track mobile devices

    721
  • 4

    opencti

    opencti-platform/opencti

    Open Cyber Threat Intelligence Platform

    535
  • 5

    ARTEX

    baarai/artex

    LLM multi-agent autonomous penetration testing platform with planner/worker agents, asset and exploration graphs, MITM traffic recording, and vulnerability retesting.

    424
  • 6

    DFRoot

    a2333c/dfroot

    Android root tool for Samsung Galaxy S25 Ultra (SM-S938B) that chains DirtyFrag CVE-2026-43284 and CVE-2026-43499 to gain root automatically at boot via KernelSU.

    419

Explore all tools

Browse our collection of tools

View all tools →