Junglewise Threat Intelligence

Nodemailer denial of service in address parser

Severity: low · CVSS 3.1 · Published 2025-12-18

Executive brief

Nodemailer is a popular Node.js library used to send emails from applications. A specially crafted email address header with deeply nested group structures can cause the email parser to enter infinite recursion, crashing the entire Node.js process immediately. No authentication is required—a single malicious email is enough to take down any service using the vulnerable version of Nodemailer.

Technical details

The vulnerability exists in the address parser (lib/addressparser/index.js) where nested email group structures are recursively flattened without depth limits. RFC 5322 forbids nested groups, but the parser attempts to handle them by recursively calling itself. An attacker can craft a malicious "To" header with many colons (e.g., "g0: g1: g2: ... gN: victim@example.com;") that triggers unbounded recursion in the _handleAddress function. Each colon in the group causes an additional recursive call, and with sufficient nesting (thousands of levels), the JavaScript call stack overflows, throwing "Maximum call stack size exceeded" and terminating the Node.js process. The attack requires no authentication and succeeds with a single request. The patch adds a recursion depth limit (50 levels maximum) to prevent the attack while preserving legitimate functionality, as legitimate nested groups are extremely rare.

Affected products

  • Nodemailer Project Nodemailer 7.0.10 and earlier

Timeline

  • 2025-11-27: disclosed
  • 2025-11-26: patched: Fix commit b61b9c0 implementing recursion depth limiting
  • 2025-12-18: advisory: GHSA-46j5-6fg5-4gv3 published as duplicate of GHSA-rcmh-qjqh-p98v

References