CVE-2025-64486 Overview
CVE-2025-64486 is a critical arbitrary file write vulnerability in calibre, a popular open-source e-book manager application. The vulnerability exists in versions 8.13.0 and prior, where calibre fails to properly validate filenames when processing binary assets embedded in FictionBook (FB2) files. An attacker can craft a malicious FB2 file that, when viewed or converted by calibre, writes arbitrary files to the filesystem. This vulnerability can be chained to achieve arbitrary code execution on the victim's system.
Critical Impact
Opening or converting a malicious FictionBook file in calibre can lead to arbitrary file writes on the filesystem, potentially enabling full system compromise through arbitrary code execution.
Affected Products
- calibre version 8.13.0 and all prior versions
- Systems running vulnerable calibre installations processing untrusted FB2 files
Discovery Timeline
- 2025-11-08 - CVE-2025-64486 published to NVD
- 2025-11-12 - Last updated in NVD database
Technical Details for CVE-2025-64486
Vulnerability Analysis
This vulnerability is classified as CWE-73 (External Control of File Name or Path), a path traversal weakness that allows attackers to control file operations on the target system. The flaw resides in calibre's FB2 input conversion plugin, specifically in how it handles binary asset elements within FictionBook files.
When calibre processes an FB2 file, it extracts embedded binary assets (typically images) and writes them to the filesystem. The application uses the id attribute from the XML binary element as the filename. However, in vulnerable versions, this filename is not properly sanitized before being used in file operations. An attacker can craft a malicious FB2 file containing path traversal sequences (such as ../) in the id attribute, allowing files to be written outside the intended directory.
The attack requires user interaction—a victim must open or convert the malicious FB2 file—but no authentication or special privileges are required. Given calibre's widespread use for managing e-book libraries and the common practice of downloading e-books from various sources, this represents a significant attack surface.
Root Cause
The root cause is improper validation of the id attribute value in binary XML elements within FB2 files before using it as a filename. The vulnerable code path directly uses the id attribute value without sanitizing path traversal characters or validating it represents a safe filename. This allows attackers to inject directory traversal sequences that escape the intended output directory.
Attack Vector
The attack vector is local, requiring user interaction to trigger. An attacker would:
- Craft a malicious FB2 e-book file with a binary element containing a path traversal payload in the id attribute
- Distribute the malicious file through e-book sharing platforms, torrent sites, or targeted delivery
- Wait for the victim to open or convert the file using calibre
- The malicious payload writes arbitrary files to attacker-controlled paths on the victim's filesystem
- By writing executable files or configuration files to sensitive locations, the attacker can achieve code execution
# Security patch in src/calibre/ebooks/conversion/plugins/fb2_input.py
from calibre.ebooks.fb2 import base64_decode
self.image_map = {}
for elem in doc.xpath('./*'):
- if elem.text and 'binary' in elem.tag and 'id' in elem.attrib:
+ if elem.text and 'binary' in elem.tag and elem.get('id', ''):
ct = elem.get('content-type', '').lower()
fname = sanitize_file_name(elem.get('id'))
if ct.startswith('image/'):
Source: GitHub Commit Changes
The patch ensures that the id attribute is properly retrieved using elem.get('id', '') with a safe default value, and critically, the filename is passed through sanitize_file_name() to strip any path traversal sequences before file operations.
Detection Methods for CVE-2025-64486
Indicators of Compromise
- FB2 files containing binary elements with suspicious id attributes containing path traversal sequences (../, ..\\)
- Unexpected file creation or modification in system directories or user home directories after opening FB2 files
- New executable files or scripts appearing in startup directories or cron locations
- Calibre process writing files outside its typical working directories
Detection Strategies
- Monitor file system operations from calibre processes for writes to sensitive directories (e.g., ~/.config/autostart/, /etc/, Windows startup folders)
- Implement content inspection rules to scan FB2 files for malicious id attribute patterns containing .. sequences
- Deploy endpoint detection rules that alert on calibre writing files with path traversal indicators in their paths
- Review calibre application logs for errors related to file operations in unexpected directories
Monitoring Recommendations
- Enable file integrity monitoring on critical system directories and user profile areas
- Monitor for newly created executable files or scripts in common persistence locations
- Track calibre process behavior for anomalous file system access patterns
- Implement network monitoring for downloads of FB2 files from untrusted sources
How to Mitigate CVE-2025-64486
Immediate Actions Required
- Upgrade calibre to version 8.14.0 or later immediately
- Avoid opening or converting FB2 files from untrusted sources until patched
- Review recently processed FB2 files and scan systems for unexpected file modifications
- Consider temporarily disabling FB2 import functionality if upgrade cannot be performed immediately
Patch Information
The vulnerability has been fixed in calibre version 8.14.0. The fix ensures proper filename sanitization by applying the sanitize_file_name() function to the id attribute before using it in file operations. Users should update to the latest version through their package manager or by downloading directly from the official calibre website.
For detailed information, refer to the GitHub Security Advisory and the commit implementing the fix.
Workarounds
- Do not open or process FB2 files from untrusted or unknown sources
- Run calibre in a sandboxed environment or container with restricted filesystem access
- Use file system permissions to limit calibre's write access to only necessary directories
- Consider using application sandboxing tools (e.g., Firejail on Linux, sandboxing on macOS) to contain potential exploits
# Example: Running calibre with restricted filesystem access using Firejail
firejail --whitelist=~/Calibre\ Library --whitelist=~/Downloads calibre
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

