CVE-2026-112304
Unsafe deserialization via torch.load in docTR ≤ 1.1.0 allows code execution.
- CVSS 7.7
- CWE-502
- Input Validation and Sanitization
- Remote
docTR through 1.1.0 contains an unsafe deserialization vulnerability in load_pretrained_params() that loads checkpoints with torch.load without weights_only=True. Attackers who control a local or URL-supplied checkpoint can embed a malicious pickle payload to execute Python code with the loading process's privileges on torch releases before 2.6.
- CWE
- CWE-502
- CVSS base score
- 7.7
- Published
- 2026-10-19
- OWASP
- A08 Software and Data Integrity Failures
- Orthogonal defect classification
- Timing/Serialization
- Code defect classification
- Serialization Issues
- Category
- Input Validation and Sanitization
- Subcategory
- Insecure Parsing or Deserialization
- Accessibility scope
- Remote
- Impact
- Arbitrary Code Execution
- Affected component
- torch
- Fixed by upgrading
- Yes
Solution
Upgrade docTR to version 1.1.1 or later.
Vulnerable code sample
import torch
from pathlib import Path
def load_pretrained_params(checkpoint_path: str):
"""
Load model parameters from a checkpoint file.
"""
# VULNERABLE: unsafe deserialization via torch.load without weights_only
state_dict = torch.load(checkpoint_path, map_location="cpu")
model = torch.nn.Linear(10, 2)
model.load_state_dict(state_dict)
return modelPatched code sample
import torch
from pathlib import Path
def load_pretrained_params(checkpoint_path: str):
"""
Load model parameters from a checkpoint file.
"""
# FIX: safe deserialization using weights_only=True
state_dict = torch.load(checkpoint_path, map_location="cpu", weights_only=True)
model = torch.nn.Linear(10, 2)
model.load_state_dict(state_dict)
return modelPublished 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.
- [models] Switch torch.load to weights_only loading / copy boxes in `crop_boxes` (#2176) (mindee/doctr)
doctr/models/utils/pytorch.py · load_pretrained_params,doctr/transforms/functional/base.py · crop_boxes
Cite this entry
@misc{vaitp:cve2026112304,
title = {{Unsafe deserialization via torch.load in docTR ≤ 1.1.0 allows code execution.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-112304},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-112304/}}
}
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 ::
