{"id":"CVE-2026-1839","aliases":["CVE-2026-1839","GHSA-69w3-r845-3855","PYSEC-2026-2288"],"related":[],"kind":"vulnerability","state":"published","title":"Arbitrary Code Execution via Unsafe torch.load() in Trainer Checkpoint Loading in huggingface/transformers","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"es","text":"Una vulnerabilidad en la biblioteca HuggingFace Transformers, específicamente en la clase “Trainer”, permite la ejecución de código arbitrario. El método “_load_rng_state()” en “src/transformers/trainer.py” en la línea 3059 llama a “torch.load()” sin el parámetro “weights_only=True”. Este problema afecta a todas las versiones de la biblioteca que soportan “torchmayor o igual que 2.2” cuando se usan con versiones de PyTorch inferiores a 2.6, ya que el gestor de contexto “safe_globals()” no proporciona protección en estas versiones. Un atacante puede explotar esta vulnerabilidad suministrando un archivo de punto de control malicioso, como “rng_state.pth”, que puede ejecutar código arbitrario cuando se carga. El problema está resuelto en la versión v5.0.0rc3.","source":"nvd"}],"published":"2026-04-07T05:22:00.959Z","modified":"2026-10-26T22:10:00.163Z","severity":{"scorer":"@huntr_ai","scheme":"CVSS:3.0","vector":"CVSS:3.0/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:L/A:H","score":6.5,"rating":"MEDIUM"},"severities":[{"scorer":"@huntr_ai","scheme":"CVSS:3.0","vector":"CVSS:3.0/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:L/A:H","score":6.5,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.0","vector":"CVSS:3.0/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:L/A:H","score":6.5,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H","score":7.8,"rating":"HIGH"},{"scorer":"PyPA Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H","score":7.8,"rating":"HIGH"}],"cwes":["CWE-502"],"affected":[{"ranges":[{"type":"custom","introduced":"unspecified","fixed":"v5.0.0rc3","status":"affected"}],"vendor":"huggingface","product":"huggingface/transformers","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"5.0.0rc3"}],"ecosystem":"PyPI","package":"transformers","purl":"pkg:pypi/transformers","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"5.0.0"},{"status":"affected","version":"5.0.0"},{"status":"affected","version":"5.0.0"},{"status":"affected","version":"5.0.0"}],"vendor":"huggingface","product":"transformers","cpe":"cpe:2.3:a:huggingface:transformers:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"5.0.0"}],"ecosystem":"PyPI","package":"transformers","purl":"pkg:pypi/transformers","source":"pysec"}],"references":[{"url":"https://huntr.com/bounties/3c77bb97-e493-493d-9a88-c57f5c536485","tags":["evidence","exploit","third-party-advisory","web"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/huggingface/transformers/commit/03c8082ba4594c9b8d6fe190ca9bed0e5f8ca396","tags":["fix","patch","web"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-1839","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/huggingface/transformers","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/huggingface/transformers/releases/tag/v5.0.0rc3","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/advisories/GHSA-69w3-r845-3855","tags":["advisory"],"sources":["pysec"]}],"credits":[],"assigner":"@huntr_ai","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"total","date":"2026-04-07T13:27:38.099Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-1839","url":"https://www.cve.org/CVERecord?id=CVE-2026-1839","licence":"CVE Terms of Use","modified":"2026-04-07T13:27:41.789Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-69w3-r845-3855","url":"https://github.com/advisories/GHSA-69w3-r845-3855","licence":"CC-BY-4.0","modified":"2026-09-10T03:50:43.300Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-1839","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-1839","licence":"Public domain","modified":"2026-10-26T22:10:00.163Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-2288","url":"https://osv.dev/vulnerability/PYSEC-2026-2288","licence":"CC-BY-4.0","modified":"2026-07-13T16:45:06.516Z"}],"updatedAt":"2026-11-25T22:59:18.084Z","epss":{"score":0.00396,"percentile":0.3598,"date":"2026-12-01T12:00:22.000Z"}}