CVE-2024-5980 Arbitrary File Write via /v1/runs API endpoint in lightning-ai/pytorch-lightning

Critical 9.1 Published Updated

Attackers can write arbitrary files via path traversal in the /v1/runs API when the plugin server is active, potentially leading to remote code execution.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2024-5980?

CVE-2024-5980 is a critical path traversal vulnerability in lightning-ai/pytorch-lightning, published on 27 Jun 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

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.

Weakness: CWE-22

Which versions are affected by CVE-2024-5980?

4 open source packages ship an affected version, including lightning and pytorch-lightning. It affects 1 product.

PackageAffectedFixed in
lightning PyPIAll versions2.3.3
lightning PyPIAll versions2.3.3
lightning PyPIAll versions2.3.3
pytorch-lightning PyPIAll versions2.3.3

Products include Lightningai Pytorch Lightning.

How do I fix CVE-2024-5980?

Upgrade lightning to 2.3.3 or later.

Upgrade, and resolve every user-supplied path against an allowed base folder before opening it. More about Path traversal.

Is CVE-2024-5980 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-5980 exists.

Sources

Also known as GHSA-mr7h-w2qc-ffc2, PYSEC-2026-386, PYSEC-2026-3975.

Is CVE-2024-5980 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free