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 allows unauthorized access to SSH servers built with affected Go versions. Immediate action is required to secure your Go applications.
What is Go crypto/ssh – Misuse of ServerConfig.PublicKeyCallback?
This critical vulnerability, CVE-2024-45337, stems from a logic flaw in Go's crypto/ssh ServerConfig.PublicKeyCallback. Applications may incorrectly authorize SSH connections even when the callback approves a key but the actual authentication fails. This bypasses intended security checks, allowing unauthorized access.
Impact and Risks for your Infrastructure
The impact of CVE-2024-45337 is severe, enabling unauthorized SSH authentication bypass in Go applications. Attackers can gain full access to affected SSH servers using any public key, leading to data exfiltration, system compromise, and potential remote code execution. This poses a critical risk to infrastructure.
Step-by-Step Mitigation Guide
To mitigate CVE-2024-45337, upgrade your Go runtime to version 1.22.10 or 1.23.4, or newer. Verify the fix by recompiling and redeploying affected applications, ensuring the updated Go standard library is in use. Regularly check for Go security updates to maintain robust security posture.
- 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.