Browse / Unsafe Model Loading and Supply Chain / CVE-2026-58659
PyTorch Lightning allows arbitrary code execution through checkpoint _instantiator hyperparameters
- Class
- Unsafe Model Loading and Supply Chain (filed by a model that read the advisory)
- Technique
- Unsafe deserialisation
- Affected
- lightning (PyPI)
- Gets past
- Safe model loader or scanner
- CVSS
- CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
- EPSS
- 0.6% chance of exploitation in 30 days
How it works, in short
A crafted checkpoint supplies a module name in hyperparameters that is imported during loading, bypassing the weights_only protection. (Our summary, written by a model. The source text is below.)
Details
PyTorch Lightning through 2.6.5, fixed in commit d710d68, contains a remote code execution vulnerability in the _load_state function that imports and executes attacker-controlled module names from checkpoint _instantiator hyperparameters. Attackers can craft malicious checkpoint files that bypass weights_only=True protections to execute arbitrary code when LightningModule.load_from_checkpoint is called.
References
- https://nvd.nist.gov/vuln/detail/CVE-2026-58659
- https://github.com/Lightning-AI/pytorch-lightning/issues/21822
- https://github.com/Lightning-AI/pytorch-lightning/pull/21832
- https://github.com/Lightning-AI/pytorch-lightning/commit/d710d689510d50e800f53b3cd773cbca20b1f86f
- https://github.com/Lightning-AI/pytorch-lightning
- https://github.com/Lightning-AI/pytorch-lightning/releases/tag/2.6.6
- https://github.com/advisories/GHSA-qqmf-gpg7-g8gw
- https://github.com/pypa/advisory-database/tree/main/vulns/lightning/PYSEC-2026-3624.yaml
- https://github.com/pypa/advisory-database/tree/main/vulns/pytorch-lightning/PYSEC-2026-3967.yaml
- https://www.vulncheck.com/advisories/pytorch-lightning-arbitrary-code-execution-via-instantiator-hyperparameter
Source: GitHub Advisory Database, used under CC BY 4.0.