CVE-2026-1839 json
Arbitrary Code Execution via Unsafe torch.load() in Trainer Checkpoint Loading in huggingface/transformers
published 2026-04-07 7 mo ago modified 2026-10-26 13 d ago also GHSA-69w3-r845-3855 , PYSEC-2026-2288 , EUVD-2026-19573
- cvss
- 6.5
- version 3.0, CNA
- cisa kev
- Not listed
- not in CISA's catalog
- epss
- 0.4%
- EPSS 0.4% chance of exploitation in 30 days, percentile 33%
- public exploits
- 0
- none known
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.
Patch / fix
- pypi transformers 5.0.0, 5.0.0rc3
- huggingface huggingface/transformers v5.0.0rc3
Vendor advisories
What the vendors themselves say about their products: affected, fixed or not affected, and what to do.
red hat product security vex CVE-2026-1839 updated cvss 6.7
transformers: HuggingFace Transformers: Arbitrary code execution via malicious checkpoint file
-
Red Hat Lightspeed Core openshift-lightspeed-tech-preview/lightspeed-rag-tool-rhel9, redhat-user-workloads/lightspeed-core-tenant/lightspeed-stack Red Hat OpenShift Lightspeed openshift-lightspeed/lightspeed-ocp-rag-rhel9, openshift-lightspeed/lightspeed-service-api-rhel9, redhat-user-workloads/crt-nshift-lightspeed-tenant/lightspeed-rag-tool Red Hat AI Inference Server redhat-user-workloads/ai-tenant/rhaiis/rhaiis-tpu-ubi9, redhat-user-workloads/ai-tenant/rhaiis/rhaiis-spyre-ubi9, redhat-user-workloads/ai-tenant/rhaiis-3-3/rhaiis-cpu-ubi9-3-3, redhat-user-workloads/ai-tenant/rhaiis-3-3/rhaiis-tpu-ubi9-3-3, redhat-user-workloads/ai-tenant/rhaiis-3-3/rhaiis-cuda-ubi9-3-3, redhat-user-workloads/ai-tenant/rhaiis-3-3/rhaiis-rocm-ubi9-3-3, +6 more Red Hat Ansible Automation Platform 2 ansible-automation-platform-25/lightspeed-chatbot-rhel8, redhat-user-workloads/ansible-tenant/ansible-automation-platform-26/lightspeed-chatbot-rhel9 Red Hat Enterprise Linux AI (RHEL AI) 3 rhelai3/bootc-cuda-rhel9, rhelai3/bootc-rocm-rhel9, rhelai3/disk-image-cuda-rhel9, redhat-user-workloads/rhel-ai-tenant/rhelai-bootc-3-3/bootc-cuda-aws-3-3, redhat-user-workloads/rhel-ai-tenant/rhelai-bootc-3-3/bootc-cuda-gcp-3-3, redhat-user-workloads/rhel-ai-tenant/rhelai-bootc-3-3/bootc-cuda-azure-3-3, +1 more Red Hat OpenShift AI (RHOAI) rhoai/odh-vllm-cuda-rhel9, rhoai/odh-vllm-rocm-rhel9, rhoai/odh-caikit-nlp-rhel9, rhoai/odh-vllm-gaudi-rhel9, rhoai/odh-ta-lmes-job-rhel9, rhoai/odh-kserve-agent-rhel9, +21 moreaffected: workaround, no fix available “Fix deferred”
Red Hat CSAF VEX © Red Hat, Inc., from https://security.access.redhat.com/data/csaf/v2/vex/; changed: reduced to product statuses and remediations. CC BY 4.0 · csaf
CISA SSVC
- Exploitation
- Proof of concept is public
- Automatable
- no
- Technical impact
- total
- Assessed
- 7 mo ago
Exploit prediction
0.39% chance of exploitation in the next 30 days, higher than 33% of all scored CVEs (FIRST EPSS, 2026-11-08).
Exploits and checks
- huntr.com https://huntr.com/bounties/3c77bb97-e493-493d-9a88-c57f5c536485 referenced PoC, tagged "exploit" by a source, unverified
CVSS scores
| assigned by | version | score | vector |
|---|---|---|---|
| CNA | 3.0 | 6.5 | CVSS:3.0/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:L/A:H |
| NVD | 3.1 | 7.8 | CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H |
| GitHub | 3.0 | 6.5 | CVSS:3.0/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:L/A:H |
| OSV | 3.1 | 7.8 | CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H |
Affected packages
| ecosystem | package | affected | fixed in |
|---|---|---|---|
| pypi | transformers | <5.0.0rc3 <5.0.0 |
5.0.0rc3 5.0.0 |
Affected products
- huggingface huggingface/transformers
Classification
- Weakness
-
- CWE-502 Deserialization of Untrusted Data
References
-
github.com
/huggingface/transformers/commit/03c8082ba4594c9b8d6fe190ca9bed0e5f8ca396
web, patch
-
huntr.com
/bounties/3c77bb97-e493-493d-9a88-c57f5c536485
exploit, web, third-party-advisory, evidence
-
nvd.nist.gov
/vuln/detail/CVE-2026-1839
advisory
-
github.com
/huggingface/transformers
package
-
github.com
/huggingface/transformers/releases/tag/v5.0.0rc3
web
-
github.com
/advisories/GHSA-69w3-r845-3855
advisory
Sources
- CVE List CVE-2026-1839
- GitHub Advisory GHSA-69w3-r845-3855
- NVD CVE-2026-1839
- OSV PYSEC-2026-2288
Fencer Vulns keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.