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', allows unauthorized SSH authentication bypass.
What is Go crypto/ssh – Misuse of ServerConfig.PublicKeyCallback?
This vulnerability arises from a logic flaw in Go's `crypto/ssh` `ServerConfig.PublicKeyCallback`. Applications may incorrectly authorize SSH connections if the callback approves a public key, even when subsequent authentication fails. This bypasses intended security checks, allowing unauthorized access.
Impact and Risks for your Infrastructure
The critical impact is unauthorized SSH authentication bypass in affected Go applications. Attackers can gain access to SSH servers using any public key, potentially leading to system compromise, data exfiltration, or further network penetration.
Step-by-Step Mitigation Guide
To fix CVE-2024-45337, upgrade your Go environment to version 1.22.10+ or 1.23.4+. Verify the fix by ensuring your Go applications are compiled with the patched versions, preventing the `PublicKeyCallback` misuse. Rebuild and redeploy affected services.
- 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.