CVE-2026-58659: PyTorch Lightning Remote Code Execution Vulnerability

lightning Updated 07 Aug 2026

Summary

15/07/2026
Yes i
Unrated
Not published

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

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.

Free scan

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.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

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 →

Share this vulnerability

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.

Related vulnerabilities

Recent vulnerabilities recorded for lightning.

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 →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback