Vulnerability
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.
24 advisories report this vulnerability, across 2 ecosystems.
Advisories
- CGA-2mrv-mrmw-8qhw
- CGA-3qjp-5934-phr7
- CGA-56xr-7m2m-783g
- CGA-59m3-p2xf-3wcw
- CGA-5f9f-463c-3hjm
- CGA-8c2x-8q33-p5gq
- CGA-cc8x-6ch2-58v2
- CGA-g9cj-m9x5-g7rj
- CGA-h6q7-g55f-7chc
- CGA-j764-mgjp-6q66
- CGA-j89m-wrj3-54r6
- CGA-jfc3-gg23-w5q4
- CGA-jgf9-4cjr-cv39
- CGA-jw49-4f94-w976
- CGA-mx6x-v72j-mvrq
- CGA-q3q7-8x94-86j7
- CGA-r8j9-g697-g7x8
- CGA-rm4h-83wq-5jf6
- CGA-v3hj-3phr-wqx9
- CGA-v59x-pqc9-jfw8
- CGA-vmf5-ccjj-j849
- CGA-xrhf-x2m8-7x7r
-
GHSA-69w3-r845-3855
HuggingFace Transformers allows for arbitrary code execution in the `Trainer` class
-
PYSEC-2026-2288
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…