Description

A high-severity security vulnerability, tracked as CVE-2024-45337 (CVSS score 9.1), has been identified in the Golang cryptography library, specifically within the ServerConfig[.]PublicKeyCallback function. This vulnerability could allow attackers to bypass authorization controls in affected systems. The PublicKeyCallback function is meant to validate public keys provided by clients during SSH authentication. However, its documentation explicitly states that it does not ensure the authenticity of the keys used for authentication. The issue arises when applications mistakenly depend on the order or content of the public keys passed to the callback to make authorization decisions. Attackers can exploit this vulnerability by submitting multiple keys to confuse the server or by using alternative authentication methods, such as passwords or keyboard-interactive methods, to bypass public key authentication. This mismatch between the provided keys and the actual authentication method used may result in unauthorized access. To address this issue, users should update to golang.org/x/crypto v0.31.0 or later. This update resolves the vulnerability by ensuring only the final public key passed to the PublicKeyCallback during successful authentication is deemed valid. Developers are also encouraged to use the Permissions field within authentication callbacks to store relevant data for each attempt, thereby avoiding dependence on key order for authorization. Additionally, it is vital to audit third-party libraries that interact with the Golang cryptography library to confirm they are not susceptible to this flaw. Implementing these measures will help secure systems and prevent exploitation of this vulnerability.