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

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

Canonical: https://rewindex.com/cve/CVE-2026-1839
Last updated: 2026-06-17T10:16:35Z

- Published: 2026-04-07 05:22 UTC · Updated: 2026-06-17 10:16 UTC · Assigner: @huntr\_ai
- CVSS: 6.5 (CVSS 3.1) · Severity: Medium · Vector: CVSS:3.0/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:L/A:H
- EPSS: 0.38%, 32th percentile (scored 2026-10-25)
- CISA KEV: no
- CWE: CWE-502

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

## Affected vendors and products

- huggingface: huggingface/transformers

## Tracked companies

- [Hugging Face](https://rewindex.com/company/hugging-face.md)

## References

- [CVE record on cve.org](https://www.cve.org/CVERecord?id=CVE-2026-1839)
- [NVD entry](https://nvd.nist.gov/vuln/detail/CVE-2026-1839)
- [https://github.com/huggingface/transformers/commit/03c8082ba4594c9b8d6fe190ca9bed0e5f8ca396](https://github.com/huggingface/transformers/commit/03c8082ba4594c9b8d6fe190ca9bed0e5f8ca396)
- [https://huntr.com/bounties/3c77bb97-e493-493d-9a88-c57f5c536485](https://huntr.com/bounties/3c77bb97-e493-493d-9a88-c57f5c536485)

---

_Sources: CVE records from the CVE Program (cve.org). CVE® is a registered trademark of The MITRE Corporation. (https://www.cve.org/) This product uses data from the NVD API but is not endorsed or certified by the NVD. (https://nvd.nist.gov/) Known Exploited Vulnerabilities catalog from CISA. (https://www.cisa.gov/known-exploited-vulnerabilities-catalog) EPSS scores from FIRST (Exploit Prediction Scoring System). (https://www.first.org/epss/)_


---
Canonical: https://rewindex.com/cve/CVE-2026-1839 · Markdown: https://rewindex.com/cve/CVE-2026-1839.md · JSON: https://rewindex.com/api/v1/cves/CVE-2026-1839 · Data licensed CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) · Generated 2026-10-26T04:06:19.446Z
