Arbitrary Code Execution via Unsafe torch.load() in Trainer Checkpoint Loading in huggingface/transformers (huggingface huggingface/transformers)
En bref
- Source
- NVD
- EPSS
- EPSS 0.38 % · centile 32 ()
- État
- PUBLISHED
- Publiée
- Mise à jour
- Attribuée par
- @huntr_ai
- Statut NVD
- Analyzed
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.
Faiblesses (CWE)
- CWE-502 — Désérialisation de données non fiables
Références
Scores
| Version | Score | Vecteur | Évalué par |
|---|---|---|---|
| CVSS 3.0 | MEDIUM 6.5 | CVSS:3.0/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:L/A:H | @huntr_ai |
| CVSS 3.1 | HIGH 7.8 | CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H | NVD · nvd@nist.gov (Primary) |
| CVSS 3.0 | MEDIUM 6.5 | CVSS:3.0/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:L/A:H | NVD · security@huntr.dev (Secondary) |
Avis
- 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()` metho
Références européennes
- ENISA EUVD · EUVD-2026-19573
- GCVE · GCVE-0-2026-1839
Avis du CERT-FR
- CERTFR-2026-AVI-0556 — Multiples vulnérabilités dans les produits VMware · cert.ssi.gouv.fr
Configurations affectées (CPE NVD)
cpe:2.3:a:huggingface:transformers:*:*:*:*:*:*:*:*< 5.0.0cpe:2.3:a:huggingface:transformers:5.0.0:rc0:*:*:*:*:*:*cpe:2.3:a:huggingface:transformers:5.0.0:rc1:*:*:*:*:*:*cpe:2.3:a:huggingface:transformers:5.0.0:rc2:*:*:*:*:*:*
Produits affectés
| Produit | Versions |
|---|---|
| huggingface · huggingface/transformers | affected unspecified < v5.0.0rc3 |
Sources
| Source | Licence |
|---|---|
| CVE List (CVEProject cvelistV5) | CVE Program Terms of Use |
| EPSS (FIRST.org) | FIRST — attribution requested |
| ENISA EUVD | ENISA — reproduction authorised, source acknowledged |
| CERT-FR (ANSSI) | Licence Ouverte / Etalab 2.0 |
| NVD (NIST) via fkie-cad/nvd-json-data-feeds | Public domain — this product uses data from the NVD API but is not endorsed or certified by the NVD |