How to fix CVE-2024-45337 – Step-by-Step Guide
CVE-2024-45337 addresses a critical authentication bypass vulnerability in Go's crypto/ssh library. This flaw, rated CVSS 9.1, could allow unauthorized access to SSH servers built with affected Go versions. It's crucial to update immediately.
What is Go crypto/ssh – Misuse of ServerConfig.PublicKeyCallback?
The vulnerability stems from a logic error in crypto/ssh's ServerConfig.PublicKeyCallback. When this callback approves a public key, the authentication flow might incorrectly authorize the connection even if subsequent authentication steps fail. This bypasses intended security checks, allowing unauthorized access.
Impact and Risks for your Infrastructure
This critical flaw enables unauthorized SSH authentication bypass in Go applications. Attackers can authenticate to vulnerable SSH servers using any public key, potentially gaining full control over affected systems. This leads to severe data breaches, system compromise, and service disruption.
Step-by-Step Mitigation Guide
To mitigate CVE-2024-45337, update your Go applications to versions 1.22.10+ or 1.23.4+. Rebuild and redeploy all affected services. Verify the fix by checking your Go version and ensuring crypto/ssh implementations are using the updated library.
- 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.