CVE-2026-58659: Lightning PyTorch Lightning Allows Arbitrary Code Vulnerability
HIGHCVE-2026-58659 is a HIGH (CVSS 7.8) pytorch lightning allows arbitrary code vulnerability (CWE-470: Use of Externally-Controlled Input to Select Classes or Code ('Unsafe Reflection')) affecting Lightning libraries in the PyPI ecosystem. The issue involves pytorch lightning allows arbitrary code execution through checkpoint _instantiator hyperparameters. Remediation is available by upgrading affected packages to version 2.6.6.
CVE-2026-58659 at a Glance
Security Impact
CVSS: 7.8
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H).
How to Fix CVE-2026-58659
To remediate this vulnerability, upgrade all affected Lightning dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install lightning>=2.6.6
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show lightning
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2026-58659, inspect your installed packages using pip:
pip show lightning
Analyze the terminal output to locate any version of Lightning in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.6.6), your application is affected.
Note: The pip show lightning command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-470: Use of Externally-Controlled Input to Select Classes or Code ('Unsafe Reflection'), where the product uses external input with reflection to select which classes or code to use, but it does not sufficiently prevent the input from selecting improper classes or code. In Lightning, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-58659 Affected Lightning Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
lightning
|
PyPI |
< 2.6.6
|
2.6.6
|
References
Frequently Asked Questions
What is CVE-2026-58659?
Which Lightning versions are affected?
What version fixes CVE-2026-58659?
Is lightning affected?
What is the CVSS score of CVE-2026-58659?
What CWE is associated with CVE-2026-58659?
How can I check PyPI dependencies for CVE-2026-58659?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-qqmf-gpg7-g8gw",
"modified" : "2026-09-24T15:39:46Z",
"published" : "2026-07-15T18:31:58Z",
"aliases" : [ "CVE-2026-58659" ],
"summary" : " PyTorch Lightning allows arbitrary code execution through checkpoint _instantiator hyperparameters",
"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.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "lightning"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.6.6"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-58659"
}, {
"type" : "WEB",
"url" : "https://github.com/Lightning-AI/pytorch-lightning/issues/21822"
}, {
"type" : "WEB",
"url" : "https://github.com/Lightning-AI/pytorch-lightning/pull/21832"
}, {
"type" : "WEB",
"url" : "https://github.com/Lightning-AI/pytorch-lightning/commit/d710d689510d50e800f53b3cd773cbca20b1f86f"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/Lightning-AI/pytorch-lightning"
}, {
"type" : "WEB",
"url" : "https://github.com/Lightning-AI/pytorch-lightning/releases/tag/2.6.6"
}, {
"type" : "ADVISORY",
"url" : "https://github.com/advisories/GHSA-qqmf-gpg7-g8gw"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/advisory-database/tree/main/vulns/lightning/PYSEC-2026-3624.yaml"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/advisory-database/tree/main/vulns/pytorch-lightning/PYSEC-2026-3967.yaml"
}, {
"type" : "WEB",
"url" : "https://www.vulncheck.com/advisories/pytorch-lightning-arbitrary-code-execution-via-instantiator-hyperparameter"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-470" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-09-03T19:51:19Z",
"nvd_published_at" : "2026-07-15T18:16:48Z"
}
}