Code execution via unsafe checkpoint deserialization
Published Apr 7, 2026 · Updated Apr 7, 2026
Unsafe deserialization in Hugging Face Transformers before 5.0.0rc3 allows attackers to execute code through a malicious checkpoint. Trainer._load_rng_state passes rng_state.pth to torch.load without weights_only=True, permitting pickle-controlled objects to execute during restoration. Exploitation requires the checkpoint to be loaded with PyTorch before 2.6, where the surrounding safe_globals context does not constrain deserialization.
Summary
What happened
Unsafe deserialization in Hugging Face Transformers before 5.0.0rc3 allows attackers to execute code through a malicious checkpoint. Trainer._load_rng_state passes rng_state.pth to torch.load without weights_only=True, permitting pickle-controlled objects to execute during restoration. Exploitation requires the checkpoint to be loaded with PyTorch before 2.6, where the surrounding safe_globals context does not constrain deserialization.
The record
- CVE
- CVE-2026-1839
- Published
- Apr 7, 2026
- Updated
- Apr 7, 2026
- Vendor
- Hugging Face
- Product
- Transformers
- Classifications
- CWE-502, T1204.002, T1059.006
- Attack vector
- local
- Privileges
- unauthenticated
Timeline
How it unfolded
- Apr 7, 2026CVE publishedPublication date reported by the CVE source.
- Apr 7, 2026Record updatedLatest update available in the CVE record.
Exploitability
Present is not the same as exploitable
Compare your product and version with the public record. A matching version still requires validation against your environment.
Is a vulnerable build present?
Compare these published version ranges with your installed build and any vendor patches.
- Affected versionversion=unspecified <v5.0.0rc3
What conditions does exploitation require?
What is affected?
Attacks
What attackers are doing with it
Daily unique IPs observed by Shadowserver honeypots for known exploited vulnerabilities (KEVs). Missing observations do not establish an absence of attacks.
Weakness, pattern, technique
Public exploit references
- Huntr malicious rng_state.pth proof of conceptproof of concept · demonstrated
Labels summarize the accepted research assessment. They do not indicate a test against your environment.
Technologies
Your stack
See the directory against your own environment.
Your stack
Check the software in your environment
Book a demo to see how Hinoki identifies affected software and validates exploitability in your environment.
Book a demo