# 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.

- **Severity:** Critical 9.1 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 11 Dec 2024
- **Updated:** 18 Feb 2025
- **Also known as:** AZL-54281, AZL-54286, AZL-54290, AZL-54315, AZL-54317, AZL-54320, AZL-54327, AZL-54330, AZL-54333, AZL-54345, AZL-54353, AZL-54357, AZL-54363, AZL-54372, AZL-54381, AZL-54384, CLEANSTART-2026-GJ99404, CLEANSTART-2026-PY90502, CLEANSTART-2026-QZ20471, DEBIAN-CVE-2024-45337, GHSA-v778-237x-gjrc, GO-2024-3321, MINI-225p-wh6f-vm9w, MINI-24jf-gm96-44mh, MINI-2cj7-vh65-qqg5, MINI-339j-45j7-p732, MINI-4c36-3pvv-8h6q, MINI-4m22-gc7w-5qfj, MINI-53j9-962p-57q3, MINI-5f2c-r4qg-w5wf, MINI-5mmg-fq85-96f6, MINI-5vch-h76p-2gcr, MINI-6f8r-8mqf-7h46, MINI-6h66-5w62-hprr, MINI-8vgw-5xc7-m52c, MINI-8xwq-jfxw-2wcq, MINI-929j-7933-hq8g, MINI-933p-63gq-hp65, MINI-97rc-g8j5-chgj, MINI-98gr-4pm8-789p, MINI-9jfg-3c5f-r73h, MINI-c9cm-952w-ph54, MINI-cf44-vg2v-9x7r, MINI-cm4h-j3p8-5q77, MINI-f6g5-9vwf-xp6q, MINI-g8m7-36c2-4rx4, MINI-g9h3-2vq8-wmj7, MINI-gx78-3mqq-fv4x, MINI-gxfw-xhjp-g443, MINI-h7fm-vvq5-2mmm, MINI-hq66-4fx9-5vj4, MINI-hw6w-m24j-7jvp, MINI-j48x-x4qh-hfvp, MINI-j8x5-hqcf-xh32, MINI-jg4f-h5mv-5f5g, MINI-jp2r-cv7p-vh57, MINI-jqpp-v9cj-62c6, MINI-mfr2-r9p9-qxxj, MINI-mh5f-7w7q-hr7x, MINI-pfxx-69g8-qx8g, MINI-pv87-hmp5-26h7, MINI-qh9g-qq98-cpx4, MINI-qhq8-94x3-vc4c, MINI-r2m3-wpqx-hc62, MINI-r2wf-f5f8-282h, MINI-r4rq-cj28-vxrq, MINI-r7rc-f3pr-qpx3, MINI-rmfc-r9c4-ph89, MINI-rvrj-x89w-828j, MINI-rwr2-5r9m-h2r3, MINI-vhqw-8p54-x4m3, MINI-w47x-3ppw-2mq7, MINI-wv62-h89f-m95r, MINI-xwph-23r9-fhh4, ROOT-APP-GOBINARY-CVE-2024-45337, SUSE-SU-2025:1142-1, SUSE-SU-2025:1143-1, UBUNTU-CVE-2024-45337, USN-7839-1, USN-7839-2, openSUSE-SU-2024:14573-1, openSUSE-SU-2024:14585-1, openSUSE-SU-2024:14590-1, openSUSE-SU-2024:14592-1, openSUSE-SU-2024:14593-1, openSUSE-SU-2024:14595-1, openSUSE-SU-2024:14602-1, openSUSE-SU-2024:14604-1, openSUSE-SU-2025:0025-1, openSUSE-SU-2025:14633-1, openSUSE-SU-2025:14660-1, openSUSE-SU-2025:14920-1, openSUSE-SU-2025:14969-1, openSUSE-SU-2025:15013-1, openSUSE-SU-2025:15463-1

## 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/cry...@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. 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 | Ecosystem | 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 |
| `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.

## 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:

- Proof of concept (POC) for CVE-2024-45337  (github_poc): https://github.com/NHAS/CVE-2024-45337-POC
- An example project that showcases golang code vulnerable to CVE-2024-45337 (github_poc): https://github.com/NHAS/VULNERABLE-CVE-2024-45337
- Proof of Concept for CVE-2024-45337 against Gitea and Forgejo (github_poc): https://github.com/peace-maker/CVE-2024-45337
- Fork of gogs/gogs for reachability benchmark testing (CVE-2024-45337) (github_poc): https://github.com/Backline-playground/gogs
- Security case-study: reachability vs SCA on Gitea CVE-2024-45337 — real code reconstructed at historical commits (PoE → failed fix → fix). Demo only, not for use. (github_poc): https://github.com/ferralon-demo/gitea-cve-2024-45337

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-45337 and fix it if it is affected.

What it is: 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.
Exploitation: There is no known exploitation of CVE-2024-45337 in the wild and no public exploit code.

Affected packages and fixed versions:
- golang.org/x/crypto (Go): affected all versions; fixed in 0.31.0
- golang.org/x/crypto (Go): affected all versions; fixed in 0.31.0
- golang.org/x/crypto (Go): affected all versions; fixed in 0.31.0

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2024-45337/ (Markdown: https://insights.sbomify.com/CVE-2024-45337/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2024-45337
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2024-45337
- OSV: https://osv.dev/vulnerability/CVE-2024-45337

---
From sbomify Insights: https://insights.sbomify.com/CVE-2024-45337/
Summaries are generated and may contain mistakes; the official description above is the record.
