How to fix CVE-2024-45337 – Step-by-Step Guide
CVE-2024-45337 (Go crypto/ssh – Misuse of ServerConfig.PublicKeyCallback) is a <strong>CRITICAL severity</strong> vulnerability with a CVSS score of 9.1/10. Applications using crypto/ssh's ServerConfig.PublicKeyCallback may incorrectly authorize connections when the callback approves a key but authentication fails, due to a logic flaw in the authentication flow. Follow the step-by-step guide below to remediate this vulnerability in your infrastructure.
What is Go crypto/ssh – Misuse of ServerConfig.PublicKeyCallback?
Go crypto/ssh – Misuse of ServerConfig.PublicKeyCallback (CVE-2024-45337) affects <strong>Go standard library (crypto/ssh)</strong>. Applications using crypto/ssh's ServerConfig.PublicKeyCallback may incorrectly authorize connections when the callback approves a key but authentication fails, due to a logic flaw in the authentication flow. It was published on 2024-12-11 and affects <strong>Go < 1.22.10, < 1.23.4</strong>. The fixed version is <strong>Go 1.22.10+, 1.23.4+</strong>.
Impact and Risks for your Infrastructure
Unauthorized SSH authentication bypass in Go applications. Attackers can authenticate to SSH servers using any public key if the PublicKeyCallback is improperly implemented.
Step-by-Step Mitigation Guide
To remediate CVE-2024-45337, follow the prioritized mitigation steps: Upgrade Go to 1.22.10+ or 1.23.4+. → Review your PublicKeyCallback implementation to ensure it rejects unauthorized keys. → Add explicit key allowlist validation inside PublicKeyCallback. → Rotate SSH host keys and audit SSH access logs for anomalies. → Run static analysis (govulncheck) to detect usage of vulnerable patterns. → Pin allowed public keys in your callback rather than relying on post-callback checks.. Verify the fix using the verification commands below and confirm the patched version is deployed across all affected systems.
- 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.