Arbitrary Code Execution via Unsafe torch.load() in Trainer Checkpoint Loading in huggingface/transformers
Key facts
- Attack vector
- Local
- Privileges required
- None
- User interaction
- Required
- Attack complexity
- Low
- Impact type
- Code execution
- Confidentiality · integrity · availability
- High · High · High
- Fix status
- Partial Red Hat: 6 without a fix
Attack profile from CVSS 3.1 · NVD. Fix status from CNA, GitHub and Red Hat. Impact type from CWE-502.
Summary
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.
Why it matters now
SSVC decision points
CISA ADP · SSVC 2.0.3
- Exploitation
- Poc
- Automatable
- No
- Technical impact
- Total
The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| huggingface | huggingface/transformers | before v5.0.0rc3 | v5.0.0rc3 | Patch available | CNA |
| — | transformers (PyPI) | before 5.0.0rc3 | 5.0.0rc3 | Patch available | GHSA-69w3-r845-3855 |
- huggingface/transformers Vendorhuggingface Affected before v5.0.0rc3 Fixed in v5.0.0rc3 Patch available CNA
- transformers (PyPI) Vendor— Affected before 5.0.0rc3 Fixed in 5.0.0rc3 Patch available GHSA-69w3-r845-3855
CPE configurations NVD · 4
| CPE | Versions | Role | Vendor |
|---|---|---|---|
| cpe:2.3:a:huggingface:transformers:*:*:*:*:*:*:*:* | before 5.0.0 | Vulnerable | huggingface |
| cpe:2.3:a:huggingface:transformers:5.0.0:rc0:*:*:*:*:*:* | 5.0.0 rc0 | Vulnerable | huggingface |
| cpe:2.3:a:huggingface:transformers:5.0.0:rc1:*:*:*:*:*:* | 5.0.0 rc1 | Vulnerable | huggingface |
| cpe:2.3:a:huggingface:transformers:5.0.0:rc2:*:*:*:*:*:* | 5.0.0 rc2 | Vulnerable | huggingface |
- cpe:2.3:a:huggingface:transformers:*:*:*:*:*:*:*:* Versions before 5.0.0 Vulnerable ·huggingface
- cpe:2.3:a:huggingface:transformers:5.0.0:rc0:*:*:*:*:*:* Versions 5.0.0 rc0 Vulnerable ·huggingface
- cpe:2.3:a:huggingface:transformers:5.0.0:rc1:*:*:*:*:*:* Versions 5.0.0 rc1 Vulnerable ·huggingface
- cpe:2.3:a:huggingface:transformers:5.0.0:rc2:*:*:*:*:*:* Versions 5.0.0 rc2 Vulnerable ·huggingface
Remediation
- Fix · CNA huggingface/transformers (huggingface) Fixed in v5.0.0rc3
- Fix · GHSA-69w3-r845-3855 transformers (PyPI) Fixed in 5.0.0rc3 Advisory →
Vendor assessments
Red Hat
Red Hat rating: Moderate. Red Hat's page for this CVE →
| Product | Status | Plan or fix |
|---|---|---|
| Lightspeed Core | Affected | No fix yet: Fix deferred |
| OpenShift Lightspeed | Affected | No fix yet: Fix deferred |
| Red Hat AI Inference Server | Affected | No fix yet: Fix deferred |
| Red Hat Ansible Automation Platform 2 | Affected | No fix yet: Fix deferred |
| Red Hat Enterprise Linux AI (RHEL AI) 3 | Affected | No fix yet: Fix deferred |
| Red Hat OpenShift AI (RHOAI) | Affected | No fix yet: Fix deferred |
Timeline
- 2026-10-02 Threatist record created from CVE-2026-1839
- 2026-10-03 Alias added: GHSA-69w3-r845-3855
References
More huggingface Transformers vulnerabilities
- TI-2026-04577 Policy Bypass in LightGlue Nested Config Resolution in huggingface/transformers CVSS 3.1CRITICAL 9.6
- TI-2025-06294 Regular Expression Denial of Service (ReDoS) in huggingface/transformers CVSS 3.1HIGH 7.5
- TI-2025-06027 Regular Expression Denial of Service (ReDoS) in huggingface/transformers CVSS 3.1HIGH 7.5
- TI-2025-02858 Regular Expression Denial of Service (ReDoS) in huggingface/transformers CVSS 3.1HIGH 7.5
- TI-2025-01837 Regular Expression Denial of Service (ReDoS) in huggingface/transformers CVSS 3.1HIGH 7.5
- TI-2024-11793 Regular Expression Denial of Service (ReDoS) in huggingface/transformers CVSS 3.1HIGH 7.5
Sources
- CVE-2026-1839 · CVE Program
- CVE-2026-1839 · NVD
- FIRST EPSS
- GHSA-69w3-r845-3855 · GitHub Advisory Database · CC BY 4.0
- CVE-2026-1839 · Red Hat security data · CC BY 4.0
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences