Arbitrary Code Execution via Unsafe torch.load() in Trainer Checkpoint Loading in huggingface/transformers

Summary

CVECVE-2026-1839
StatePUBLISHED
Assigner@huntr_ai
Source PriorityCVE Program / NVD first with legacy fallback
Published2026-04-07 06:16:41 UTC
Updated2026-04-07 14:16:18 UTC
DescriptionA 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.

Risk And Classification

Primary CVSS: v3.0 6.5 MEDIUM from [email protected]

CVSS:3.0/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:L/A:H

EPSS: 0.000200000 probability, percentile 0.052420000 (date 2026-04-07)

Problem Types: CWE-502 | CWE-502 CWE-502 Deserialization of Untrusted Data


VersionSourceTypeScoreSeverityVector
3.0[email protected]Secondary6.5MEDIUMCVSS:3.0/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:L/A:H
3.0CNADECLARED6.5MEDIUMCVSS:3.0/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:L/A:H

CVSS v3.0 Breakdown

Attack Vector
Local
Attack Complexity
High
Privileges Required
None
User Interaction
Required
Scope
Unchanged
Confidentiality
High
Integrity
Low
Availability
High

CVSS:3.0/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:L/A:H

Vendor Declared Affected Products

SourceVendorProductVersionPlatforms
CNA Huggingface Huggingface/transformers affected unspecified v5.0.0rc3 custom Not specified

References

ReferenceSourceLinkTags
github.com/huggingface/transformers/commit/03c8082ba4594c9b8d6fe190ca9be... [email protected] github.com
huntr.com/bounties/3c77bb97-e493-493d-9a88-c57f5c536485 134c704f-9b21-4f2e-91b3-4a467353bcc0 huntr.com
CVE Program record CVE.ORG www.cve.org canonical
NVD vulnerability detail NVD nvd.nist.gov canonical, analysis
© CVE.report 2026 |

Use of this information constitutes acceptance for use in an AS IS condition. There are NO warranties, implied or otherwise, with regard to this information or its use. Any use of this information is at the user's risk. It is the responsibility of user to evaluate the accuracy, completeness or usefulness of any information, opinion, advice or other content. EACH USER WILL BE SOLELY RESPONSIBLE FOR ANY consequences of his or her direct or indirect use of this web site. ALL WARRANTIES OF ANY KIND ARE EXPRESSLY DISCLAIMED. This site will NOT BE LIABLE FOR ANY DIRECT, INDIRECT or any other kind of loss.

CVE, CWE, and OVAL are registred trademarks of The MITRE Corporation and the authoritative source of CVE content is MITRE's CVE web site. This site includes MITRE data granted under the following license.

Free CVE JSON API cve.report/api

CVE.report and Source URL Uptime Status status.cve.report