Quadratic CPU consumption in postal-mime RFC 2047 header decoding
Key facts
- Attack vector
- —
- Privileges required
- —
- User interaction
- —
- Attack complexity
- —
- Impact type
- Denial of service
- Confidentiality · integrity · availability
- —
- Fix status
- Fixed
No CVSS vector from any source. Fix status from GitHub. Impact type from CWE-400.
Summary
postal-mime versions from 3.0.0 before 4.0.8 are affected, including the exported decodeWords() helper. When a header such as Subject or From holds a long run of joinable RFC 2047 base64 encoded words, decoding takes time quadratic in the number of words, so an untrusted mail message can block the event loop for one to twenty seconds. Any application that parses untrusted mail with these versions is exposed. The advisory reports no confidentiality or integrity impact.
Written with Claude Haiku 5.5 from the sources below · 2026-10-28
Description from the GitHub advisory
### 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.
Why it matters now
SSVC decision points
Not available: CISA has not published SSVC decision points for this record.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| — | postal-mime (npm) | 3.0.0 to before 4.0.8 | 4.0.8 | Patch available | GHSA-f2hq-32vh-53cc |
- postal-mime (npm) Vendor— Affected 3.0.0 to before 4.0.8 Fixed in 4.0.8 Patch available GHSA-f2hq-32vh-53cc
Remediation
Upgrade postal-mime to version 4.0.8, which makes decoding linear in the header length. If upgrading is not possible, lower maxHeadersSize from its 2 MiB default or parse untrusted mail in a worker that can be terminated.
Written with Claude Haiku 5.5 from the sources below · 2026-10-28
- Fix · GHSA-f2hq-32vh-53cc postal-mime (npm) Fixed in 4.0.8 Advisory →
Timeline
- 2026-10-23 Threatist record created from GHSA-f2hq-32vh-53cc
References
Sources
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences