CVE-2024-5980: PyTorch Lightning: path traversal allows arbitrary file write
GHSA-mr7h-w2qc-ffc2CRITICALCVE-2024-5980 is a path traversal flaw in the plugin server's /v1/runs endpoint of PyTorch Lightning (and the lightning package). It extracts uploaded tar.gz plugins without validating member paths, so an unauthenticated remote attacker can write files anywhere on the host and potentially reach remote code execution. The CVSS is 9.1 (critical) and there are roughly 1,770 downstream dependents, but the practical risk is narrower than the score suggests. The EPSS percentile is only around the top 29% (score 0.013), there is no public exploit, no Nuclei template, and it is not in CISA KEV. Only deployments that run a LightningApp with the plugin_server exposed are affected, so inventory those first. Upgrade pytorch-lightning and lightning to 2.3.3 or later, and until then keep the plugin server off untrusted networks.
What is the risk?
Risk is high for the narrow set of deployments that expose a LightningApp plugin_server, and low for typical training-only use of the library. The attack needs no authentication or user interaction and has low complexity (network vector, privileges none). Impact is high for integrity and availability, with arbitrary file write that can lead to code execution. Exploitation likelihood today is modest: EPSS 0.013 (top 29%), no public exploit or scanner template, and no KEV listing. The package has an OpenSSF Scorecard of 5.9/10 and 8 other CVEs, which indicates moderate security hygiene. Note that the NVD description cites v2.2.4, while the advisories list all versions before 2.3.3 as affected.
How does the attack unfold?
What systems are affected?
| Package | Ecosystem | Vulnerable Range | Patched |
|---|---|---|---|
| PyTorch Lightning | pip | < 2.3.3 | 2.3.3 |
| PyTorch Lightning | pip | < 2.3.3 | 2.3.3 |
How severe is it?
What is the attack surface?
What should I do?
1 step1) Upgrade pytorch-lightning and lightning to 2.3.3 or later (fix in PR #20039). 2) Identify deployments that use LightningApp with plugin_server (grep for plugin_server and /v1/runs usage) and inventory pip installs of both packages in images, notebooks and CI. 3) Until patched, do not expose the plugin server to untrusted networks: bind it to localhost or a private segment and put it behind authenticated network controls. 4) Run the service as a non-root user in a container with a read-only root filesystem and only the required writable mounts. 5) Detect: monitor requests to /v1/runs with tar.gz uploads, archives containing '../' or absolute path members, and unexpected file writes outside the plugin directory or new files in startup, cron or SSH locations. 6) Rotate credentials on any host where suspicious plugin uploads were observed.
How is it classified?
Which compliance frameworks are affected?
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2024-5980?
CVE-2024-5980 is a path traversal flaw in the plugin server's /v1/runs endpoint of PyTorch Lightning (and the lightning package). It extracts uploaded tar.gz plugins without validating member paths, so an unauthenticated remote attacker can write files anywhere on the host and potentially reach remote code execution. The CVSS is 9.1 (critical) and there are roughly 1,770 downstream dependents, but the practical risk is narrower than the score suggests. The EPSS percentile is only around the top 29% (score 0.013), there is no public exploit, no Nuclei template, and it is not in CISA KEV. Only deployments that run a LightningApp with the plugin_server exposed are affected, so inventory those first. Upgrade pytorch-lightning and lightning to 2.3.3 or later, and until then keep the plugin server off untrusted networks.
Is CVE-2024-5980 actively exploited?
No confirmed active exploitation of CVE-2024-5980 has been reported, but organizations should still patch proactively.
How to fix CVE-2024-5980?
1) Upgrade pytorch-lightning and lightning to 2.3.3 or later (fix in PR #20039). 2) Identify deployments that use LightningApp with plugin_server (grep for plugin_server and /v1/runs usage) and inventory pip installs of both packages in images, notebooks and CI. 3) Until patched, do not expose the plugin server to untrusted networks: bind it to localhost or a private segment and put it behind authenticated network controls. 4) Run the service as a non-root user in a container with a read-only root filesystem and only the required writable mounts. 5) Detect: monitor requests to /v1/runs with tar.gz uploads, archives containing '../' or absolute path members, and unexpected file writes outside the plugin directory or new files in startup, cron or SSH locations. 6) Rotate credentials on any host where suspicious plugin uploads were observed.
What systems are affected by CVE-2024-5980?
This vulnerability affects the following AI/ML architecture patterns: training pipelines, ML orchestration platforms, model serving, plugin servers, MLOps infrastructure.
What is the CVSS score for CVE-2024-5980?
CVE-2024-5980 has a CVSS v3.1 base score of 9.1 (CRITICAL). The EPSS exploitation probability is 1.32%.
What is the AI security impact?
Affected AI Architectures
MITRE ATLAS Techniques
AML.T0010.001AI SoftwareAML.T0049Exploit Public-Facing ApplicationAML.T0112.001AI ArtifactsCompliance Controls Affected
What are the technical details?
Original Advisory
A vulnerability in the /v1/runs API endpoint of lightning-ai/pytorch-lightning v2.2.4 allows attackers to exploit path traversal when extracting tar.gz files. When the LightningApp is running with the plugin_server, attackers can deploy malicious tar.gz plugins that embed arbitrary files with path traversal vulnerabilities. This can result in arbitrary files being written to any directory in the victim's local file system, potentially leading to remote code execution.
Exploitation Scenario
An attacker finds an internet-reachable or internally reachable Lightning App with the plugin_server running. They craft a malicious tar.gz plugin whose members use ../ sequences to target locations such as a Python site-packages module, a cron directory or ~/.ssh/authorized_keys, and POST it to /v1/runs. The server extracts the archive without sanitizing paths and writes the files outside the intended directory. The attacker then gets code execution when the overwritten module is imported or the cron job fires, and uses the foothold to steal cloud credentials, datasets and model checkpoints, or to tamper with models in the training pipeline.
Weaknesses (CWE)
CWE-22Improper Limitation of a Pathname to a Restricted DirectoryPrimaryCWE-434Unrestricted Upload of File with Dangerous TypePrimaryCWE-22 — Improper Limitation of a Pathname to a Restricted Directory: The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.
- [Implementation] Assume all input is malicious. Use an "accept known good" input validation strategy, i.e., use a list of acceptable inputs that strictly conform to specifications. Reject any input that does not strictly conform to specifications, or transform it into something that does. When performing input validation, consider all potentially relevant properties, including length, type of input, the full range of acceptable values, missing or extra inputs, syntax, consistency across related fields, and conformance to business rules. As an example of business rule logic, "boat" may be syntactically valid because it only contains alphanumeric characters, but it is not valid if the input is only expected to contain colors such as "red" or "blue." Do not rely exclusively on looking for malicious or malformed inputs. This is likely to miss at least one undesirable input, especially if the code's environment changes. This can give attackers enough room to bypass the intended validation. However, denylis
- [Architecture and Design] For any security checks that are performed on the client side, ensure that these checks are duplicated on the server side, in order to avoid CWE-602. Attackers can bypass the client-side checks by modifying values after the checks have been performed, or by changing the client to remove the client-side checks entirely. Then, these modified values would be submitted to the server.
Source: MITRE CWE corpus.
CVSS Vector
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:HReferences
- github.com/Lightning-AI/pytorch-lightning/pull/20039
- github.com/Lightning-AI/pytorch-lightning/releases/tag/2.3.3
- github.com/advisories/GHSA-mr7h-w2qc-ffc2
- github.com/lightning-ai/pytorch-lightning/commit/330af381de88cff17515418a341cbc1f9f127f9a
- github.com/pypa/advisory-database/tree/main/vulns/lightning/PYSEC-2026-386.yaml
- github.com/pypa/advisory-database/tree/main/vulns/pytorch-lightning/PYSEC-2026-3975.yaml
- huntr.com/bounties/55a6ac6f-89c7-42ea-86f3-c6e93a2679f3
- nvd.nist.gov/vuln/detail/CVE-2024-5980
- pypi.org/project/lightning
Timeline
Related Vulnerabilities
CVE-2024-54529.8pytorch-lightning: RCE via deepdiff Delta deserialization
Same package: pytorch-lightningCVE-2022-08459.8pytorch-lightning: code injection enables full RCE
Same package: pytorch-lightningCVE-2024-80199.1pytorch-lightning: file upload RCE (Windows)
Same package: pytorch-lightningCVE-2026-247478.8pytorch: Code Injection enables RCE
Same package: pytorch-lightningCVE-2026-312217.8pytorch-lightning: RCE via insecure checkpoint deserialization
Same package: pytorch-lightning