CVE-2026-129307
ReDoS in eml_parser routing regex via crafted Received header
- CVSS 5.3
- CWE-407
- Resource Management
- Remote
eml_parser serves as a python module for parsing eml files and returning various information found in the e-mail as well as computed information. In 3.0.3 and earlier, eml_parser.routing.parserouting() in eml_parser/routing.py builds a regular expression with multiple greedy capture groups and appends the npdate date literal extracted from a normalized copy of an attacker-controlled Received header, then searches that expression against the original unnormalized line. A formatting difference can make the trailing literal impossible to match, causing exhaustive backtracking across the greedy groups at each start position. The unsliced Received-header path is invoked by decode_email, decode_email_bytes, and parse_email, so one small unauthenticated message can pin a parser worker and create sustained queue backlog. This issue is fixed in version 3.0.4.
- CWE
- CWE-407
- CVSS base score
- 5.3
- Published
- 2026-11-16
- OWASP
- A04 Insecure Design
- Orthogonal defect classification
- Timing/Serialization
- Code defect classification
- Timing Issues
- Category
- Resource Management
- Subcategory
- Resource Exhaustion
- Accessibility scope
- Remote
- Impact
- Denial of Service (DoS)
- Affected component
- eml_parser
- Fixed by upgrading
- Yes
Solution
Upgrade eml_parser to version 3.0.4 (or later) to fix the vulnerability.
Vulnerable code sample
import re
def parserouting(received_header: str) -> str:
"""
Extract the routing date from a Received header.
Vulnerable to catastrophic backtracking when the trailing date literal
cannot match due to formatting differences.
"""
# Normalize a copy of the header (attacker‑controlled)
norm = received_header.replace('\t', ' ').strip()
# Extract a date literal (e.g., "Fri, 23 Oct 2022 12:34:56 +0000")
npdate = norm.split(';')[-1].strip()
# Build a regex with multiple greedy capture groups and append the literal
# VULNERABLE: greedy groups cause exponential backtracking
pattern = r'(.+)(.+)' + npdate
# Search the original (unnormalized) header
match = re.search(pattern, received_header)
return match.group(0) if match else ''Patched code sample
import re
def parserouting(received_header: str) -> str:
"""
Extract the routing date from a Received header.
Fixed by making capture groups non‑greedy and escaping the literal,
eliminating catastrophic backtracking.
"""
norm = received_header.replace('\t', ' ').strip()
npdate = norm.split(';')[-1].strip()
# FIX: use non‑greedy groups and escape the date literal
pattern = r'(.+?)(.+?)' + re.escape(npdate)
match = re.search(pattern, received_header)
return match.group(0) if match else ''Published fix
Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.
- Merge commit from fork (GOVCERT-LU/eml_parser)
eml_parser/routing.py · parserouting
Cite this entry
@misc{vaitp:cve2026129307,
title = {{ReDoS in eml_parser routing regex via crafted Received header}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-129307},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-129307/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
