CVE-2026-129299: mail-parser: Uncaught exceptions and silent header loss in mail-parser on attacker-controlled input

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. Prior to 4.6.2, multiple message-processing behaviors can raise exceptions or silently lose content. Headers colliding with methods such as Parse, Message, and WriteAttachments can place bound method objects into parsed output and raise TypeError when a caller requests JSON serialization such as mailjson. When byte input is parsed through parsefrombytes(), an 8-bit header value returned as email.header.Header can likewise raise TypeError when an Xraw accessor passes the value to json.dumps; both exceptions are outside the MailParserError hierarchy. Separately, rewritten names such as Subjectjson and XSpamFlag can be substituted or disappear from mail, headers, and JSON output while hasdefects remains false, and a headerless message can be treated as falsy before parser state is initialized, causing body and attachment properties to return empty values without an error signal. These behaviors can abort message processing or hide malicious indicators from downstream scanners. This issue is fixed in version 4.6.2.

Affected Software

1 affected component
pypi/mail-parser<4.6.2

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.2

Event History

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

Frequently Asked Questions

1

Who is exposed to this issue?

Applications that use mail-parser to process attacker-controlled email content are exposed. Impact is most relevant where parsed headers, body content, attachments, or JSON output are consumed by downstream scanners or processing workflows.

2

What can an attacker do to trigger the problem?

An attacker can supply messages with headers that collide with parser method names, 8-bit header values parsed from byte input, rewritten header names such as Subject_json or X_Spam_Flag, or no headers. These inputs can cause uncaught TypeError exceptions, silently omit or substitute header content, or make body and attachment properties appear empty.

3

Can normal defect detection identify all affected messages?

No. Rewritten header-name cases can alter or remove content from mail, headers, and JSON output while has_defects remains false. Headerless messages can also produce empty body and attachment results without an error signal.

4

What should be done if upgrading is not immediately possible?

Treat exceptions from JSON serialization and related message processing as potential malformed or adversarial input rather than relying only on MailParserError handling. Independently validate required headers and message content before downstream scanning or decision-making, particularly for headerless messages and rewritten header names.

5

What version contains the fix?

The issue is fixed in mail-parser version 4.6.2. Versions prior to 4.6.2 are affected.

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