Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2026-112304 Overview
CVE-2026-112304 is an unsafe deserialization vulnerability in Mindee's docTR optical character recognition library through version 1.1.0. The flaw resides in the load_pretrained_params() function in doctr/models/utils/pytorch.py, which calls torch.load() without the weights_only=True safeguard. An attacker who controls a local checkpoint file or a URL from which a checkpoint is fetched can embed a malicious pickle payload. When docTR loads the model, Python code executes with the privileges of the loading process on PyTorch releases prior to 2.6. The vulnerability is tracked as CWE-502: Deserialization of Untrusted Data.
Critical Impact
Arbitrary Python code execution during model loading, enabling remote code execution in ML pipelines, inference servers, and developer workstations that fetch third-party docTR checkpoints.
Affected Products
- Mindee docTR versions through 1.1.0
- Deployments relying on PyTorch releases earlier than 2.6 (where weights_only defaults to False)
- Any application or pipeline that invokes load_pretrained_params() against attacker-controlled URLs or files
Discovery Timeline
- 2026-10-19 - CVE-2026-112304 published to NVD
- 2026-10-22 - Last updated in NVD database
Technical Details for CVE-2026-112304
Vulnerability Analysis
The docTR library provides pretrained model loading utilities for OCR workflows. In doctr/models/utils/pytorch.py, load_pretrained_params() downloads a checkpoint archive and passes it directly to torch.load(). Historically, torch.load() deserializes Python objects via pickle, which permits arbitrary callables to execute during unpickling. Without weights_only=True, the function reconstructs any object the pickle stream describes, including os.system, subprocess.Popen, or custom __reduce__ payloads.
An attacker who hosts a malicious checkpoint, compromises a model registry, or performs a man-in-the-middle attack on checkpoint downloads can trigger code execution the moment a developer or production worker loads the model.
Root Cause
The root cause is a missing weights_only=True argument on the torch.load() call. PyTorch versions before 2.6 default this flag to False, trusting the checkpoint producer. docTR did not override the default, so every call path routed untrusted serialized data into the full pickle deserializer.
Attack Vector
Exploitation requires that the victim load a checkpoint supplied by the attacker. Common delivery paths include typosquatted model repositories, poisoned mirror URLs, shared network paths, and compromised CI artifacts. User interaction is required to initiate the load, but no authentication to docTR itself is needed. The payload executes with the privileges of the Python process, which in container or inference-server deployments often includes network, filesystem, and credential access.
The security patch (commit 687503d) replaces the vulnerable call with a weights_only load:
)
# Read state_dict
- state_dict = torch.load(archive_path, map_location="cpu")
+ state_dict = torch.load(archive_path, map_location="cpu", weights_only=True)
# Remove weights from the state_dict
if ignore_keys is not None and len(ignore_keys) > 0:
Source: GitHub Commit 687503d
The same commit also hardens crop_boxes in doctr/transforms/functional/base.py by copying the boxes array before mutation:
Returns:
the cropped boxes
"""
+ boxes = boxes.copy()
is_box_rel = boxes.max() <= 1
is_crop_rel = max(crop_box) <= 1
Source: GitHub Commit 687503d
Stop Remote Code Execution Before It Runs
Singularity™ Endpoint detects and blocks exploit attempts at machine speed, including zero-days and novel attack techniques.
Stop Exploit AttemptsDetection Methods for CVE-2026-112304
Indicators of Compromise
- Unexpected child processes spawned by Python workers that import docTR, especially shells, curl, wget, or package managers
- Outbound network connections from inference hosts to unfamiliar domains immediately after a checkpoint download
- Checkpoint files sourced from non-official URLs or mirrors, or files whose SHA-256 hashes do not match the Mindee release manifest
- Writes to ~/.cache/doctr/, /tmp/, or model-cache directories followed by execution of binaries from those paths
Detection Strategies
- Statically scan Python code for torch.load( calls that omit weights_only=True and route them through code review
- Inspect pickle streams within .pt, .pth, and .bin artifacts for GLOBAL opcodes referencing os, subprocess, builtins.eval, or builtins.exec
- Alert when the Python interpreter spawns an interactive shell, scripting engine, or network client as a descendant process
Monitoring Recommendations
- Record and audit the source URLs of every model checkpoint pulled into production and reject domains outside an allowlist
- Monitor filesystem access to model cache directories and correlate with process-creation telemetry
- Enable egress logging on ML worker nodes to surface callbacks initiated by malicious pickle payloads
How to Mitigate CVE-2026-112304
Immediate Actions Required
- Upgrade docTR to the version containing commit 687503d or later, which enforces weights_only=True
- Upgrade PyTorch to 2.6 or later so that weights_only defaults to True even for third-party loaders
- Audit existing cached checkpoints and discard any whose provenance cannot be verified against the official Mindee release
- Rotate credentials and tokens accessible from any host that loaded an untrusted docTR checkpoint
Patch Information
The fix is delivered in commit 687503d in the Mindee docTR repository. See the VulnCheck Advisory on Doctr RCE and the upstream tracking issue GitHub Issue #2175 for additional context on affected code paths in doctr/models/utils/pytorch.py.
Workarounds
- Restrict load_pretrained_params() inputs to checkpoints produced and signed by trusted internal pipelines
- Load models inside sandboxed containers with no outbound network access and minimal filesystem privileges
- Pin PyTorch to 2.6 or later as a defense-in-depth measure so torch.load() refuses unsafe pickle payloads by default
- Verify checkpoint integrity with SHA-256 hashes against the vendor release manifest before invoking any loader
# Pin fixed versions in requirements.txt
pip install --upgrade "torch>=2.6" "python-doctr>1.1.0"
# Verify checkpoint integrity before loading
sha256sum model.pt | diff - expected_hash.txt
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

