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, rated CVSS 9.1, allows unauthorized SSH authentication bypass in affected applications. It's crucial to update to patched versions to prevent potential security breaches.
What is Go crypto/ssh – Misuse of ServerConfig.PublicKeyCallback?
This vulnerability stems from a logic flaw in Go's `crypto/ssh` library. Specifically, applications using `ServerConfig.PublicKeyCallback` can incorrectly authorize SSH connections. This occurs even if the callback approves a public key but the subsequent authentication process fails, leading to an authentication bypass.
Impact and Risks for your Infrastructure
The primary impact is unauthorized SSH authentication bypass. Attackers can gain access to SSH servers running vulnerable Go applications using any public key, regardless of its validity. This can lead to unauthorized access to sensitive systems and data, compromising infrastructure integrity.
Step-by-Step Mitigation Guide
To mitigate CVE-2024-45337, update your Go applications to versions 1.22.10+ or 1.23.4+. Verify the fix by ensuring your Go environment is running the patched version. Rebuild and redeploy any affected services to incorporate the security update promptly.
- 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.