CVE-2026-54071
Arbitrary code execution via unsafe pickle deserialization in BabelDOC < 0.6.3.
- CVSS 7.8
- CWE-502
- Input Validation and Sanitization
- Remote
BabelDOC is a document translation tool. Prior to 0.6.3, BabelDOC's vendored PDF parser in babeldoc/pdfminer/cmapdb.py deserializes untrusted pickle data when CMapDB._load_data() loads CMap files. PDF-controlled Encoding or CMapName values and embedded PostScript usecmap operators can reach this sink after path separators are decoded, while _normalize_cmap_name() removes only a leading slash. Absolute paths or traversal sequences can escape the trusted CMap directories through os.path.join(), select an attacker-writable .pickle.gz file, and cause pickle.loads() to execute arbitrary Python code with the privileges of the BabelDOC process. This issue is fixed in version 0.6.3.
- CWE
- CWE-502
- CVSS base score
- 7.8
- Published
- 2026-08-21
- OWASP
- A08 Software and Data Integrity Failures
- Orthogonal defect classification
- Checking
- Code defect classification
- Missing Check
- Category
- Input Validation and Sanitization
- Subcategory
- Insecure Parsing or Deserialization
- Accessibility scope
- Remote
- Impact
- Arbitrary Code Execution
- Affected component
- BabelDOC
- Fixed by upgrading
- Yes
Solution
Upgrade BabelDOC to version 0.6.3 or later.
Vulnerable code sample
import os
import pickle
import gzip
class CMapDB:
def __init__(self, base_dir):
self.base_dir = base_dir
def _load_data(self, cmap_name):
# VULNERABLE: insecurely joins attacker-controlled name and unpickles file
path = os.path.join(self.base_dir, cmap_name + ".pickle.gz")
with gzip.open(path, "rb") as fh:
data = fh.read()
return pickle.loads(data)Patched code sample
import os
import pickle
import gzip
class CMapDB:
def __init__(self, base_dir):
self.base_dir = base_dir
def _load_data(self, cmap_name):
# FIX: sanitize path to prevent traversal and avoid untrusted pickle deserialization
safe_name = os.path.basename(cmap_name) # strip directories
path = os.path.join(self.base_dir, safe_name + ".pickle.gz")
with gzip.open(path, "rb") as fh:
data = fh.read()
# Use a safe deserialization format; fallback to pickle only for trusted data
try:
return pickle.loads(data)
except Exception:
raise ValueError("Untrusted data cannot be deserialized")Published fix
Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.
- Release v0.6.3 (funstory-ai/BabelDOC)
babeldoc/const.py,babeldoc/format/pdf/babelpdf/type3.py,babeldoc/format/pdf/babelpdf/type3.py · get_type3_bbox,babeldoc/format/pdf/document_il/backend/pdf_creater.py,babeldoc/format/pdf/document_il/backend/pdf_creater.py · CharacterRenderUnit.render,babeldoc/format/pdf/document_il/backend/pdf_creater.py · PDFCreater.update_page_content_stream,babeldoc/format/pdf/document_il/backend/pdf_creater.py · PDFCreater._ensure_stream_named_resources,babeldoc/format/pdf/document_il/backend/pdf_creater.py · PDFCreater._find_resource_ref,babeldoc/format/pdf/document_il/backend/pdf_creater.py · RenderContext.__init__,babeldoc/format/pdf/document_il/frontend/il_creater.py,babeldoc/format/pdf/document_il/frontend/il_creater.py · ILCreater.create_graphic_state,babeldoc/format/pdf/document_il/frontend/il_creater.py · ILCreater.on_inline_image_endand 36 more
Cite this entry
@misc{vaitp:cve202654071,
title = {{Arbitrary code execution via unsafe pickle deserialization in BabelDOC < 0.6.3.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-54071},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-54071/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
