Medium · 5.9 Node.js & npm GHSA-4g23-2xm8-66gc GHSA-g73g-hqqh-jr95 GHSA-4ffr-jq9g-5ffx
Nodemailer: Three Vulnerabilities Allow Pre-Auth Denial of Service and Address Parsing Corruption
Three vulnerabilities in the nodemailer npm package allow a malicious or on-path SMTP server to freeze a Node.js process via algorithmic complexity attacks, and allow RFC 5322 comments in angle-bracket addresses to corrupt recipient addresses before they reach the wire.
By PatchBriefing ·
Produced automatically from official sources with the help of AI. How we work →
AI summary
Three separate advisories affecting the nodemailer npm package have been published. Two describe algorithmic-complexity (quadratic time) issues in the SMTP client's parsing logic that can be triggered by a malicious or on-path SMTP server before the client authenticates, each capable of freezing the entire Node.js process. The third describes a parsing gap in nodemailer's address parser that allows an RFC 5322 comment inside an angle-bracket address to survive unstripped into the recipient value used on the wire. This briefing summarizes what is affected, why it matters, and what site owners and developers should do.
What happened
Three vulnerabilities were disclosed in nodemailer, an npm package used to send email from Node.js applications. GHSA-4g23-2xm8-66gc describes a quadratic-time (O(n^2)) flaw in how the SMTP client reassembles multiline server replies: a malicious or on-path server that streams continuation lines without ever completing the reply forces the client to repeatedly re-scan the growing accumulated text, consuming CPU quadratically in the amount of data sent. GHSA-4ffr-jq9g-5ffx describes a related but distinct issue: four regular expressions used to detect supported SMTP AUTH mechanisms from the EHLO response contain an ambiguous alternation that causes catastrophic backtracking when the response contains a long whitespace run that does not match a known mechanism name. GHSA-g73g-hqqh-jr95 describes a parsing gap in the address parser: when a recipient is written as a display name followed by an angle-bracket address (the most common form, e.g. 'Name <user@domain>'), an RFC 5322 comment placed inside the angle brackets is never recognized or stripped, so the literal comment text, including parentheses, survives into the parsed address and is sent as-is in the SMTP RCPT TO command.
Technical cause
For GHSA-4g23-2xm8-66gc, the SMTP client's response parser appends every continuation line to a single growing string and re-tests whether that string is still a partial reply by slicing from the last newline on every line; because the string is stored internally as a rope structure, each test forces a full flatten proportional to the accumulated size, yielding quadratic cost with no cap on reply size or line count. For GHSA-4ffr-jq9g-5ffx, the four AUTH-mechanism detection regular expressions contain a sub-pattern where two parts can match the same whitespace characters; when the target mechanism name is absent, the regex engine must try every possible split of the whitespace before failing, producing quadratic backtracking time. For GHSA-g73g-hqqh-jr95, the address tokenizer tracks only a single expected closing character at a time; once inside angle brackets awaiting '>', it cannot also recognize an opening comment character '(', so the comment is never tokenized as an operator and instead becomes ordinary text; the one existing cleanup routine that could catch stray comment text only runs when whitespace is present, and the vulnerable input pattern contains none.
Why it matters
Node.js runs JavaScript on a single thread, so when either quadratic-complexity flaw is triggered, the entire process is blocked, not just the affected SMTP connection. This means every other request, connection, and timer handled by that process stalls for the duration of the attack, which can be sustained as long as the attacker keeps streaming data. Both DoS issues are reachable before the client authenticates to the SMTP server, so no valid credentials are needed by the attacking peer. The address-parsing issue has a different impact: it does not crash anything, but it can cause legitimate-looking recipient addresses to be corrupted before being sent, which can cause mail delivery to silently fail against a strict receiving mail server, or cause different mail parsers in a chain to disagree about which domain is actually being addressed.
Who is affected
Applications and services that use nodemailer to connect to SMTP servers that are not fully trusted are at risk for the two denial-of-service issues. This includes multi-tenant mail-sending platforms where tenants configure their own outbound SMTP server, mailbox-probing or deliverability-testing tools that connect to arbitrary servers, and any client whose plaintext or pre-STARTTLS SMTP connection could be intercepted by a network-adjacent attacker. The address-parsing issue affects any application using nodemailer to send mail to recipients supplied as a display name plus angle-bracket address, including through the to, cc, bcc, from, replyTo fields or the explicit envelope option.
Affected versions
nodemailer: the SMTP reply-parsing denial-of-service issue (GHSA-4g23-2xm8-66gc) affects versions 3.0.0 through 10.0.9, fixed in 10.0.10. The AUTH-mechanism regex denial-of-service issue (GHSA-4ffr-jq9g-5ffx) affects versions 3.0.0 through 10.0.12, fixed in 10.0.13. The address-parsing issue (GHSA-g73g-hqqh-jr95) affects versions 3.0.0 through 10.0.12, fixed in 10.0.13.
Fixes and mitigation
Fixed versions are available: 10.0.10 addresses the SMTP reply-parsing denial-of-service issue, and 10.0.13 addresses both the AUTH-mechanism regex denial-of-service issue and the address-parsing issue. As interim mitigation for the two denial-of-service issues, only connect to trusted SMTP servers over authenticated TLS and avoid plaintext or STARTTLS-strippable connections; in multi-tenant deployments, isolate outbound SMTP sessions per tenant so that one tenant's configured server cannot stall a shared process. No specific interim mitigation for the address-parsing issue beyond upgrading was supplied in the source material.
Recommended action
Upgrade nodemailer to version 10.0.13 or later, which includes fixes for all three issues (10.0.13 supersedes the 10.0.10 fix for the reply-parsing issue, but confirm your upgrade path includes all three patches). If an immediate upgrade is not possible, restrict SMTP connections to trusted, known hosts, and treat any application-level validation of recipient addresses as potentially inconsistent with nodemailer's own parsing until upgraded.
PatchBriefing score
5.9 / 10 · Medium
Official CVSS: 5.9
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H
Why this score
The PatchBriefing score equals the official CVSS score; when this article covers several vulnerabilities, the highest one. Signals such as known exploitation and EPSS are listed separately and do not change the score.
Affected versions
- nodemailer >= 3.0.0, <= 10.0.9
- vulnerable
- ≥ 10.0.10
- patched
- nodemailer >= 3.0.0, <= 10.0.12
- vulnerable
- ≥ 10.0.13
- patched
- nodemailer >= 3.0.0, <= 10.0.12
- vulnerable
- ≥ 10.0.13
- patched
Reported fixes
Fixed versions are available: 10.0.10 addresses the SMTP reply-parsing denial-of-service issue, and 10.0.13 addresses both the AUTH-mechanism regex denial-of-service issue and the address-parsing issue. As interim mitigation for the two denial-of-service issues, only connect to trusted SMTP servers over authenticated TLS and avoid plaintext or STARTTLS-strippable connections; in multi-tenant deployments, isolate outbound SMTP sessions per tenant so that one tenant's configured server cannot stall a shared process. No specific interim mitigation for the address-parsing issue beyond upgrading was supplied in the source material.
How this was built
3 source records were collected, matched and used to prepare the report above.
-
GitHub Advisory Database database
-
GitHub Advisory Database database
-
GitHub Advisory Database database
Revision history
- Published
- Generated