CVE-2026-129295
### Summary Two regular expressions used while parsing email headers backtrack polynomially on attacker-controlled input. Parsing a single small, well-formed email can consume minutes to hours of CPU, denying service to any process that parses untrusted mail. Both are reachable from an ordinary `parse_from_string()`, `parse_from_bytes()` or `parse_from_file()` call — no special API, option, or malformed structure is required by the victim. ### Details **1. Address-header fallback regex (`src/mailparser/utils.py`)** `get_addresses()` falls back to `_ADDR_FALLBACK_RE` whenever `email.utils.getaddresses(strict=True)` yields no usable address. The alternative `([^<,]*?)\s*<([^>]+)>` overlaps a lazy quantifier with an adjacent `\s*` — a space matches both. Driven by `finditer`, which retries at every offset and rescans the remainder, matching degrades to **quadratic** on `<` padding and **cubic** on whitespace padding. The fallback engages on the feature's own happy path, e.g. `From: [email protected] <[email protected]>`. Measured (4.6.0, CPython 3.14, macOS arm64; reproduced identically on Linux and on CPython 3.9, 3.11, 3.12, 3.13): | Padding | Parse time | | ---------------------- | ------------------ | | valid address + 750 sp | 0.38 s | | + 1500 sp | 2.97 s | | + 3000 sp | 23.4 s (×7.9/2×) | | + 6 KB sp | 185 s | | ~100 KB sp | hours | Fully RFC 5322-compliant folded headers (all lines ≤ 71 octets) trigger the same blowup, so the input passes normal MTA and library checks. ~100 KB of headers is within Postfix's default `header_size_limit = 102400`. All six address headers parsed by the library (`From`, `To`, `Cc`, `Bcc`, `Reply-To`, `Delivered-To`) are affected and their cost adds up linearly. **2. Received-header clause splitter (`src/mailparser/const.py`)** `parse_received()` splits on `_CLAUSE_SPLITTER`, `(?:^|\s+)(from|by|via|w
Properties
- Summary
- mail-parser is vulnerable to polynomial ReDoS in email header parsing
- Severity
- high
- Nvd fetched at
- 2026-11-16T22:44:16.771339+00:00
- Cvss score
- 7.5
- Cvss severity
- HIGH
- Retrieved at
- 2026-11-16T22:45:19+00:00
- Ghsa published
- 2026-11-16T22:11:08Z
- Source url
- https://github.com/advisories/GHSA-r7w7-vpq8-c5vv
- Ghsa updated
- 2026-11-16T22:11:09Z
- Ghsa id
- GHSA-r7w7-vpq8-c5vv
- Last source
- GitHub Advisory Database
- Score
- 7.5
- Cvss version
- 3.1
- Cve id
- CVE-2026-129295
- Cvss vector
- CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
- First seen by Signal
- 2026-11-16T18:35:21+00:00
- Is ghsa only
- false
- Vector
- CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
- Published at
- 2026-11-16T18:17:30.183
- Last modified
- 2026-11-16T18:17:30.183
Related Entities (3)
AFFECTS (1)
HAS_WEAKNESS (1)
VULNERABLE_TO (1)
Related research
Explore deeper with Ninja Signal's threat intelligence graph