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

Published Nov 16, 2026
·
Updated

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, writeattachments() calls safeattachmentfilename() and writesample() without isolating failures for individual attacker-controlled MIME parts. An RFC 2231 filename containing a NUL, a basename exceeding NAMEMAX, 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.

Affected Software

1 affected component
pypi/mail-parser>=4.6.0<4.6.3

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade mail-parser to a version that resolves this vulnerability.

    Fixed in 4.6.3

Event History

Nov 16, 2026
CVE Published
via MITRE·05:47 PM
Data Sourced
via MITRE·05:47 PM
DescriptionSeverityWeakness

Frequently Asked Questions

1

Who is exposed to this issue?

Deployments using mail-parser from 4.6.0 through 4.6.3 are affected when they call write_attachments(). Exposure is most significant where downstream scanners or sandboxes inspect only the attachment extraction directory.

2

What does an attacker need to provide to trigger the failure?

An attacker needs to send an email with a crafted MIME attachment part before attachments they want to prevent from being extracted. Triggering inputs include an RFC 2231 filename containing a NUL byte, a filename basename exceeding NAME_MAX, or an undecodable base64 payload.

3

How can this affect security processing?

A failure processing one crafted attachment aborts the save loop, leaving later attachments unwritten. A malicious payload placed after the crafted part can remain in the delivered message while being absent from the extraction directory inspected by a scanner or sandbox.

4

What should be done if upgrading is not immediately possible?

Ensure attachment-processing callers handle ValueError, OSError, and binascii.Error in addition to MailParserError, and avoid treating an incomplete extraction directory as evidence that all attachments were scanned. Retain and inspect the original delivered message when extraction fails.

5

How can operators identify affected behavior?

Look for write_attachments() failures involving ValueError, OSError, or binascii.Error, particularly where only MailParserError is caught. Verify whether later attachments from the same message are missing from the extraction directory after such a failure.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203