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.
Risk Assessment
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.
Affected Systems
| Package | Ecosystem | Vulnerable Range | Patched |
|---|---|---|---|
| pytorch-lightning | pip | < 2.4.0 | 2.4.0 |
Do you use pytorch-lightning? You're affected.
Severity & Risk
Attack Surface
Recommended Action
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.
CISA SSVC Assessment
Source: CISA Vulnrichment (SSVC v2.0). Decision based on the CISA Coordinator decision tree.
Classification
Compliance Impact
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 2.10%.
Technical Details
NVD Description
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)
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-8020 7.5 pytorch-lightning: unauthenticated DoS crashes LightningApp
Same package: pytorch-lightning CVE-2026-44484 pytorch-lightning: supply chain, credential harvesting
Same package: pytorch-lightning CVE-2025-59528 10.0 Flowise: Unauthenticated RCE via MCP config injection
Same attack type: Supply Chain CVE-2023-3765 10.0 MLflow: path traversal allows arbitrary file read
Same attack type: Supply Chain
AI Threat Alert