CVE-2026-29780: eml_parser Path Traversal Vulnerability
MODERATECVE-2026-29780 is a MODERATE (CVSS 5.5) path traversal vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting eml_parser libraries in the PyPI ecosystem. The issue involves path traversal in official example script leads to arbitrary file write. Remediation is available by upgrading affected packages to version 2.0.1.
CVE-2026-29780 at a Glance
Security Impact
CVSS: 5.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N).
How to Fix CVE-2026-29780
To remediate this vulnerability, upgrade all affected eml_parser dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install eml-parser>=2.0.1
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show eml-parser
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2026-29780, inspect your installed packages using pip:
pip show eml-parser
Analyze the terminal output to locate any version of eml_parser in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.0.1), your application is affected.
Note: The pip show eml-parser command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In eml_parser, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-29780 Affected eml_parser Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
eml-parser
|
PyPI |
< 2.0.1
|
2.0.1
|
References
Frequently Asked Questions
What is CVE-2026-29780?
Which eml_parser versions are affected?
What version fixes CVE-2026-29780?
Is eml-parser affected?
What is the CVSS score of CVE-2026-29780?
What CWE is associated with CVE-2026-29780?
How can I check PyPI dependencies for CVE-2026-29780?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-389r-rccm-h3h5",
"modified" : "2026-03-09T15:49:19Z",
"published" : "2026-03-05T00:16:57Z",
"aliases" : [ "CVE-2026-29780" ],
"summary" : "eml_parser: Path Traversal in Official Example Script Leads to Arbitrary File Write",
"details" : "### Summary\nThe official example script `examples/recursively_extract_attachments.py` contains a path traversal vulnerability that allows arbitrary file write outside the intended output directory. Attachment filenames extracted from parsed emails are directly used to construct output file paths without any sanitization, allowing an attacker-controlled filename to escape the target directory.\n\n### Details\nFile: `examples/recursively_extract_attachments.py`\nLines: 61–64\n```python\nfor a in m['attachment']:\n out_filepath = out_path / a['filename'] # No sanitization\n print(f'\\tWriting attachment: {out_filepath}')\n with out_filepath.open('wb') as a_out:\n a_out.write(base64.b64decode(a['raw']))\n```\n\nThe value `a['filename']` is attacker-controlled via crafted email attachment headers:\n```\nContent-Disposition: attachment; filename=\"../outside/pwned.txt\"\n```\n\nNo path normalization or boundary validation is performed before writing.\n\n### PoC\n1. Create a malicious `.eml` file:\n```\nContent-Disposition: attachment; filename=\"../outside/pwned.txt\"\n```\n2. Run the example script:\n```\npython recursively_extract_attachments.py -p ./emails -o ./safe\n```\n3. Expected: `./safe/pwned.txt` \n4. Actual: `./outside/pwned.txt` ← written outside the intended directory\n\nVerified on Kali Linux with eml_parser installed via pip in a virtual environment.\n\n### Impact\nThis vulnerability is limited to the **example script only** and does not affect the core eml_parser library. However, as the script is part of the official repository and is likely to be adapted for production use, an attacker supplying a crafted email could achieve arbitrary file write within the execution context.\n\nPotential attack scenarios include:\n- Cron job injection: `filename=\"../../etc/cron.d/backdoor\"`\n- Web shell upload: `filename=\"../../var/www/html/shell.php\"`\n- SSH key injection: `filename=\"../../home/user/.ssh/authorized_keys\"`\n\n### Recommended Fix\n```python\nimport os.path\n\nfor a in m['attachment']:\n filename = os.path.basename(a['filename'])\n out_filepath = out_path / filename\n\n if not out_filepath.resolve().is_relative_to(out_path.resolve()):\n print(f'[!] Skipping suspicious filename: {a[\"filename\"]}')\n continue\n\n print(f'\\tWriting attachment: {out_filepath}')\n with out_filepath.open('wb') as a_out:\n a_out.write(base64.b64decode(a['raw']))\n```",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "eml-parser"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.0.1"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/GOVCERT-LU/eml_parser/security/advisories/GHSA-389r-rccm-h3h5"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-29780"
}, {
"type" : "WEB",
"url" : "https://github.com/GOVCERT-LU/eml_parser/issues/88"
}, {
"type" : "WEB",
"url" : "https://github.com/GOVCERT-LU/eml_parser/commit/99af03a09a90aaaaadd0ed2ffb5eea46d1ea2cc9"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/GOVCERT-LU/eml_parser"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-22" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2026-03-05T00:16:57Z",
"nvd_published_at" : "2026-03-07T16:15:55Z"
}
}