CVE-2024-8019: pytorch-lightning: file upload RCE (Windows)

GHSA-4cv3-v7pv-rfhf CRITICAL CISA: TRACK*
Published March 20, 2025
CISO Take

Any Windows-hosted ML environment running pytorch-lightning's LightningApp exposes an unauthenticated file upload endpoint that allows arbitrary file writes — including overwriting Python scripts executed by the training pipeline. Upgrade to pytorch-lightning 2.4.0 immediately; if patching is delayed, block external access to the /api/v1/upload_file/ endpoint at the network perimeter. No authentication is required, making this trivially exploitable by any network-adjacent attacker.

What is the risk?

CVSS 9.1 with no authentication, no user interaction, and network-accessible attack vector makes this severe for any team exposing LightningApp on Windows hosts. EPSS of ~1.1% indicates no confirmed active exploitation at time of publication, but the low attack complexity means weaponization is trivial. ML development environments frequently lack lateral movement controls, so a foothold here can cascade to model artifact stores, training data, and experiment tracking systems. Risk is HIGH for organizations running LightningApp-based experiment infrastructure on Windows.

What systems are affected?

Package Ecosystem Vulnerable Range Patched
PyTorch Lightning pip < 2.4.0 2.4.0
31.2K OpenSSF 5.9 1.6K dependents Pushed 13d ago 57% patched ~373d to patch Full package profile →

Do you use PyTorch Lightning? You're affected.

How severe is it?

CVSS 3.1
9.1 / 10
EPSS
1.0%
chance of exploitation in 30 days
Higher than 59% of all CVEs
Exploitation Status
Exploit Available
Exploitation: MEDIUM
Sophistication
Trivial
Exploitation Confidence
medium
CISA SSVC: Public PoC
Composite signal derived from CISA KEV, VulnCheck KEV, CISA SSVC, EPSS, Metasploit, Exploit-DB, trickest/cve, Nuclei templates, and inthewild.io exploitation reports.

What is the attack surface?

AV AC PR UI S C I A
AV Network
AC Low
PR None
UI None
S Unchanged
C None
I High
A High

What should I do?

6 steps
  1. PATCH

    Upgrade pytorch-lightning to >= 2.4.0 immediately.

  2. BLOCK

    Restrict access to /api/v1/upload_file/ via WAF rule or reverse proxy ACL if running behind a gateway.

  3. ISOLATE

    Ensure LightningApp ports (default 7501) are not exposed to untrusted networks; bind to localhost if remote access is not required.

  4. DETECT

    Review web server logs for POST requests to /api/v1/upload_file/ containing path traversal sequences (../, ..\ URL-encoded variants).

  5. AUDIT

    Check recently modified .py, .pth, and .ckpt files in pytorch-lightning working directories for unauthorized changes.

  6. HARDEN

    Run LightningApp processes under a low-privilege service account with restricted filesystem write permissions.

What does CISA's SSVC say?

Decision Track*
Exploitation poc
Automatable Yes
Technical Impact partial

Source: CISA Vulnrichment (SSVC v2.0). Decision based on the CISA Coordinator decision tree.

How is it classified?

Which compliance frameworks are affected?

This CVE is relevant to:

ISO 42001
A.6.2 - AI system security
NIST AI RMF
GOVERN 1.7 - AI risk management processes address practices for AI lifecycle security MANAGE 2.2 - Mechanisms to respond to and recover from AI risks
OWASP LLM Top 10
LLM03 - Supply Chain Vulnerabilities

Frequently Asked Questions

What is CVE-2024-8019?

Any Windows-hosted ML environment running pytorch-lightning's LightningApp exposes an unauthenticated file upload endpoint that allows arbitrary file writes — including overwriting Python scripts executed by the training pipeline. Upgrade to pytorch-lightning 2.4.0 immediately; if patching is delayed, block external access to the /api/v1/upload_file/ endpoint at the network perimeter. No authentication is required, making this trivially exploitable by any network-adjacent attacker.

Is CVE-2024-8019 actively exploited?

No confirmed active exploitation of CVE-2024-8019 has been reported, but organizations should still patch proactively.

How to fix CVE-2024-8019?

1. PATCH: Upgrade pytorch-lightning to >= 2.4.0 immediately. 2. BLOCK: Restrict access to /api/v1/upload_file/ via WAF rule or reverse proxy ACL if running behind a gateway. 3. ISOLATE: Ensure LightningApp ports (default 7501) are not exposed to untrusted networks; bind to localhost if remote access is not required. 4. DETECT: Review web server logs for POST requests to /api/v1/upload_file/ containing path traversal sequences (../, ..\ URL-encoded variants). 5. AUDIT: Check recently modified .py, .pth, and .ckpt files in pytorch-lightning working directories for unauthorized changes. 6. HARDEN: Run LightningApp processes under a low-privilege service account with restricted filesystem write permissions.

What systems are affected by CVE-2024-8019?

This vulnerability affects the following AI/ML architecture patterns: model training pipelines, experiment tracking, ML development environments, model serving.

What is the CVSS score for CVE-2024-8019?

CVE-2024-8019 has a CVSS v3.1 base score of 9.1 (CRITICAL). The EPSS exploitation probability is 1.03%.

What is the AI security impact?

Affected AI Architectures

model training pipelinesexperiment trackingML development environmentsmodel serving

MITRE ATLAS Techniques

AML.T0010.001 AI Software
AML.T0018 Manipulate AI Model
AML.T0049 Exploit Public-Facing Application
AML.T0072 Reverse Shell

Compliance Controls Affected

ISO 42001: A.6.2
NIST AI RMF: GOVERN 1.7, MANAGE 2.2
OWASP LLM Top 10: LLM03

What are the technical details?

Original Advisory

In lightning-ai/pytorch-lightning version 2.3.2, a vulnerability exists in the `LightningApp` when running on a Windows host. The vulnerability occurs at the `/api/v1/upload_file/` endpoint, allowing an attacker to write or overwrite arbitrary files by providing a crafted filename. This can lead to potential remote code execution (RCE) by overwriting critical files or placing malicious files in sensitive locations.

Exploitation Scenario

An adversary targeting an ML team's Windows-based training server identifies a LightningApp instance reachable on the internal network (e.g., via Shodan, internal pivot, or compromised VPN). They POST a multipart file upload request to /api/v1/upload_file/ with a filename crafted to traverse directories — e.g., filename='../../site-packages/lightning/app/core/app.py' — overwriting a core pytorch-lightning module with a malicious version containing a reverse shell payload. The next time any training job imports the module, the attacker gains code execution under the ML worker's OS context, with access to model artifacts, training data, credentials stored in environment variables, and cloud provider tokens used for remote storage.

Weaknesses (CWE)

CWE-434 — Unrestricted Upload of File with Dangerous Type: The product allows the upload or transfer of dangerous file types that are automatically processed within its environment.

  • [Architecture and Design] Generate a new, unique filename for an uploaded file instead of using the user-supplied filename, so that no external input is used at all.[REF-422] [REF-423]
  • [Architecture and Design] When the set of acceptable objects, such as filenames or URLs, is limited or known, create a mapping from a set of fixed input values (such as numeric IDs) to the actual filenames or URLs, and reject all other inputs.

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
March 20, 2025
Last Modified
March 21, 2025
First Seen
March 24, 2026

Related Vulnerabilities