Skip to main content

PyTorch Lightning CVE-2026-58659

| EUVDEUVD-2026-44751 HIGH
Use of Externally-Controlled Input to Select Classes or Code ('Unsafe Reflection') (CWE-470)
2026-07-15 VulnCheck GHSA-qqmf-gpg7-g8gw
8.4
CVSS 4.0 · Vendor: VulnCheck
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Craft malicious .ckpt with _instantiator=os.system
  2. Delivery
    Distribute checkpoint via model hub or shared storage
  3. Exploit
    Victim calls load_from_checkpoint
  4. Execution
    _load_state imports attacker module path
  5. Impact
    Arbitrary code executes with victim privileges

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V15 - Secure Coding and Architecture Reflection safety, class allowlisting
Exploitation Conditions

Exploitation requires that a victim load an attacker-supplied checkpoint via LightningModule.load_from_checkpoint (the underlying _load_state path); specifically the malicious .ckpt must set hyper_parameters['_instantiator'] to an arbitrary importable path (the POC/test uses 'os.system'), which unpatched Lightning imports and executes. Critically, torch weights_only=True does NOT prevent it, because execution occurs in Lightning's own instantiator-resolution logic rather than in pickle. Limiting factors: the vector is local (AV:L) and requires active user interaction (UI:A) - the attacker cannot trigger it remotely and must convince the victim to obtain and load the crafted checkpoint; no authentication or special privileges are needed to craft the file (PR:N), and it works against default configurations of affected versions with no non-default feature required. Deployments that only ever load self-produced, trusted checkpoints are effectively not exposed.

Impact

The vendor CVSS 4.0 vector (AV:L/AC:L/AT:N/PR:N/UI:A/VC:H/VI:H/VA:H, base 8.4) correctly frames this as a local, low-complexity, unauthenticated flaw whose exploitation hinges on active user interaction - the victim must load an attacker-supplied checkpoint. No EPSS/exploitation-probability figure is supplied and there is no CISA KEV listing, so there is no evidence of active in-the-wild exploitation; however, publicly available exploit code exists and the patch's own test case (using os.system as the instantiator) shows exploitation is trivial once a malicious file is loaded. The realistic risk is high in ML supply-chain contexts where practitioners routinely download pretrained checkpoints from model hubs or shared storage and load them without provenance checks - a common habit this flaw weaponizes. It is not remotely exploitable against a service (AV:L, UI:A), so it is not a wormable or mass-exploitation network threat; it is a targeted social-engineering / supply-chain vector. The signals are consistent (local vector, high technical impact, POC available) with no conflicts, though the absence of an EPSS score means widespread automated-exploitation likelihood cannot be quantified from the input.

Exploit ScenarioDerived

An attacker publishes an attractive pretrained model checkpoint (e.g., on a model-sharing hub or shared drive) whose hyper_parameters include _instantiator set to a dangerous import path such as os.system. When a data scientist runs LightningModule.load_from_checkpoint on the file - even with weights_only=True - Lightning imports and executes that path, running arbitrary code with the victim's privileges. A public POC demonstrating this via the _instantiator field exists.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
Patch available 0.2% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Jul 15, 2026

Remote code execution in PyTorch Lightning through 2.6.5 allows an attacker who can get a victim to load a malicious checkpoint file to execute arbitrary code. The flaw lives in the _load_state routine, which imports and calls the module path named in a checkpoint's _instantiator hyperparameter, letting a crafted .ckpt bypass torch's weights_only=True safeguard when LightningModule.load_from_checkpoint is invoked. Reported by VulnCheck, it is fixed in commit d710d68 (PR #21832) via an instantiator allowlist, and publicly available exploit code exists though it is not listed in CISA KEV.

RemediationAI

Upgrade to a PyTorch Lightning build containing fix commit d710d689510d50e800f53b3cd773cbca20b1f86f (PR #21832), which restricts the checkpoint _instantiator hyperparameter to an allowlist (_ALLOWED_INSTANTIATORS = lightning.pytorch.cli.instantiate_module and pytorch_lightning.cli.instantiate_module) and raises a ValueError on any other path; the upstream fix is confirmed, but a specific tagged/PyPI release version is not stated in the provided data, so verify the fixed version against the vendor advisory (https://www.vulncheck.com/advisories/pytorch-lightning-arbitrary-code-execution-via-instantiator-hyperparameter) before pinning. Until patched, only load checkpoints from trusted, provenance-verified sources and never load third-party or user-uploaded .ckpt files, since weights_only=True does NOT mitigate this bug; as a compensating control, inspect a checkpoint's hyper_parameters['_instantiator'] value before loading and reject anything that is not an lightning.pytorch.cli / pytorch_lightning.cli instantiate_module path, or run load_from_checkpoint inside a sandboxed, network-isolated, least-privilege process so any code execution is contained. The trade-off of restricting to trusted checkpoints is operational friction in workflows that consume community models, and manual _instantiator inspection is error-prone compared with upgrading.

Affected VersionsENISA

pytorch-lightning 0 ≤2.6.5

Affected Packages

pypi lightning fix: 2.6.6
pypi pytorch-lightning fix: 2.6.6

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 2 packages in pypi

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

PyTorch Lightning is a widely used high-level training framework layered on top of PyTorch. Checkpoints are Python objects serialized with torch.save; recent PyTorch versions added weights_only=True to torch.load to block the classic pickle-based code-execution path during deserialization. This vulnerability is a distinct, application-level bypass: Lightning stores an _instantiator hyperparameter (an import path string) inside the checkpoint's hyper_parameters, and _load_state in src/lightning/pytorch/core/saving.py dynamically imports and invokes whatever module path that string names. This is a textbook CWE-470 (Use of Externally-Controlled Input to Select Classes or Code / unsafe reflection) issue - trusted control flow is driven by attacker-controlled data, so weights_only=True offers no protection because the dangerous import happens in Lightning's own logic after load, not inside pickle. The affected package is cpe:2.3:a:lightning-ai:pytorch-lightning.

Know when Pytorch Lightning gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (VulnCheck) PRIMARY 8.4 HIGH
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
vuln.today AI 7.8 HIGH

Local because a checkpoint file must be loaded (AV:L) with required victim interaction (UI:R); crafting the file needs no attacker privileges (PR:N), and code execution yields full C/I/A impact.

3.1 AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
4.0 AV:L/AC:L/AT:N/PR:N/UI:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
Red Hat 7.8 HIGH

Primary rating from Vendor (VulnCheck).

CVSS VectorVendor: VulnCheck

Attack Vector
Local
Attack Complexity
Low
Attack Requirements
None
Privileges Required
None
User Interaction
Active
Vulnerable system: Confidentiality
High
Vulnerable system: Integrity
High
Vulnerable system: Availability
High
Subsequent system: Confidentiality
None
Subsequent system: Integrity
None
Subsequent system: Availability
None

DescriptionCVE.org

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.

Blast Radius

ecosystem impact
† from your stack dependencies † transitive graph · vuln.today resolves 4-path depth
  • 985 pypi packages depend on lightning (594 direct, 402 indirect)
  • 1,744 pypi packages depend on pytorch-lightning (669 direct, 1,150 indirect)

Ecosystem-wide dependent count for version 2.6.6 and other introduced versions.

Executive ViewAI

Why It Matters

A vulnerability in PyTorch Lightning through version 2.6.5 allows attackers to execute arbitrary code on systems when users load malicious machine learning model files, threatening AI/ML infrastructure and intellectual property. Organizations using PyTorch Lightning-particularly those training models with external data or consuming open-source models-face potential system compromise and data theft. Publicly available exploit code exists, making practical attacks likely without immediate remediation.

Business Impact: High
Compensating Controls

Apply vendor patch.

Threat Intelligence Overview

EPSS Score
0.2%
Top 86% exploitable
Prevalence
High
very popular ML training framework across research and production pipelines
Threat Intel
2
1 sources
Exploit
POC
Public exploit code exists
Data Quality
9 sources
Confidence: High
EUVD NVD CVE.org EPSS Vulnrichment GHSA MAL Vendor CIRCL GitHub VulDB

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity HIGH
CISA KEV No
Public POC Yes
EPSS 0.2%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision
Scheduled
Exploitation
Poc
System Exposure· derived
Small
Automatable
No
Human Impact
High
Technical Impact
Total

Priority Score

62
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +42
PoC: +20
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Remote Code Execution represents the critical moment when an attacker successfully runs arbitrary code on a target system without physical access.

Vendor StatusVendor

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy