CVE-2025-64712: Unstructured Path Traversal Vulnerability

CRITICAL
Advisory Identifier: GHSA-gm8q-m8mv-jj5m
CVSS 9.8
CWE-73 CWE-22
Published
Advisory Summary

CVE-2025-64712 is a CRITICAL (CVSS 9.8) path traversal vulnerability (CWE-73: External Control of File Name or Path) affecting Unstructured libraries in the PyPI ecosystem. The issue involves unstructured has path traversal via malicious msg attachment that allows arbitrary file write. Remediation is available by upgrading affected packages to version 0.18.18.

CVE-2025-64712 at a Glance

CVE Identifier CVE-2025-64712
GHSA Identifier GHSA-gm8q-m8mv-jj5m
Severity CRITICAL
CVSS v3.1 Base Score 9.8
CWE Classification CWE-73: External Control of File Name or Path
Affected Product Unstructured
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 9.8

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:N/S:U/C:H/I:H/A:H).

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

How to Fix CVE-2025-64712

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

unstructured fixed: 0.18.18
pip install unstructured>=0.18.18
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 unstructured

How to Check if You Are Affected

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

pip show unstructured

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

Note: The pip show unstructured 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 Unstructured, 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 in the `partition_msg` function allows an attacker to write or overwrite arbitrary files on the filesystem when processing malicious MSG files with attachments. ## Impact An attacker can craft a malicious .msg file with attachment filenames containing path traversal sequences (e.g., `../../../etc/cron.d/malicious`). When processed with `process_attachments=True`, the library writes the attachment to an attacker-controlled path, potentially leading to: - Arbitrary file overwrite - Remote code execution (via overwriting configuration files, cron jobs, or Python packages) - Data corruption - Denial of service ## Affected Functionality The vulnerability affects the MSG file partitioning functionality when `process_attachments=True` is enabled. ## Vulnerability Details The library does not sanitize attachment filenames in MSG files before using them in file write operations, allowing directory traversal sequences to escape the intended output directory. ## Workarounds Until patched, users can: - Set `process_attachments=False` when processing untrusted MSG files - Avoid processing MSG files from untrusted sources - Implement additional filename validation before processing

CVE-2025-64712 Affected Unstructured Versions

1 component(s)
Fixed Versions:
0.18.18
Product / Package Ecosystem Affected Versions Fixed Version
unstructured
PyPI
< 0.18.18
0.18.18

References

Frequently Asked Questions

What is CVE-2025-64712?
CVE-2025-64712 is a security vulnerability in Unstructured involving Unstructured has Path Traversal via Malicious MSG Attachment that Allows Arbitrary File Write under CWE-73: External Control of File Name or Path.
Which Unstructured versions are affected?
Affected versions include releases prior to 0.18.18 across affected packages: unstructured.
What version fixes CVE-2025-64712?
Upgrading to 0.18.18 (or the latest patched release for your respective branch) resolves the vulnerability.
Is unstructured affected?
Yes, unstructured is affected in releases prior to 0.18.18. Upgrade your dependency to 0.18.18 or later.
What is the CVSS score of CVE-2025-64712?
CVE-2025-64712 has a CVSS v3.1 base score of 9.8 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2025-64712?
CVE-2025-64712 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-2025-64712?
Run the dependency tree command: 'pip show unstructured'. 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-gm8q-m8mv-jj5m",
  "modified" : "2026-02-04T19:53:04Z",
  "published" : "2026-02-03T17:43:56Z",
  "aliases" : [ "CVE-2025-64712" ],
  "summary" : "Unstructured has Path Traversal via Malicious MSG Attachment that Allows Arbitrary File Write",
  "details" : "A Path Traversal vulnerability in the `partition_msg` function allows an attacker to write or overwrite arbitrary files on the filesystem when processing malicious MSG files with attachments.\n\n  ## Impact\n  An attacker can craft a malicious .msg file with attachment filenames containing path traversal sequences (e.g.,\n  `../../../etc/cron.d/malicious`). When processed with `process_attachments=True`, the library writes the attachment to an\n  attacker-controlled path, potentially leading to:\n\n  - Arbitrary file overwrite\n  - Remote code execution (via overwriting configuration files, cron jobs, or Python packages)\n  - Data corruption\n  - Denial of service\n\n  ## Affected Functionality\n  The vulnerability affects the MSG file partitioning functionality when `process_attachments=True` is enabled.\n\n  ## Vulnerability Details\n  The library does not sanitize attachment filenames in MSG files before using them in file write operations, allowing directory\n  traversal sequences to escape the intended output directory.\n\n  ## Workarounds\n  Until patched, users can:\n  - Set `process_attachments=False` when processing untrusted MSG files\n  - Avoid processing MSG files from untrusted sources\n  - Implement additional filename validation before processing",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "unstructured"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.18.18"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.18.17"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/Unstructured-IO/unstructured/security/advisories/GHSA-gm8q-m8mv-jj5m"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-64712"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Unstructured-IO/unstructured/commit/b01d35b2373fd087d2e15162b9c021663c97155d"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/Unstructured-IO/unstructured"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22", "CWE-73" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-02-03T17:43:56Z",
    "nvd_published_at" : "2026-02-04T18:16:07Z"
  }
}