{"vuln_id":"CVE-2026-129299","aliases":["GHSA-24mq-4vc6-2prf"],"description":"mail-parser: mail-parser: Security inspection bypass via crafted email messages","published_at":"2026-11-16T17:43:22Z","modified_at":"2026-11-16T22:12:52Z","first_seen_at":"2026-11-21T19:15:15.264611Z","severity":"medium","severity_source":"nvd","cvss_score":6.5,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:L","cwe":["CWE-248","CWE-436"],"vendor":null,"product":null,"kev":{"is_kev":false,"date_added":null,"due_date":null,"ransomware":false},"epss":0.00355,"epss_percentile":0.29788,"nvd_status":"Received","enriched_at":null,"links":{"nvd":"https://nvd.nist.gov/vuln/detail/CVE-2026-129299"},"matched_alias":null,"items":[{"id":2480,"source":{"id":"ghsa","name":"GitHub Security Advisories"},"title":"GHSA-24mq-4vc6-2prf / CVE-2026-129299: mail-parser: Uncaught exceptions and silent header loss in mail-parser on attacker-controlled input","summary":"mail-parser: Uncaught exceptions and silent header loss in mail-parser on attacker-controlled input\n\n### Impact\n\nTwo effects, sharing the root cause of Advisory 1 — header names chosen by the sender were\nresolved through Python attribute lookup and rewritten before lookup.\n\n**Uncaught exceptions.** A crafted message raises an exception that is *outside* the\n`MailParser*` hierarchy, so a caller catching only mail-parser exceptions does not catch it\nand the worker dies.\n\n*Header named after a method* (CWE-248, reported by @iam-niranjan). Python resolves real\nclass attributes before `__getattr__`, so a header named after a method put a bound method\nobject into the parsed mail dict. A 12-byte email is sufficient. Nine colliding names were\nconfirmed: `Parse`, `Message`, `Write_Attachments`, `From_File`, `From_File_Obj`,\n`From_File_Msg`, `From_String`, `From_Bytes`, `Get_Server_Ipaddress`. Also reproducible from\nthe CLI (`mail-parser -f evil.eml -j`).\n\n```python\nimport mailparser\nmailparser.parse_from_string(\"Parse: x\\r\\n\\r\\n\").mail_json\n# 4.6.1 -> TypeError: Object of type method is not JSON serializable\n# 4.6.2 -> {\"parse\": \"x\", \"has_defects\": false}\n```\n\n*Header carrying 8-bit bytes* (CWE-248). For a header containing raw 8-bit bytes, Python's\n`compat32` policy returns an `email.header.Header` rather than a `str`, which the `_raw`\naccessor passed straight to `json.dumps`. This fires on entirely benign non-ASCII mail via\n`parse_from_bytes()`, the normal entry point for mail off the wire.\n\n```python\nimport mailparser\nmailparser.parse_from_bytes(b\"Subject: caf\\xe9\\r\\n\\r\\nbody\\r\\n\").subject_raw\n# 4.6.1 -> TypeError: Object of type Header is not JSON serializable\n# 4.6.2 -> '[\"caf�\"]'\n```\n\n**Silent loss of message content** (CWE-436). A sender can make a header's value vanish from\nevery output surface, or be replaced by a different header's value, with `has_defects`\nremaining `false`. This is an evasion primitive: the tool's output diverges from the bytes\nactually in the message, and a pipeline scanning parsed output for indicators sees nothing\nand no failure signal.\n\nHeader names were normalised before lookup — underscores folded to dashes, and `_json` /\n`_raw` suffixes interpreted — so a header genuinely named `Subject_json` was reported with\nthe value of `Subject` and its own value discarded, and any header whose name contains an\nunderscore resolved to nothing.\n\n```python\nimport mailparser\n\nraw = (\"From: Real Sender\n\\r\\n\"\n\"Subject: innocuous\\r\\n\"\n\"Subject_json: MALWARE-C2 http://evil.example/payload.exe\\r\\n\"\n\"X_Spam_Flag: YES\\r\\n\\r\\nbody\\r\\n\")\nmail = mailparser.parse_from_string(raw)\nprint(mail.mail[\"subject_json\"]) # 4.6.1 -> '\"innocuous\"' 4.6.2 -> the real value\nprint(mail.headers[\"X_Spam_Flag\"]) # 4.6.1 -> '' 4.6.2 -> 'YES'\nprint(\"MALWARE-C2\" in mail.mail_json) # 4.6.1 -> False 4.6.2 -> True\nprint(mail.has_defects) # both -> False\n```\n\nA related case: `email.message.Message.__len__` returns the header count, so a message with\n**no headers** is falsy. `parse\n\nAffected packages: pip:mail-parser\nPatched: mail-parser 4.6.2","url":"https://github.com/advisories/GHSA-24mq-4vc6-2prf","published_at":"2026-11-16T22:12:51Z","updated_at":"2026-11-16T22:12:52Z","fetched_at":"2026-11-21T19:15:18.416870Z","severity":"medium","cvss_score":6.5,"epss":0.00355,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":"mail-parser","vuln_id":"CVE-2026-129299","vuln_ids":["CVE-2026-129299","GHSA-24MQ-4VC6-2PRF"],"tags":["ghsa","pip","CWE-248","CWE-436"],"cluster_id":2399,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/2480","html":"https://vulnwatch.ve1ve2.com/item/2480"}},{"id":6220,"source":{"id":"nvd","name":"NVD CVE API 2.0"},"title":"CVE-2026-129299: 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, m…","summary":"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 Write_Attachments can place bound method objects into parsed output and raise TypeError when a caller requests JSON serialization such as mail_json. When byte input is parsed through parse_from_bytes(), an 8-bit header value returned as email.header.Header can likewise raise TypeError when an X_raw accessor passes the value to json.dumps; both exceptions are outside the MailParserError hierarchy. Separately, rewritten names such as Subject_json and X_Spam_Flag can be substituted or disappear from mail, headers, and JSON output while has_defects 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.\n\nReferences:\nhttps://github.com/SpamScope/mail-parser/commit/ce3cf3559db1ff806bda598b378de9f8c2a5be96\nhttps://github.com/SpamScope/mail-parser/pull/167\nhttps://github.com/SpamScope/mail-parser/releases/tag/4.6.2\nhttps://github.com/SpamScope/mail-parser/security/advisories/GHSA-24mq-4vc6-2prf","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-129299","published_at":"2026-11-16T18:17:30.787000Z","updated_at":"2026-11-16T19:17:40.623000Z","fetched_at":"2026-11-21T19:15:31.481995Z","severity":"medium","cvss_score":6.5,"epss":0.00355,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":null,"vuln_id":"CVE-2026-129299","vuln_ids":["CVE-2026-129299","GHSA-24MQ-4VC6-2PRF"],"tags":["CWE-248","CWE-436"],"cluster_id":1407,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/6220","html":"https://vulnwatch.ve1ve2.com/item/6220"}},{"id":1697,"source":{"id":"redhat","name":"Red Hat Security Data API"},"title":"CVE-2026-129299: mail-parser: mail-parser: Security inspection bypass via crafted email messages","summary":"mail-parser: mail-parser: Security inspection bypass via crafted email messages","url":"https://access.redhat.com/security/cve/cve-2026-129299","published_at":"2026-11-16T17:43:22Z","updated_at":null,"fetched_at":"2026-11-21T19:15:08.894904Z","severity":"medium","cvss_score":6.5,"epss":0.00355,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":"redhat","product":null,"vuln_id":"CVE-2026-129299","vuln_ids":["CVE-2026-129299","GHSA-24MQ-4VC6-2PRF"],"tags":["redhat"],"cluster_id":1407,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/1697","html":"https://vulnwatch.ve1ve2.com/item/1697"}}]}