{"id":"CVE-2026-129296","kind":"vulnerability","aliases":["CVE-2026-129296","GHSA-fr3h-cpq2-9496"],"related":[],"title":"mail-parser: Path Traversal vulnerability in attachment extraction","description":"A path traversal vulnerability was identified in mail-parser when extracting email attachments using the write_attachments() and write_sample() APIs.\n\nA specially crafted email containing malicious attachment filenames (for example, using directory traversal sequences such as \"../\" or absolute filesystem paths) could cause files to be written outside the intended output directory. Depending on how the library was used and the permissions of the executing process, this could result in arbitrary file overwrite.\n\nThe vulnerability affects mail-parser versions 3.8.0 through 4.5.0.\n\nThe issue has been addressed by introducing comprehensive filename sanitization and path validation before any file is written to disk. The fix includes:\n\n- Sanitization of attachment filenames before writing.\n- Validation that all output paths remain within the intended destination directory.\n- Rejection of symbolic link targets.\n- Normalization of Windows and POSIX path separators.\n- Validation and rejection of invalid or unsafe filenames.\n- Protection applied consistently in both write_attachments() and write_sample() APIs.\n\nUsers are strongly encouraged to upgrade to the patched release.\n\n## Credits\n\nThe vulnerability was responsibly reported by **Niranjan Ganesan** (Security Insights, https://securityinsights.io/, GitHub: @iam-niranjan).\n\nThe vulnerability was analyzed, remediated, and the security fix was implemented by **Fedele Mantuano**, maintainer of mail-parser (LinkedIn: https://www.linkedin.com/in/fmantuano/).\n\nmail-parser would like to thank Niranjan Ganesan for following a coordinated vulnerability disclosure process and for collaborating throughout the remediation and verification of the fix.","summary":"mail-parser's write_attachments() and write_sample() functions accept attachment filenames containing path traversal sequences such as \"../\" or absolute paths. A crafted email can make the library write files outside the intended directory, which can overwrite arbitrary files depending on process permissions.","severity":"medium","cvss":6.5,"epss":null,"exploited":false,"exploited_at":null,"products":[{"name":"mail-parser","fixed":["4.6.0"],"affected":">= 3.8.0, < 4.6.0","ecosystem":"pypi"}],"ecosystems":["pypi"],"tags":["cwe-22","cwe-73","mail-parser","package","python"],"not_affected_if":["no-attachment-writing","trusted-input-only"],"how_to_check":"- Check the installed version with `pip show mail-parser`; affected versions are `3.8.0` through `4.5.0`.\n- Search your code for calls to `write_attachments()` or `write_sample()` on untrusted email input.","fix":"- `mail-parser` upgrade to `4.6.0`","status":"open","published_at":"2026-11-16T18:17:30+00:00","first_seen_at":"2026-11-16T18:38:03+00:00","triaged_at":"2026-11-16T22:13:27+00:00","updated_at":"2026-11-16T22:13:27+00:00","category":"package","confidence":0.8,"triage":{"at":"2026-11-16T22:13:27Z","model":"claude-haiku-5-5","output":{"fix":"- `mail-parser` upgrade to `4.6.0`","reach":"network","title":"mail-parser: crafted attachment filenames can write files outside the output directory","impact":"high","summary":"mail-parser's write_attachments() and write_sample() functions accept attachment filenames containing path traversal sequences such as \"../\" or absolute paths. A crafted email can make the library write files outside the intended directory, which can overwrite arbitrary files depending on process permissions.","audience":"developers","category":"package","nicknames":[],"who_cares":["python","mail-parser"],"confidence":0.8,"fix_status":"available","needs_auth":"no","worst_case":"attacker overwrites arbitrary files writable by the process","analyst_note":"","how_to_check":"- Check the installed version with `pip show mail-parser`; affected versions are `3.8.0` through `4.5.0`.\n- Search your code for calls to `write_attachments()` or `write_sample()` on untrusted email input.","plain_action":"","product_name":"","needs_analyst":false,"not_affected_if":["no-attachment-writing","trusted-input-only"],"who_is_affected":"Applications that use the mail-parser Python package to save email attachments to disk from messages they do not fully trust, through write_attachments() or write_sample(). Code that only parses email in memory, or never calls those two functions, is not exposed by this flaw.","user_interaction":"no","product_ecosystem":"","needs_special_setup":"no","severity_if_unknown":"medium"},"cost_usd":0.000774,"input_tokens":5200,"output_tokens":507,"severity_before":"medium"},"analyst_status":null,"analyst_note":null,"search":"'-129296':12A,20A '-2026':11A,19A '-22':25B '-73':27B '/,':255C '/in/fmantuano/).':282C '3.8.0':158C '4.5.0':160C '9496':17A 'absolut':53B,116C 'accept':43B 'address':165C 'affect':153C 'analyz':263C 'api':98C,231C 'appli':222C 'arbitrari':71B,148C 'attach':8A,38B,44B,90C,94C,105C,186C,227C 'caus':120C 'collabor':301C 'comprehens':168C 'consist':223C 'contain':46B,103C 'coordin':295C 'could':119C,145C 'cpq2':16A 'craft':56B,101C 'credit':242C 'cve':10A,18A 'cwe':24B,26B 'depend':73B,130C 'destin':199C 'directori':67B,110C,129C,200C 'disclosur':297C 'disk':180C 'email':57B,89C,102C 'encourag':235C 'exampl':108C 'execut':142C 'extract':9A,88C 'fedel':272C 'file':63B,72B,121C,149C,176C 'filenam':45B,106C,169C,187C,220C 'filesystem':117C 'fix':182C,268C,309C 'follow':293C 'fr3h':15A 'function':42B 'ganesan':250C,291C 'ghsa':14A 'ghsa-fr3h-cpq2':13A 'github':256C 'iam':258C 'iam-niranjan':257C 'identifi':82C 'implement':270C 'includ':183C 'insight':252C 'intend':66B,127C,198C 'introduc':167C 'invalid':217C 'issu':162C 'librari':61B,134C 'like':287C 'link':204C 'linkedin':279C 'mail':2A,22A,29B,34B,85C,155C,277C,284C 'mail-pars':1A,28B,33B,84C,154C,276C,283C 'mail-parser':21A 'maintain':274C 'make':59B 'malici':104C 'mantuano':273C 'niranjan':249C,259C,290C 'normal':206C 'output':128C,193C 'outsid':64B,125C 'overwrit':70B,150C 'packag':31B 'parser':3A,23A,30B,35B,86C,156C,278C,285C 'patch':240C 'path':4A,47B,54B,78C,118C,172C,194C,211C 'permiss':76B,139C 'posix':210C 'process':75B,143C,298C 'protect':221C 'python':32B 'reject':201C,215C 'releas':241C 'remain':195C 'remedi':264C,304C 'report':247C 'respons':246C 'result':146C 'sampl':41B,97C,230C 'sanit':170C,184C 'secur':251C,267C 'securityinsights.io':254C 'securityinsights.io/,':253C 'separ':212C 'sequenc':49B,112C 'special':100C 'strong':234C 'symbol':203C 'target':205C 'thank':289C 'throughout':302C 'travers':5A,48B,79C,111C 'unsaf':219C 'upgrad':237C 'use':91C,109C,136C 'user':232C 'valid':173C,190C,213C 'verif':306C 'version':157C 'vulner':6A,80C,152C,244C,261C,296C 'window':208C 'within':196C 'would':286C 'write':37B,40B,62B,93C,96C,189C,226C,229C 'written':124C,178C 'www.linkedin.com':281C 'www.linkedin.com/in/fmantuano/).':280C","nicknames":[],"mitigations":[],"who_affected":"Applications that use the mail-parser Python package to save email attachments to disk from messages they do not fully trust, through write_attachments() or write_sample(). Code that only parses email in memory, or never calls those two functions, is not exposed by this flaw.","tier":"C","verified":{},"analyst_revisit_at":null,"fix_status":"available","audience":"developers","plain_action":null,"pkeys":["mailparser"],"ptokens":["mail","parser"],"labels":["cwe22","cwe73","mailparser","medium","package","pypi","python"],"campaign_type":null,"search_a":"'-129296':12A,20A '-2026':11A,19A '9496':17A 'attach':8A 'cpq2':16A 'cve':10A,18A 'extract':9A 'fr3h':15A 'ghsa':14A 'ghsa-fr3h-cpq2':13A 'mail':2A,22A 'mail-pars':1A 'mail-parser':21A 'parser':3A,23A 'path':4A 'travers':5A 'vulner':6A","search_b":"'-22':25B '-73':27B 'absolut':53B 'accept':43B 'arbitrari':71B 'attach':38B,44B 'contain':46B 'craft':56B 'cwe':24B,26B 'depend':73B 'directori':67B 'email':57B 'file':63B,72B 'filenam':45B 'function':42B 'intend':66B 'librari':61B 'mail':29B,34B 'mail-pars':28B,33B 'make':59B 'outsid':64B 'overwrit':70B 'packag':31B 'parser':30B,35B 'path':47B,54B 'permiss':76B 'process':75B 'python':32B 'sampl':41B 'sequenc':49B 'travers':48B 'write':37B,40B,62B","search_c":"'/,':255C '/in/fmantuano/).':282C '3.8.0':158C '4.5.0':160C 'absolut':116C 'address':165C 'affect':153C 'analyz':263C 'api':98C,231C 'appli':222C 'arbitrari':148C 'attach':90C,94C,105C,186C,227C 'caus':120C 'collabor':301C 'comprehens':168C 'consist':223C 'contain':103C 'coordin':295C 'could':119C,145C 'craft':101C 'credit':242C 'depend':130C 'destin':199C 'directori':110C,129C,200C 'disclosur':297C 'disk':180C 'email':89C,102C 'encourag':235C 'exampl':108C 'execut':142C 'extract':88C 'fedel':272C 'file':121C,149C,176C 'filenam':106C,169C,187C,220C 'filesystem':117C 'fix':182C,268C,309C 'follow':293C 'ganesan':250C,291C 'github':256C 'iam':258C 'iam-niranjan':257C 'identifi':82C 'implement':270C 'includ':183C 'insight':252C 'intend':127C,198C 'introduc':167C 'invalid':217C 'issu':162C 'librari':134C 'like':287C 'link':204C 'linkedin':279C 'mail':85C,155C,277C,284C 'mail-pars':84C,154C,276C,283C 'maintain':274C 'malici':104C 'mantuano':273C 'niranjan':249C,259C,290C 'normal':206C 'output':128C,193C 'outsid':125C 'overwrit':150C 'parser':86C,156C,278C,285C 'patch':240C 'path':78C,118C,172C,194C,211C 'permiss':139C 'posix':210C 'process':143C,298C 'protect':221C 'reject':201C,215C 'releas':241C 'remain':195C 'remedi':264C,304C 'report':247C 'respons':246C 'result':146C 'sampl':97C,230C 'sanit':170C,184C 'secur':251C,267C 'securityinsights.io':254C 'securityinsights.io/,':253C 'separ':212C 'sequenc':112C 'special':100C 'strong':234C 'symbol':203C 'target':205C 'thank':289C 'throughout':302C 'travers':79C,111C 'unsaf':219C 'upgrad':237C 'use':91C,109C,136C 'user':232C 'valid':173C,190C,213C 'verif':306C 'version':157C 'vulner':80C,152C,244C,261C,296C 'window':208C 'within':196C 'would':286C 'write':93C,96C,189C,226C,229C 'written':124C,178C 'www.linkedin.com':281C 'www.linkedin.com/in/fmantuano/).':280C","cause_entry":null,"cause_path":null,"disclosures_checked_at":null,"first_public_at":"2026-08-09T09:01:45+00:00","kev":null,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N","cvss_by":"GitHub","poc_count":0,"sources":[{"source":"nvd","external_id":"CVE-2026-129296","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-129296","severity":null,"published_at":"2026-11-16T18:17:30+00:00","modified_at":"2026-11-16T18:17:30+00:00","first_seen_at":"2026-11-16T18:38:03+00:00","fetched_at":"2026-11-16T18:38:03+00:00","note":null},{"source":"ghsa","external_id":"GHSA-fr3h-cpq2-9496","url":"https://github.com/advisories/GHSA-fr3h-cpq2-9496","severity":"medium","published_at":"2026-11-16T22:10:55+00:00","modified_at":"2026-11-16T22:10:56+00:00","first_seen_at":"2026-11-16T22:12:15+00:00","fetched_at":"2026-11-16T22:12:15+00:00","note":null}],"documents":[{"id":171751,"url":"https://github.com/SpamScope/mail-parser/commit/3d6cb7a51f2ad7ea57e529121dbd5d56f29fefe8","title":"Patch: github.com","kind":"other","source":"nvd","publisher":"vendor","text":null,"published_at":null,"relation":"fix","confidence":null,"note":"Patch: github.com"},{"id":171752,"url":"https://github.com/SpamScope/mail-parser/commit/b0a2e968815f3ed9e129efb0f5f7e935a9dacd1d","title":"Patch: github.com","kind":"other","source":"nvd","publisher":"vendor","text":null,"published_at":null,"relation":"fix","confidence":null,"note":"Patch: github.com"},{"id":171753,"url":"https://github.com/SpamScope/mail-parser/releases/tag/4.6.0","title":"Release notes: github.com","kind":"release","source":"nvd","publisher":"vendor","text":null,"published_at":null,"relation":"fix","confidence":null,"note":"Release notes: github.com"},{"id":171754,"url":"https://github.com/SpamScope/mail-parser/security/advisories/GHSA-fr3h-cpq2-9496","title":"Vendor advisory: github.com","kind":"vendor","source":"nvd","publisher":"vendor","text":null,"published_at":"2026-08-09T09:01:45+00:00","relation":"advisory","confidence":null,"note":"Vendor advisory: github.com"},{"id":172688,"url":"https://api.github.com/repos/SpamScope/mail-parser/security-advisories/GHSA-fr3h-cpq2-9496","title":"Maintainer's advisory: api.github.com","kind":"vendor","source":"ghsa","publisher":"vendor","text":null,"published_at":null,"relation":"advisory","confidence":null,"note":"Maintainer's advisory: api.github.com"},{"id":172690,"url":"https://github.com/SpamScope/mail-parser/pull/165","title":"Patch: github.com","kind":"other","source":"ghsa","publisher":"vendor","text":null,"published_at":null,"relation":"fix","confidence":null,"note":"Patch: github.com"}],"disclosures":[],"exploit_sources":[],"notice":"Free to read, with fair use of about 60 pages a minute. For higher limits or API access: sales@infrastack.ai"}