/

CVE-2026-26065

Severity:

HIGH RISK

(8.8)

Path Traversal in Calibre PDB Readers Enables Arbitrary

CVE-2026-26065

Analyzed

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

Arbitrary File Write and Potential Code Execution

Severity:

HIGH RISK

(8.8)

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

A path traversal vulnerability in Calibre's PDB ebook readers allows crafted PDB files to write arbitrary files with attacker-controlled content and extensions anywhere the user has write permissions.

Because files are opened in binary write mode and existing files can be silently overwritten, this can result in code execution or denial of service through targeted file corruption when a user processes a malicious PDB.

Affected context

The issue occurs when Calibre processes PDB ebook files, specifically through the PDB readers that handle both 132-byte and 202-byte header variants.

The vulnerability is relevant in environments where:

  • Users import, open, or convert untrusted or third-party PDB ebooks.
  • Calibre runs with the user's normal file system permissions.
  • Application or configuration directories within the user's writable paths contain executable scripts, extensions, or configuration files that influence behavior when modified.

Under these conditions, a malicious PDB can cause arbitrary files to be created or overwritten in locations the user can write to.

Exploit preconditions

  • Attack surface: Local, via Calibre's PDB parsing and conversion functionality.
  • Required access: The attacker must convince a user to open, import, or convert a crafted PDB ebook with a vulnerable Calibre version.
  • Trigger point: Parsing of the PDB file, where embedded paths are interpreted and used to determine output file locations.
  • Why exploitation is possible: Inadequate sanitization and normalization of file paths extracted from the PDB file allow directory traversal sequences (e.g., using relative paths) to influence where files are written, enabling writes outside the intended directory and overwriting existing files using binary write mode.

Why this happens

The underlying flaw is a classic path traversal (CWE-22) and directory breakout issue within the PDB reader logic.

PDB metadata or internal references are treated as trusted file paths without robust validation, canonicalization, or restriction to an allowed base directory.

As a result, attacker-controlled path components can:

  • Navigate out of the expected working directory.
  • Point to arbitrary locations within the user's writable file system.
  • Force Calibre to open files in wb mode, thereby creating or overwriting arbitrary files with content supplied via the crafted PDB.

Conceptually, this reflects an insecure pattern where external data is used directly to construct filesystem paths and passed to file APIs without proper containment checks.

Potential impact

  • Overwriting of user files within writable directories, potentially destroying data.
  • Arbitrary file creation with attacker-controlled content and extension.
  • Potential execution of attacker-supplied code by overwriting scripts, plugins, or configuration files that are later executed or interpreted.
  • Denial of service by corrupting Calibre configuration, caches, or other application-related files.
  • Interference with other applications by corrupting their data files if they reside in user-writable paths.

General mitigation guidance

Effective mitigation relies on constraining how externally controlled paths are handled and minimizing trust in file metadata from ebooks:

  • Normalize and validate all file paths derived from PDB (or similar) content, rejecting any that attempt to escape a designated base directory or contain traversal sequences.
  • Build file paths using a fixed, application-controlled root directory and combine them with sanitized filenames, rather than accepting full paths directly from untrusted data.
  • Enforce allowlists for permissible output locations and file extensions when writing derived content.
  • Before opening files for writing, verify that the resolved, canonical path remains within an approved directory tree.
  • Consider using unique, random filenames or internal identifiers instead of user-controlled names when extracting or converting ebook resources.
  • Apply the principle of least privilege for the process, so that its writable scope is minimized to directories necessary for operation.

How teams detect issues like this

Detection focuses on identifying insecure path handling and unexpected file system modifications:

  • Static analysis: Look for file operations where paths are built directly from parsed ebook data or other untrusted input without normalization and directory constraints. Patterns include calls to file open APIs that use user-controlled strings as paths or concatenation of relative path elements without subsequent canonicalization.
  • Code review: Examine ebook parsing and conversion routines, especially around PDB readers, for:
  • Use of raw values from headers or metadata to construct output paths.
  • Absence of checks for .., absolute paths, or path segment normalization.
  • Lack of enforcement that output paths remain under a known safe directory.
  • Runtime monitoring: On development and testing systems, enable logging of file writes originating from Calibre processes and flag unexpected writes outside designated working or temp directories.
  • Policy enforcement: Integrate secure coding guidelines and automated checks into CI pipelines to prevent new code from introducing unrestricted path usage based on untrusted inputs.

Sources

SourceLink
github.comgithub.com/kovidgoyal/calibre/commit/b6da1c3878c06eb1356cb0ec1106cb66e0e9bfb8
github.comgithub.com/kovidgoyal/calibre/security/advisories/GHSA-vmfh-7mr7-pp2w

Frequently asked

questions

It is not remotely exploitable in the traditional network sense, but it is exploitable by supplying a malicious PDB file. If an attacker can distribute a crafted PDB that a user opens with Calibre, they can leverage the vulnerability without direct access to the victim's system.

The attacker needs the ability to get a user to process a malicious PDB ebook with a vulnerable Calibre version. They do not need local shell access or prior permissions beyond the user's decision to open or convert the attacker's file.

The safest pattern is to fully decouple untrusted path data from actual filesystem locations: sanitize and canonicalize all paths, restrict them to controlled base directories, reject traversal attempts, and use application-defined naming schemes instead of trusting file metadata.

Prevent similar issues by adopting a standard path-handling strategy: treat all external file paths as untrusted, enforce canonicalization and base-directory checks, implement robust validation and allowlists for output locations, and include automated checks in your development pipeline to detect insecure path constructions early.

Find out what's already
exploitable in your codebase.