CVE-2022-0845: pytorch-lightning: code injection enables full RCE
GHSA-r5qj-cvf9-p85h CRITICAL PoC AVAILABLEAny ML training pipeline running pytorch-lightning below 1.6.0 is exposed to unauthenticated remote code execution — no privileges, no user interaction required. Upgrade to 1.6.0+ immediately; treat any training host that ran the vulnerable version as potentially compromised and rotate credentials. This is especially urgent for teams that expose Jupyter notebooks, training APIs, or Lightning-based serving endpoints to internal networks.
Risk Assessment
Despite CVSS 9.8, EPSS sits at 0.27%, indicating limited observed exploitation in the wild as of enrichment date. However, the attack profile (network-accessible, zero complexity, zero privileges) makes any exposed training infrastructure a high-priority target. ML environments are notoriously under-patched and often run with elevated cloud credentials attached, dramatically amplifying blast radius beyond the compromised host.
Affected Systems
| Package | Ecosystem | Vulnerable Range | Patched |
|---|---|---|---|
| pytorch-lightning | pip | < 1.6.0 | 1.6.0 |
| pytorch_lightning | pip | — | No patch |
Severity & Risk
Attack Surface
Recommended Action
6 steps-
Patch
Upgrade pytorch-lightning to >= 1.6.0 immediately. Pin the version in requirements.txt and lock files.
-
Audit exposure
Identify any pytorch-lightning processes or APIs reachable over the network — training orchestrators, REST wrappers, Jupyter kernels with Lightning installed.
-
Assume breach if unpatched
Rotate all credentials (cloud IAM, API keys, database passwords) accessible from affected training hosts.
-
Network controls
Training infrastructure should not be directly internet-accessible; enforce egress filtering and segment training environments from production.
-
Detection
Review logs for unexpected subprocess spawns, outbound connections, or new user accounts created from training processes.
-
Dependency scanning
Integrate pip-audit or Safety into CI/CD to catch vulnerable ML library versions before deployment.
Classification
Compliance Impact
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2022-0845?
Any ML training pipeline running pytorch-lightning below 1.6.0 is exposed to unauthenticated remote code execution — no privileges, no user interaction required. Upgrade to 1.6.0+ immediately; treat any training host that ran the vulnerable version as potentially compromised and rotate credentials. This is especially urgent for teams that expose Jupyter notebooks, training APIs, or Lightning-based serving endpoints to internal networks.
Is CVE-2022-0845 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2022-0845, increasing the risk of exploitation.
How to fix CVE-2022-0845?
1. **Patch**: Upgrade pytorch-lightning to >= 1.6.0 immediately. Pin the version in requirements.txt and lock files. 2. **Audit exposure**: Identify any pytorch-lightning processes or APIs reachable over the network — training orchestrators, REST wrappers, Jupyter kernels with Lightning installed. 3. **Assume breach if unpatched**: Rotate all credentials (cloud IAM, API keys, database passwords) accessible from affected training hosts. 4. **Network controls**: Training infrastructure should not be directly internet-accessible; enforce egress filtering and segment training environments from production. 5. **Detection**: Review logs for unexpected subprocess spawns, outbound connections, or new user accounts created from training processes. 6. **Dependency scanning**: Integrate pip-audit or Safety into CI/CD to catch vulnerable ML library versions before deployment.
What systems are affected by CVE-2022-0845?
This vulnerability affects the following AI/ML architecture patterns: training pipelines, MLOps pipelines, model serving, experiment tracking integrations.
What is the CVSS score for CVE-2022-0845?
CVE-2022-0845 has a CVSS v3.1 base score of 9.8 (CRITICAL). The EPSS exploitation probability is 0.27%.
Technical Details
NVD Description
Code Injection in GitHub repository pytorchlightning/pytorch-lightning prior to 1.6.0.
Exploitation Scenario
An adversary identifies an organization's ML training API or exposed Jupyter notebook running pytorch-lightning < 1.6.0. By crafting a malicious payload — for example, embedding injected Python code in a model checkpoint path or trainer configuration parameter — the attacker triggers code execution within the Lightning training process. Since training environments typically run with broad IAM permissions to access S3 buckets, GPU clusters, or secrets managers, the attacker immediately pivots to exfiltrate model weights, training data, and cloud credentials. In a distributed training scenario, lateral movement to other training nodes is trivial. The entire ML supply chain — from data to model — is compromised without any phishing or social engineering.
Weaknesses (CWE)
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H References
- github.com/PyTorchLightning/pytorch-lightning/pull/12212
- github.com/advisories/GHSA-r5qj-cvf9-p85h
- github.com/pypa/advisory-database/tree/main/vulns/pytorch-lightning/PYSEC-2022-181.yaml
- nvd.nist.gov/vuln/detail/CVE-2022-0845
- github.com/pytorchlightning/pytorch-lightning/commit/8b7a12c52e52a06408e9231647839ddb4665e8ae Patch 3rd Party
- huntr.dev/bounties/a795bf93-c91e-4c79-aae8-f7d8bda92e2a Exploit Issue Patch 3rd Party
Timeline
Related Vulnerabilities
CVE-2024-5452 9.8 pytorch-lightning: RCE via deepdiff Delta deserialization
Same package: torch CVE-2024-35198 9.8 TorchServe: URL bypass enables arbitrary model loading
Same package: torch CVE-2023-43654 9.8 TorchServe: SSRF + RCE via unrestricted model URL loading
Same package: torch CVE-2022-45907 9.8 PyTorch: RCE via unsafe eval in JIT annotations
Same package: torch CVE-2024-48063 9.8 PyTorch: RCE via RemoteModule deserialization
Same package: torch
AI Threat Alert