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

pytorch-lightning Updated 10 Sep 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 pytorch-lightning versions < 2.6.6. Fixed in 2.6.6. 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 Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

PyTorch Lightning is a lightweight wrapper for PyTorch that helps researchers and developers to scale their models and organize their code. It provides a high-level interface for training models, managing experiments, and handling distributed training. However, versions up to 2.6.5 are vulnerable to a remote code execution issue that arises from improper handling of checkpoint files.

Vulnerability Detail

The vulnerability exists in the _load_state function of PyTorch Lightning, which allows an attacker to import and execute arbitrary code by manipulating checkpoint files. Specifically, the function imports module names from attacker-controlled hyperparameters, bypassing the weights_only=True protection. This can lead to severe consequences, including unauthorized access to system resources and execution of malicious code when the LightningModule.load_from_checkpoint method is called.

How To Fix

Latest published version: 2.6.6 as of 23 Oct 2026

pip install --upgrade "pytorch-lightning==2.6.6"

The newest release already contains this fix.

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 any checkpoint files you use are from verified and secure origins to mitigate the risk of executing malicious code.

Conclusion

The CVE-2026-58659 vulnerability in PyTorch Lightning poses a significant risk due to its potential for remote code execution. Users are strongly advised to update to version 2.6.6 or later to mitigate this risk and to exercise caution when handling checkpoint files.

See every vulnerability recorded for pytorch-lightning →

Share this vulnerability

FAQ

The vulnerability allows remote code execution through manipulated checkpoint files, which can lead to arbitrary code execution.

Versions of PyTorch Lightning up to and including 2.6.5 are affected by this vulnerability.

You can use Vulert to monitor and alert for open-source vulnerabilities in your software. Visit Vulert Scanner to check if your application is affected without any signup.

If an immediate update is not possible, avoid using checkpoint files from untrusted sources as a temporary measure.

Exploitation of this vulnerability can lead to unauthorized access, data breaches, and execution of malicious code on the affected system.

Related vulnerabilities

Recent vulnerabilities recorded for pytorch-lightning.

How To Fix

Latest published version: 2.6.6 as of 23 Oct 2026

pip install --upgrade "pytorch-lightning==2.6.6"

The newest release already contains this fix.

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