postal-mime quadratic CPU consumption in RFC 2047 header decoding

Severity: high · CVSS 7.5 · Published 2026-10-23

postal-mime is a Node.js library that parses email messages and headers. Parsing a maliciously crafted email with extremely long RFC 2047 encoded headers causes excessive CPU consumption, blocking the application for up to 20 seconds per message and causing a denial of service. Applications processing untrusted email are vulnerable.

Technologies: Postalsys Postal-Mime. Vendors: npm, Postalsys.

Quick answers

Is This vulnerability exploited in the wild?
No. Junglewise Threat Intelligence has no report of This vulnerability being exploited in the wild.
How severe is This vulnerability?
High severity, with a CVSS score of 7.5, published 23 October 2026.
Which products and versions are affected?
postal-mime (npm) >= 3.0.0, < 4.0.8, SEMVER:introduced=3.0.0,fixed=4.0.8; Postalsys Postal-Mime 3.0.0 through 4.0.7.
Is there a fix for This vulnerability?
Yes. postal-mime (npm): upgrade to 4.0.8 or later. Until then: Lower the maxHeadersSize setting from its 2 MiB default to restrict the cost per message, or parse untrusted mail within a worker process that can be terminated if it hangs. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is This vulnerability attacked?
It is attacked over the network, in a software library.
Am I affected?
Check whether you run postal-mime (npm) or Postalsys Postal-Mime at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • postal-mime (npm): upgrade to 4.0.8 or later
    npm install postal-mime@4.0.8

Lower the maxHeadersSize setting from its 2 MiB default to restrict the cost per message, or parse untrusted mail within a worker process that can be terminated if it hangs.

Technical details

The decodeWords() function exhibits quadratic algorithmic complexity when processing long sequences of joinable RFC 2047 base64 encoded words due to repeated regex validation against the accumulated string. An attacker sends an email with ~1.6 MB of repeated encoded words in headers (Subject, From, To, etc.) or nested message/rfc822 parts, each causing the parser to block the event loop. The vulnerability requires network access and no user interaction or privileges.

Affected products

  • postalsys postal-mime 3.0.0 through 4.0.7

Timeline

  • 2026-10-23: advisory

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.