---
id: CVE-2025-64712
aliases:
  - GHSA-gm8q-m8mv-jj5m
  - PYSEC-2026-558
title: >-
  Unstructured has Path Traversal via Malicious MSG Attachment that Allows
  Arbitrary File Write
summary: >-
  Unstructured has Path Traversal via Malicious MSG Attachment that Allows
  Arbitrary File Write
severity: critical
cvss: 9.8
cvssVector: 'CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H'
vendor: unstructured
product: unstructured
ecosystem: pip
affected:
  - unstructured < 0.18.18
patched:
  - unstructured 0.18.18
published: '2026-02-03'
updated: '2026-09-10'
sourceUpdated: '2026-09-10T03:50:34.982019627Z'
source: OSV
sourceUrl: 'https://osv.dev/vulnerability/GHSA-gm8q-m8mv-jj5m'
references:
  - url: >-
      https://github.com/Unstructured-IO/unstructured/security/advisories/GHSA-gm8q-m8mv-jj5m
  - url: 'https://nvd.nist.gov/vuln/detail/CVE-2025-64712'
  - url: >-
      https://github.com/Unstructured-IO/unstructured/commit/b01d35b2373fd087d2e15162b9c021663c97155d
  - url: 'https://github.com/Unstructured-IO/unstructured'
tags:
  - osv
  - pip
epss: 0.00642
epssPercentile: 0.48571
ingestedAt: '2026-09-12T03:13:01.696Z'
---

## Overview

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

## Affected packages

- `unstructured < 0.18.18`

## Remediation

Upgrade to a patched release:

- `unstructured 0.18.18`
