CVE-2024-5980
📋 TL;DR
A path traversal vulnerability in PyTorch Lightning's /v1/runs API endpoint allows attackers to write arbitrary files anywhere on the local filesystem when extracting malicious tar.gz plugin files. This affects systems running LightningApp with plugin_server enabled and can lead to remote code execution. Users of pytorch-lightning v2.2.4 with the plugin_server feature are vulnerable.
💻 Affected Systems
- lightning-ai/pytorch-lightning
📦 What is this software?
Pytorch Lightning by Lightningai
⚠️ Risk & Real-World Impact
Worst Case
Remote code execution leading to complete system compromise, data theft, or ransomware deployment.
Likely Case
Arbitrary file write allowing privilege escalation, backdoor installation, or sensitive data exfiltration.
If Mitigated
Limited impact if plugin_server is disabled or network access is restricted.
🎯 Exploit Status
Exploit details are publicly available via huntr.com bounty reports. Attack requires crafting malicious tar.gz files with path traversal payloads.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: Fixed in commit 330af381de88cff17515418a341cbc1f9f127f9a and later versions
Vendor Advisory: https://github.com/lightning-ai/pytorch-lightning/commit/330af381de88cff17515418a341cbc1f9f127f9a
Restart Required: Yes
Instructions:
1. Update pytorch-lightning to version after commit 330af381de88cff17515418a341cbc1f9f127f9a. 2. Restart any running LightningApp instances. 3. Verify plugin_server functionality if required.
🔧 Temporary Workarounds
Disable plugin_server
allDisable the vulnerable plugin_server feature if not required.
Modify LightningApp configuration to disable plugin_server or remove --plugin-server flag
Network isolation
allRestrict network access to the /v1/runs API endpoint.
Configure firewall rules to block external access to port serving LightningApp
🧯 If You Can't Patch
- Disable plugin_server feature immediately
- Implement strict network segmentation and firewall rules to limit access to vulnerable endpoint
🔍 How to Verify
Check if Vulnerable:
Check if running pytorch-lightning v2.2.4 with plugin_server enabled. Review application logs for tar.gz extraction via /v1/runs endpoint.
Check Version:
pip show pytorch-lightning | grep Version
Verify Fix Applied:
Verify pytorch-lightning version is updated beyond commit 330af381de88cff17515418a341cbc1f9f127f9a. Test tar.gz extraction with path traversal payloads.
📡 Detection & Monitoring
Log Indicators:
- Unusual tar.gz file extraction via /v1/runs endpoint
- File write operations to unexpected directories
- Plugin deployment attempts with suspicious filenames
Network Indicators:
- HTTP POST requests to /v1/runs with tar.gz payloads
- Unusual outbound connections following plugin deployment
SIEM Query:
source="lightning_app" AND (uri_path="/v1/runs" AND file_ext="tar.gz")