{"id":"CVE-2026-1839","state":"PUBLISHED","title":"Arbitrary Code Execution via Unsafe torch.load() in Trainer Checkpoint Loading in huggingface/transformers","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.","publishedAt":"2026-04-07T05:22:00.959Z","updatedAt":"2026-04-07T13:27:41.789Z","severity":{"score":6.5,"label":"Medium","version":"3.0","vector":"CVSS:3.0/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:L/A:H","source":"@huntr_ai"},"assigner":"@huntr_ai","products":["huggingface huggingface/transformers"],"affected":[{"vendor":"huggingface","product":"huggingface/transformers","versions":[{"version":"unspecified","status":"affected","lessThan":"v5.0.0rc3","versionType":"custom"}]}],"references":["https://huntr.com/bounties/3c77bb97-e493-493d-9a88-c57f5c536485","https://github.com/huggingface/transformers/commit/03c8082ba4594c9b8d6fe190ca9bed0e5f8ca396"],"weaknesses":["CWE-502"],"ingestedAt":"2026-10-29T20:11:10.572Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2026/1xxx/CVE-2026-1839.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2026-1839","state":"PUBLISHED","datePublished":"2026-04-07T05:22:00.959Z","dateUpdated":"2026-04-07T13:27:41.789Z","assignerShortName":"@huntr_ai","assignerOrgId":"c09c270a-b464-47c1-9133-acb35b22c19a","dateReserved":"2026-02-03T16:49:27.781Z"},"containers":{"cna":{"title":"Arbitrary Code Execution via Unsafe torch.load() in Trainer Checkpoint Loading in huggingface/transformers","descriptions":[{"lang":"en","value":"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":[{"vendor":"huggingface","product":"huggingface/transformers","versions":[{"version":"unspecified","status":"affected","lessThan":"v5.0.0rc3","versionType":"custom"}]}],"references":[{"url":"https://huntr.com/bounties/3c77bb97-e493-493d-9a88-c57f5c536485"},{"url":"https://github.com/huggingface/transformers/commit/03c8082ba4594c9b8d6fe190ca9bed0e5f8ca396"}],"metrics":[{"cvssV3_0":{"version":"3.0","attackComplexity":"HIGH","attackVector":"LOCAL","availabilityImpact":"HIGH","confidentialityImpact":"HIGH","integrityImpact":"LOW","privilegesRequired":"NONE","scope":"UNCHANGED","userInteraction":"REQUIRED","vectorString":"CVSS:3.0/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:L/A:H","baseScore":6.5,"baseSeverity":"MEDIUM"}}],"problemTypes":[{"descriptions":[{"cweId":"CWE-502","type":"CWE","lang":"en","description":"CWE-502 Deserialization of Untrusted Data"}]}],"providerMetadata":{"shortName":"@huntr_ai","orgId":"c09c270a-b464-47c1-9133-acb35b22c19a","dateUpdated":"2026-04-07T05:22:00.959Z"},"source":{"advisory":"3c77bb97-e493-493d-9a88-c57f5c536485","discovery":"EXTERNAL"}},"adp":[{"title":"CISA ADP Vulnrichment","references":[{"url":"https://huntr.com/bounties/3c77bb97-e493-493d-9a88-c57f5c536485","tags":["exploit"]}],"metrics":[{"other":{"type":"ssvc","content":{"timestamp":"2026-04-07T13:27:38.099805Z","id":"CVE-2026-1839","options":[{"Exploitation":"poc"},{"Automatable":"no"},{"Technical Impact":"total"}],"role":"CISA Coordinator","version":"2.0.3"}}}],"providerMetadata":{"shortName":"CISA-ADP","orgId":"134c704f-9b21-4f2e-91b3-4a467353bcc0","dateUpdated":"2026-04-07T13:27:41.789Z"}}]}}}