CVE-2026-1839 Details
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.
A vulnerability exists in the Hugging Face Transformers library within the Trainer class, allowing arbitrary code execution. The issue arises because the _load_rng_state() method in trainer.py line 3059 calls torch.load() without the weights_only=True parameter. This vulnerability affects all versions of the library that support torch version 2.2 or higher, when used with PyTorch versions prior to 2.6. In these earlier PyTorch versions, the safe_globals() context manager does not provide adequate protection, leaving the torch.load() call vulnerable to pickle deserialization attacks. An attacker can exploit this by providing a malicious checkpoint file, such as rng_state.pth, which executes arbitrary code upon being loaded. The vulnerability has been fixed in version 5.0.0rc3.
Users should update to Hugging Face Transformers version 5.0.0rc3 or later, where this vulnerability has been fixed.
Metrics
CVSS 4.0 Severity and Vector Strings:
No CVSS 4.0 data is available for this CVE.
CVSS 3.x Severity and Vector Strings:
No data available for CVSS Version 2.0 on this CVE.
CISA-ADP
Assessed Apr 7, 2026References to Advisories, Solutions, and Tools
By selecting these links, you will be leaving this site. These are references gathered from the official CVE record and are not endorsed by Volerion.
| URL | Source(s) | Tag(s) |
|---|---|---|
| https://huntr.com/bounties/3c77bb97-e493-493d-9a88-c57f5c536485 | CISA-ADP | ExploitThird Party Advisory |
| https://github.com/huggingface/transformers/commit/03c8082ba4594c9b8d6fe190ca9bed0e5f8ca396 | [email protected] | Patch |
| https://huntr.com/bounties/3c77bb97-e493-493d-9a88-c57f5c536485 | [email protected] | ExploitThird Party Advisory |
Weakness Enumeration
| CWE-ID | CWE Name | Source |
|---|---|---|
| CWE-502 | Deserialization of Untrusted Data | [email protected] |
Affected Products
| Product | Versions |
|---|---|
| huggingface transformers | < 5.0.0 5.0.0 rc0 5.0.0 rc1 5.0.0 rc2 |
CPE
Remediation
| |
Change History
6 change records found show changes
| Date | Action | Recorded By |
|---|---|---|
| Oct 26, 2026 | CVE Translated | [email protected] |
| Jun 17, 2026 | CVE Modified | [email protected] |
| Jun 17, 2026 | CVE Modified | CISA-ADP |
| Apr 28, 2026 | Initial Analysis | [email protected] |
| Apr 7, 2026 | CVE Modified | CISA-ADP |
| Apr 7, 2026 | New CVE Received | [email protected] |