Nov 17, 2026·8 min read·1 visit
SpamScope mail-parser versions 3.7.0 through 4.6.2 fail to catch OverflowError and OSError exceptions when parsing extreme dates or timezone offsets in Received email headers. Remote attackers can send crafted emails to crash automated parsing workers or evade security inspection pipelines. Upgrading to version 4.6.3 resolves the issue.
CVE-2026-129300 (GHSA-xhrq-2mqv-q8wx) is an unhandled exception vulnerability in SpamScope mail-parser, a Python library used to parse raw emails. When processing an email with a malformed Received header containing an out-of-range year or timezone offset, standard library datetime conversion routines raise OverflowError or OSError. Because the internal error handler only caught TypeError and ValueError, these exceptions escape the parser hierarchy, terminating email ingestion pipelines and causing a denial of service.
SpamScope mail-parser is a widely deployed Python library designed to parse raw RFC 5322 email messages into structured objects. It serves as an extraction engine for email headers, body content, attachments, and routing path inspection, and is frequently integrated into automated threat intelligence pipelines, anti-spam filters, and Security Orchestration, Automation, and Response (SOAR) platforms.
Because mail-parser operates directly on untrusted data ingested from external Simple Mail Transfer Protocol (SMTP) gateways, IMAP mailboxes, and webhook endpoints, its parsing routines represent an exposed network attack surface. Callers rely on the library to safely handle malformed or non-compliant email headers by raising exceptions strictly confined within the custom MailParserError hierarchy.
CVE-2026-129300 (tracked as GHSA-xhrq-2mqv-q8wx) is an uncaught exception vulnerability classified under CWE-248. The flaw exists within the receiveds_format() utility function located in src/mailparser/utils.py, which is responsible for normalizing routing timestamps across all Received headers in an email message.
When receiveds_format() processes a Received header containing an extreme out-of-range year or timezone offset, underlying Python standard library date conversion routines raise OverflowError or OSError. Because the exception handler in versions 3.7.0 through 4.6.2 only catches TypeError and ValueError, the unhandled exception escapes top-level parsing functions and terminates the calling execution thread.
In RFC 5322 compliant email messages, each mail transfer agent (MTA) prepends a Received header to document the routing hop. These headers typically terminate with a semicolon followed by a date-time specification. During message parsing, mail-parser extracts these headers and invokes receiveds_format() in src/mailparser/utils.py to normalize the hop timestamps into UTC format.
To perform this normalization, receiveds_format() strips leading comments from the raw date string and passes the resulting string to convert_mail_date(). Internally, convert_mail_date() parses the components of the timestamp and delegates the epoch calculation and timezone shifting to the Python standard library functions calendar.timegm() and datetime.fromtimestamp().
The root cause of CVE-2026-129300 is an incomplete exception handling block surrounding the call to convert_mail_date(). The developer anticipated malformed strings that would fail type checking or format parsing, wrapping the call in an except (TypeError, ValueError): block. However, when numerical components of the date string are syntactically valid integers that exceed C-level integer boundaries, Python raises exceptions outside this tuple.
Specifically, two distinct failure modes occur inside the standard library delegates:
292277026596), calendar.timegm() attempts to convert the value into epoch seconds. This value exceeds standard 64-bit integer limits (int64), causing the runtime to raise OverflowError.+9999999999999999), applying the offset shifts the calculated timestamp outside the valid bounds supported by the underlying operating system's C library localtime or gmtime implementation. When datetime.fromtimestamp() encounters the resulting EOVERFLOW errno, Python raises an OSError.Neither OverflowError nor OSError inherits from TypeError, ValueError, or the library's custom MailParserError base class. While other timestamp properties in mail-parser (such as the primary Date header property) wrapped convert_mail_date() in a broad except Exception: handler, the Received header processing path omitted this coverage.
The vulnerability is isolated to the date conversion block within receiveds_format() in src/mailparser/utils.py. Prior to version 4.6.3, the implementation assumed that any failure inside convert_mail_date() would manifest exclusively as a TypeError or ValueError.
# Vulnerable implementation in src/mailparser/utils.py (< 4.6.3)
def receiveds_format(receiveds):
# ... [truncated] ...
if i.get("date"):
i["date"] = re.sub(r"^\s*(?:\([^)]*\)\s*)+", "", i["date"])
try:
j["date_utc"], _ = convert_mail_date(i["date"])
except (TypeError, ValueError):
# Fails to catch OverflowError or OSError raised by C-backed stdlib calls
j["date_utc"] = NoneIn commits d69f6f9b6ad0bf74d731b373bbdeabb462c32b26 and e1d9fe6778045d6e2c44406bc8822e3464c1097f (merged via Pull Request #171), the maintainers updated the exception tuple in receiveds_format() to explicitly catch OverflowError and OSError alongside TypeError and ValueError.
--- a/src/mailparser/utils.py
+++ b/src/mailparser/utils.py
@@ -862,7 +862,12 @@ def receiveds_format(receiveds):
i["date"] = re.sub(r"^\s*(?:\([^)]*\)\s*)+", "", i["date"])
try:
j["date_utc"], _ = convert_mail_date(i["date"])
- except (TypeError, ValueError):
+ except (TypeError, ValueError, OverflowError, OSError):
+ # Out-of-range dates fail in three different ways: a huge
+ # year overflows int64 inside calendar.timegm()
+ # (OverflowError), and a huge timezone offset pushes the
+ # timestamp into the band where datetime.fromtimestamp()
+ # reports EOVERFLOW (OSError).
j["date_utc"] = None
# Add delayWhen the patched code encounters an out-of-range year or timezone offset, it catches the resulting exception and assigns None to j["date_utc"], matching the fallback behavior already established for unparseable date strings. This allows the parser to continue processing the remaining headers and body of the email without interruption.
> [!NOTE]
> Fix Completeness Assessment: Expanding the exception tuple to (TypeError, ValueError, OverflowError, OSError) addresses all known exception types raised by Python's email.utils.parsedate_tz, calendar.timegm, and datetime.fromtimestamp when operating on string inputs. Because i["date"] is guaranteed to be a string due to the preceding re.sub() operation, no other standard library exception types are reachable through convert_mail_date().
Exploiting CVE-2026-129300 requires no authentication, elevated privileges, or user interaction. An attacker only needs the ability to submit an email message to a target service or ingestion pipeline that parses messages using a vulnerable version of mail-parser (>= 3.7.0, < 4.6.3).
Because SMTP allows senders to include arbitrary preexisting Received headers in outbound messages before they reach the recipient's mail boundary, an attacker can prepend a forged Received header containing a malformed timestamp directly in the raw message payload. When the recipient system ingests the message via parse_from_string(), parse_from_bytes(), parse_from_file(), or parse_from_file_obj(), the parser processes all Received headers sequentially and triggers the crash.
The vulnerability can be triggered using either of two distinct header payloads:
Received: from attacker.com ([192.0.2.1]) by mx.victim.com; Tue, 7 Mar 292277026596 14:29:24 +0000Received: from attacker.com ([192.0.2.1]) by mx.victim.com; 7 Mar 1970 14:29:24 +99999999999999999999The following script demonstrates both unhandled exception vectors against vulnerable installations of mail-parser:
import mailparser
# Vector 1: Triggers OverflowError in calendar.timegm() via 12-digit year
raw_mail_year = (
"Received: from x ([1.2.3.4]) by mx.victim.com; "
"Tue, 7 Mar 292277026596 14:29:24 +0000\r\n\r\nTest Body\r\n"
)
try:
mail = mailparser.parse_from_string(raw_mail_year)
print("Parsed year vector successfully:", mail.received)
except OverflowError as e:
print("VULNERABLE: Unhandled OverflowError escaped parser:", e)
# Vector 2: Triggers OSError (EOVERFLOW) in datetime.fromtimestamp() via extreme timezone
raw_mail_tz = (
"Received: from a by b; 7 Mar 1970 14:29:24 +9999999999999999\r\n\r\nTest Body\r\n"
)
try:
mail = mailparser.parse_from_string(raw_mail_tz)
print("Parsed timezone vector successfully:", mail.received)
except OSError as e:
print("VULNERABLE: Unhandled OSError escaped parser:", e)On versions prior to 4.6.3, executing this script results in immediate exception termination on both vectors. On version 4.6.3 and later, both calls return a parsed object where the date_utc field for the malformed hop is safely set to None.
CVE-2026-129300 carries a CVSS v3.1 base score of 5.3 (Medium) with the vector CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L. The vulnerability does not permit memory corruption, arbitrary code execution, data disclosure, or unauthorized modification of data. Its impact is strictly confined to service availability and downstream inspection logic.
In production environments, applications utilizing mail-parser typically catch MailParserError to isolate malformed emails from halting worker processes. Because OverflowError and OSError bypass MailParserError, an uncaught exception terminates the active worker thread or process.
If the ingestion architecture processes emails in batches without per-message fault isolation, a single email containing a malformed Received header will abort processing for the entire batch. Furthermore, if the message queue broker automatically retries unacknowledged messages upon worker crash, a single malicious email can create a poison-pill loop that repeatedly crashes worker instances and stalls the ingestion queue.
> [!WARNING]
> Defense Evasion Risk (MITRE ATT&CK T1562.001): Security analysis frameworks, phishing detection engines, and malware sandboxes (such as SpamScope) rely on mail-parser to extract URLs, headers, and file attachments for inspection. If an error handler fails open when an unexpected exception occurs during parsing, an attacker can prepend a malformed Received header to a phishing or malware email to crash the analysis routine and bypass automated security inspection.
The primary remediation is to upgrade mail-parser to version 4.6.3 or later, which incorporates the expanded exception handling in src/mailparser/utils.py.
Update the dependency using pip or your project's package manager:
pip install --upgrade "mail-parser>=4.6.3"After upgrading, verify the installed version in your Python environment:
python3 -c "import mailparser; print(mailparser.__version__)"For environments where an immediate package upgrade cannot be deployed, developers should implement a defensive wrapper around all mail-parser entry points (parse_from_string, parse_from_bytes, parse_from_file, and parse_from_file_obj) that explicitly catches OverflowError and OSError alongside MailParserError:
import logging
import mailparser
from mailparser.exceptions import MailParserError
def safe_parse_email(raw_content: str):
try:
return mailparser.parse_from_string(raw_content)
except (MailParserError, OverflowError, OSError) as exc:
logging.warning("Failed to parse email due to malformed header or date overflow: %s", exc)
return NoneNote that while catching OverflowError and OSError outside the library prevents the calling worker process from crashing, the parser will still abort processing of the individual message containing the malformed header. Upgrading to version 4.6.3 is necessary to allow the library to gracefully set date_utc to None and complete parsing of the remaining email body and attachments.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L| Product | Affected Versions | Fixed Version |
|---|---|---|
mail-parser SpamScope | >= 3.7.0, < 4.6.3 | 4.6.3 |
| Attribute | Detail |
|---|---|
| CVE ID | CVE-2026-129300 (GHSA-xhrq-2mqv-q8wx) |
| Weakness Class | CWE-248: Uncaught Exception |
| CVSS v3.1 Score | 5.3 Medium (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L) |
| Affected Component | receiveds_format() in src/mailparser/utils.py |
| Affected Versions | SpamScope mail-parser >= 3.7.0, < 4.6.3 |
| Patched Version | 4.6.3 |
| Impact | Denial of Service via unhandled OverflowError or OSError |
| CISA KEV Status | Not Listed |
An exception is thrown by an application or runtime environment, but the application does not catch or handle the exception, causing the program to terminate unexpectedly or enter an unexpected state.
CVE-2026-129301 (GHSA-8cgq-x343-p74c) is an uncaught exception and MIME interpretation conflict vulnerability in the Python email parsing library mail-parser (versions >= 4.6.0 and < 4.6.3). The write_attachments() function iterates over parsed email attachments without per-attachment exception containment. When processing a specially crafted MIME part containing an RFC 2231-encoded null byte in the filename, a basename exceeding filesystem NAME_MAX limits, or a malformed base64 payload, the function raises an unhandled standard library exception (ValueError, OSError, or binascii.Error). This prematurely aborts the attachment extraction loop, preventing subsequent attachments from being written to disk for downstream security inspection while also triggering unhandled worker crashes in applications that only catch MailParserError.
Directus versions prior to 12.3.1 contain an authorization bypass and privilege management flaw in the SharesService component. Authenticated non-administrative users with update permissions on the directus_shares collection can modify the user_created, role, item, and collection fields of an existing owned share. Because the update operation validates permissions solely against the pre-update record state without revalidating the modified fields, an attacker can reassign share ownership and role context to an administrator. Subsequent guest access using the share token derives administrative accountability, exposing restricted relational data.
CVE-2026-88987 (GHSA-qqrg-8jpm-8mph) is a stored Cross-Site Scripting (XSS) vulnerability in the Silverstripe Framework prior to version 6.2.13. The framework's HTML sanitization engine, XssSanitiser, relies on an incomplete regular expression denylist when filtering URI schemes in HTML attributes. Specifically, the sanitizer strips data:text/html URIs but fails to restrict executable XML and XHTML media types such as data:application/xhtml+xml, data:text/xml, and data:application/xml. An authenticated user with content creation privileges can embed crafted data URIs inside HTML attributes like iframe src or object data, leading to arbitrary JavaScript execution when the content is rendered by a victim's browser.
A Stored Cross-Site Scripting (XSS) vulnerability exists in Silverstripe Framework versions prior to 6.2.13 within the SilverStripe\Core\XssSanitiser component. The HTML sanitizer fails to strip SVG data URIs (data:image/svg*) from dangerous HTML attributes such as href, src, lowsrc, and data. Authenticated CMS authors can persist crafted SVG data URIs in stored content, leading to arbitrary JavaScript execution in the browser context of users who view or interact with the rendered page.
CVE-2026-88989 (tracked as GHSA-3qh3-54qg-gpq3) is a missing authorization vulnerability (CWE-862) in the Silverstripe Framework affecting versions prior to 6.2.13. The flaw exists within the GridFieldDetailForm_ItemRequest request handler, which orchestrates record creation and editing workflows inside the Silverstripe CMS backend. Specifically, the server-side persistence method saveFormIntoRecord() fails to verify whether an authenticated user possesses the necessary creation permissions (canCreate) when processing an unpersisted DataObject record. Consequently, a low-privileged CMS user who has permission to access a GridField interface and edit existing records can bypass role-based creation restrictions. By sending a crafted HTTP POST request directly to the item/new endpoint with the action_doSave parameter, the user can instantiate and persist unauthorized database records. The vulnerability is rated Medium severity with a CVSS v3.1 base score of 4.3 and is remediated in Silverstripe Framework version 6.2.13.
Silverstripe Framework prior to version 6.2.13 contains an improper privilege management vulnerability (CWE-269) within the Group authorization and validation logic. A delegated administrator possessing the CMS_ACCESS_SecurityAdmin permission, but lacking full ADMIN privileges, can edit or reparent groups that acquire administrative capabilities indirectly via permission roles or ancestor inheritance. By adding their own account to such a group or moving a controlled group underneath a role-privileged parent, the user escalates to full administrative access across the CMS.