Jun 26, 2026·5 min read·4 visits
Unauthenticated remote attackers can exhaust SSH server CPU resources by sending public keys with oversized parameters during the authentication handshake.
A high-severity Denial of Service (DoS) vulnerability exists in the golang.org/x/crypto/ssh package prior to version 0.52.0. The vulnerability is caused by a lack of size and range validation on incoming RSA and DSA public key parameters during SSH authentication. An unauthenticated attacker can submit a crafted public key with pathologically large parameters, triggering intensive CPU computation during signature verification and leading to a complete Denial of Service.
The Go SSH implementation inside the golang.org/x/crypto/ssh package prior to version 0.52.0 is vulnerable to an unauthenticated remote Denial of Service (DoS) vulnerability. During the public key authentication phase of an SSH handshake, a client can send public keys with pathologically large parameters. The library attempts to parse these keys and perform expensive mathematical computations before validating the key parameters.\n\nAn attacker does not need to possess valid credentials to trigger this vulnerability. The parsing and subsequent validation attempt occurs during the initial authentication phase (SSH_MSG_USERAUTH_REQUEST), which is accessible to any network-connected client. This flaw exposes any server utilizing the Go SSH library, such as container runtimes, Kubernetes components, and custom SSH bastions.
The root cause of this vulnerability lies in the missing range and size verification of incoming cryptographic parameters within the RSA and DSA public key parsers in ssh/keys.go. When an SSH client requests public key authentication, it transmits key parameters as raw byte arrays, which the server parses into Go's arbitrary-precision big.Int structures.\n\nIn the case of RSA, the parser extracted the modulus $N$ and public exponent $E$ using Unmarshal, but did not check the bit length of the modulus $N$. In the case of DSA, the parser failed to verify the sub-prime $Q$, the generator $G$, and the public value $Y$ against standard boundaries.\n\nBecause signature verification involves modular exponentiation (such as $g^{u_1} \cdot y^{u_2} \pmod p$), processing pathologically large values of $N$, $Q$, or $Y$ causes the underlying arbitrary-precision arithmetic operations to consume massive CPU resources. The execution time of these operations scales quadratically or cubically with the bit length, allowing an attacker to exhaust the host's CPU cycles with a single crafted key.
The vulnerability was mitigated in golang.org/x/crypto version 0.52.0 by enforcing strict constraints on parameter sizes during deserialization.\n\nIn the RSA parser (parseRSA in ssh/keys.go), a boundary check was introduced to reject keys with a modulus exceeding 8192 bits. This limit aligns with the threshold enforced by the Go standard library's crypto/tls package.\n\ngo\n// ssh/keys.go\nif w.N.BitLen() > 8192 {\n\treturn nil, nil, errors.New(\"ssh: rsa modulus too large\")\n}\n\n\nFor DSA public keys, the patch introduced validations in both checkDSAParams and parseDSA. It restricts the subprime $Q$ to exactly 160 bits (in accordance with FIPS 186-2) and validates that the generator $G$ and public value $Y$ reside within the finite group boundaries ($0 < G < P$, $0 < Y < P$).\n\ngo\n// ssh/keys.go\nif l := param.Q.BitLen(); l != 160 {\n\treturn fmt.Errorf(\"ssh: unsupported DSA sub-prime size %d\", l)\n}\nif param.G.Cmp(param.P) >= 0 {\n\treturn errors.New(\"ssh: DSA generator larger than modulus\")\n}\nif param.G.Sign() <= 0 {\n\treturn errors.New(\"ssh: DSA generator must be positive\")\n}\nif w.Y.Sign() <= 0 || w.Y.Cmp(w.P) >= 0 {\n\treturn nil, nil, errors.New(\"ssh: DSA public value Y out of range\")\n}\n\n\nThese checks ensure that the mathematical operations performed during signature verification are bounded by safe complexity limits.
An attacker can exploit this vulnerability by initiating an SSH handshake and sending a crafted public key. During the SSH_MSG_USERAUTH_REQUEST phase, the attacker submits an RSA public key containing a modulus $N$ with a length of several hundred thousand bits, or a DSA public key containing an oversized sub-prime $Q$ or public value $Y$.\n\nThe SSH server reads the packet and unmarshals the parameters into memory as big.Int structures. When the server attempts to verify the signature associated with the public key, the cryptographic package executes modular exponentiations using these arbitrary-precision integers.\n\nBecause the CPU overhead of multi-precision division and multiplication scales exponentially with the input size, a single authentication attempt can lock a CPU core for several minutes. A threat actor can send multiple parallel authentication requests, quickly exhausting all available CPU cores on the host and resulting in a complete Denial of Service for legitimate connections.
This vulnerability has a high CVSS v3.1 base score of 7.5. The impact is categorized as a high availability loss because successful exploitation halts the target service. The vulnerability can be exploited remotely, does not require authentication, and does not require user interaction.\n\nDue to Go's dominance in cloud-native infrastructure, the downstream impact is extensive. Vulnerable versions of the SSH library are embedded within critical technologies, including Docker, containerd, Kubernetes-related components, HashiCorp Vault, and various Linux distribution utilities.\n\nIf these management agents or container daemons expose SSH endpoints or parse untrusted keys, they can be targeted to disrupt host operations and infrastructure orchestration. High-priority deployments must immediately scan their binaries to detect compiled dependencies on older versions of golang.org/x/crypto.
The primary remediation strategy is upgrading the golang.org/x/crypto dependency to version 0.52.0 or higher and recompiling all dependent Go applications.\n\nTo identify vulnerable binaries, security teams should use static analysis utilities such as govulncheck. This tool parses the embedded build metadata of Go binaries to verify import versions:\n\nbash\ngovulncheck ./...\n\n\nTo update the dependency within a Go module, run the following commands:\n\nbash\ngo get golang.org/x/crypto@v0.52.0\ngo mod tidy\n\n\nIn environments where immediate updating is not possible, access to SSH interfaces should be restricted to trusted networks using firewall rules and network access control lists (ACLs).
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H| Product | Affected Versions | Fixed Version |
|---|---|---|
golang.org/x/crypto/ssh Go Project | < v0.52.0 | v0.52.0 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-1176 |
| Attack Vector | Network (Unauthenticated) |
| CVSS v3.1 Score | 7.5 |
| EPSS Score | 0.00304 |
| Exploit Status | Proof-of-Concept |
| Affected Module | golang.org/x/crypto/ssh |
| Fixed Version | v0.52.0 |
The product performs computational operations on arbitrary-precision parameters without restricting input boundaries, resulting in excessive resource consumption.
A denial-of-service (DoS) and resource leak vulnerability in the Go SSH package (golang.org/x/crypto/ssh) allows a malicious peer to permanently deadlock connection processing loops and leak memory. This issue stems from improper handling of unsolicited responses at the global and channel layers, which saturate internal bounded channel buffers and block the main multiplexer loop. The vulnerability is fully resolved in version 0.52.0.
An authentication bypass vulnerability was identified in the golang.org/x/crypto/ssh package. The library's verification logic for FIDO/U2F security keys failed to check the User Presence (UP) flag. This omission allows an attacker with access to a hardware token interface or an agent-forwarding socket to authenticate without physical user interaction.
A critical vulnerability exists in the Go SSH sub-repository (golang.org/x/crypto/ssh) before version 0.52.0. When an application writes payloads of 4GB or larger in a single write operation, integer truncation in the remote window calculation causes an infinite loop. This results in complete CPU core exhaustion and a denial-of-service condition.
An issue was discovered in Go's `golang.org/x/crypto/ssh/knownhosts` package where a revoked Certification Authority (CA) public key was not correctly checked for revocation during SSH host certificate validation. This allowed clients or servers utilizing the library to validate and trust host certificates issued by explicitly revoked CAs.
An authorization bypass vulnerability exists in the golang.org/x/crypto/ssh package prior to version 0.52.0. When an SSH server is configured with a custom VerifiedPublicKeyCallback that returns a Permissions object containing a source-address critical option, the server fails to validate and enforce the restriction. This allows remote clients with valid public keys to bypass IP-based access restrictions and authenticate from unauthorized network locations.
A critical vulnerability exists in MessagePack-CSharp's typeless deserialization mechanism where configured blocklists fail to recursively inspect nested types. An attacker can bypass security restrictions by wrapping unauthorized types in arrays or generic collections, allowing insecure deserialization and remote code execution.