NewApp Monitoring is liveSign up free
AgentbeamBeta
Open-source package vulnerability · npm

GHSA-f2hq-32vh-53cc: postal-mime: Quadratic CPU consumption when decoding a header of many joinable RFC 2047 base64 encoded words

highCVSS 3.1 7.5

postal-mime 3.0.0 through 4.0.7 decodes headers with many joinable RFC 2047 base64 words in quadratic time. One crafted email of about 1.6 MB can block the Node.js event loop for one to twenty seconds. Any app that parses untrusted mail is exposed to denial of service. Upgrade to postal-mime 4.0.8.

Published Oct 23, 2026 · Analysis Nov 2, 2026

What an attacker can do

When postal-mime joins consecutive base64 encoded words such as =?utf-8?B?QUJD?=, it runs a regex over the whole text joined so far for every new word. Each run flattens the accumulated string, so the cost grows with the square of the word count. A Subject, From, To, filename or description header holding tens of thousands of such words triggers it. The exported decodeWords() helper has the same problem.

The attacker only needs to get one message to a parser. That means sending an email to a mailbox, webhook or support inbox that your service reads with postal-mime. Inline message/rfc822 parts multiply the effect, because each nested message had its own header budget. The researcher measured one to twenty seconds of blocked event loop per message, depending on the host. A few messages can stall a single-threaded worker for as long as they keep arriving. There is no confidentiality or integrity impact.

Who is affected

postal-mime from 3.0.0 up to and including 4.0.7, in any Node.js or browser app that parses untrusted mail or calls decodeWords() on untrusted input.

Check the installed version, including transitive copies:

npm ls postal-mime

postal-mime

Ecosystem
npm
Affected
>= 3.0.0, < 4.0.8
Fixed in
4.0.8
Check
npm ls postal-mime

How to fix it

Upgrade to postal-mime 4.0.8:

npm install [email protected]

The pad check now tracks the last appended word instead of testing the joined text, so decoding is linear. The same release counts parts and header bytes of inline message/rfc822 sub-messages against the whole message's limits and counts every header line as at least 64 bytes toward maxHeadersSize.

Workarounds from the advisory: lower maxHeadersSize from its 2 MiB default to bound the cost per message, or parse untrusted mail in a worker you can terminate.

How to tell if you were hit

Look for event-loop stalls or CPU spikes of several seconds in processes that parse mail, and for inbound messages with a very long Subject, From or To header made of repeated =?utf-8?B? encoded words, around 1.6 MB in size. Slow-request or health-check timeouts that line up with a mail arrival are a signal. Check your lockfile for postal-mime between 3.0.0 and 4.0.7.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Impact

Decoding a header that holds a long run of joinable RFC 2047 base64 encoded words, such as =?utf-8?B?QUJD?= repeated tens of thousands of times in a Subject, From, To, a filename or a description, took time quadratic in the number of words. The join check ran a regex over the text joined so far for every word, which flattens the accumulated string each time. A single well formed message of about 1.6 MB blocked the event loop for one to twenty seconds depending on the host, and inline message/rfc822 parts multiplied the cost, since each nested message carried its own header budget.

Any application that parses untrusted mail with postal-mime 3.0.0 through 4.0.7, including the exported decodeWords() helper, is affected. There is no confidentiality or integrity impact.

Patches

Fixed in 4.0.8. The pad check now tracks the last appended word instead of testing the joined text, so decoding is linear in the header length. The same release also counts the parts and header bytes of inline message/rfc822 sub-messages against the limits of the message as a whole, counts every header line for at least 64 bytes of maxHeadersSize, and adds a scaling test that measures every stage of the parser at two input sizes.

Workarounds

Lower maxHeadersSize from its 2 MiB default to bound the cost per message, or parse untrusted mail in a worker that can be terminated.

Credits

Reported by Felipe Fernández.

Questions

Does this lead to code execution or data theft?

No. The advisory states there is no confidentiality or integrity impact. The effect is availability only: the event loop is blocked while one message is parsed.

Is postal-mime 3.0.0 affected?

Yes. The affected range is 3.0.0 up to but not including 4.0.8. Versions before 3.0.0 are not listed as vulnerable.

Can I mitigate without upgrading?

Partly. Lowering maxHeadersSize from the 2 MiB default bounds the cost per message. Running the parser in a worker that you can terminate also limits the damage. Upgrading to 4.0.8 removes the quadratic behavior.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology