CVE-2026-1839: Arbitrary Code Execution via Unsafe torch.load() in Trainer Checkpoint Loading in huggingface/transformers
Vulnerability summary
CVE-2026-1839 is a high (CVSS 7.8) Deserialization of Untrusted Data vulnerability in huggingface huggingface/transformers. EPSS estimates a 0.38% chance of exploitation in the next 30 days, higher than 32.2% of scored vulnerabilities. 1 public exploit is recorded.
Not severe (CVSS 6.5, local access); no exploitation reported by the 5 checked sources
Source freshness unavailable
How is this decided?Advisory lineage
Upstream 0 · Downstream 0 · Related 1Timeline
- 07-04-2026PublishedVulnerability first disclosed.
- 07-04-2026Last modifiedVulnerability information updated.
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.
CVSS metrics
5 scores · 4 sources · 2 versions- OSV · PypiEcosystem advisory · calculated7.8HighCVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
- OSV · ChainguardEcosystem advisory · calculated6.5MediumCVSS:3.0/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:L/A:H
- NVDNIST6.5MediumCVSS:3.0/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:L/A:H
EPSS trend
Probability
0.38%
Chance of exploitation in the next 30 days
Percentile
32%
Versus all other CVEs
30-day change
No change 0.00 pp
From 0.38% on 04-10-2026
Known exploited
Compare KEV catalogsNot in the CISA KEV catalog.
Not in the ENISA CNW catalog.
Not in the CIRCL catalog.
Public exploits
1 foundExploit Reference (huntr.com)
Maturity: unknown
Weaknesses
CWE · root causeAffected systems
Known conditions: local access, no authentication, user interaction (CVSS vector). Other conditions: not stated in public data.
Chainguard14 products
- lmcache-cuda-12.8< 0.4.4-r0
- nemo< 2.7.3-r1
- py3.10-transformers-4.51All versions (No fix recorded)
- py3.10-transformers-4.56< 4.56.2-r2
- py3.11-transformers-4.51All versions (No fix recorded)
Huggingface2 products
- huggingface/transformers≥ unspecified, < v5.0.0rc3
- transformers< 5.0.0 | 5.0.0:rc0 | 5.0.0:rc1 | 5.0.0:rc2
PyPI1 product
- transformers< 5.0.0rc3 | < 5.0.0
3 vendors · 17 products