CVE-2026-129296: mail-parser: Path Traversal vulnerability in attachment extraction
mail-parser is a tool that parses emails by enhancing the Python standard library and extracting message details into a comprehensive object. From 3.8.0 until 4.6.0, the writeattachments() and writesample() APIs use attacker-controlled attachment filenames without sufficient sanitization and path containment validation. Directory traversal sequences and absolute filesystem paths can cause an attachment to be written outside the intended output directory. An attacker can overwrite files accessible to the parsing process when an application extracts attachments from a crafted message. This issue is fixed in version 4.6.0.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 4.6.0
Event History
Frequently Asked Questions
Which applications are exposed to this issue?
Applications using mail-parser versions from 3.8.0 up to, but not including, 4.6.0 are exposed when they call write_attachments() or write_sample() on attacker-crafted email content. The impact is limited to files that the parsing process has permission to overwrite.
What does an attacker need to exploit it?
An attacker needs to provide a crafted email with an attachment filename containing directory-traversal sequences or an absolute filesystem path, and have that message processed by an application that extracts attachments using the affected APIs. No authentication is required, but user interaction is required according to the supplied severity vector.
Is there a fixed version available?
Yes. The issue is fixed in mail-parser version 4.6.0.