CouchdbApplication · Apache

CVE-2021-38295

HIGH · 7.3 CVSS v3.1 Published 2021-10-14
Fix available
A fix is available. Upgrade to 3.1.2 or later.
See remediation →
73/100
Remediation priority · Elevated

Official description Straight from the sourceThe vendor's or NVD's own wording, published unedited. Authoritative, but often terse — it says what broke, rarely what to do.

NVD · unedited
In Apache CouchDB, a malicious user with permission to create documents in a database is able to attach a HTML attachment to a document. If a CouchDB admin opens that attachment in a browser, e.g. via the CouchDB admin interface Fauxton, any JavaScript code embedded in that HTML attachment will be executed within the security context of that admin. A similar route is available with the already deprecated _show and _list functionality. This privilege escalation vulnerability allows an attacker to add or remove data in any database or make configuration changes. This issue affected Apache CouchDB prior to 3.1.2

Technical summary Written by usOur analysis, written from the advisory, the CVSS vector and the affected-version data. It adds context the advisory leaves out, and never invents facts that are not in the source.

dbcve analysis · high confidence

A stored XSS vulnerability in Apache CouchDB allows low-privileged users with document creation rights to embed malicious JavaScript in HTML attachments. When an admin views these attachments through the Fauxton interface, the script executes within the admin's security context, enabling privilege escalation to modify any database or change configuration settings. The deprecated _show and _list functions provide an additional attack vector.

MitigationUpgrade to Apache CouchDB 3.1.2 or later to patch the vulnerability. Until upgrade is possible, restrict document creation permissions and consider disabling the _show and _list endpoints if unused.

Verify against the referenced sources before acting — the references below are authoritative for this CVE, this summary is not.

Affected products & versions What the vendor confirmedThe version ranges the vendor confirmed as vulnerable. If your version sits inside a range here, treat yourself as exposed until you have upgraded.

NVD · CPE data
CouchdbApplication
Affected:< 3.1.2

CVSS breakdown How the score is builtThe industry scoring standard. It rates how the flaw is reached, what it takes to exploit, and what an attacker gains — the score is derived from those, not the other way round.

From the vector
Attack vector
Local
Complexity
Low
Privileges
Low
User interaction
Required
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H

Am I affected? How to checkSteps we derive from the advisory and the affected-version data, so you can decide whether this CVE reaches your setup. They are a guide, not a scan — your own configuration is the authority.

dbcve checks

Work through these to decide whether this CVE applies to you.

  1. Identify CouchDB version
    Run 'curl http://localhost:5984/' or check the CouchDB startup logs. Look for the 'version' field in the JSON response.
    Affected if The version is below 3.1.2 (e.g., 3.1.1, 3.1.0, 3.0.x, 2.x, 1.x)
  2. Verify if _show and _list endpoints are accessible
    Send a GET request to http://localhost:5984/{db}/_design/{ddoc}/_show/{name} for any known design document. Also check http://localhost:5984/{db}/_design/{ddoc}/_list/{name}/{view}.
    Affected if These endpoints return any response (even 404s with design doc info) rather than being blocked, indicating they are still enabled.
  3. Check for low-privilege user creation permissions
    Query the _security endpoint of databases: 'curl http://localhost:5984/{db}/_security'. Review the 'members' and 'readers' sections for roles or users that have write access.
    Affected if Any non-admin users or roles have 'write' or 'create' permissions on any database.
  4. Inspect for existing HTML or script attachments
    Query all design documents: 'curl http://localhost:5984/{db}/_all_docs?startkey="_design/"&endkey="_design0"'. For each, check '_attachments' for .html, .htm, or .js files using 'curl http://localhost:5984/{db}/{docid}'
    Affected if Any attachment with MIME type 'text/html' or containing <script> tags exists in any database.
  5. Confirm Fauxton interface accessibility
    Access http://localhost:5984/_utils/ or check if the Fauxton static files are being served. Check the [httpd] section of local.ini for 'enable_cors' and admin party status.
    Affected if Fauxton is reachable and the server is not in admin-party-only mode (i.e., there are existing admins who would log in to Fauxton).

You are affected if your CouchDB version is below 3.1.2 AND you have low-privileged users with document creation rights AND the _show/_list endpoints or Fauxton interface are accessible to trigger the XSS.

Generated from the published advisory. Verify against your own configuration.

Check your environment

Paste your version and any relevant configuration and it will be compared against the affected criteria above. Do not include secrets or credentials.

AI-assisted, checked against the advisory. Informational, not a guarantee.

Remediation Closing itWhat it takes to close this. Where a vendor fix exists we point at it; where none exists we say so plainly, and can build one. Effort estimates are scoped from the advisory, not from your codebase.

dbcve · scoped
Upgrade available Upgrade to 3.1.2 or later
Fixed in 3.1.2
Interim mitigation

Upgrade to Apache CouchDB 3.1.2 or later to patch the vulnerability. Until upgrade is possible, restrict document creation permissions and consider disabling the _show and _list endpoints if unused.

Recommended fix High confidence

Apache CouchDB 3.1.2 or later

  1. Backup your CouchDB databases and configuration files before upgrading
  2. Download Apache CouchDB 3.1.2 or later from the official source (https://couchdb.apache.org/)
  3. Stop the current CouchDB service
  4. Install the new CouchDB version (3.1.2 or later)
  5. Start the CouchDB service
  6. Verify the upgrade was successful by checking the CouchDB version via the /_node/_local/_cluster API endpoint
  7. Test that HTML attachments no longer execute JavaScript when opened in Fauxton
Caveat Minor version upgrades within 3.x typically do not introduce breaking changes; however, review release notes for any configuration or compatibility notes

Generated from the published advisory — verify against the referenced sources before acting.

Fix this in Couchdb Scoped from the published advisory
  • Consultation4.0 h
  • Implementation8.0 h
  • Testing12.0 h
  • Review / QA6.0 h
30.0 hours of engineering $5,120
Get the upgrade done

An estimate, not a bill — we confirm scope with you before any work starts. Need it this week? Rush from $8,192.

Scan for this in your stack

Free · runs locally
dbcve dependency scanner

Check whether your project pulls in CVE-2021-38295 — or any other known-vulnerable package — straight from your lock files. Free and open source; it runs locally and uploads nothing.

References Go to the primary sourcePrimary sources — vendor advisories, patches and trackers. Where our summary and a reference disagree, the reference wins.

Primary sources

Practitioner notes

Contributed

Peer-ranked notes from engineers who’ve handled CVE-2021-38295 in production — separate from our analysis above.

No notes yet

Be the first to add a field note for this CVE — a mitigation you’ve verified, a version caveat, or a link to a working fix. Sign in above to contribute.

What this is

A place for practitioners to share what actually worked: a mitigation you’ve tested, a configuration change, a version- or environment-specific caveat, or a link to a verified patch. The most useful notes rise to the top as peers upvote them, so the signal stays high.

What belongs here
  • Verified mitigations, workarounds, and config changes
  • Version or environment caveats, and links to real fixes
  • No weaponised exploit code, or anything meant to cause harm
  • No spam, self-promotion, credentials, or personal data