CVE-2026-1839
Arbitrary Code Execution via Unsafe torch.load() in Trainer Checkpoint Loading in huggingface/transformers
CVE-2026-1839 is a medium vulnerability (CVSS 6.5) in Huggingface Huggingface/transformers, published April 7, 2026. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.38%, the 32nd percentile. Fixed in transformers 5.0.0rc3.
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.
Attack profile
How easy it is to exploit
- Attack vector
- Local
- Complexity
- High
- Privileges needed
- None
- User interaction
- Required
What an attacker can affect
- Confidentiality
- High
- Integrity
- Low
- Availability
- High
Exploit likelihood
What each source reports
CVE List Score used
6.5
Arbitrary Code Execution via Unsafe torch.load() in Trainer Checkpoint Loading in huggingface/transformers
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.
- Record
CVE-2026-1839- 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 - Weakness
- CWE-502
- Updated
- 2026-11-02
EUVDEUVD-2026-19573
6.5
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.
- Record
EUVD-2026-19573- 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 - Updated
- 2026-11-02
GitHub AdvisoriesGHSA-69w3-r845-3855
6.5
HuggingFace Transformers allows for arbitrary code execution in the `Trainer` class
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.
- Record
GHSA-69w3-r845-3855- 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 - Weakness
- CWE-502
- Updated
- 2026-11-02
NVD
7.8
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.
- Record
CVE-2026-1839- 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 - 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 - Weakness
- CWE-502
- Updated
- 2026-11-02
OSV
6.5
Arbitrary Code Execution via Unsafe torch.load() in Trainer Checkpoint Loading in huggingface/transformers
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.
- Record
CVE-2026-1839- 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 - Weakness
- CWE-502
- Updated
- 2026-11-02
OSVGHSA-69w3-r845-3855
6.5
HuggingFace Transformers allows for arbitrary code execution in the `Trainer` class
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.
- Record
GHSA-69w3-r845-3855- 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 - Weakness
- CWE-502
- Updated
- 2026-11-02
OSVPYSEC-2026-2288
7.8
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.
- Record
PYSEC-2026-2288- 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 - Updated
- 2026-11-02
OSVCLSA-2026-1779065183 No score
TuxCare security update for transformers (1 CVE)
TuxCare rebuilt transformers to address 1 CVE. Fixed in 4.57.6.post1+tuxcare.
- Record
CLSA-2026-1779065183- Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
transformersPyPI |
before 5.0.0rc3 | 5.0.0rc3 |
transformersTuxCare:PyPI |
4.57.6 up to 4.57.6.post1+tuxcare | 4.57.6.post1+tuxcare |
transformersPyPI |
before 5.0.0rc3, plus listed versions 0.12.0.02.1.02.1.12.10.0 Show 45 moreShow less2.11.02.2.02.2.12.2.22.3.02.4.02.4.12.5.02.5.12.6.02.7.02.8.02.9.02.9.13.0.03.0.13.0.23.1.03.2.03.3.03.3.13.4.03.5.03.5.14.0.04.0.0rc14.0.14.1.04.1.14.10.04.10.14.10.24.10.34.11.04.11.14.11.24.11.34.12.04.12.14.12.24.12.34.12.44.12.54.13.04.14.0 |
5.0.0rc3 |
transformersPyPI |
before 5.0.0, plus listed versions 0.12.0.02.1.02.1.12.10.0 Show 45 moreShow less2.11.02.2.02.2.12.2.22.3.02.4.02.4.12.5.02.5.12.6.02.7.02.8.02.9.02.9.13.0.03.0.13.0.23.1.03.2.03.3.03.3.13.4.03.5.03.5.14.0.04.0.0rc14.0.14.1.04.1.14.10.04.10.14.10.24.10.34.11.04.11.14.11.24.11.34.12.04.12.14.12.24.12.34.12.44.12.54.13.04.14.0 |
5.0.0 |
History
| When | Changed | Sources |
|---|---|---|
| 2026-11-02 | created | CVE List, EUVD, GitHub Advisories, NVD, OSV |
References
huntr.com/bounties/3c77bb97-e493-493d-9a88-c57f5c536485
github.com/huggingface/transformers/commit/03c8082ba4594c9b8d6fe190ca9bed0e5f8ca396
nvd.nist.gov/vuln/detail/CVE-2026-1839
github.com/huggingface/transformers/releases/tag/v5.0.0rc3
github.com/advisories/GHSA-69w3-r845-3855
github.com/CVEProject/cvelistV5/tree/main/cves/2026/1xxx/CVE-2026-1839.json
github.com/huggingface/transformers
Left out here: 317 versions. The JSON record has them.