/

CVE-2026-82035

Severity:

HIGH RISK

(7.1)

Path Traversal (CWE-22) in PyMuPDF Object Extraction

CVE-2026-82035

Awaiting Analysis

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

Arbitrary File Write

Severity:

HIGH RISK

(7.1)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

PyMuPDF contains a path traversal vulnerability in the font-processing branch of extract_objects(). A crafted document may cause extracted output to be written outside the intended directory when a document-controlled font name is used to construct the output path.

Affected context

The vulnerability affects PyMuPDF workflows that process PDF, EPUB, XPS, or FB2 documents through the affected object-extraction logic. It becomes risky when an attacker can supply or influence a document and the application allows extracted objects to be written to a filesystem location without normalizing or constraining document-controlled path components.

Exploit preconditions

  • Attack surface: Applications or services that process attacker-controlled PDF, EPUB, XPS, or FB2 files
  • Required access: Ability to submit or cause processing of a crafted document; authentication or elevated privileges may not be required
  • Trigger point: Font handling within extract_objects() during document extraction
  • Why exploitation is possible: A document-controlled BaseFont value can influence the output filename, while path separators, traversal components, or absolute-path syntax are not sufficiently constrained

Why this happens

The underlying bug is path construction based on untrusted document metadata. The affected logic joins a user-supplied output directory with a BaseFont-derived filename without reliably stripping or rejecting path separators, parent-directory references, or absolute paths. This maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, because attacker-controlled input can escape the intended filesystem boundary.

Potential impact

  • Files may be written outside the designated output directory
  • Existing files could be overwritten if filesystem permissions allow it
  • Application data or configuration may be modified
  • A subsequent execution or loading process could be influenced
  • The affected service may experience integrity, availability, or operational impacts

General mitigation guidance

Mitigation generally focuses on treating document metadata as untrusted and enforcing a strict output-directory boundary.

Common defensive patterns include:

  • Resolve candidate paths and verify that they remain beneath the approved output directory
  • Reject absolute paths, parent-directory components, and platform-specific path separators
  • Generate server-side filenames rather than deriving names directly from document metadata
  • Use isolated, least-privileged worker processes for document conversion and extraction
  • Apply restrictive filesystem permissions and separate writable workspaces from sensitive application paths
  • Avoid allowing extracted filenames to control arbitrary destination locations

How teams detect issues like this

Organizations can identify similar issues through:

  • Static analysis rules for path joins involving document metadata or other untrusted strings
  • Code review checks for missing canonicalization and containment validation
  • Tests using traversal markers, encoded separators, absolute-path forms, and platform-specific path syntax
  • Runtime monitoring for writes outside approved extraction directories
  • Policy enforcement requiring generated filenames and sandboxed document-processing workers
  • Automated security review tools that flag filesystem operations whose paths derive from untrusted input

Sources

SourceLink
github.comgithub.com/pymupdf/PyMuPDF/commit/b2c8f3a859fed35c379a44df566f770dc3e18605
vulncheck.comvulncheck.com/advisories/pymupdf-path-traversal-via-extract-objects-font-branch

Frequently asked

questions

Yes, when a network-facing or otherwise accessible application processes attacker-supplied documents. The vulnerability does not inherently require direct shell access to the host.

The described issue does not require elevated privileges, and authentication may not be necessary if the application accepts documents from unauthenticated users. The resulting write is still limited by the permissions of the processing process.

Treat all document-derived names as untrusted, generate safe server-side filenames, and verify after path resolution that every destination remains within an approved directory.

Combine strict path containment checks with sandboxed, least-privileged processing, restrictive filesystem permissions, security-focused tests, and code review policies for untrusted input used in filesystem operations.

Find out what's already
exploitable in your codebase.