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, with a CVSS score of 9.1, could lead to unauthorized SSH authentication bypass. It impacts applications using specific versions of the Go standard library.
What is Go crypto/ssh – Misuse of ServerConfig.PublicKeyCallback?
This vulnerability stems from a logic flaw in Go's crypto/ssh ServerConfig.PublicKeyCallback. When an application's callback approves a public key, but the subsequent authentication fails, the system may still incorrectly authorize the connection. This bypasses intended security checks, allowing unauthorized access.
Impact and Risks for your Infrastructure
The critical impact of CVE-2024-45337 is an unauthorized SSH authentication bypass. Attackers can gain access to affected Go SSH servers using any public key, regardless of proper authorization. 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 Go 1.22.10+ or Go 1.23.4+. Recompile and redeploy all affected services. Verify the fix by ensuring your Go environment is running the patched versions and conducting thorough access control tests.
- 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.