You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Path Traversal Leading to Arbitrary File Write and Potential Code Execution
High
kovidgoyal
published
GHSA-32vh-whvh-9fxrFeb 6, 2026
Package
No package listed
Affected versions
< 9.2.0
Patched versions
9.2.0
Description
Summary
Calibre's CHM reader contains a path traversal vulnerability that allows arbitrary file writes anywhere the user has write permissions. On Windows (haven't tested on other OS's), this can lead to Remote Code Execution by writing a payload to the Startup folder, which executes on next login.
Details
Confirmed on: Calibre 9.1.0, Windows 11 (x64) Trigger: Converting a malicious CHM file via GUI ("Convert books") or CLI (ebook-convert)
Payload written to Startup folder, executes on next login
PoC:
> python3 create_poc.py
[+] Created: poc.chm
[+] Open poc.chm in Calibre, rce.bat will be written to Startup folder
[+] Tested on Windows 11, Calibre 9.1.0
> dir "$env:APPDATA\Microsoft\Windows\Start Menu\Programs\Startup"
rce.bat 78 bytes
# Reboot → calc.exe launches automatically
Proof Files:
create_poc.py - Standalone PoC generator
I can't upload the .chm file due to GitHub not supporting it, please feel free to run the create_poc.py.
The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.
Learn more on MITRE.
Summary
Calibre's CHM reader contains a path traversal vulnerability that allows arbitrary file writes anywhere the user has write permissions. On Windows (haven't tested on other OS's), this can lead to Remote Code Execution by writing a payload to the Startup folder, which executes on next login.
Details
Confirmed on: Calibre 9.1.0, Windows 11 (x64)
Trigger: Converting a malicious CHM file via GUI ("Convert books") or CLI (
ebook-convert)Affected Component:
src/calibre/ebooks/chm/reader.pyVulnerable Code (Line 351):
Only strips leading slash, does not sanitize
..sequences.Vulnerable Code (Lines 185-198):
Attack Flow:
/..\\..\\..\\..\\Roaming\\Microsoft\\Windows\\STARTM~1\\Programs\\Startup\\rce.batContents()returns path with..intact (only leading/stripped)os.path.join(output_dir, path)escapes extraction directoryPoC:
Proof Files:
create_poc.py- Standalone PoC generatorI can't upload the
.chmfile due to GitHub not supporting it, please feel free to run thecreate_poc.py.POC.mp4
create_poc.py