# CVE-2026-129301: mail-parser: One hostile attachment aborts `write_attachments()` and silently drops the rest of the batch

> Crafted email attachments can abort mail-parser's attachment save, leaving malicious content undetected for downstream scanners.

- **Severity:** Medium 6.5 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:L`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Harmful if only installed:** No
- **Needs a specific call:** Yes (`write_attachments()`, `_safe_attachment_filename()`, `write_sample()`)
- **Fix available:** Yes
- **Published:** 16 Nov 2026
- **Updated:** 16 Nov 2026
- **Also known as:** GHSA-8cgq-x343-p74c

## What is CVE-2026-129301?

CVE-2026-129301 is a medium-severity denial of service vulnerability in SpamScope mail-parser, published on 16 Nov 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

mail-parser is a tool that parses emails by enhancing the Python standard library and extracting message details into a comprehensive object. From 4.6.0 until 4.6.3, write_attachments() calls _safe_attachment_filename() and write_sample() without isolating failures for individual attacker-controlled MIME parts. An RFC 2231 filename containing a NUL, a basename exceeding NAME_MAX, or an undecodable base64 payload can raise ValueError, OSError, or binascii.Error and abort the entire save loop. Later attachments remain unwritten; when a caller catches only MailParserError, the failure is not surfaced through the expected library-exception path. If a downstream scanner or sandbox reads only the extraction directory, a payload after the crafted part can be missed even though it remains in the delivered message, and the aborted batch also causes availability loss. This issue is fixed in version 4.6.3.

Weakness: CWE-436 (Interpretation Conflict), CWE-248 (Uncaught Exception)

## Which versions are affected by CVE-2026-129301?

1 open source package ship an affected version, including mail-parser.

An affected version is only exploitable if your software calls write_attachments(), _safe_attachment_filename() or write_sample(). Many projects that include it are not exposed.


| Package | Ecosystem | PURL | Affected | Fixed in |
| --- | --- | --- | --- | --- |
| `mail-parser` | PyPI | `pkg:pypi/mail-parser` | From 4.6.0 | 4.6.3 |

Status by vendor (upstream, then each distribution release and vendor build):

| Who | Release | Status | Packages | Fixed in |
| --- | --- | --- | --- | --- |
| Upstream |  | fixed | `mail-parser` | 4.6.3 |

## How do I fix CVE-2026-129301?

Upgrade mail-parser to 4.6.3 or later.

## Is CVE-2026-129301 being exploited?

There is no known exploitation of CVE-2026-129301 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-129301 and fix it if it is affected.

What it is: CVE-2026-129301 is a medium-severity denial of service vulnerability in SpamScope mail-parser, published on 16 Nov 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2026-129301 in the wild and no public exploit code.
Exposure: An affected version is only exploitable if your software calls write_attachments(), _safe_attachment_filename() or write_sample(). Many projects that include it are not exposed.

Affected packages and fixed versions:
- mail-parser (PyPI): affected from 4.6.0; fixed in 4.6.3

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
   If an affected version is present, also search the code for calls to write_attachments(), _safe_attachment_filename() or write_sample() and report whether any exist.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-129301/ (Markdown: https://insights.sbomify.com/CVE-2026-129301/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-129301
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-129301
- OSV: https://osv.dev/vulnerability/CVE-2026-129301

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-129301/
Summaries are generated and may contain mistakes; the official description above is the record.
