Patch Forecast
Yellow warning
Plan into this sprint.

GHSA-4g23-2xm8-66gc

Nodemailer: Quadratic (O(n^2)) SMTP client reply parsing lets a malicious server or MITM cause a pre-auth remote denial of service

Risk score
45/100
CVSS
5.9 v3.1
Published
27 Oct 2026

Open in the live forecast Today's forecast

What to know

What it is
The SMTP client response parser reassembles multiline server replies by appending each continuation line onto a single response-queue entry and re-testing whether that entry is still a partial (continuation) reply on every line. The partial-response test runs str.slice(str.lastIndexOf('\n') + 1) on the growing entry, …
Affected
nodemailer (npm) >= 3.0.0, <= 10.0.9
Fix
Upgrade nodemailer to 10.0.10 or later.
Exploitation
Public proof of concept

Story map

Story map: nodemailerTHE FLAWSTHE FIXGHSA-4g23-2xm8-66gcNodemailer: Quadratic (O(n^2))SMTP client reply parsing letsa malicious server or MITM…CVSS 5.9CVE-2026-90776Nodemailer addressparser:O(n^2) on comment-joinedaddresses enables a remote…CVSS 7.5 · EPSS 1%CVE-2026-110871Nodemailer: Quadratic (O(n^2))DKIM header unfolding lets alarge folded header cause…CVSS 6.5 · EPSS 0%GHSA-v53p-9fqp-m79jNodemailer: Quadraticbacktracking in theaddressparser free-text…CVSS 7.5Upgrade nodemailer10.0.10or later on your release lineWho is exposednodemailer (npm) >= 9.1.0, <=10.0.4AMBER · PATCH THIS WEEKnodemailernodemailer/lib/addressparserparses one shape of address inO(n^2) time. A single ~640 KBaddress value blocks the Node.jsevent loop for roughly 7 seconds.And it is reachable without auth:mailparser feeds inbound email…Where it standsPublic proof of conceptCONNECTS TOSame weaknessDenial of service (CWE-400)268 other warnings in 30 days →
Story map: the flaws, the fix, how it unfolded and what it connects to. Boxes link to the record or article.

At a glance

nodemailer: Amber, patch this week. nodemailer/lib/addressparser parses one shape of address in O(n^2) time. A single ~640 KB address value blocks the Node.js event loop for roughly 7 seconds. And it is reachable without auth: mailparser feeds inbound email headers straight into this parser, so one crafted email is enough to stall a service that parses …

The flaws

  • GHSA-4g23-2xm8-66gc: Nodemailer: Quadratic (O(n^2)) SMTP client reply parsing lets a malicious server or MITM cause a pre-auth remote denial of service (CVSS 5.9)
  • CVE-2026-90776: Nodemailer addressparser: O(n^2) on comment-joined addresses enables a remote DoS (reachable via mailparser) (CVSS 7.5 · EPSS 1%)
  • CVE-2026-110871: Nodemailer: Quadratic (O(n^2)) DKIM header unfolding lets a large folded header cause remote denial of service during signing (CVSS 6.5 · EPSS 0%)
  • GHSA-v53p-9fqp-m79j: Nodemailer: Quadratic backtracking in the addressparser free-text fallback allows remote denial of service (CVSS 7.5)

The fix

Upgrade nodemailer: 10.0.10 or later on your release line

Who is exposed: nodemailer (npm) >= 9.1.0, <= 10.0.4

Where it stands

  • Public proof of concept

Connects to

Why it is Yellow

  • CVSS 5.9 medium
  • Public exploit or proof of concept referenced
  • On your watchlist: npm

Affected packages

PackageEcosystemVulnerableFixed in
nodemailernpm>= 3.0.0, <= 10.0.910.0.10

References

Original description

## Summary The SMTP client response parser reassembles multiline server replies by appending each continuation line onto a single response-queue entry and re-testing whether that entry is still a partial (continuation) reply on every line. The partial-response test runs `str.slice(str.lastIndexOf('\n') + 1)` on the growing entry, which forces a full flatten of the entire accumulated string on each line. A malicious or compromised SMTP server (or an on-path attacker on a plaintext or pre-STARTTLS hop) that streams continuation lines and never sends a completion line drives O(n^2) CPU on the single-threaded Node.js event loop before any authentication, freezing the whole process for an attacker-controlled duration. ## Root Cause The invariant that a server cannot cause superlinear client-side work while a reply is being reassembled is violated. In `src/smtp-connection/index.ts`, `_onData` splits inbound bytes into lines and, while the last queued entry is a continuation reply, concatenates each new line onto that same entry with `this._responseQueue[len - 1] += '\n' + lines[i]`. On every iteration it calls `isPartialResponse(lastline)`, which evaluates `/^\d+-/.test(str.slice(str.lastIndexOf('\n') + 1))`. Because the queued entry grows by one line per continuation line and is stored as a V8 rope (ConsString), each `lastIndexOf`/`slice` forces a full string flatten of length proportional to the accumulated reply. Executed once per line over n continuation lines, this is O(n^2) CPU. While the reply stays partial the function early-returns and never resets the entry, so the growth and the per-line reflatten continue unbounded. There is no response-size or line-count cap in the connection code; the only limits are time-based (`greetingTimeout`, and an inactivity `socketTimeout`), and neither bounds accumulated reply size. ```text Affected file and functions (verified at the published v10.0.9 artifact, in src/ and in the built dist/cjs and dist/esm output): - src/smtp-connection/index.ts: isPartialResponse (the /^\d+-/ test over str.slice(str.lastIndexOf('\n')+1)) - src/smtp-connection/index.ts: SMTPConnection._onData (the continuation-line append loop with no size cap) ``` ## Impact An attacker who is, or can impersonate, the SMTP peer the client connects to can freeze the connecting Node.js process. Because Node.js is single-threaded, event-loop starvation halts all other work in that process (every other connection, request, and timer), not just the offending SMTP session. The reply is parsed during the greeting and EHLO phases, before the client authenticates or issues any command, so no credentials on the client are required. The blocking duration scales with the volume of continuation data the attacker streams and can be sustained indefinitely by continuing to stream, and memory for the accumulated entry also grows without bound. Independent reproduction on Node.js 24 measured roughly 11.6 seconds of event-loop blocking for about 640 KB of continuation data and roughly 47 seconds for about 1.3 MB, scaling quadratically. This is a repeatable remote denial of service against the sending process. ## Proof of Concept `Node.js 24; a raw TCP listener acting as a hostile SMTP server; the client uses the shipped SMTPConnection (require('nodemailer/lib/smtp-connection')).` Steps: (1) start a TCP server that accepts a connection and streams continuation lines of the form `220-flood...\r\n` in large batches, never emitting a completion line such as `220 ready`; (2) point an SMTPConnection at it and observe the client event loop stall while the single response-queue entry grows and is reflattened on every line. A minimal microbenchmark of the exact parsing logic demonstrates the complexity: ```js // Reproduces isPartialResponse + the _onData append loop verbatim (Node 24). function isPartialResponse(str) { return /^\d+-/.test(str.slice(str.lastIndexOf('\n') + 1)); } function run(n) { const queue = []; let remainder = ''; function onData(chunk) { const lines = (remainder + chunk).split(/\r?\n/); remainder = lines.pop(); for (let i = 0; i < lines.length; i++) { if (queue.length && isPartialResponse(queue[queue.length - 1])) { queue[queue.length - 1] += '\n' + lines[i]; continue; } queue.push(lines[i]); } } let buf = ''; for (let i = 0; i < n; i++) buf += '220-flood line ' + i + '\r\n'; const t = Date.now(); onData(buf); return Date.now() - t; } for (const n of [8000, 16000, 32000, 64000]) console.log(n, run(n) + 'ms'); ``` ```text 8000 26.5ms 16000 357.6ms 32000 2712.0ms 64000 11645.1ms (2x input yields roughly 4x-7x time: quadratic. ~640 KB of continuation data blocks the event loop ~11.6s.) ``` ## Attack Chain 1. **Exposure:** The client opens an SMTP connection whose peer is attacker-controlled or attacker-influenced: a compromised or malicious configured server, a tenant-supplied outbound server in a multi-tenant "bring your own SMTP" deployment, a deliverability or mailbox-probing tool that connects to arbitrary servers, or an on-path attacker on a plaintext or pre-STARTTLS hop. 2. **Control:** The peer fully controls the bytes of its greeting and EHLO replies, including whether a reply ever completes. 3. **Path:** Inbound bytes reach the socket `data` handler `_onData`, the sole data handler; every reply phase traverses the same continuation-append loop. 4. **Guard:** No response-size or line-count cap exists. The greeting timer is time-based and cleared after the greeting, and its callback is itself starved while `_onData` runs synchronously; the inactivity timer resets on every inbound chunk, so an actively streaming attacker never trips it. 5. **Primitive:** Each continuation line appended to the single growing queue entry triggers a full string flatten in `isPartialResponse`, yielding O(n^2) synchronous CPU on the event loop. 6. **Result:**

Last activity 27 Oct 2026. Patch Forecast updates every hour.