CVE-2026-129296: CVE-2026-129296: Path Traversal in SpamScope mail-parser Attachment Extraction
CVE-2026-129296: Path Traversal in SpamScope mail-parser Attachment Extraction Vulnerability ID: CVE-2026-129296 CVSS Score: 6.5 Published: 2026-11-16 SpamScope mail-parser versions 3.8.0 prior to 4.6.0 contain a pa
CVE-2026-129296: Path Traversal in SpamScope mail-parser Attachment Extraction
Vulnerability ID: CVE-2026-129296
CVSS Score: 6.5
Published: 2026-11-16
SpamScope mail-parser versions 3.8.0 prior to 4.6.0 contain a path traversal vulnerability (CWE-22) within the write_attachments() and write_sample() functions. The library passes untrusted attachment filenames directly into os.path.join() without stripping directory components, validating path containment, or verifying symbolic links. An attacker can send a crafted email containing relative path traversal sequences or absolute filesystem paths in the Content-Disposition header to write or overwrite arbitrary files accessible to the parsing process.
TL;DR
A path traversal vulnerability in SpamScope mail-parser (>= 3.8.0, < 4.6.0) allows remote attackers to write or overwrite arbitrary files on the host filesystem when an application extracts attachments from a crafted email using write_attachments() or write_sample(). Upgrade to version 4.6.0 to remediate the flaw.
β οΈ Exploit Status: POC
Technical Details
- CVE ID: CVE-2026-129296 (GHSA-fr3h-cpq2-9496)
- Vulnerability Class: CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
- CVSS v3.1 Score: 6.5 Medium (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N)
- Affected Component: SpamScope mail-parser (write_attachments and write_sample)
- Affected Versions: >= 3.8.0, < 4.6.0
- Patched Version: 4.6.0
- Exploit Status: Proof-of-Concept (PoC) Available
- CISA KEV Status: Not Listed
Affected Systems
- SpamScope mail-parser (PyPI package)
-
mail-parser: >= 3.8.0, < 4.6.0 (Fixed in:
4.6.0)
Code Analysis
Commit: 3d6cb7a
Merge pull request #165: Sanitize attachment filenames, enforce output directory containment, and deduplicate collisions.
Commit: b0a2e96
Initial patch commit implementing _safe_attachment_filename and path containment checks.
Exploit Details
- GitHub: Official GitHub Security Advisory containing technical details of the path traversal mechanism.
- GitHub: Fix commit containing unit test payloads demonstrating relative, absolute, and symlink path traversal attempts.
Mitigation Strategies
- Upgrade SpamScope mail-parser to version 4.6.0 or later to enforce built-in path containment and filename sanitization.
- Replace any direct filesystem usage of mail.attachments[i]['filename'] in custom application code with mail.attachments[i]['safe_filename'].
- Run email parsing and attachment extraction worker processes under dedicated, low-privilege operating system accounts or isolated containers with read-only access to application code and system directories.
Remediation Steps:
- Audit project dependencies (requirements.txt, Pipfile, poetry.lock) to identify installations of mail-parser between versions 3.8.0 and 4.5.x.
- Run 'pip install --upgrade mail-parser>=4.6.0' in all affected environments.
- Inspect application source code for calls to mail.write_attachments(), mailparser.utils.write_sample(), or direct file writes using attachment['filename'].
- Verify that attachment extraction directories do not contain untrusted pre-existing symbolic links.
References
- GitHub Security Advisory GHSA-fr3h-cpq2-9496
- SpamScope mail-parser Pull Request #165
- Primary Fix Commit 3d6cb7a51f2ad7ea57e529121dbd5d56f29fefe8
- Secondary Fix Commit b0a2e968815f3ed9e129efb0f5f7e935a9dacd1d
- SpamScope mail-parser Release 4.6.0
- Official CVE Record: CVE-2026-129296
- NVD Vulnerability Detail: CVE-2026-129296
- CVE JSON Record in cvelistV5
Read the full report for CVE-2026-129296 on our website for more details including interactive diagrams and full exploit analysis.
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.