CVE-2022-21716

7.5 HIGH

📋 TL;DR

CVE-2022-21716 is a memory exhaustion vulnerability in Twisted's SSH client and server implementations. Attackers can send unlimited data during SSH version negotiation, causing the target system to consume all available memory and crash. This affects any system running vulnerable versions of Twisted with SSH enabled.

💻 Affected Systems

Products:
  • Twisted
Versions: All versions prior to 22.2.0
Operating Systems: All operating systems running Python with Twisted
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects Twisted installations with SSH functionality enabled (twisted.conch).

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete denial of service through memory exhaustion, potentially causing system crashes and service unavailability.

🟠

Likely Case

Service disruption and denial of service affecting SSH connectivity and dependent applications.

🟢

If Mitigated

Limited impact with proper network segmentation and monitoring, but still vulnerable to DoS from authorized network segments.

🌐 Internet-Facing: HIGH - SSH services exposed to the internet are directly vulnerable to simple DoS attacks.
🏢 Internal Only: MEDIUM - Internal SSH services are vulnerable to authenticated or network-accessible attackers.

🎯 Exploit Status

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

Simple network command (nc -rv localhost 22 < /dev/zero) can trigger the vulnerability. No authentication required.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 22.2.0

Vendor Advisory: https://github.com/twisted/twisted/security/advisories/GHSA-rv6r-3f5q-9rgx

Restart Required: Yes

Instructions:

1. Upgrade Twisted to version 22.2.0 or later using pip: pip install --upgrade twisted>=22.2.0
2. Restart all services using Twisted SSH functionality
3. Verify the upgrade with: python -c "import twisted; print(twisted.__version__)"

🔧 Temporary Workarounds

No known workarounds

all

The vendor advisory states there are no known workarounds. Patching is required.

🧯 If You Can't Patch

  • Implement network-level controls to restrict SSH access to trusted sources only
  • Monitor memory usage on systems running Twisted SSH services and implement alerting for abnormal consumption

🔍 How to Verify

Check if Vulnerable:

Check Twisted version: python -c "import twisted; print(twisted.__version__)" - if version is less than 22.2.0 and SSH functionality is enabled, system is vulnerable.

Check Version:

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

Verify Fix Applied:

Verify Twisted version is 22.2.0 or higher: python -c "import twisted; print(twisted.__version__)" should show 22.2.0 or greater.

📡 Detection & Monitoring

Log Indicators:

  • Unusually large SSH version strings in logs
  • Memory exhaustion alerts
  • SSH service crashes or restarts

Network Indicators:

  • Excessive data sent during SSH version negotiation
  • Unusual traffic patterns to SSH port 22

SIEM Query:

source="*ssh*" AND (message="*memory*" OR message="*exhaust*" OR message="*crash*")

🔗 References

📤 Share & Export