CVE-2024-5980

9.8 CRITICAL

📋 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

Products:
  • lightning-ai/pytorch-lightning
Versions: v2.2.4 specifically (check commit 330af381de88cff17515418a341cbc1f9f127f9a for exact fix)
Operating Systems: All operating systems running PyTorch Lightning
Default Config Vulnerable: ✅ No
Notes: Only vulnerable when LightningApp is running with plugin_server enabled. Standard PyTorch Lightning installations without plugin_server are not affected.

📦 What is this software?

⚠️ 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.

🌐 Internet-Facing: HIGH - Exploitable via network requests to the vulnerable API endpoint.
🏢 Internal Only: MEDIUM - Requires access to the plugin_server endpoint, which may be internal-only.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

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

all

Disable the vulnerable plugin_server feature if not required.

Modify LightningApp configuration to disable plugin_server or remove --plugin-server flag

Network isolation

all

Restrict 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")

🔗 References

📤 Share & Export