Listen to this Post
A malicious SSH peer can trigger a denial-of-service condition in Go applications that use the `golang.org/x/crypto/ssh` package by sending unsolicited global request responses. The SSH protocol allows clients to send global requests (e.g., tcpip-forward, keepalive) to the server, which the server then responds to. However, the `ssh` package’s multiplexer (mux) maintains an internal buffer (pending) to track outstanding global requests and their expected responses.
When a client sends a global request, the server adds an entry to this buffer and waits for a response. The vulnerability arises because the `ssh` package does not validate that an incoming global request response corresponds to a pending request. A malicious client can send a flood of unsolicited `globalRequestSuccess` or `globalRequestFailure` messages without first sending the corresponding global requests. Each unsolicited response is appended to the internal buffer, gradually filling it.
Once the buffer reaches its capacity, the connection’s read loop becomes blocked because it attempts to write to the full buffer and waits indefinitely for space to become available. This blocked goroutine cannot be released even if the application calls `Close()` on the connection, as the read loop is stuck in a waiting state that ignores the close signal. Consequently, each compromised connection results in a permanent resource leak—the blocked goroutine and its associated memory are never garbage-collected.
An attacker with network access to an SSH server can establish a single connection and repeatedly send unsolicited responses, causing the server to exhaust its goroutine pool or memory resources over time. This leads to a gradual denial of service, as new connections cannot be accepted or existing ones become unresponsive. The issue affects both client and server roles, as the vulnerable `mux` logic is shared. The fix, implemented in version 0.52.0, now discards unsolicited global responses instead of queuing them.
DailyCVE Form:
Platform: golang.org/x/crypto/ssh
Version: before 0.52.0
Vulnerability: Resource leak deadlock
Severity: Critical
date: 2026-05-22
Prediction: Patch 2026-05-22
What Undercode Say:
Analytics indicate active scanning for Go SSH services. The EPSS score is 0.04% (13th percentile), suggesting low current exploitation but high potential due to simplicity. The vulnerability is trivial to trigger, requiring only a single TCP connection and crafted SSH packets. Public proof-of-concept scripts are expected within days.
Bash Commands & Codes:
Check your Go module version go list -m golang.org/x/crypto Update to the fixed version go get golang.org/x/[email protected] Verify the update go mod tidy go list -m golang.org/x/crypto
Exploit:
A malicious client sends a continuous stream of `SSH_MSG_GLOBAL_REQUEST` response messages (type 101 or 102) without preceding requests. The payload can be minimal (e.g., `\x00\x00\x00\x00` for success). Each packet fills the internal `pending` buffer until the read loop deadlocks. No authentication is required.
Protection:
- Upgrade to `golang.org/x/crypto/ssh` version 0.52.0 or later.
- If upgrading is not possible, apply a temporary workaround by setting read/write deadlines on the underlying `net.Conn` to force connection termination after a timeout.
- Monitor goroutine counts and connection states; a sudden spike in blocked goroutines may indicate an attack.
- Restrict SSH access to trusted IP ranges using firewall rules.
Impact:
- Denial of Service: Each malicious connection permanently consumes one goroutine and associated memory, leading to gradual resource exhaustion.
- No Data Breach: The vulnerability does not affect confidentiality or integrity; only availability is impacted.
- Wide Applicability: Affects all Go applications using the `ssh` package for client or server functionality, including popular tools like Gogs, Teleport, and custom SSH services.
- Easy Exploitation: No privileges or user interaction required; the attack is network-based and low-complexity.
🎯Let’s Practice Exploiting & Learn Patching For Free:
🎓 Live Courses & Certifications:
Join Undercode Academy for Verified Certifications
🚀 Request a Custom Project:
Secure, high-velocity infrastructure and disruptive technological engineering. Contact our engineering team for high-tier development and proprietary systems:
[email protected]
💎 Smart Architecture | 🛡️ Secure by Design | ⭐ Trusted by Thousands
Sources:
Reported By: github.com
Extra Source Hub:
Undercode

