How to fix CVE-2024-45337 – Step-by-Step Guide
CVE-2024-45337 is a critical vulnerability (CVSS 9.1) affecting the Go crypto/ssh package. It enables an unauthorized SSH authentication bypass, allowing attackers to gain access to Go applications. This flaw stems from a logic error in ServerConfig.PublicKeyCallback handling.
What is Go crypto/ssh – Misuse of ServerConfig.PublicKeyCallback?
This vulnerability arises when Go applications using crypto/ssh implement ServerConfig.PublicKeyCallback. A logic flaw allows the callback to approve a public key, but even if subsequent authentication steps fail, the connection may still be authorized. This bypasses the intended authentication flow, granting unauthorized access to SSH servers.
Impact and Risks for your Infrastructure
The critical impact of CVE-2024-45337 is an unauthorized SSH authentication bypass. Attackers can leverage this flaw to authenticate to affected Go SSH servers using any public key, potentially leading to full system compromise, data exfiltration, or unauthorized command execution on vulnerable infrastructure.
Step-by-Step Mitigation Guide
To mitigate CVE-2024-45337, update your Go applications to Go 1.22.10+ or Go 1.23.4+. Verify the fix by recompiling and redeploying your SSH server applications. Ensure your go.mod reflects the updated Go version and run go mod tidy to confirm dependencies are correctly resolved.
- 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.