CVE-2022-0845

9.8 CRITICAL

📋 TL;DR

CVE-2022-0845 is a critical code injection vulnerability in PyTorch Lightning that allows attackers to execute arbitrary code by exploiting improper input validation. This affects all users of PyTorch Lightning versions prior to 1.6.0 who process untrusted data through vulnerable components.

💻 Affected Systems

Products:
  • PyTorch Lightning
Versions: All versions prior to 1.6.0
Operating Systems: All
Default Config Vulnerable: ⚠️ Yes
Notes: Vulnerability exists in code that processes untrusted input; exploitation requires attacker-controlled input to reach vulnerable functions.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete system compromise with remote code execution leading to data theft, ransomware deployment, or lateral movement across networks.

🟠

Likely Case

Arbitrary code execution within the application context, potentially allowing data exfiltration, privilege escalation, or service disruption.

🟢

If Mitigated

Limited impact with proper input validation and sandboxing, potentially only denial of service or information disclosure.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

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

Exploitation requires the ability to provide malicious input to vulnerable functions; proof-of-concept details are publicly available in the referenced bounty report.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 1.6.0 and later

Vendor Advisory: https://github.com/pytorchlightning/pytorch-lightning/commit/8b7a12c52e52a06408e9231647839ddb4665e8ae

Restart Required: Yes

Instructions:

1. Update PyTorch Lightning to version 1.6.0 or later using pip: pip install --upgrade pytorch-lightning>=1.6.0
2. Restart all services using PyTorch Lightning
3. Verify the update with: pip show pytorch-lightning

🔧 Temporary Workarounds

Input Validation and Sanitization

all

Implement strict input validation and sanitization for all user-provided data before processing by PyTorch Lightning components.

Network Segmentation

all

Isolate systems running vulnerable PyTorch Lightning versions from untrusted networks and limit inbound connections.

🧯 If You Can't Patch

  • Implement strict network access controls to limit which systems can communicate with vulnerable instances
  • Deploy runtime application self-protection (RASP) or web application firewall (WAF) rules to detect and block code injection attempts

🔍 How to Verify

Check if Vulnerable:

Check PyTorch Lightning version: python -c "import pytorch_lightning; print(pytorch_lightning.__version__)" - if version is less than 1.6.0, the system is vulnerable.

Check Version:

python -c "import pytorch_lightning; print(pytorch_lightning.__version__)"

Verify Fix Applied:

After updating, verify version is 1.6.0 or higher using the same command and test that previously vulnerable input handling now rejects malicious payloads.

📡 Detection & Monitoring

Log Indicators:

  • Unusual process spawns from PyTorch Lightning processes
  • Error logs containing code injection attempts or malformed input patterns
  • Unexpected system command execution

Network Indicators:

  • Unusual outbound connections from PyTorch Lightning hosts
  • Data exfiltration patterns from affected systems

SIEM Query:

Process creation where parent process contains 'python' AND command line contains 'pytorch_lightning' AND (command line contains suspicious patterns like 'eval', 'exec', 'os.system')

🔗 References

📤 Share & Export