← Vulnerability feed

Vulnerability record · CVE-2026-31221 · published 12 May 2026

CVE-2026-31221: Lightningai pytorch lightning deserialization of untrusted data vulnerability

Lightningai · Pytorch Lightning

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.

7.8 CVSS 3.1 High EPSS 0.55% · top 56.0% CWE-502 · Deserialization of untrusted data
7.8CVSS 3.1 base score
0.55%EPSS exploitation probability, 30 days
NoNot in CISA KEV
1Affected product versions listed by NVD
2References, 1 tagged exploit
17 Jun 2026Last modified by NVD

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.

CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H

Affected products

1 vulnerable configurations from NVD's CPE data, grouped by vendor and product.

References

Track CVE-2026-31221 inside VULONE

Watch it alongside the ransomware crews, C2 infrastructure and forum chatter that reference it, query it through the API and pull it into your SIEM over TAXII.

Start free Open in platform

Related vulnerabilities

Same products first, then exploited flaws of the same weakness class.

9.8CVE-2024-5980Lightningai pytorch lightning path traversal vulnerabilityA vulnerability in the /v1/runs API endpoint of lightning-ai/pytorch-lightning v2.2.4 allows attackers to exploit path traversal when extracting tar.…EPSS 1.3%9.8CVE-2024-5452Lightningai pytorch lightning mass assignment vulnerabilityA remote code execution (RCE) vulnerability exists in the lightning-ai/pytorch-lightning library version 2.2.1 due to improper handling of deserializ…EPSS 27%9.8CVE-2022-0845Lightningai pytorch lightning code injection vulnerabilityCode Injection in GitHub repository pytorchlightning/pytorch-lightning prior to 1.6.0.EPSS 0.98%9.3CVE-2026-44484Lightningai pytorch lightning inclusion from untrusted sphere vulnerabilityPyTorch Lightning is a deep learning framework to pretrain and finetune AI models. Versions 2.6.2 and 2.6.2 have introduced functionality consistent …EPSS 0.67%9.1CVE-2024-8019Lightningai pytorch lightning unrestricted file upload vulnerabilityIn lightning-ai/pytorch-lightning version 2.3.2, a vulnerability exists in the `LightningApp` when running on a Windows host. The vulnerability occur…EPSS 1.1%8.4CVE-2026-58659Lightningai pytorch lightning vulnerabilityPyTorch Lightning through 2.6.5, fixed in commit d710d68, contains a remote code execution vulnerability in the _load_state function that imports and…EPSS 0.63%7.8CVE-2021-4118Lightningai pytorch lightning deserialization of untrusted data vulnerabilitypytorch-lightning is vulnerable to Deserialization of Untrusted DataEPSS 0.98%7.5CVE-2024-8020Lightningai pytorch lightning vulnerabilityA vulnerability in lightning-ai/pytorch-lightning version 2.3.2 allows an attacker to cause a denial of service by sending an unexpected POST request…EPSS 0.63%

Source: NIST National Vulnerability Database (record CVE-2026-31221), CISA KEV, FIRST EPSS (scores of 2026-09-26). This page is refreshed as NVD updates the record.