How to fix CVE-2024-45337 – Step-by-Step Guide
CVE-2024-45337 addresses a critical vulnerability in Go's crypto/ssh library. This flaw, named "Misuse of ServerConfig.PublicKeyCallback," can lead to unauthorized SSH authentication bypass. It affects Go versions prior to 1.22.10 and 1.23.4.
What is Go crypto/ssh – Misuse of ServerConfig.PublicKeyCallback?
This vulnerability stems from a logic flaw within Go's crypto/ssh ServerConfig.PublicKeyCallback. When an application's callback approves a public key, the SSH server might incorrectly authorize the connection even if the subsequent authentication process fails. This bypasses intended authentication checks, allowing unauthorized access.
Impact and Risks for your Infrastructure
The critical impact of CVE-2024-45337 is unauthorized SSH authentication bypass. Attackers can exploit this flaw to gain illicit access to SSH servers running vulnerable Go applications. This could lead to data breaches, system compromise, and significant operational disruption.
Step-by-Step Mitigation Guide
To mitigate CVE-2024-45337, update your Go applications to versions 1.22.10 or 1.23.4, or newer. Verify the fix by recompiling your Go applications with the patched Go toolchain. Ensure your deployment environments are running the latest secure Go versions to prevent unauthorized SSH access.
- 1Upgrade Go to 1.22.10+ or 1.23.4+.
- 2Review your PublicKeyCallback implementation to ensure it rejects unauthorized keys.
- 3Add explicit key allowlist validation inside PublicKeyCallback.
- 4Rotate SSH host keys and audit SSH access logs for anomalies.
- 5Run static analysis (govulncheck) to detect usage of vulnerable patterns.
- 6Pin allowed public keys in your callback rather than relying on post-callback checks.