CVE-2026-1839

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.
Configurations

Configuration 1 (hide)

OR cpe:2.3:a:huggingface:transformers:*:*:*:*:*:*:*:*
cpe:2.3:a:huggingface:transformers:5.0.0:rc0:*:*:*:*:*:*
cpe:2.3:a:huggingface:transformers:5.0.0:rc1:*:*:*:*:*:*
cpe:2.3:a:huggingface:transformers:5.0.0:rc2:*:*:*:*:*:*

History

28 Apr 2026, 16:39

Type Values Removed Values Added
CPE cpe:2.3:a:huggingface:transformers:5.0.0:rc0:*:*:*:*:*:*
cpe:2.3:a:huggingface:transformers:*:*:*:*:*:*:*:*
cpe:2.3:a:huggingface:transformers:5.0.0:rc2:*:*:*:*:*:*
cpe:2.3:a:huggingface:transformers:5.0.0:rc1:*:*:*:*:*:*
References () https://github.com/huggingface/transformers/commit/03c8082ba4594c9b8d6fe190ca9bed0e5f8ca396 - () https://github.com/huggingface/transformers/commit/03c8082ba4594c9b8d6fe190ca9bed0e5f8ca396 - Patch
References () https://huntr.com/bounties/3c77bb97-e493-493d-9a88-c57f5c536485 - () https://huntr.com/bounties/3c77bb97-e493-493d-9a88-c57f5c536485 - Exploit, Third Party Advisory
First Time Huggingface
Huggingface transformers
CVSS v2 : unknown
v3 : 6.5
v2 : unknown
v3 : 7.8

07 Apr 2026, 14:16

Type Values Removed Values Added
References () https://huntr.com/bounties/3c77bb97-e493-493d-9a88-c57f5c536485 - () https://huntr.com/bounties/3c77bb97-e493-493d-9a88-c57f5c536485 -

07 Apr 2026, 06:16

Type Values Removed Values Added
New CVE

Information

Published : 2026-04-07 06:16

Updated : 2026-04-28 16:39


NVD link : CVE-2026-1839

Mitre link : CVE-2026-1839

CVE.ORG link : CVE-2026-1839


JSON object : View

Products Affected

huggingface

  • transformers
CWE
CWE-502

Deserialization of Untrusted Data