CVE-2026-129301: Security Scanner Evasion and Batch Denial of Service in SpamScope mail-parser via Unhandled Attachment Exceptions

Vulnerability ID: CVE-2026-129301
CVSS Score: 6.5
Published: 2026-11-16

CVE-2026-129301 (GHSA-8cgq-x343-p74c) is an uncaught exception and MIME interpretation conflict vulnerability in the Python email parsing library mail-parser (versions >= 4.6.0 and < 4.6.3). The write_attachments() function iterates over parsed email attachments without per-attachment exception containment. When processing a specially crafted MIME part containing an RFC 2231-encoded null byte in the filename, a basename exceeding filesystem NAME_MAX limits, or a malformed base64 payload, the function raises an unhandled standard library exception (ValueError, OSError, or binascii.Error). This prematurely aborts the attachment extraction loop, preventing subsequent attachments from being written to disk for downstream security inspection while also triggering unhandled worker crashes in applications that only catch MailParserError.

TL;DR

In mail-parser versions 4.6.0 through 4.6.2, write_attachments() lacks per-attachment exception handling. An attacker can include a malformed attachment part early in a multipart MIME message to trigger an unhandled ValueError, OSError, or binascii.Error, terminating the extraction loop before subsequent malicious attachments are written to disk for antivirus or sandbox analysis.

⚠️ Exploit Status: POC

Technical Details

  • Vulnerability ID: CVE-2026-129301 / GHSA-8cgq-x343-p74c
  • CWE Classification: CWE-248 (Uncaught Exception) / CWE-436 (Interpretation Conflict)
  • CVSS v3.1 Score: 6.5 Medium (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:L)
  • Affected Component: write_attachments() and write_sample() in src/mailparser/utils.py
  • Affected Versions: mail-parser >= 4.6.0, < 4.6.3
  • Patched Version: mail-parser 4.6.3
  • Primary Impact: Downstream security scanner evasion and unhandled worker crash (DoS)
  • Exploit Status: Proof-of-Concept available in official repository tests

Affected Systems

  • SpamScope mail-parser (PyPI package: mail-parser)
  • mail-parser: >= 4.6.0, < 4.6.3 (Fixed in: 4.6.3)

Code Analysis

Commit: 11b894a

Fix write_attachments exception guard, filename truncation, and lenient base64 decoding

Commit: e1d9fe6

Merge commit for Pull Request #171 into master

Exploit Details

Mitigation Strategies

  • Upgrade mail-parser to version 4.6.3 or later to enforce per-attachment exception isolation, proactive filename truncation, and lenient base64 decoding.
  • Configure email security gateways and sandbox pipelines to fail closed (quarantine or flag for manual review) when any MIME part logs an extraction warning or fails filename validation.
  • Wrap manual attachment processing loops in broad exception handlers that catch (MailParserError, OSError, ValueError) per item rather than wrapping the entire batch call.

Remediation Steps:

  1. Identify all Python services, virtual environments, and container images using mail-parser versions >= 4.6.0 and < 4.6.3.
  2. Update dependency manifests (requirements.txt, pyproject.toml, Pipfile) to require mail-parser>=4.6.3 and redeploy affected workers.
  3. Verify that application logging captures warnings from the mailparser logger to detect incoming emails attempting to trigger skipped attachment conditions.

References

Read the full report for CVE-2026-129301 on our website for more details including interactive diagrams and full exploit analysis.