CVE-2026-129295: mail-parser is vulnerable to polynomial ReDoS in email header parsing
mail-parser is a tool that parses emails by enhancing the Python standard library and extracting message details into a comprehensive object. From 4.2.0 until 4.6.1, attacker-controlled email headers can cause polynomial regular-expression backtracking during ordinary parsefromstring(), parsefrombytes(), or parsefromfile() calls. In src/mailparser/utils.py, getaddresses() invokes the ADDRFALLBACKRE fallback when strict address parsing yields no usable address, and overlapping quantifiers rescan padded address headers quadratically or cubically. In src/mailparser/const.py, parsereceived() applies CLAUSESPLITTER to uncollapsed whitespace in a Received header, causing quadratic backtracking when a whitespace run is not followed by a clause keyword. A small, well-formed message can keep mail gateway, ticketing, quarantine, or archival parsing workers busy for extended periods. This issue is fixed in version 4.6.1.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
mail-parserto a version that resolves this vulnerability.Fixed in 4.6.1
Event History
Frequently Asked Questions
Which deployments are most exposed to this issue?
Deployments that parse untrusted email with mail-parser are exposed, including mail gateways, ticketing systems, quarantine services, and archival workers. A small, well-formed message can keep parsing workers busy for an extended period.
What does an attacker need to exploit it?
An attacker only needs to supply an email with crafted headers that are processed by ordinary parse_from_string(), parse_from_bytes(), or parse_from_file() calls. No privileges or user interaction are required.
Are normal parsing paths affected, or only unusual options?
Normal parsing paths are affected. The problematic regular expressions are reached during fallback address parsing for headers without a usable strictly parsed address and during Received-header parsing with uncollapsed whitespace that is not followed by a clause keyword.
How can I determine whether my installation is affected?
mail-parser versions from 4.2.0 until 4.6.1 are affected according to the provided information. Version 4.6.1 contains the fix.