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. It arises from the _load_rng_state() method calling torch. load() without the weights_only=True parameter, allowing arbitrary code execution when loading malicious checkpoint files. This affects all versions supporting torch>=2. 2 used with PyTorch versions below 2. 6. The issue is fixed in version v5. 0. 0rc3. The CVSS score is 6.
AI Analysis
Technical Summary
The vulnerability exists in the HuggingFace Transformers library, specifically in the Trainer class's _load_rng_state() method, which calls torch.load() without the weights_only=True parameter. When used with PyTorch versions below 2.6, the safe_globals() context manager does not provide protection, allowing an attacker to execute arbitrary code by supplying a crafted checkpoint file such as rng_state.pth. This affects all versions supporting torch>=2.2. The issue is resolved in version v5.0.0rc3.
Potential Impact
An attacker who can supply a malicious checkpoint file to the vulnerable Trainer class can achieve arbitrary code execution during the loading process. This can lead to compromise of the host environment where the library is used. The impact includes potential confidentiality loss, integrity compromise, and availability disruption as indicated by the CVSS vector (C:H/I:L/A:H).
Mitigation Recommendations
Upgrade to HuggingFace Transformers version v5.0.0rc3 or later, where this vulnerability is resolved. There is no official patch or temporary fix for earlier versions. Avoid loading untrusted checkpoint files, especially when using PyTorch versions below 2.6. Patch status is not explicitly confirmed beyond the version fix; verify with 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. It arises from the _load_rng_state() method calling torch. load() without the weights_only=True parameter, allowing arbitrary code execution when loading malicious checkpoint files. This affects all versions supporting torch>=2. 2 used with PyTorch versions below 2. 6. The issue is fixed in version v5. 0. 0rc3. The CVSS score is 6.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The vulnerability exists in the HuggingFace Transformers library, specifically in the Trainer class's _load_rng_state() method, which calls torch.load() without the weights_only=True parameter. When used with PyTorch versions below 2.6, the safe_globals() context manager does not provide protection, allowing an attacker to execute arbitrary code by supplying a crafted checkpoint file such as rng_state.pth. This affects all versions supporting torch>=2.2. The issue is resolved in version v5.0.0rc3.
Potential Impact
An attacker who can supply a malicious checkpoint file to the vulnerable Trainer class can achieve arbitrary code execution during the loading process. This can lead to compromise of the host environment where the library is used. The impact includes potential confidentiality loss, integrity compromise, and availability disruption as indicated by the CVSS vector (C:H/I:L/A:H).
Mitigation Recommendations
Upgrade to HuggingFace Transformers version v5.0.0rc3 or later, where this vulnerability is resolved. There is no official patch or temporary fix for earlier versions. Avoid loading untrusted checkpoint files, especially when using PyTorch versions below 2.6. Patch status is not explicitly confirmed beyond the version fix; verify with 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/7/2026, 6:01:27 AM
Last updated: 4/7/2026, 7:29:45 AM
Views: 4
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.