CVE-2026-1839: CWE-502 Deserialization of Untrusted Data in huggingface huggingface/transformers
CVE-2026-1839 is a deserialization vulnerability in the HuggingFace Transformers library's Trainer class that allows arbitrary code execution when loading malicious checkpoint files. The issue arises because the _load_rng_state() method calls torch. load() without the weights_only=True parameter, and the safe_globals() context manager does not provide protection in PyTorch versions below 2. 6. This affects all versions of the library supporting torch>=2. 2 used with PyTorch versions below 2. 6. The vulnerability is resolved in version v5. 0. 0rc3.
AI Analysis
Technical Summary
The vulnerability in huggingface/transformers (CVE-2026-1839) involves unsafe deserialization in the Trainer class's _load_rng_state() method, which uses torch.load() without the weights_only=True parameter. When used with PyTorch versions below 2.6, the safe_globals() context manager does not mitigate the risk, allowing an attacker to execute arbitrary code by providing a crafted checkpoint file (e.g., rng_state.pth). This affects all library versions supporting torch>=2.2 with PyTorch < 2.6. The issue is fixed in version v5.0.0rc3.
Potential Impact
An attacker who can supply a malicious checkpoint file to the Trainer class can execute arbitrary code on the system loading the checkpoint. This can lead to confidentiality, integrity, and availability impacts, including code execution and potential system compromise. The vulnerability requires local access to supply the malicious file and user interaction to load it, as indicated by the CVSS vector (AV:L/UI:R).
Mitigation Recommendations
The vulnerability is resolved in huggingface/transformers version v5.0.0rc3. Users should upgrade to this version or later to mitigate the issue. If upgrading is not immediately possible, avoid loading untrusted checkpoint files with affected versions and PyTorch versions below 2.6. Patch status is not explicitly stated beyond the fix in v5.0.0rc3; check the vendor advisory for the latest remediation guidance.
CVE-2026-1839: CWE-502 Deserialization of Untrusted Data in huggingface huggingface/transformers
Description
CVE-2026-1839 is a deserialization vulnerability in the HuggingFace Transformers library's Trainer class that allows arbitrary code execution when loading malicious checkpoint files. The issue arises because the _load_rng_state() method calls torch. load() without the weights_only=True parameter, and the safe_globals() context manager does not provide protection in PyTorch versions below 2. 6. This affects all versions of the library supporting torch>=2. 2 used with PyTorch versions below 2. 6. The vulnerability is resolved in version v5. 0. 0rc3.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The vulnerability in huggingface/transformers (CVE-2026-1839) involves unsafe deserialization in the Trainer class's _load_rng_state() method, which uses torch.load() without the weights_only=True parameter. When used with PyTorch versions below 2.6, the safe_globals() context manager does not mitigate the risk, allowing an attacker to execute arbitrary code by providing a crafted checkpoint file (e.g., rng_state.pth). This affects all library versions supporting torch>=2.2 with PyTorch < 2.6. The issue is fixed in version v5.0.0rc3.
Potential Impact
An attacker who can supply a malicious checkpoint file to the Trainer class can execute arbitrary code on the system loading the checkpoint. This can lead to confidentiality, integrity, and availability impacts, including code execution and potential system compromise. The vulnerability requires local access to supply the malicious file and user interaction to load it, as indicated by the CVSS vector (AV:L/UI:R).
Mitigation Recommendations
The vulnerability is resolved in huggingface/transformers version v5.0.0rc3. Users should upgrade to this version or later to mitigate the issue. If upgrading is not immediately possible, avoid loading untrusted checkpoint files with affected versions and PyTorch versions below 2.6. Patch status is not explicitly stated beyond the fix in v5.0.0rc3; check the vendor advisory for the latest remediation guidance.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- @huntr_ai
- Date Reserved
- 2026-02-03T16:49:27.781Z
- Cvss Version
- 3.0
- State
- PUBLISHED
- Remediation Level
- null
Threat ID: 69d49a21aaed68159acbc2ad
Added to database: 4/7/2026, 5:46:09 AM
Last enriched: 4/14/2026, 4:13:03 PM
Last updated: 5/22/2026, 9:59:51 AM
Views: 195
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.