CVE-2022-24706
📋 TL;DR
CVE-2022-24706 is a critical authentication bypass vulnerability in Apache CouchDB that allows unauthenticated attackers to gain admin privileges on improperly secured default installations. This affects all CouchDB installations prior to version 3.2.2 that haven't been properly hardened according to security recommendations.
💻 Affected Systems
- Apache CouchDB
📦 What is this software?
Couchdb by Apache
⚠️ Risk & Real-World Impact
Worst Case
Complete system compromise with remote code execution, data theft, and potential lateral movement to other systems.
Likely Case
Unauthenticated attackers gaining admin access to CouchDB databases, allowing data manipulation, deletion, or exfiltration.
If Mitigated
Minimal impact if proper network segmentation, firewalls, and authentication are configured as recommended.
🎯 Exploit Status
Multiple public exploit scripts and detailed technical analysis available. Exploitation requires no authentication.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: 3.2.2 and later
Vendor Advisory: https://couchdb.apache.org/#cve-2022-24706
Restart Required: Yes
Instructions:
1. Backup CouchDB data and configuration. 2. Stop CouchDB service. 3. Upgrade to CouchDB 3.2.2 or later using your package manager or manual installation. 4. Start CouchDB service. 5. Verify upgrade and test functionality.
🔧 Temporary Workarounds
Network Access Restriction
linuxConfigure firewall rules to restrict access to CouchDB ports (default 5984, 5986) to only trusted IP addresses.
iptables -A INPUT -p tcp --dport 5984 -s TRUSTED_IP -j ACCEPT
iptables -A INPUT -p tcp --dport 5984 -j DROP
iptables -A INPUT -p tcp --dport 5986 -s TRUSTED_IP -j ACCEPT
iptables -A INPUT -p tcp --dport 5986 -j DROP
Enable Authentication
allConfigure CouchDB to require authentication for all operations, following official security hardening guidelines.
curl -X PUT http://localhost:5984/_node/_local/_config/admins/admin -d '"secure_password"'
curl -X PUT http://localhost:5984/_node/_local/_config/chttpd/require_valid_user -d '"true"'
🧯 If You Can't Patch
- Place CouchDB behind a reverse proxy with authentication (like nginx with HTTP basic auth)
- Implement network segmentation to isolate CouchDB from untrusted networks
🔍 How to Verify
Check if Vulnerable:
Check CouchDB version and attempt unauthenticated admin access: curl -X GET http://couchdb-host:5984/_membership
Check Version:
curl -s http://couchdb-host:5984/ | grep version
Verify Fix Applied:
Verify version is 3.2.2 or later and test that unauthenticated admin access is denied.
📡 Detection & Monitoring
Log Indicators:
- Unauthenticated requests to admin endpoints
- Failed authentication attempts followed by successful admin operations
- Unusual database creation or modification patterns
Network Indicators:
- Unusual traffic to CouchDB ports from unexpected sources
- HTTP requests to /_membership, /_config, or /_nodes without authentication
SIEM Query:
source="couchdb.log" AND (uri_path="/_membership" OR uri_path="/_config" OR uri_path="/_nodes") AND NOT (user!="")
🔗 References
- http://packetstormsecurity.com/files/167032/Apache-CouchDB-3.2.1-Remote-Code-Execution.html
- http://packetstormsecurity.com/files/169702/Apache-CouchDB-Erlang-Remote-Code-Execution.html
- http://www.openwall.com/lists/oss-security/2022/04/26/1
- http://www.openwall.com/lists/oss-security/2022/05/09/1
- http://www.openwall.com/lists/oss-security/2022/05/09/2
- http://www.openwall.com/lists/oss-security/2022/05/09/3
- http://www.openwall.com/lists/oss-security/2022/05/09/4
- https://docs.couchdb.org/en/3.2.2/setup/cluster.html
- https://lists.apache.org/thread/w24wo0h8nlctfps65txvk0oc5hdcnv00
- https://medium.com/%40_sadshade/couchdb-erlang-and-cookies-rce-on-default-settings-b1e9173a4bcd
- http://packetstormsecurity.com/files/167032/Apache-CouchDB-3.2.1-Remote-Code-Execution.html
- http://packetstormsecurity.com/files/169702/Apache-CouchDB-Erlang-Remote-Code-Execution.html
- http://www.openwall.com/lists/oss-security/2022/04/26/1
- http://www.openwall.com/lists/oss-security/2022/05/09/1
- http://www.openwall.com/lists/oss-security/2022/05/09/2
- http://www.openwall.com/lists/oss-security/2022/05/09/3
- http://www.openwall.com/lists/oss-security/2022/05/09/4
- https://docs.couchdb.org/en/3.2.2/setup/cluster.html
- https://lists.apache.org/thread/w24wo0h8nlctfps65txvk0oc5hdcnv00
- https://medium.com/%40_sadshade/couchdb-erlang-and-cookies-rce-on-default-settings-b1e9173a4bcd
- https://www.cisa.gov/known-exploited-vulnerabilities-catalog?field_cve=CVE-2022-24706