CVE-2024-8019: pytorch-lightning: file upload RCE (Windows)
GHSA-4cv3-v7pv-rfhf CRITICAL CISA: TRACK*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 |
Do you use PyTorch Lightning? You're affected.
How severe is it?
What is the attack surface?
What should I do?
6 steps-
PATCH
Upgrade pytorch-lightning to >= 2.4.0 immediately.
-
BLOCK
Restrict access to /api/v1/upload_file/ via WAF rule or reverse proxy ACL if running behind a gateway.
-
ISOLATE
Ensure LightningApp ports (default 7501) are not exposed to untrusted networks; bind to localhost if remote access is not required.
-
DETECT
Review web server logs for POST requests to /api/v1/upload_file/ containing path traversal sequences (../, ..\ URL-encoded variants).
-
AUDIT
Check recently modified .py, .pth, and .ckpt files in pytorch-lightning working directories for unauthorized changes.
-
HARDEN
Run LightningApp processes under a low-privilege service account with restricted filesystem write permissions.
What does CISA's SSVC say?
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:
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
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
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 References
Timeline
Related Vulnerabilities
CVE-2022-0845 9.8 pytorch-lightning: code injection enables full RCE
Same package: pytorch-lightning CVE-2024-5452 9.8 pytorch-lightning: RCE via deepdiff Delta deserialization
Same package: pytorch-lightning CVE-2026-24747 8.8 pytorch: Code Injection enables RCE
Same package: pytorch-lightning CVE-2026-31221 7.8 pytorch-lightning: RCE via insecure checkpoint deserialization
Same package: pytorch-lightning CVE-2024-8020 7.5 pytorch-lightning: unauthenticated DoS crashes LightningApp
Same package: pytorch-lightning