{"id":"CVE-2026-1839","aliases":["GHSA-69w3-r845-3855","PYSEC-2026-2288"],"title":"HuggingFace Transformers allows for arbitrary code execution in the `Trainer` class","summary":"HuggingFace Transformers allows for arbitrary code execution in the `Trainer` class","severity":"medium","cvss":6.5,"cvssVector":"CVSS:3.0/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:L/A:H","vendor":"transformers","product":"transformers","ecosystem":"pip","affected":["transformers < 5.0.0rc3"],"patched":["transformers 5.0.0rc3"],"published":"2026-04-07","updated":"2026-09-10","sourceUpdated":"2026-09-10T03:50:43.300048881Z","source":"OSV","sourceUrl":"https://osv.dev/vulnerability/GHSA-69w3-r845-3855","references":[{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-1839"},{"url":"https://github.com/huggingface/transformers/commit/03c8082ba4594c9b8d6fe190ca9bed0e5f8ca396"},{"url":"https://github.com/huggingface/transformers"},{"url":"https://github.com/huggingface/transformers/releases/tag/v5.0.0rc3"},{"url":"https://huntr.com/bounties/3c77bb97-e493-493d-9a88-c57f5c536485"}],"tags":["osv","pip"],"epss":0.00349,"epssPercentile":0.28573,"ingestedAt":"2026-07-13T18:57:53.765Z","slug":"CVE-2026-1839","body":"## Overview\n\nA 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.\n\n## Affected packages\n\n- `transformers < 5.0.0rc3`\n\n## Remediation\n\nUpgrade to a patched release:\n\n- `transformers 5.0.0rc3`","depth":"sunlit","depthScore":36,"depthScoreParts":{"impact":35.8,"likelihood":0.1,"exploitation":0,"ransomware":0},"changes":[]}