Unsafe Deserialization in HuggingFace Transformers library
Summary
Vulnerability in HuggingFace Transformers library (CVE-2026-1839). Confidential information can be exposed externally. Exploitable via Trainer.
AI summary
Produced by SecPulse using an external AI model; it may contain mistakes. Check the original description and references below before acting on it.
A vulnerability tracked as CVE-2026-1839 has been found in HuggingFace Transformers library.
Attackers can target a specific entry point like Trainer over the network to misuse the product.
Confidential information can be exposed externally.
What to do: apply the vendor's official patched release.
If unsure, ask your IT team or search "HuggingFace Transformers library CVE-2026-1839" on the vendor's site.
CVE-2026-1839 (HuggingFace Transformers library) — CWE-502
Attack vector: local / unauthenticated
Attack surface: Trainer / rng_state.pth
Plan: 1) Audit SBOM/dependencies, 2) Stage→prod upgrade, 3) Add WAF/proxy monitoring on affected endpoints, 4) Hunt IOCs in logs.
Refs: see the GHSA / vendor advisory / patched release linked on this page.
Unsafe deserialization (CWE-502) exists in HuggingFace Transformers library. Attackers reach the vulnerable code path via Trainer without authentication.
Check the vendor advisory for the affected versions of HuggingFace Transformers library. Attack surface: Trainer / rng_state.pth.
Severity: ?. Confidential information can be exposed externally.
Update to the patched release per vendor advisory.
Until the patch is applied: disable the affected feature, apply WAF rules, or restrict access via network ACLs.
Search webserver/proxy logs for unusual request patterns matching this CVE's known IOCs. Audit SBOM/dependencies to find affected services.
Response actions
Concrete steps and command examples for SOC/SRE teams to execute in order
-
1
Identify exposureidentify
Audit SBOM/dependencies for affected components.資産台帳・SBOM・依存マニフェストで HuggingFace Transformers library を使っているサービスとバージョンを洗い出す。
-
2
Post-deployment verificationverify
Confirm patched version is live in productionパッチ適用後、ステージングで PoC または同等の悪用パターンを再現して脆弱性が閉じたことを確認。本番ではアクセスログ・WAF でアラート再発が無いか継続監視。
Original description The description as published by the source.
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: OSV.dev (Open Source Vulnerabilities) NVD GitHub Advisory OSV
References
- advisory github.com
- advisory nvd.nist.gov
- exploit huntr.com
- patch security@huntr.dev