PyTorch Lightning load_from_checkpoint has an insecure checkpoint deserialization
CVE-2026-31221 · GHSA-75m9-98v2-hjpm · published 2026-05-12 · updated 2026-05-18
- Severity
- High
- CVSS score
- 7.8
- Chance of exploitation (EPSS)
- 0.39%
- Fixed in
- No fix yet
- Exploitation No known exploitation
- Automatable No
- Technical impact Total
- CISA SSVC
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.
No fixed release is listed yet for pytorch-lightning. Follow the source advisory for updates, and until one ships:
General guidance from ShieldPi, not a vendor fix
- Unsafe deserialization. Do not let it load files, models or data from sources you do not trust, and keep its RPC and socket ports reachable only from localhost or hosts you trust.
| Package | Registry | Affected | Fixed in |
|---|---|---|---|
| pytorch-lightning | PyPI | <= 2.6.0 | No fix yet |
- CriticalLMDeploy has Remote Code Execution by Pickle Deserialization via handle_zmq_recv in lmdeploy/lmdeploy/pytorch/disagg/conn/engine_conn.pylmdeploy
- CriticalLMdeploy has Remote Code Execution by Pickle Deserialization via zmq_rpc.call_and_response() in InterLM/lmdeploylmdeploy
- CriticalSGLang: Unauthenticated RCE via --enable-custom-logit-processorsglang
- CriticalSGLanG: Multimodal scheduler deserializes untrusted pickle data on 0.0.0.0 ROUTER socketsglang
- Criticaln8n: HTTP Request Node Pagination Prototype Pollution to RCEn8n, n8n, n8n
- Criticaln8n Has an XML Node Prototype Pollution Patch Bypassn8n, n8n, n8n
- CriticalCompromise of PyTorch Lightning PyPi Package Versionspytorch-lightning, pytorch-lightning
- CriticalPyTorch Lightning path traversal vulnerabilitylightning, pytorch-lightning
- Criticalpytorch-lightning vulnerable to Arbitrary File Write via /v1/runs API endpointlightning, pytorch-lightning
- CriticalRemote code execution in pytorch lightninglightning, pytorch-lightning
- CriticalCode Injection in PyTorch Lightningpytorch-lightning
- HighPyTorch Lightning denial of service vulnerabilitypytorch-lightning
The impact, patch and workaround text comes from the advisory, shortened (GitHub Advisory Database, CC BY 4.0). Proof-of-concept and reproduction sections and code are left out; the original advisory has them.