CVE-2026-58659: PyTorch Lightning Remote Code Execution Vulnerability
Summary
CVE-2026-58659: 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 _instantiato... Affects lightning versions < 2022.6.15. Fixed in 2022.6.15. How to fix ↓
Also tracked for
- pytorch-lightning · PyPI
The same CVE-2026-58659 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
PyTorch Lightning is a lightweight wrapper around PyTorch that helps researchers and developers streamline their deep learning workflows. It provides features such as automatic logging, checkpointing, and distributed training, making it easier to build and scale machine learning models. However, versions up to 2.6.5 have a critical vulnerability that allows remote code execution through malicious checkpoint files.
Vulnerability Detail
The vulnerability arises from the _load_state function in PyTorch Lightning, which imports and executes module names controlled by an attacker from checkpoint _instantiator hyperparameters. This flaw allows attackers to craft malicious checkpoint files that can bypass the weights_only=True protections, leading to the execution of arbitrary code when the LightningModule.load_from_checkpoint method is invoked. This poses significant risks, as it can lead to unauthorized access and control over the system running the affected application.
How To Fix
Latest published version: 2.6.6 as of 22 Oct 2026
pip install --upgrade "lightning==2.6.6"
Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.
If you need the minimum change
2022.6.15
This is the first release that contains the fix.
pip install --upgrade "lightning==2022.6.15"
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
As a temporary workaround, avoid loading checkpoint files from untrusted sources. Ensure that the checkpoint files you use are from verified and secure origins to mitigate the risk of executing malicious code.
Conclusion
In summary, CVE-2026-58659 is a critical remote code execution vulnerability in PyTorch Lightning that can be exploited through malicious checkpoint files. It is essential to update to the latest version to mitigate risks and ensure the security of your applications.
See every vulnerability recorded for lightning →
FAQ
CVE-2026-58659 is a vulnerability in PyTorch Lightning that allows remote code execution through malicious checkpoint files.
You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability without requiring any signup.
Versions of PyTorch Lightning up to and including 2.6.5 are affected by this vulnerability.
If you cannot update the package, avoid loading checkpoint files from untrusted sources as a temporary workaround.
The potential consequences include unauthorized access to the system, execution of arbitrary code, and compromise of sensitive data.
References
Related vulnerabilities
Recent vulnerabilities recorded for lightning.