CVE-2026-1839
published medium CVSS 3.0 · 6.5Arbitrary Code Execution via Unsafe torch.load() in Trainer Checkpoint Loading in huggingface/transformers
Package status and fixes
| Distro / vendor | Release | Package / product | Publisher status | Fixed build | Source |
|---|---|---|---|---|---|
| huggingface | — | huggingface/transformersunspecified to < v5.0.0rc3 | Affected | Not stated | @huntr_ai |
Description
A vulnerability in the HuggingFace Transformers library, specifically in the `Trainer` class, allows for arbitrary code execution. The `_load_rng_state()` method in `src/transformers/trainer.py` at line 3059 calls `torch.load()` without the `weights_only=True` parameter. This issue affects all versions of the library supporting `torch>=2.2` when used with PyTorch versions below 2.6, as the `safe_globals()` context manager provides no protection in these versions. An attacker can exploit this vulnerability by supplying a malicious checkpoint file, such as `rng_state.pth`, which can execute arbitrary code when loaded. The issue is resolved in version v5.0.0rc3.
Related advisories
Vendor advisories explicitly linked to this CVE.
No linked advisories were found for this CVE.
Assessment
CVSS risk assessment and additional context for this vulnerability.
- CVSS version
- 3.0
- Base score
- 6.5 / 10
- Severity
- medium
- Provider
- @huntr_ai · cna
- Vector string
- CVSS:3.0/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:L/A:H
Publisher product statements
Version ranges and default statuses as reported by each provider.
| Vendor | Product | Version status | Source |
|---|---|---|---|
| huggingface | huggingface/transformers | unspecified to < v5.0.0rc3 (affected · custom) | @huntr_ai · cna |
Weaknesses
1- CWE-502 CWE-502 Deserialization of Untrusted Data
References
2Provider assertions
2@huntr_ai · cna
Arbitrary Code Execution via Unsafe torch.load() in Trainer Checkpoint Loading in huggingface/transformers
CISA-ADP · adp
CISA ADP Vulnrichment
Provenance
- Schema
- 5.2
- Searchable
- yes
- Content hash
- 30b2282dfefe492d3a1b9490ed5f75314cd89bc806d3f7f2c4efb8a6f11483cf
- Ingested
- 23 Sep 2026, 09:04:24 UTC
- Source record
- Official CVE record