{"id":"GHSA-f2hq-32vh-53cc","kind":"vulnerability","aliases":["GHSA-f2hq-32vh-53cc"],"related":[],"title":"postal-mime: Quadratic CPU consumption when decoding a header of many joinable RFC 2047 base64 encoded words","description":"### Impact\n\nDecoding 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.\n\nAny 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.\n\n### Patches\n\nFixed 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.\n\n### Workarounds\n\nLower `maxHeadersSize` from its 2 MiB default to bound the cost per message, or parse untrusted mail in a worker that can be terminated.\n\n### Credits\n\nReported by Felipe Fernández.","summary":"postal-mime is an npm library that parses email messages. A crafted header with tens of thousands of joinable RFC 2047 encoded words makes decoding take quadratic time, so a single message of about 1.6 MB can block the Node.js event loop for one to twenty seconds, a denial of service.","severity":"high","cvss":7.5,"epss":null,"exploited":false,"exploited_at":null,"products":[{"name":"postal-mime","fixed":["4.0.8"],"affected":">= 3.0.0, < 4.0.8","ecosystem":"npm"}],"ecosystems":["npm"],"tags":["cwe-400","cwe-407","email-parsing","node.js","npm","package"],"not_affected_if":["no-untrusted-mail-parsing","version-4.0.8-or-later"],"how_to_check":"Run npm ls postal-mime and check whether the version is >= 3.0.0 and < 4.0.8.","fix":"Upgrade postal-mime to 4.0.8 or later.\nAs a workaround, lower maxHeadersSize below its 2 MiB default or parse untrusted mail in a worker that can be terminated.","status":"open","published_at":"2026-10-23T21:54:36+00:00","first_seen_at":"2026-10-23T21:56:55+00:00","triaged_at":"2026-10-23T21:57:08+00:00","updated_at":"2026-10-23T21:57:08+00:00","category":"package","confidence":0.85,"triage":{"at":"2026-10-23T21:57:08Z","model":"claude-haiku-5-5","output":{"fix":"Upgrade postal-mime to 4.0.8 or later.\nAs a workaround, lower maxHeadersSize below its 2 MiB default or parse untrusted mail in a worker that can be terminated.","reach":"internet","impact":"low","summary":"postal-mime is an npm library that parses email messages. A crafted header with tens of thousands of joinable RFC 2047 encoded words makes decoding take quadratic time, so a single message of about 1.6 MB can block the Node.js event loop for one to twenty seconds, a denial of service.","category":"package","who_cares":["npm","node.js","email-parsing"],"confidence":0.85,"needs_auth":"no","worst_case":"Attacker stalls the event loop, causing denial of service on the parsing process","analyst_note":"","how_to_check":"Run npm ls postal-mime and check whether the version is >= 3.0.0 and < 4.0.8.\nunknown\nunknown","needs_analyst":false,"not_affected_if":["version-4.0.8-or-later","no-untrusted-mail-parsing"],"user_interaction":"no","needs_special_setup":"no","severity_if_unknown":"high"},"cost_usd":0.000528,"input_tokens":3252,"output_tokens":406,"severity_before":"high"},"analyst_status":null,"analyst_note":null,"search":"'-400':33B '-407':35B '-8':113C '1.6':77B,169C '2':311C '2047':15A,63B,106C '3.0.0':210C '32vh':22A,27A '4.0.7':212C '4.0.8':230C '53cc':23A,28A '64':286C 'accumul':158C 'add':291C 'affect':219C 'also':257C 'append':238C 'applic':201C 'b':114C 'base64':16A,107C 'block':80B,171C 'bound':315C 'budget':199C 'byte':263C,287C 'carri':195C 'check':142C,233C 'confidenti':223C 'consumpt':6A 'cost':190C,317C 'count':258C,279C 'cpu':5A 'craft':54B 'credit':331C 'cwe':32B,34B 'decod':8A,67B,95C,247C 'decodeword':216C 'default':313C 'denial':91B 'depend':180C 'descript':131C 'email':37B,51B 'email-pars':36B 'encod':17A,64B,108C 'event':83B,173C 'everi':153C,280C,297C 'export':215C 'f2hq':21A,26A 'far':151C 'felip':334C 'fernández':335C 'filenam':128C 'fix':228C 'flatten':156C 'form':165C 'ghsa':20A,25A 'ghsa-f2hq-32vh-53cc':19A,24A 'header':10A,55B,97C,198C,252C,262C,281C 'helper':217C 'hold':99C 'host':183C 'impact':94C,226C 'includ':213C 'inlin':185C,265C 'input':304C 'instead':240C 'integr':225C 'join':141C,149C,244C 'joinabl':13A,61B,104C 'last':237C 'least':285C 'length':253C 'librari':48B 'limit':272C 'line':282C 'linear':249C 'long':101C 'loop':84B,174C 'lower':307C 'mail':205C,323C 'make':66B 'mani':12A 'maxheaderss':289C,308C 'mb':78B,170C 'measur':296C 'messag':52B,74B,166C,194C,269C,275C,319C 'message/rfc822':186C,266C 'mib':312C 'mime':3A,31A,44B,209C 'multipli':188C 'nest':193C 'node.js':39B,82B 'npm':40B,47B 'number':137C 'one':86B,176C 'packag':41B 'pad':232C 'pars':38B,50B,203C,321C 'parser':301C 'part':187C,260C 'patch':227C 'per':318C 'postal':2A,30A,43B,208C 'postal-mim':1A,42B,207C 'postal-mime':29A 'quadrat':4A,69B,134C 'qujd':115C 'ran':143C 'regex':145C 'releas':256C 'repeat':116C 'report':332C 'rfc':14A,62B,105C 'run':102C 'scale':293C 'second':89B,179C 'servic':93B 'sinc':191C 'singl':73B,163C 'size':305C 'stage':298C 'string':159C 'sub':268C 'sub-messag':267C 'subject':124C 'take':68B 'ten':57B,117C 'termin':330C 'test':242C,294C 'text':148C,245C 'thousand':59B,119C 'time':70B,121C,133C,161C 'took':132C 'track':235C 'twenti':88B,178C 'two':303C 'untrust':204C,322C 'utf':112C 'well':164C 'whole':278C 'word':18A,65B,109C,139C,154C,239C 'workaround':306C 'worker':326C","nicknames":[],"mitigations":[],"who_affected":null,"tier":"B","verified":{},"analyst_revisit_at":null,"first_public_at":"2026-10-23T21:54:36+00:00","kev":null,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","cvss_by":"GitHub","poc_count":0,"sources":[{"source":"ghsa","external_id":"GHSA-f2hq-32vh-53cc","url":"https://github.com/advisories/GHSA-f2hq-32vh-53cc","severity":"high","published_at":"2026-10-23T21:54:36+00:00","modified_at":"2026-10-23T21:54:37+00:00","first_seen_at":"2026-10-23T21:56:55+00:00","fetched_at":"2026-10-23T21:56:55+00:00","note":null}],"documents":[],"notice":"Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai"}