GHSA-fr3h-cpq2-9496

    Dashboard / Vulnerabilities / GHSA-fr3h-cpq2-9496

    GHSA-fr3h-cpq2-9496

    Published: 16 Nov 2026Last Modified: 16 Nov 2026

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

    Affected packages

    Package

    Name: mail-parser

    Purl: pkg:pypi/mail-parser

    Affected ranges

    Type: ECOSYSTEM

    Events:

    Introduced- 3.8.0
    Fixed -4.6.0

    Affected versions

    3.10.0

    Common Vulnerability Scoring System

    Attack Vector
    Network
    Adjacent
    Local
    Physical
    Privileges Required
    None
    Low
    High
    User Interaction
    None
    Required
    Scope
    Unchanged
    Changed
    Confidentiality
    None
    Low
    High
    Integrity
    None
    Low
    High
    Availability
    None
    Low
    High
    GHSA-fr3h-cpq2-9496 | CVE-DB