---
id: "CVE-2026-129300"
page: "https://infrastack.ai/live/CVE-2026-129300"
kind: "vulnerability"
aliases: ["CVE-2026-129300", "GHSA-xhrq-2mqv-q8wx"]
title: "mail-parser: Uncaught `OverflowError` / `OSError` on an out-of-range `Received` date"
severity: "medium"
cvss: 5.3
epss: null
exploited: false
status: "open"
category: "package"
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"]
published_at: "2026-11-16T18:17:30+00:00"
first_seen_at: "2026-11-16T18:38:03+00:00"
updated_at: "2026-11-16T22:23:55+00:00"
sources: [{"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-129300", "first_seen_at": "2026-11-16T18:38:03+00:00"}, {"source": "ghsa", "url": "https://github.com/advisories/GHSA-xhrq-2mqv-q8wx", "first_seen_at": "2026-11-16T22:22:35+00:00"}]
exploit_sources: []
---

# mail-parser: Uncaught `OverflowError` / `OSError` on an out-of-range `Received` date

Link for people: https://infrastack.ai/live/CVE-2026-129300 (this .md is for agents)

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.

_Summary, check and fix written by a model from the sources; labelled as such._

## Affected

- pypi:mail-parser affected >= 3.7.0, < 4.6.3 fixed 4.6.3

## How to check

- Check the installed version with `pip show mail-parser`; versions from `>= 3.7.0` and before `4.6.3` are affected.
- 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).

## Timeline

- 2026-11-16T18:38:03+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-129300
- 2026-11-16T22:22:35+00:00 ghsa https://github.com/advisories/GHSA-xhrq-2mqv-q8wx

## Documents

- [advisory] Vendor advisory: github.com https://github.com/SpamScope/mail-parser/security/advisories/GHSA-xhrq-2mqv-q8wx
- [advisory] Maintainer's advisory: api.github.com https://api.github.com/repos/SpamScope/mail-parser/security-advisories/GHSA-xhrq-2mqv-q8wx
- [fix] Patch: github.com https://github.com/SpamScope/mail-parser/commit/d69f6f9b6ad0bf74d731b373bbdeabb462c32b26
- [fix] Patch: github.com https://github.com/SpamScope/mail-parser/commit/e1d9fe6778045d6e2c44406bc8822e3464c1097f
- [fix] Release notes: github.com https://github.com/SpamScope/mail-parser/releases/tag/4.6.3
- [fix] Patch: github.com https://github.com/SpamScope/mail-parser/pull/171

## From the sources

### Impact

A `Received` header whose trailing date carries an out-of-range year, or a timezone offset
large enough to push the timestamp past the int64 epoch range, raises an exception that is
**outside the `MailParser*` hierarchy**. A caller that catches only mail-parser exceptions
does not catch it, and the parse of the entire message is aborted — the same class of issue
as [GHSA-24mq-4vc6-2prf](https://github.com/SpamScope/mail-parser/security/advisories/GHSA-24mq-4vc6-2prf),
which this survives (it is not a duplicate; 24mq is fixed in 4.6.2 and this reproduces on 4.6.2).

All entry points are affected: `parse_from_string()`, `parse_from_bytes()`, `parse_from_file()`,
`parse_from_file_obj()` and the `mail-parser` CLI. The header is fully attacker-controlled and
a single line is enough, so any pipeline that parses untrusted mail can be made to lose the
message — and, if one worker handles a queue, to drop the batch.

```python
import mailparser

raw = ("Received: from x ([1.2.3.4]) by mx.victim.com; "
       "Tue, 7 Mar 292277026596 14:29:24 +0000\r\n\r\nbody\r\n")
mailparser.parse_from_string(raw).mail_json
# <= 4.6.2 -> OverflowError: signed integer is greater than maximum
# 4.6.3    -> parses; the unusable hop date is reported as "date_utc": null
```

**Root cause.** `receiveds_format()` in `src/mailparser/utils.py` guarded the date conversion
with `except (TypeError, ValueError)`, but `convert_mail_date()` → `email.utils.mktime_tz()` →
`calendar.timegm()` raises `OverflowError` for years whose epoch seconds overflow int64, and
`datetime.fromtimestamp()` reports `EOVERFLOW` as `OSError` for a sufficiently large timezone
offset. The `date` and `timezone` properties already wrapped the same conversion in
`except Exception`; only the `Received` path was left open.

**Affected range.** Introduced by the date-handling change in `ca2aa6a`, first released in
3.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`
before the fix (Python 3.14). 3.6.0 is not affected.

### Patches

Fixed in **4.6.3**. `receiveds_format()` now also catches `OverflowError` and `OSError` and
records `date_utc = None` for that hop, so the rest of the message still parses:

```python
try:
    j["date_utc"], _ = convert_mail_date(i["date"])
except (TypeError, ValueError, OverflowError, OSError):
    j["date_utc"] = None
```

A sweep of year magnitudes from 10^7 to 10^12 shows only `ValueError`, `OverflowError` and
`OSError` are reachable on this path.

### Workarounds

Upgrade to 4.6.3. If you cannot upgrade, wrap every `parse_from_*` call in a bare
`except Exception` rather than `except MailParserError`, and treat the message as unparsed.

### References

- Fix: https://github.com/SpamScope/mail-parser/pull/171
- Related: [GHSA-24mq-4vc6-2prf](https://github.com/SpamScope/mail-parser/security/advisories/GHSA-24mq-4vc6-2prf)

---

_Free to read, with fair use of about 60 pages a minute. For higher limits or API access: sales@infrastack.ai_
