CVE-2026-31221: High severity pypi/pytorch-lightning vulnerability

Published May 12, 2026
·
Updated

PyTorch-Lightning versions 2.6.0 and earlier contain an insecure deserialization vulnerability (CWE-502) in the checkpoint loading mechanism. The LightningModule.loadfromcheckpoint() method, which is commonly used to load saved model states, internally calls torch.load() without setting the security-restrictive weightsonly=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.

Affected Software

2 affected components
pypi/pytorch-lightning<=2.6.0
Lightningai Pytorch Lightning Python<=2.6.0

Event History

May 12, 2026
CVE Published
via MITRE·12:00 AM
Data Sourced
via MITRE·12:00 AM
Description
Data Sourced
via NVD·04:16 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2026-31221?

The severity of CVE-2026-31221 is rated high with a CVSS score of 8.8.

2

What vulnerability does CVE-2026-31221 expose?

CVE-2026-31221 exposes an insecure deserialization vulnerability in the checkpoint loading mechanism of PyTorch-Lightning.

3

How do I fix CVE-2026-31221?

To fix CVE-2026-31221, upgrade PyTorch-Lightning to version 2.6.1 or later.

4

Which versions are affected by CVE-2026-31221?

CVE-2026-31221 affects PyTorch-Lightning versions 2.6.0 and earlier.

5

What components are involved in CVE-2026-31221?

CVE-2026-31221 involves the LightningModule.load_from_checkpoint() method and the torch.load() function.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203