MEDIUM · CVSS 3.1 6.5 EPSS 0.7% · 51th percentile CWE-22CWE-73

CVE-2026-129296: mail-parser: Path Traversal vulnerability in attachment extraction

Published 2026-11-16 · Updated 2026-11-16 · Also known as GHSA-fr3h-cpq2-9496

Summary

A path traversal vulnerability in the mail-parser library allows malicious attachment filenames to write files outside the intended directory via write_attachments() and write_sample(). Engineering teams using versions 3.8.0 through 4.5.0 should upgrade immediately.

Who is affected

Affected deployments are those utilizing mail-parser versions 3.8.0 to 4.5.0 to process untrusted emails and extract attachments. When processing a specially crafted email containing directory traversal sequences or absolute paths, arbitrary file overwrites can occur depending on process permissions.

Exploitability

The vulnerability can be exploited over the network with low attack complexity, requiring user interaction to open a malicious email containing the crafted attachment filename. It has a CVSS base score of 6.5 with high integrity impact, and an EPSS score of 0.006 while not being listed on the CISA KEV catalog.

Remediation

How to check your project

Automated analysis of the published advisory data, generated 2026-11-18. Not human-reviewed; verify against the official advisory. How this works.

Affected packages

EcosystemPackageAffected versionsFixed inUpgrade
PyPI mail-parser >= 3.8.0, < 4.6.0 4.6.0 python -m pip install 'mail-parser>=4.6.0'

CVSS 3.1 vector

CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N

Attack vectorNetwork
Attack complexityLow
Privileges requiredNone
User interactionRequired
ScopeUnchanged
ConfidentialityNone
IntegrityHigh
AvailabilityNone

FAQ

Which package and versions are affected?

The PyPI package mail-parser is affected in versions introduced at 3.8.0 and fixed in 4.6.0 (specifically versions 3.8.0 through 4.5.0).

Which APIs are vulnerable?

The write_attachments() and write_sample() APIs are vulnerable to path traversal during attachment extraction.

How was the issue resolved?

The maintainer fixed the issue by introducing filename sanitization, output path validation, symbolic link rejection, and path separator normalization.

Original advisory description
A path traversal vulnerability was identified in mail-parser when extracting email attachments using the write_attachments() and write_sample() APIs. A specially crafted email containing malicious attachment filenames (for example, using directory traversal sequences such as "../" or absolute filesystem paths) could cause files to be written outside the intended output directory. Depending on how the library was used and the permissions of the executing process, this could result in arbitrary file overwrite. The vulnerability affects mail-parser versions 3.8.0 through 4.5.0. The issue has been addressed by introducing comprehensive filename sanitization and path validation before any file is written to disk. The fix includes: - Sanitization of attachment filenames before writing. - Validation that all output paths remain within the intended destination directory. - Rejection of symbolic link targets. - Normalization of Windows and POSIX path separators. - Validation and rejection of invalid or unsafe filenames. - Protection applied consistently in both write_attachments() and write_sample() APIs. Users are strongly encouraged to upgrade to the patched release. ## Credits The vulnerability was responsibly reported by **Niranjan Ganesan** (Security Insights, https://securityinsights.io/, GitHub: @iam-niranjan). The vulnerability was analyzed, remediated, and the security fix was implemented by **Fedele Mantuano**, maintainer of mail-parser (LinkedIn: https://www.linkedin.com/in/fmantuano/). mail-parser would like to thank Niranjan Ganesan for following a coordinated vulnerability disclosure process and for collaborating throughout the remediation and verification of the fix.

References

Source records: GHSA-fr3h-cpq2-9496 (OSV.dev) · EPSS by FIRST, 2026-11-26.