/

CVE-2026-112304

Severity:

HIGH RISK

(7.5)

Unsafe Deserialization (CWE-502) in docTR Checkpoints

CVE-2026-112304

Deferred

Vulnerability type

Category:

Unsafe Deserialization

CWE:

CWE-502

Impact:

Arbitrary Code Execution

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

docTR through version 1.1.0 uses torch.load without restricting checkpoint deserialization, allowing controlled checkpoint data to carry malicious pickle content. An attacker who can supply a local or URL-based checkpoint may execute Python code with the privileges of the loading process, particularly when using affected PyTorch releases.

docTR through version 1.1.0 uses torch.load without restricting checkpoint deserialization, allowing controlled checkpoint data to carry malicious pickle content. An attacker who can supply a local or URL-based checkpoint may execute Python code with the privileges of the loading process, particularly when using affected PyTorch releases.

Affected context

The vulnerability occurs in docTR's load_pretrained_params() routine when it loads model checkpoints through an unrestricted PyTorch deserialization path. Risk is present when an application accepts checkpoints from local locations or remote URLs that are not fully trusted, and when the underlying PyTorch behavior permits pickle-based object reconstruction.

The vulnerability occurs in docTR's load_pretrained_params() routine when it loads model checkpoints through an unrestricted PyTorch deserialization path. Risk is present when an application accepts checkpoints from local locations or remote URLs that are not fully trusted, and when the underlying PyTorch behavior permits pickle-based object reconstruction.

Exploit preconditions

  • Attack surface: Model checkpoint loading through docTR's pretrained-parameter functionality
  • Required access: Ability to place, select, or provide a local or URL-supplied checkpoint
  • Trigger point: Invocation of load_pretrained_params() and subsequent torch.load processing
  • Why exploitation is possible: The checkpoint can contain pickle instructions that are processed during deserialization with the loader process's permissions
  • Attack surface: Model checkpoint loading through docTR's pretrained-parameter functionality
  • Required access: Ability to place, select, or provide a local or URL-supplied checkpoint
  • Trigger point: Invocation of load_pretrained_params() and subsequent torch.load processing
  • Why exploitation is possible: The checkpoint can contain pickle instructions that are processed during deserialization with the loader process's permissions

Why this happens

The underlying bug is unsafe deserialization of attacker-influenced checkpoint data. Calling torch.load without a restricted weights-only mode allows pickle-backed object reconstruction, which can invoke code during loading rather than merely restoring model weights. This behavior maps to CWE-502: Deserialization of Untrusted Data, because serialized input is treated as trusted executable object data.

The underlying bug is unsafe deserialization of attacker-influenced checkpoint data. Calling torch.load without a restricted weights-only mode allows pickle-backed object reconstruction, which can invoke code during loading rather than merely restoring model weights. This behavior maps to CWE-502: Deserialization of Untrusted Data, because serialized input is treated as trusted executable object data.

Potential impact

  • The attacker may execute arbitrary Python code in the loading process
  • The application could be compromised with its existing privileges
  • Local files, credentials, or environment data may be exposed
  • A compromised process could be used for lateral movement or further attacks
  • The attacker may execute arbitrary Python code in the loading process
  • The application could be compromised with its existing privileges
  • Local files, credentials, or environment data may be exposed
  • A compromised process could be used for lateral movement or further attacks

General mitigation guidance

Mitigation generally focuses on eliminating unrestricted pickle deserialization and reducing trust in checkpoint sources.

Common defensive patterns include:

  • Using a restricted, weights-only checkpoint loading mode where model compatibility permits
  • Accepting checkpoints only from authenticated and integrity-verified sources
  • Separating model download, validation, and loading into a constrained process
  • Applying strict allowlists for supported checkpoint formats and locations
  • Running model-loading workloads with least privilege and minimal filesystem and network access
  • Treating externally supplied checkpoints as untrusted even when they use expected file extensions

Mitigation generally focuses on eliminating unrestricted pickle deserialization and reducing trust in checkpoint sources.

Common defensive patterns include:

  • Using a restricted, weights-only checkpoint loading mode where model compatibility permits
  • Accepting checkpoints only from authenticated and integrity-verified sources
  • Separating model download, validation, and loading into a constrained process
  • Applying strict allowlists for supported checkpoint formats and locations
  • Running model-loading workloads with least privilege and minimal filesystem and network access
  • Treating externally supplied checkpoints as untrusted even when they use expected file extensions

How teams detect issues like this

Detection approaches commonly include:

  • Static analysis rules for torch.load calls that omit restricted loading options
  • Code review checks for checkpoint paths or URLs derived from user-controlled input
  • Dependency and policy scans covering unsafe serialization APIs
  • Runtime monitoring for unexpected process execution, filesystem access, or outbound network activity during model loading
  • CI enforcement requiring approved checkpoint formats and integrity validation before ingestion

Automated code review and security scanning tools can help identify unsafe deserialization patterns early.

Detection approaches commonly include:

  • Static analysis rules for torch.load calls that omit restricted loading options
  • Code review checks for checkpoint paths or URLs derived from user-controlled input
  • Dependency and policy scans covering unsafe serialization APIs
  • Runtime monitoring for unexpected process execution, filesystem access, or outbound network activity during model loading
  • CI enforcement requiring approved checkpoint formats and integrity validation before ingestion

Automated code review and security scanning tools can help identify unsafe deserialization patterns early.

Sources

SourceLink
github.comgithub.com/mindee/doctr/blob/v1.1.0/doctr/models/utils/pytorch.py
github.comgithub.com/mindee/doctr/commit/687503dd15592483c4699ee51280b41938579a9e
github.comgithub.com/mindee/doctr/issues/2175
vulncheck.comvulncheck.com/advisories/doctr-through-1.1.0-unsafe-deserialization-rce-via-load-pretrained-params

Frequently asked

questions

It can be, when an application retrieves checkpoints from attacker-influenced URLs or another remotely controllable source. Otherwise, exploitation generally requires local ability to provide or replace a checkpoint.

Not necessarily. The key requirement is the ability to influence the checkpoint that docTR loads; code then executes with the privileges of the loading process.

Use restricted weights-only loading or another format that does not execute arbitrary pickle content, and verify checkpoint origin and integrity before loading.

Treat model artifacts as untrusted input, enforce approved-source and format policies, isolate deserialization, and run loading components with minimal privileges.

It can be, when an application retrieves checkpoints from attacker-influenced URLs or another remotely controllable source. Otherwise, exploitation generally requires local ability to provide or replace a checkpoint.

Not necessarily. The key requirement is the ability to influence the checkpoint that docTR loads; code then executes with the privileges of the loading process.

Use restricted weights-only loading or another format that does not execute arbitrary pickle content, and verify checkpoint origin and integrity before loading.

Treat model artifacts as untrusted input, enforce approved-source and format policies, isolate deserialization, and run loading components with minimal privileges.

Find out what's already
exploitable in your codebase.