golang.org/x/crypto

CVE-2024-45337

CVE-2024-45337 is a critical-severity security vulnerability in golang.org/x/crypto (go), affecting versions < 0.31.0. It is fixed in 0.31.0.

Key facts
CVSS score
9.1
Critical
Attack vector
Network
Issuing authority
GitHub Advisory Database
Affected package
golang.org/x/crypto
Fixed in
0.31.0
Disclosed
2024

Summary

Applications and libraries which misuse the ServerConfig.PublicKeyCallback callback 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.

Impact

Severity and exposure

CVE-2024-45337 has a CVSS score of 9.1 (Critical). The vector is network-reachable, no privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment.

A fixed version is available (0.31.0). Upgrading removes the vulnerable code path.

Affected versions

go

  • golang.org/x/crypto (< 0.31.0)

Security releases

  • golang.org/x/crypto → 0.31.0 (go)
Kodem intelligence

Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.

Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter instead of chasing every advisory.

Kodem's runtime-powered SCA identifies whether CVE-2024-45337 is reachable in your applications. Explore open-source security for your team.

See if CVE-2024-45337 is reachable in your applications. Get a demo

Already deployed Kodem? See CVE-2024-45337 in your environment

Remediation advice

Upgrade golang.org/x/crypto to 0.31.0 or later to resolve this vulnerability.

Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.

Frequently asked questions about CVE-2024-45337

What is CVE-2024-45337?

CVE-2024-45337 is a critical-severity security vulnerability in golang.org/x/crypto (go), affecting versions < 0.31.0. It is fixed in 0.31.0.

How severe is CVE-2024-45337?

CVE-2024-45337 has a CVSS score of 9.1 (Critical). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.

Which versions of golang.org/x/crypto are affected by CVE-2024-45337?

golang.org/x/crypto (go) versions < 0.31.0 is affected.

Is there a fix for CVE-2024-45337?

Yes. CVE-2024-45337 is fixed in 0.31.0. Upgrade to this version or later.

Is CVE-2024-45337 exploitable, and should I be worried?

Whether CVE-2024-45337 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo

What actually determines whether CVE-2024-45337 is exploitable, and how bad it is?

Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.

How do I fix CVE-2024-45337?

Upgrade golang.org/x/crypto to 0.31.0 or later.

Stop the waste.
Protect your environment with Kodem.