CVE-2021-38295
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 · uneditedIn 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 confidenceA 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.
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< 3.1.2CVSS 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 checksWork through these to decide whether this CVE applies to you.
-
Identify CouchDB versionRun '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)
-
Verify if _show and _list endpoints are accessibleSend 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.
-
Check for low-privilege user creation permissionsQuery 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.
-
Inspect for existing HTML or script attachmentsQuery 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.
-
Confirm Fauxton interface accessibilityAccess 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.
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 · scoped3.1.2
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.
Apache CouchDB 3.1.2 or later
- Backup your CouchDB databases and configuration files before upgrading
- Download Apache CouchDB 3.1.2 or later from the official source (https://couchdb.apache.org/)
- Stop the current CouchDB service
- Install the new CouchDB version (3.1.2 or later)
- Start the CouchDB service
- Verify the upgrade was successful by checking the CouchDB version via the /_node/_local/_cluster API endpoint
- Test that HTML attachments no longer execute JavaScript when opened in Fauxton
Generated from the published advisory — verify against the referenced sources before acting.
- Consultation4.0 h
- Implementation8.0 h
- Testing12.0 h
- Review / QA6.0 h
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 locallyCheck 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 sourcesPractitioner notes
ContributedPeer-ranked notes from engineers who’ve handled CVE-2021-38295 in production — separate from our analysis above.
The advisory tells you what broke. It rarely tells you what actually worked. If you’ve dealt with this one, that detail is what the next engineer is searching for.
- The version that genuinely resolved it — not the one the vendor claimed
- A config change or rule that shut the vector down
- A gotcha in the upgrade path that cost you an afternoon
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.
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.
- 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