# CVE-2026-1839: Arbitrary Code Execution via Unsafe torch.load() in Trainer Checkpoint Loading in huggingface/transformers

- Severity: Medium 6.5 (CVSS:3.0, scored by @huntr_ai) `CVSS:3.0/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:L/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.40%, higher than 35% of CVEs (2026-12-01)
- Public exploit code or proof of concept: one link below, marked "exploit"
- Published: 2026-04-07T05:22:00.959Z
- Modified: 2026-10-26T22:10:00.163Z
- Also known as: GHSA-69w3-r845-3855, PYSEC-2026-2288
- Weaknesses: CWE-502
- SSVC (CISA-ADP): exploitation poc, automatable no, technical impact total
- Assigned by: @huntr_ai

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

(As written by CVE List.)

## Affected

- huggingface huggingface/transformers: from unspecified before v5.0.0rc3
- transformers (PyPI): before 5.0.0rc3; before 5.0.0
- huggingface transformers: before 5.0.0; 5.0.0

## Every score

- @huntr_ai: CVSS:3.0 6.5 Medium `CVSS:3.0/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:L/A:H`
- GitHub: CVSS:3.0 6.5 Medium `CVSS:3.0/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:L/A:H`
- NVD: CVSS:3.1 7.8 High `CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H`
- PyPA Advisory Database: CVSS:3.1 7.8 High `CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H`

## References

- <https://huntr.com/bounties/3c77bb97-e493-493d-9a88-c57f5c536485> (exploit, evidence, third-party-advisory, web)
- <https://github.com/huggingface/transformers/commit/03c8082ba4594c9b8d6fe190ca9bed0e5f8ca396> (fix, patch, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2026-1839> (advisory)
- <https://github.com/huggingface/transformers> (package)
- <https://github.com/huggingface/transformers/releases/tag/v5.0.0rc3> (web)
- <https://github.com/advisories/GHSA-69w3-r845-3855> (advisory)

## Sources

- CVE List: [CVE-2026-1839](https://www.cve.org/CVERecord?id=CVE-2026-1839), CVE Terms of Use, modified 2026-04-07
- GitHub Advisory Database: [GHSA-69w3-r845-3855](https://github.com/advisories/GHSA-69w3-r845-3855), CC-BY-4.0, modified 2026-09-10
- NVD: [CVE-2026-1839](https://nvd.nist.gov/vuln/detail/CVE-2026-1839), Public domain, modified 2026-10-26
- PyPA Advisory Database: [PYSEC-2026-2288](https://osv.dev/vulnerability/PYSEC-2026-2288), CC-BY-4.0, modified 2026-07-13

---

Page: https://cve.day/CVE-2026-1839 · Whole record: https://cve.day/CVE-2026-1839.json · Rebuilt by cve.day 2026-11-25T22:59:18.084Z
