{"id":"CVE-2026-129300","kind":"vulnerability","aliases":["CVE-2026-129300","GHSA-xhrq-2mqv-q8wx"],"related":[],"title":"mail-parser: Uncaught `OverflowError` / `OSError` on an out-of-range `Received` date","description":"### Impact\n\nA `Received` header whose trailing date carries an out-of-range year, or a timezone offset\nlarge enough to push the timestamp past the int64 epoch range, raises an exception that is\n**outside the `MailParser*` hierarchy**. A caller that catches only mail-parser exceptions\ndoes not catch it, and the parse of the entire message is aborted — the same class of issue\nas [GHSA-24mq-4vc6-2prf](https://github.com/SpamScope/mail-parser/security/advisories/GHSA-24mq-4vc6-2prf),\nwhich this survives (it is not a duplicate; 24mq is fixed in 4.6.2 and this reproduces on 4.6.2).\n\nAll entry points are affected: `parse_from_string()`, `parse_from_bytes()`, `parse_from_file()`,\n`parse_from_file_obj()` and the `mail-parser` CLI. The header is fully attacker-controlled and\na single line is enough, so any pipeline that parses untrusted mail can be made to lose the\nmessage — and, if one worker handles a queue, to drop the batch.\n\n```python\nimport mailparser\n\nraw = (\"Received: from x ([1.2.3.4]) by mx.victim.com; \"\n       \"Tue, 7 Mar 292277026596 14:29:24 +0000\\r\\n\\r\\nbody\\r\\n\")\nmailparser.parse_from_string(raw).mail_json\n# <= 4.6.2 -> OverflowError: signed integer is greater than maximum\n# 4.6.3    -> parses; the unusable hop date is reported as \"date_utc\": null\n```\n\n**Root cause.** `receiveds_format()` in `src/mailparser/utils.py` guarded the date conversion\nwith `except (TypeError, ValueError)`, but `convert_mail_date()` → `email.utils.mktime_tz()` →\n`calendar.timegm()` raises `OverflowError` for years whose epoch seconds overflow int64, and\n`datetime.fromtimestamp()` reports `EOVERFLOW` as `OSError` for a sufficiently large timezone\noffset. The `date` and `timezone` properties already wrapped the same conversion in\n`except Exception`; only the `Received` path was left open.\n\n**Affected range.** Introduced by the date-handling change in `ca2aa6a`, first released in\n3.7.0. Reproduced on PyPI 3.7.0, 3.8.0, 3.9.3, 4.0.0, 4.5.0, 4.6.0, 4.6.2 and on `master`\nbefore the fix (Python 3.14). 3.6.0 is not affected.\n\n### Patches\n\nFixed in **4.6.3**. `receiveds_format()` now also catches `OverflowError` and `OSError` and\nrecords `date_utc = None` for that hop, so the rest of the message still parses:\n\n```python\ntry:\n    j[\"date_utc\"], _ = convert_mail_date(i[\"date\"])\nexcept (TypeError, ValueError, OverflowError, OSError):\n    j[\"date_utc\"] = None\n```\n\nA sweep of year magnitudes from 10^7 to 10^12 shows only `ValueError`, `OverflowError` and\n`OSError` are reachable on this path.\n\n### Workarounds\n\nUpgrade to 4.6.3. If you cannot upgrade, wrap every `parse_from_*` call in a bare\n`except Exception` rather than `except MailParserError`, and treat the message as unparsed.\n\n### References\n\n- Fix: https://github.com/SpamScope/mail-parser/pull/171\n- Related: [GHSA-24mq-4vc6-2prf](https://github.com/SpamScope/mail-parser/security/advisories/GHSA-24mq-4vc6-2prf)","summary":"A crafted Received header with an out-of-range year or timezone offset makes mail-parser raise an OverflowError or OSError that is not a MailParser exception, so callers catching only library errors lose the whole message. An attacker who can send mail to a system that parses it can make parsing abort and, in a queue worker, drop the batch.","severity":"medium","cvss":5.3,"epss":null,"exploited":false,"exploited_at":null,"products":[{"name":"mail-parser","fixed":["4.6.3"],"affected":">= 3.7.0, < 4.6.3","ecosystem":"pypi"}],"ecosystems":["pypi"],"tags":["cwe-248","email-pipeline","mail-parser","package","python"],"not_affected_if":["trusted-mail-only","version-4.6.3-or-later","version-below-3.7.0"],"how_to_check":"- Check the installed version with `pip show mail-parser`; versions from `>= 3.7.0` and before `4.6.3` are affected.\n- Search your code for `parse_from_string`, `parse_from_bytes`, `parse_from_file` or `parse_from_file_obj` on untrusted mail, and check whether the exception handling catches only `MailParserError`.","fix":"- `mail-parser` `4.6.3` (the fixed version per the product data; the fix also records the hop date as None and keeps parsing).","status":"open","published_at":"2026-11-16T18:17:30+00:00","first_seen_at":"2026-11-16T18:38:03+00:00","triaged_at":"2026-11-16T22:23:55+00:00","updated_at":"2026-11-16T22:23:55+00:00","category":"package","confidence":0.8,"triage":{"at":"2026-11-16T22:23:55Z","model":"claude-haiku-5-5","output":{"fix":"- `mail-parser` `4.6.3` (the fixed version per the product data; the fix also records the hop date as None and keeps parsing).","reach":"internet","title":"mail-parser: crafted Received date crashes parsing outside library's exception handling","impact":"low","summary":"A crafted Received header with an out-of-range year or timezone offset makes mail-parser raise an OverflowError or OSError that is not a MailParser exception, so callers catching only library errors lose the whole message. An attacker who can send mail to a system that parses it can make parsing abort and, in a queue worker, drop the batch.","audience":"developers","category":"package","nicknames":[],"who_cares":["python","mail-parser","email-pipeline"],"confidence":0.8,"fix_status":"available","needs_auth":"no","worst_case":"message parsing aborts; queue batch dropped","analyst_note":"","how_to_check":"- Check the installed version with `pip show mail-parser`; versions from `>= 3.7.0` and before `4.6.3` are affected.\n- Search your code for `parse_from_string`, `parse_from_bytes`, `parse_from_file` or `parse_from_file_obj` on untrusted mail, and check whether the exception handling catches only `MailParserError`.","plain_action":"","product_name":"","needs_analyst":false,"not_affected_if":["version-below-3.7.0","version-4.6.3-or-later","trusted-mail-only"],"who_is_affected":"Any application that parses untrusted email with mail-parser 3.7.0 up to but not including 4.6.3 is exposed, including the mail-parser CLI. Exposure is worse when the caller catches only MailParserError, because the uncaught exception aborts parsing of the whole message. Systems that parse only trusted mail, or that already catch broad exceptions, are less exposed.","user_interaction":"no","product_ecosystem":"","needs_special_setup":"no","severity_if_unknown":"unknown"},"cost_usd":0.000919,"input_tokens":5890,"output_tokens":660,"severity_before":"medium"},"analyst_status":null,"analyst_note":null,"search":"'+0000':273C '-129300':17A,25A '-2026':16A,24A '-248':30B '/spamscope/mail-parser/pull/171':506C '/spamscope/mail-parser/security/advisories/ghsa-24mq-4vc6-2prf)':515C '/spamscope/mail-parser/security/advisories/ghsa-24mq-4vc6-2prf),':175C '1.2.3.4':263C '10':458C,461C '12':462C '14':270C '24':272C '24mq':170C,184C,510C '29':271C '292277026596':269C '2mqv':21A '2prf':172C,512C '3.14':400C '3.6.0':401C '3.7.0':382C,386C '3.8.0':387C '3.9.3':388C '4.0.0':389C '4.5.0':390C '4.6.0':391C '4.6.2':188C,193C,286C,392C '4.6.3':294C,408C,477C '4vc6':171C,511C '7':267C,459C 'abort':93B,161C 'affect':198C,368C,404C 'alreadi':353C 'also':412C 'attack':79B,223C 'attacker-control':222C 'bare':489C 'batch':101B,255C 'byte':204C 'ca2aa6a':378C 'calendar.timegm':326C 'call':486C 'caller':69B,141C 'cannot':480C 'carri':109C 'catch':70B,143C,151C,413C 'caus':307C 'chang':376C 'class':164C 'cli':217C 'control':224C 'convers':315C,357C 'convert':321C,438C 'craft':40B 'cve':15A,23A 'cwe':29B 'date':14A,108C,299C,303C,314C,323C,349C,374C,419C,436C,440C,442C,449C 'date-handl':373C 'datetime.fromtimestamp':337C 'drop':99B,253C 'duplic':183C 'email':32B 'email-pipelin':31B 'email.utils.mktime':324C 'enough':121C,230C 'entir':158C 'entri':195C 'eoverflow':339C 'epoch':129C,332C 'error':73B 'everi':483C 'except':67B,133C,148C,317C,359C,360C,443C,490C,491C,494C 'file':207C,210C 'first':379C 'fix':186C,398C,406C,503C 'format':309C,410C 'fulli':221C 'ghsa':19A,169C,509C 'ghsa-24mq-4vc6-2prf':168C,508C 'ghsa-xhrq-2mqv-q8wx':18A 'github.com':174C,505C,514C 'github.com/spamscope/mail-parser/pull/171':504C 'github.com/spamscope/mail-parser/security/advisories/ghsa-24mq-4vc6-2prf)':513C 'github.com/spamscope/mail-parser/security/advisories/ghsa-24mq-4vc6-2prf),':173C 'greater':291C 'guard':312C 'handl':249C,375C 'header':42B,105C,219C 'hierarchi':139C 'hop':298C,424C 'impact':102C 'import':257C 'int64':128C,335C 'integ':289C 'introduc':370C 'issu':166C 'j':435C,448C 'json':285C 'larg':120C,345C 'left':366C 'librari':72B 'line':228C 'lose':74B,242C 'made':240C 'magnitud':456C 'mail':2A,27A,35B,55B,83B,146C,215C,237C,284C,322C,439C 'mail-pars':1A,34B,54B,145C,214C 'mail-parser':26A 'mailpars':66B,138C,258C 'mailparser.parse':280C 'mailparsererror':495C 'make':53B,91B 'mar':268C 'master':395C 'maximum':293C 'messag':77B,159C,244C,430C,499C 'mx.victim.com':265C 'n':275C,279C 'nbodi':277C 'none':421C,451C 'null':305C 'obj':211C 'offset':52B,119C,347C 'one':247C 'open':367C 'oserror':6A,61B,341C,416C,447C,468C 'out-of-rang':9A,45B,111C 'outsid':136C 'overflow':334C 'overflowerror':5A,59B,287C,328C,414C,446C,466C 'packag':37B 'pars':88B,92B,155C,199C,202C,205C,208C,235C,295C,432C,484C 'parser':3A,28A,36B,56B,147C,216C 'past':126C 'patch':405C 'path':364C,473C 'pipelin':33B,233C 'point':196C 'properti':352C 'push':123C 'pypi':385C 'python':38B,256C,399C,433C 'q8wx':22A 'queue':97B,251C 'r':274C,276C,278C 'rais':57B,131C,327C 'rang':12A,48B,114C,130C,369C 'rather':492C 'raw':259C,283C 'reachabl':470C 'receiv':13A,41B,104C,260C,308C,363C,409C 'record':418C 'refer':502C 'relat':507C 'releas':380C 'report':301C,338C 'reproduc':191C,383C 'rest':427C 'root':306C 'second':333C 'send':82B 'show':463C 'sign':288C 'singl':227C 'src/mailparser/utils.py':311C 'still':431C 'string':201C,282C 'suffici':344C 'surviv':178C 'sweep':453C 'system':86B 'timestamp':125C 'timezon':51B,118C,346C,351C 'trail':107C 'treat':497C 'tri':434C 'tue':266C 'typeerror':318C,444C 'tz':325C 'uncaught':4A 'unpars':501C 'untrust':236C 'unus':297C 'upgrad':475C,481C 'utc':304C,420C,437C,450C 'valueerror':319C,445C,465C 'whole':76B 'whose':106C,331C 'workaround':474C 'worker':98B,248C 'wrap':354C,482C 'x':262C 'xhrq':20A 'year':49B,115C,330C,455C","nicknames":[],"mitigations":[],"who_affected":"Any application that parses untrusted email with mail-parser 3.7.0 up to but not including 4.6.3 is exposed, including the mail-parser CLI. Exposure is worse when the caller catches only MailParserError, because the uncaught exception aborts parsing of the whole message. Systems that parse only trusted mail, or that already catch broad exceptions, are less exposed.","tier":"C","verified":{},"analyst_revisit_at":null,"fix_status":"available","audience":"developers","plain_action":null,"pkeys":["mailparser"],"ptokens":["mail","parser"],"labels":["cwe248","emailpipeline","mailparser","medium","package","pypi","python"],"campaign_type":null,"search_a":"'-129300':17A,25A '-2026':16A,24A '2mqv':21A 'cve':15A,23A 'date':14A 'ghsa':19A 'ghsa-xhrq-2mqv-q8wx':18A 'mail':2A,27A 'mail-pars':1A 'mail-parser':26A 'oserror':6A 'out-of-rang':9A 'overflowerror':5A 'parser':3A,28A 'q8wx':22A 'rang':12A 'receiv':13A 'uncaught':4A 'xhrq':20A","search_b":"'-248':30B 'abort':93B 'attack':79B 'batch':101B 'caller':69B 'catch':70B 'craft':40B 'cwe':29B 'drop':99B 'email':32B 'email-pipelin':31B 'error':73B 'except':67B 'header':42B 'librari':72B 'lose':74B 'mail':35B,55B,83B 'mail-pars':34B,54B 'mailpars':66B 'make':53B,91B 'messag':77B 'offset':52B 'oserror':61B 'out-of-rang':45B 'overflowerror':59B 'packag':37B 'pars':88B,92B 'parser':36B,56B 'pipelin':33B 'python':38B 'queue':97B 'rais':57B 'rang':48B 'receiv':41B 'send':82B 'system':86B 'timezon':51B 'whole':76B 'worker':98B 'year':49B","search_c":"'+0000':273C '/spamscope/mail-parser/pull/171':506C '/spamscope/mail-parser/security/advisories/ghsa-24mq-4vc6-2prf)':515C '/spamscope/mail-parser/security/advisories/ghsa-24mq-4vc6-2prf),':175C '1.2.3.4':263C '10':458C,461C '12':462C '14':270C '24':272C '24mq':170C,184C,510C '29':271C '292277026596':269C '2prf':172C,512C '3.14':400C '3.6.0':401C '3.7.0':382C,386C '3.8.0':387C '3.9.3':388C '4.0.0':389C '4.5.0':390C '4.6.0':391C '4.6.2':188C,193C,286C,392C '4.6.3':294C,408C,477C '4vc6':171C,511C '7':267C,459C 'abort':161C 'affect':198C,368C,404C 'alreadi':353C 'also':412C 'attack':223C 'attacker-control':222C 'bare':489C 'batch':255C 'byte':204C 'ca2aa6a':378C 'calendar.timegm':326C 'call':486C 'caller':141C 'cannot':480C 'carri':109C 'catch':143C,151C,413C 'caus':307C 'chang':376C 'class':164C 'cli':217C 'control':224C 'convers':315C,357C 'convert':321C,438C 'date':108C,299C,303C,314C,323C,349C,374C,419C,436C,440C,442C,449C 'date-handl':373C 'datetime.fromtimestamp':337C 'drop':253C 'duplic':183C 'email.utils.mktime':324C 'enough':121C,230C 'entir':158C 'entri':195C 'eoverflow':339C 'epoch':129C,332C 'everi':483C 'except':133C,148C,317C,359C,360C,443C,490C,491C,494C 'file':207C,210C 'first':379C 'fix':186C,398C,406C,503C 'format':309C,410C 'fulli':221C 'ghsa':169C,509C 'ghsa-24mq-4vc6-2prf':168C,508C 'github.com':174C,505C,514C 'github.com/spamscope/mail-parser/pull/171':504C 'github.com/spamscope/mail-parser/security/advisories/ghsa-24mq-4vc6-2prf)':513C 'github.com/spamscope/mail-parser/security/advisories/ghsa-24mq-4vc6-2prf),':173C 'greater':291C 'guard':312C 'handl':249C,375C 'header':105C,219C 'hierarchi':139C 'hop':298C,424C 'impact':102C 'import':257C 'int64':128C,335C 'integ':289C 'introduc':370C 'issu':166C 'j':435C,448C 'json':285C 'larg':120C,345C 'left':366C 'line':228C 'lose':242C 'made':240C 'magnitud':456C 'mail':146C,215C,237C,284C,322C,439C 'mail-pars':145C,214C 'mailpars':138C,258C 'mailparser.parse':280C 'mailparsererror':495C 'mar':268C 'master':395C 'maximum':293C 'messag':159C,244C,430C,499C 'mx.victim.com':265C 'n':275C,279C 'nbodi':277C 'none':421C,451C 'null':305C 'obj':211C 'offset':119C,347C 'one':247C 'open':367C 'oserror':341C,416C,447C,468C 'out-of-rang':111C 'outsid':136C 'overflow':334C 'overflowerror':287C,328C,414C,446C,466C 'pars':155C,199C,202C,205C,208C,235C,295C,432C,484C 'parser':147C,216C 'past':126C 'patch':405C 'path':364C,473C 'pipelin':233C 'point':196C 'properti':352C 'push':123C 'pypi':385C 'python':256C,399C,433C 'queue':251C 'r':274C,276C,278C 'rais':131C,327C 'rang':114C,130C,369C 'rather':492C 'raw':259C,283C 'reachabl':470C 'receiv':104C,260C,308C,363C,409C 'record':418C 'refer':502C 'relat':507C 'releas':380C 'report':301C,338C 'reproduc':191C,383C 'rest':427C 'root':306C 'second':333C 'show':463C 'sign':288C 'singl':227C 'src/mailparser/utils.py':311C 'still':431C 'string':201C,282C 'suffici':344C 'surviv':178C 'sweep':453C 'timestamp':125C 'timezon':118C,346C,351C 'trail':107C 'treat':497C 'tri':434C 'tue':266C 'typeerror':318C,444C 'tz':325C 'unpars':501C 'untrust':236C 'unus':297C 'upgrad':475C,481C 'utc':304C,420C,437C,450C 'valueerror':319C,445C,465C 'whose':106C,331C 'workaround':474C 'worker':248C 'wrap':354C,482C 'x':262C 'year':115C,330C,455C","cause_entry":null,"cause_path":null,"disclosures_checked_at":null,"first_public_at":"2026-08-19T23:39:30+00:00","kev":null,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L","cvss_by":"GitHub","poc_count":0,"sources":[{"source":"nvd","external_id":"CVE-2026-129300","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-129300","severity":null,"published_at":"2026-11-16T18:17:30+00:00","modified_at":"2026-11-16T18:17:30+00:00","first_seen_at":"2026-11-16T18:38:03+00:00","fetched_at":"2026-11-16T18:38:03+00:00","note":null},{"source":"ghsa","external_id":"GHSA-xhrq-2mqv-q8wx","url":"https://github.com/advisories/GHSA-xhrq-2mqv-q8wx","severity":"medium","published_at":"2026-11-16T22:20:32+00:00","modified_at":"2026-11-16T22:20:33+00:00","first_seen_at":"2026-11-16T22:22:35+00:00","fetched_at":"2026-11-16T22:27:49+00:00","note":null}],"documents":[{"id":171761,"url":"https://github.com/SpamScope/mail-parser/commit/d69f6f9b6ad0bf74d731b373bbdeabb462c32b26","title":"Patch: github.com","kind":"other","source":"nvd","publisher":"vendor","text":null,"published_at":null,"relation":"fix","confidence":null,"note":"Patch: github.com"},{"id":171762,"url":"https://github.com/SpamScope/mail-parser/commit/e1d9fe6778045d6e2c44406bc8822e3464c1097f","title":"Patch: github.com","kind":"other","source":"nvd","publisher":"vendor","text":null,"published_at":null,"relation":"fix","confidence":null,"note":"Patch: github.com"},{"id":171763,"url":"https://github.com/SpamScope/mail-parser/releases/tag/4.6.3","title":"Release notes: github.com","kind":"release","source":"nvd","publisher":"vendor","text":null,"published_at":null,"relation":"fix","confidence":null,"note":"Release notes: github.com"},{"id":171764,"url":"https://github.com/SpamScope/mail-parser/security/advisories/GHSA-xhrq-2mqv-q8wx","title":"Vendor advisory: github.com","kind":"vendor","source":"nvd","publisher":"vendor","text":null,"published_at":"2026-08-19T23:39:30+00:00","relation":"advisory","confidence":null,"note":"Vendor advisory: github.com"},{"id":172727,"url":"https://api.github.com/repos/SpamScope/mail-parser/security-advisories/GHSA-xhrq-2mqv-q8wx","title":"Maintainer's advisory: api.github.com","kind":"vendor","source":"ghsa","publisher":"vendor","text":null,"published_at":null,"relation":"advisory","confidence":null,"note":"Maintainer's advisory: api.github.com"},{"id":172729,"url":"https://github.com/SpamScope/mail-parser/pull/171","title":"Patch: github.com","kind":"other","source":"ghsa","publisher":"vendor","text":null,"published_at":null,"relation":"fix","confidence":null,"note":"Patch: github.com"}],"disclosures":[],"exploit_sources":[],"notice":"Free to read, with fair use of about 60 pages a minute. For higher limits or API access: sales@infrastack.ai"}