Executive brief
BabelDOC, a PDF processing and translation library, contains a vulnerability that allows an attacker to execute malicious code on a victim's system. By tricking a user or an automated system into processing a specially crafted PDF file, an attacker can force the application to load and run a malicious file from the local system. This could lead to a full system compromise, data theft, or unauthorized access to sensitive information with the same permissions as the application.
Technical details
A deserialization vulnerability exists in BabelDOC's vendored PDF parser within `babeldoc/pdfminer/cmapdb.py`. The `_load_data()` method fails to properly sanitize CMap names, removing only NUL bytes. By using hex-encoded absolute paths in a PDF's `/Encoding` name (e.g., `/#2Ftmp#2Fevil`), an attacker can exploit Python's `os.path.join()` behavior to bypass intended directory restrictions. This allows the application to load and deserialize an attacker-controlled `.pickle.gz` file via `pickle.loads()`, leading to arbitrary code execution in the context of the BabelDOC process. The vulnerability is also reachable via the PostScript `usecmap` operator.
Affected products
- funstory-ai BabelDOC <= 0.6.2
Timeline
- 2026-06-03: disclosed: EQSTLab reported the vulnerability to maintainers.
- 2026-06-03: patched: BabelDOC version 0.6.3 released with a fix.
- 2026-07-10: advisory: GitHub Advisory GHSA-m8gf-v64p-gfmg published.