CVE-2024-45337: Golang.org/x/crypto Misuse Of ServerConfig.PublicKeyCallback May Cause Vulnerability
CRITICALCVE-2024-45337 is a CRITICAL (CVSS 9.1) misuse of serverconfig.publickeycallback may cause vulnerability (CWE-285: Improper Authorization) affecting Golang.org/x/crypto libraries in the Go ecosystem. The issue involves misuse of serverconfig.publickeycallback may cause authorization bypass in golang.org/x/crypto. Remediation is available by upgrading affected packages to version 0.31.0.
CVE-2024-45337 at a Glance
Security Impact
CVSS: 9.1
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N).
How to Fix CVE-2024-45337
To remediate this vulnerability, upgrade all affected Golang.org/x/crypto dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade golang.org/x/crypto to 0.31.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for golang.org/x/crypto
How to Check if You Are Affected
To determine whether your application is affected by CVE-2024-45337, inspect your project dependencies for Golang.org/x/crypto:
inspect dependencies for golang.org/x/crypto
Analyze the terminal output to locate any version of Golang.org/x/crypto in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.31.0), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-285: Improper Authorization, where the product does not perform or incorrectly performs an authorization check when an actor attempts to access a resource or perform an action. In Golang.org/x/crypto, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2024-45337 Affected Golang.org/x/crypto Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
golang.org/x/crypto
|
Go |
< 0.31.0
|
0.31.0
|
References
Frequently Asked Questions
What is CVE-2024-45337?
Which Golang.org/x/crypto versions are affected?
What version fixes CVE-2024-45337?
Is golang.org/x/crypto affected?
What is the CVSS score of CVE-2024-45337?
What CWE is associated with CVE-2024-45337?
How can I check Go dependencies for CVE-2024-45337?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-v778-237x-gjrc",
"modified" : "2025-01-31T15:30:43Z",
"published" : "2024-12-11T22:03:04Z",
"aliases" : [ "CVE-2024-45337" ],
"summary" : "Misuse of ServerConfig.PublicKeyCallback may cause authorization bypass in golang.org/x/crypto",
"details" : "Applications and libraries which misuse the ServerConfig.PublicKeyCallback callback may be susceptible to an authorization bypass.\n\nThe 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.\n\nFor 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.\n\nSince this API is widely misused, as a partial mitigation golang.org/x/crypto@v0.31.0 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.\n\nUsers 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.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Go",
"name" : "golang.org/x/crypto"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.31.0"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-45337"
}, {
"type" : "WEB",
"url" : "https://github.com/golang/crypto/commit/b4f1988a35dee11ec3e05d6bf3e90b695fbd8909"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/golang/crypto"
}, {
"type" : "WEB",
"url" : "https://go.dev/cl/635315"
}, {
"type" : "WEB",
"url" : "https://go.dev/issue/70779"
}, {
"type" : "WEB",
"url" : "https://groups.google.com/g/golang-announce/c/-nPEi39gI4Q/m/cGVPJCqdAQAJ"
}, {
"type" : "WEB",
"url" : "https://pkg.go.dev/vuln/GO-2024-3321"
}, {
"type" : "WEB",
"url" : "https://security.netapp.com/advisory/ntap-20250131-0007"
}, {
"type" : "WEB",
"url" : "http://www.openwall.com/lists/oss-security/2024/12/11/2"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-285" ],
"severity" : "CRITICAL",
"github_reviewed" : true,
"github_reviewed_at" : "2024-12-11T22:03:04Z",
"nvd_published_at" : "2024-12-12T02:02:07Z"
}
}