How to fix CVE-2024-45337 – Step-by-Step Guide
CVE-2024-45337 addresses a critical vulnerability in Go's crypto/ssh library, named "Misuse of ServerConfig.PublicKeyCallback." This flaw, with a CVSS score of 9.1, impacts Go applications using SSH servers. It allows for unauthorized authentication bypass.
What is Go crypto/ssh – Misuse of ServerConfig.PublicKeyCallback?
The vulnerability stems from a logic flaw in Go's crypto/ssh ServerConfig.PublicKeyCallback. When an application's callback approves a public key, the authentication flow may incorrectly grant access even if the subsequent authentication fails. This bypasses intended security checks, allowing unauthorized access to SSH servers.
Impact and Risks for your Infrastructure
This critical flaw enables unauthorized SSH authentication bypass in affected Go applications. Attackers can exploit this to authenticate to SSH servers using any public key, gaining unauthorized access to sensitive systems and data. This poses a significant risk to infrastructure integrity and data confidentiality.
Step-by-Step Mitigation Guide
To fix CVE-2024-45337, update your Go environment to version 1.22.10+ or 1.23.4+. Verify the update by checking your Go version (`go version`) and ensuring all dependencies are rebuilt with the patched library. This applies the necessary security patches, closing the authentication bypass vulnerability.
- 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.