CVE Summary
- CVE ID: CVE-2025-64712
- Product: Unstructured (Python package)
- Affected Versions: All versions prior to 0.18.18
- Vulnerability Type: Path Traversal
- Impact: Arbitrary file write
- CVSS v3.1 Score: 9.8
- Severity: Critical
- Attack Vector: Network
- Privileges Required: None
- User Interaction: None
- Exploitability: High
- Exploit Availability: Public technical details available; proof-of-concept behavior described for educational and defensive research only
Description
A critical path traversal vulnerability exists in the Unstructured Python library when processing Microsoft Outlook .msg files. In vulnerable versions, attachment filenames extracted from .msg files are written to disk without sufficient validation or normalization. Because the filename is treated as trusted input, traversal sequences such as ../ or encoded equivalents may be interpreted by the filesystem.
As a result, files may be written outside the intended working directory. Any location writable by the running process may be targeted, including system directories, application configuration paths, or web-accessible folders.
This behavior occurs during automated document parsing workflows, which are commonly deployed in data ingestion pipelines, document processing services, and AI/LLM preprocessing environments. Since these pipelines often process untrusted input, exposure is considered significant.
Affected Components
.msgfile parsing logic- Attachment extraction and file write routines
- Functions invoking
partition_msgor equivalent attachment-handling code paths
Root Cause Analysis
The vulnerability is caused by improper handling of user-controlled filenames during file write operations. Specifically:
- Attachment filenames are extracted directly from
.msgmetadata - Path traversal sequences are not removed or canonicalized
- Absolute paths and encoded traversal patterns are not rejected
- File writes are performed without enforcing a fixed base directory
This allows filesystem path resolution to escape the intended output directory.
Impact
When successfully exploited, the following impacts may occur:
- Creation or overwriting of arbitrary files
- Modification of application or system configuration files
- Placement of executable scripts or scheduled tasks
- Potential escalation to remote code execution depending on file location and execution context
- Disruption of application availability or integrity
The severity of impact depends on the privileges of the process running the vulnerable library.
Exploitation Overview (Educational)
Exploitation is performed by supplying a crafted .msg file containing one or more attachments with malicious filenames. The filenames include traversal sequences or absolute paths designed to redirect file output.
At a high level, exploitation follows this flow:
- A malicious
.msgfile is created with an attachment name containing traversal characters. - The file is submitted to a service that processes
.msgdocuments using a vulnerable Unstructured version. - During parsing, the attachment is written to disk using the attacker-controlled filename.
- The resulting file is created or overwritten at an unintended filesystem location.
No authentication or user interaction is required when the processing endpoint is publicly accessible.
Proof of Concept Status
Public technical explanations describing this behavior are available. Demonstrations have shown that traversal sequences in attachment filenames result in file writes outside the expected directory.
Any proof-of-concept testing must be conducted strictly in isolated lab environments and only for defensive or educational purposes. Unauthorized testing against production systems is prohibited.
Detection Strategy
Detection should focus on identifying abnormal file write behavior and suspicious filename patterns during document ingestion.
Detection Log Sources
- Application ingestion and document processing logs
- Web server or API gateway logs handling file uploads
- Host-based file creation and modification logs
- Container runtime and volume mount activity logs
- Endpoint detection and response (EDR) telemetry
Detection Indicators
- Filenames containing
../or..\\ - URL-encoded traversal patterns such as
%2e%2e%2f - Attachment filenames beginning with
/or drive letters - File writes occurring outside approved processing directories
- Unexpected file creation in sensitive locations
Detection Rules
Splunk Query
index=application_logs
| search attachment_name="*../*" OR attachment_name="*..\\*" OR attachment_name="*%2e%2e%2f*" OR attachment_name="*%2e%2e%5c*"
| table _time host process attachment_name output_path request_id
Elastic / KQL Query
attachment_name:*../* OR
attachment_name:*..\\* OR
attachment_name:*%2e%2e%2f* OR
attachment_name:*%2e%2e%5c*
Endpoint File Monitoring Query
process_name IN ("python", "unstructured")
AND file_operation IN ("create", "write")
AND file_path NOT STARTS WITH "/approved/processing/directory/"
Web Application Firewall Query
request_body CONTAINS "../"
OR request_body CONTAINS "..\\"
OR request_body CONTAINS "%2e%2e"
Mitigation
The following actions are recommended:
- Immediate upgrade to a patched version
- Temporary restriction or quarantine of
.msgfile processing - Execution of document parsing services under low-privilege accounts
- Enforcement of fixed output directories for all file writes
- Deployment of file integrity monitoring on sensitive paths
Remediation
This vulnerability has been addressed in Unstructured version 0.18.18. Proper filename sanitization and path validation have been implemented to prevent traversal-based file writes.
Official Patch / Upgrade Link
- Upgrade and release information:
https://github.com/Unstructured-IO/unstructured/releases
MITRE Mapping
- CWE-22: Improper Limitation of a Pathname to a Restricted Directory
- ATT&CK Technique: T1190 – Exploit Public-Facing Application
Final Takeaway
CVE-2025-64712 represents a high-risk vulnerability due to its simplicity of exploitation and the widespread use of the affected library in automated document pipelines. Environments that process untrusted .msg files without isolation are particularly exposed. Immediate patching, combined with filesystem monitoring and ingestion hardening, is required to reduce risk and prevent abuse.
