CVE-2026-31221
pytorch-lightning: PyTorch-Lightning: Arbitrary code execution via insecure deserialization of checkpoint files
Overview
Description
PyTorch-Lightning versions 2.6.0 and earlier contain an insecure deserialization vulnerability (CWE-502) in the checkpoint loading mechanism. The LightningModule.load_from_checkpoint() method, which is commonly used to load saved model states, internally calls torch.load() without setting the security-restrictive weights_only=True parameter. This default behavior allows the deserialization of arbitrary Python objects via the Pickle module. A remote attacker can exploit this by providing a maliciously crafted checkpoint file, leading to arbitrary code execution on the victim's system when the file is loaded.
Source: OX vulnerability database
Severity
7.8 · HIGH
CVSS 3.1 base score, scored by NVD.
- Attack vector
- Local
- Attack complexity
- Low
- Privileges required
- None
- User interaction
- Required
- Scope
- Unchanged
- Confidentiality
- High
- Integrity
- High
- Availability
- High
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Weakness: CWE-502
Affected packages · 1
| Ecosystem | Package | Vulnerable | Fixed in |
|---|---|---|---|
| PyPI | pytorch-lightning | <=2.6.0 | No fix yet |
Open a package to see all its vulnerabilities.
Operating systems
No Linux distribution reports this ID.
References
- access.redhat.com https://access.redhat.com/security/cve/CVE-2026-31221
- github.com https://github.com/Lightning-AI/pytorch-lightning
- nvd.nist.gov https://nvd.nist.gov/vuln/detail/CVE-2026-31221
- www.cve.org https://www.cve.org/CVERecord?id=CVE-2026-31221
- www.notion.so https://www.notion.so/CVE-2026-31221-35d1e1393188815f8db7c4fd08076639
OX Radar and Response Center
Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.