CVE-2026-129296: mail-parser Path Traversal Vulnerability

MODERATE
Advisory Identifier: GHSA-fr3h-cpq2-9496
CVSS 6.5
CWE-73 CWE-22
Published
Advisory Summary

CVE-2026-129296 is a MODERATE (CVSS 6.5) path traversal vulnerability (CWE-73: External Control of File Name or Path) affecting mail-parser libraries in the PyPI ecosystem. The issue involves path traversal vulnerability in attachment extraction. Remediation is available by upgrading affected packages to version 4.6.0.

CVE-2026-129296 at a Glance

CVE Identifier CVE-2026-129296
GHSA Identifier GHSA-fr3h-cpq2-9496
Severity MODERATE
CVSS v3.1 Base Score 6.5
CWE Classification CWE-73: External Control of File Name or Path
Affected Product mail-parser
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 6.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2026-129296

To remediate this vulnerability, upgrade all affected mail-parser dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

mail-parser fixed: 4.6.0
pip install mail-parser>=4.6.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show mail-parser

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2026-129296, inspect your installed packages using pip:

pip show mail-parser

Analyze the terminal output to locate any version of mail-parser in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.6.0), your application is affected.

Note: The pip show mail-parser command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-73: External Control of File Name or Path, where the product allows user input to control or influence paths or file names that are used in filesystem operations. In mail-parser, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

A path traversal vulnerability was identified in mail-parser when extracting email attachments using the write_attachments() and write_sample() APIs. A 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. The vulnerability affects mail-parser versions 3.8.0 through 4.5.0. The issue has been addressed by introducing comprehensive filename sanitization and path validation before any file is written to disk. The fix includes: - Sanitization of attachment filenames before writing. - Validation that all output paths remain within the intended destination directory. - Rejection of symbolic link targets. - Normalization of Windows and POSIX path separators. - Validation and rejection of invalid or unsafe filenames. - Protection applied consistently in both write_attachments() and write_sample() APIs. Users are strongly encouraged to upgrade to the patched release. ## Credits The vulnerability was responsibly reported by **Niranjan Ganesan** (Security Insights, https://securityinsights.io/, GitHub: @iam-niranjan). The vulnerability was analyzed, remediated, and the security fix was implemented by **Fedele Mantuano**, maintainer of mail-parser (LinkedIn: https://www.linkedin.com/in/fmantuano/). mail-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.

CVE-2026-129296 Affected mail-parser Versions

1 component(s)
Fixed Versions:
4.6.0
Product / Package Ecosystem Affected Versions Fixed Version
mail-parser
PyPI
≥ 3.8.0
< 4.6.0
4.6.0

References

Frequently Asked Questions

What is CVE-2026-129296?
CVE-2026-129296 is a security vulnerability in mail-parser involving Path Traversal vulnerability in attachment extraction under CWE-73: External Control of File Name or Path.
Which mail-parser versions are affected?
Affected versions include releases prior to 4.6.0 across affected packages: mail-parser.
What version fixes CVE-2026-129296?
Upgrading to 4.6.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is mail-parser affected?
Yes, mail-parser is affected in releases prior to 4.6.0. Upgrade your dependency to 4.6.0 or later.
What is the CVSS score of CVE-2026-129296?
CVE-2026-129296 has a CVSS v3.1 base score of 6.5 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N.
What CWE is associated with CVE-2026-129296?
CVE-2026-129296 is classified under CWE-73: External Control of File Name or Path (The product allows user input to control or influence paths or file names that are used in filesystem operations.).
How can I check PyPI dependencies for CVE-2026-129296?
Run the dependency tree command: 'pip show mail-parser'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-fr3h-cpq2-9496",
  "modified" : "2026-11-16T22:10:55Z",
  "published" : "2026-11-16T22:10:55Z",
  "aliases" : [ "CVE-2026-129296" ],
  "summary" : "mail-parser: Path Traversal vulnerability in attachment extraction",
  "details" : "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.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "mail-parser"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.8.0"
      }, {
        "fixed" : "4.6.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/SpamScope/mail-parser/security/advisories/GHSA-fr3h-cpq2-9496"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-129296"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/SpamScope/mail-parser/pull/165"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/SpamScope/mail-parser/commit/3d6cb7a51f2ad7ea57e529121dbd5d56f29fefe8"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/SpamScope/mail-parser/commit/b0a2e968815f3ed9e129efb0f5f7e935a9dacd1d"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/SpamScope/mail-parser"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/SpamScope/mail-parser/releases/tag/4.6.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22", "CWE-73" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-11-16T22:10:55Z",
    "nvd_published_at" : "2026-11-16T18:17:30Z"
  }
}