CVE-2024-5980: PyTorch Lightning: path traversal allows arbitrary file write

GHSA-mr7h-w2qc-ffc2CRITICAL
Published June 27, 2024
CISO Take

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.

Sources:NVDEPSSGitHub AdvisoryATLASOpenSSFhuntr.com

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?

Initial Access
The attacker sends a crafted tar.gz plugin to the exposed /v1/runs endpoint of the Lightning App plugin server, with no authentication.
AML.T0049
Exploitation
The server extracts the archive without validating member paths, so entries with ../ sequences are written outside the intended directory.
AML.T0010.001
Execution
Overwritten Python modules, scripts or cron entries are executed, giving the attacker code execution on the host.
AML.T0050
Impact
The attacker steals credentials, datasets and checkpoints, or tampers with models and pipelines on the compromised ML host.
AML.T0048

What systems are affected?

PackageEcosystemVulnerable RangePatched
PyTorch Lightningpip< 2.3.32.3.3
31.4KOpenSSF 5.91.8K dependentsPushed 19d ago69% patched~681d to patchFull package profile →
PyTorch Lightningpip< 2.3.32.3.3
31.4KOpenSSF 5.91.8K dependentsPushed 19d ago69% patched~681d to patchFull package profile →

How severe is it?

CVSS 3.1
9.1 / 10
EPSS
1.3%
chance of exploitation in 30 days
Higher than 71% of all CVEs
Exploitation Status
No known exploitation
Sophistication
Trivial

What is the attack surface?

AVACPRUISCIA
AVNetwork
ACLow
PRNone
UINone
SUnchanged
CNone
IHigh
AHigh

What should I do?

1 step
  1. 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.

How is it classified?

Which compliance frameworks are affected?

This CVE is relevant to:

EU AI Act
Article 15-Accuracy, robustness and cybersecurity
ISO 42001
A.6.2.6-AI system operation and monitoring
NIST AI RMF
MANAGE 2.3-Responses to AI risks and unknown risks
OWASP LLM Top 10
LLM03-Supply Chain

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

training pipelinesML orchestration platformsmodel servingplugin serversMLOps infrastructure

MITRE ATLAS Techniques

AML.T0010.001AI Software
AML.T0049Exploit Public-Facing Application
AML.T0112.001AI Artifacts

Compliance Controls Affected

EU AI Act: Article 15
ISO 42001: A.6.2.6
NIST AI RMF: MANAGE 2.3
OWASP LLM Top 10: LLM03

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-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:H

Timeline

Published
June 27, 2024
Last Modified
November 16, 2026
First Seen
November 16, 2026

Related Vulnerabilities