CVE-2024-45337 Misuse of connection.serverAuthenticate may cause authorization bypass in golang.org/x/crypto
Attackers can bypass authorization in Go SSH applications by exploiting misuse of the PublicKeyCallback to authenticate with a different key than the one used for access decisions.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2024-45337?
CVE-2024-45337 is a critical authentication bypass vulnerability in golang.org/x/crypto/ssh, published on 11 Dec 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official description
Applications and libraries which misuse connection.serverAuthenticate (via callback field ServerConfig.PublicKeyCallback) may be susceptible to an authorization bypass. The documentation for ServerConfig.PublicKeyCallback says that "A call to this function does not guarantee that the key offered is in fact used to authenticate." Specifically, the SSH protocol allows clients to inquire about whether a public key is acceptable before proving control of the corresponding private key. PublicKeyCallback may be called with multiple keys, and the order in which the keys were provided cannot be used to infer which key the client successfully authenticated with, if any. Some applications, which store the key(s) passed to PublicKeyCallback (or derived information) and make security relevant determinations based on it once the connection is established, may make incorrect assumptions. For example, an attacker may send public keys A and B, and then authenticate with A. PublicKeyCallback would be called only twice, first with A and then with B. A vulnerable application may then make authorization decisions based on key B for which the attacker does not actually control the private key. Since this API is widely misused, as a partial mitigation golang.org/x/[email protected] enforces the property that, when successfully authenticating via public key, the last key passed to ServerConfig.PublicKeyCallback will be the key used to authenticate the connection. PublicKeyCallback will now be called multiple times with the same key, if necessary. Note that the client may still not control the last key passed to PublicKeyCallback if the connection is then authenticated with a different method, such as PasswordCallback, KeyboardInteractiveCallback, or NoClientAuth. Users should be using the Extensions field of the Permissions return value from the various authentication callbacks to record data associated with the authentication attempt instead of referencing external state. Once the connection is established the state corresponding to the successful authentication attempt can be retrieved via the ServerConn.Permissions field. Note that some third-party libraries misuse the Permissions type by sharing it across authentication attempts; users of third-party libraries should refer to the relevant projects for guidance.
Which versions are affected by CVE-2024-45337?
3 open source packages ship an affected version, including golang.org/x/crypto.
| Package | Affected | Fixed in |
|---|---|---|
golang.org/x/crypto Go | All versions | 0.31.0 |
golang.org/x/crypto Go | All versions | 0.31.0 |
golang.org/x/crypto Go | All versions | 0.31.0 |
Linux distribution packages (23)
google-guest-agent SUSE:Linux Enterprise Micro 5.5 | All versions | 20250327.01-150000.1.60.1 |
google-guest-agent SUSE:Linux Enterprise Module for Public Cloud 12 | All versions | 20250327.01-1.50.1 |
google-guest-agent SUSE:Linux Enterprise Module for Public Cloud 15 SP3 | All versions | 20250327.01-150000.1.60.1 |
google-guest-agent SUSE:Linux Enterprise Module for Public Cloud 15 SP4 | All versions | 20250327.01-150000.1.60.1 |
google-guest-agent SUSE:Linux Enterprise Module for Public Cloud 15 SP5 | All versions | 20250327.01-150000.1.60.1 |
google-guest-agent SUSE:Linux Enterprise Module for Public Cloud 15 SP6 | All versions | 20250327.01-150000.1.60.1 |
cheat SUSE:Package Hub 15 SP6 | All versions | 4.4.2-bp156.3.3.1 |
cheat openSUSE:Leap 15.6 | All versions | 4.4.2-bp156.3.3.1 |
google-guest-agent openSUSE:Leap 15.6 | All versions | 20250327.01-150000.1.60.1 |
cloudflared openSUSE:Tumbleweed | All versions | 2024.12.1-1.1 |
git-bug openSUSE:Tumbleweed | All versions | 0.8.0+git.1733745604.d499b6e-1.1 |
gitleaks openSUSE:Tumbleweed | All versions | 8.24.2-1.1 |
golang-github-prometheus-prometheus openSUSE:Tumbleweed | All versions | 3.1.0-1.1 |
google-guest-agent openSUSE:Tumbleweed | All versions | 20250327.01-1.1 |
gopass openSUSE:Tumbleweed | All versions | 1.15.16-1.1 |
grafana openSUSE:Tumbleweed | All versions | 11.3.0-4.1 |
helm openSUSE:Tumbleweed | All versions | 3.16.4-1.1 |
loki openSUSE:Tumbleweed | All versions | 3.3.2-1.1 |
minikube openSUSE:Tumbleweed | All versions | 1.36.0-2.1 |
tailscale openSUSE:Tumbleweed | All versions | 1.78.3-2.1 |
teleport openSUSE:Tumbleweed | All versions | 17.0.5-1.1 |
traefik openSUSE:Tumbleweed | All versions | 3.2.3-1.1 |
traefik2 openSUSE:Tumbleweed | All versions | 2.11.16-1.1 |
How do I fix CVE-2024-45337?
Upgrade golang.org/x/crypto to 0.31.0 or later.
Upgrade, and rotate credentials and sessions that may have been exposed. More about Authentication bypass.
Is CVE-2024-45337 being exploited?
There is no known exploitation of CVE-2024-45337 in the wild and no public exploit code.
Public exploit code: 5 proofs of concept on GitHub.
Sources
Also known as AZL-54281, AZL-54286, AZL-54290, AZL-54315, AZL-54317, AZL-54320 and 89 more.