CVE-2025-5372: Libssh: incorrect return code handling in ssh_kdf() in libssh
A flaw was found in libssh versions built with OpenSSL versions older than 3.0, specifically in the sshkdf() function responsible for key derivation. Due to inconsistent interpretation of return values where OpenSSL uses 0 to indicate failure and libssh uses 0 for success—the function may mistakenly return a success status even when key derivation fails. This results in uninitialized cryptographic key buffers being used in subsequent communication, potentially compromising SSH sessions' confidentiality, integrity, and availability.
Other sources
Incorrect Success Return vulnerability in the sshkdf() function of libssh when built with OpenSSL versions prior to 3.0. This issue arises because libssh interprets OpenSSL's return value 0 (indicating failure) as SSHOK (indicating success). As a result, on failure, the function may return success without initializing the output key buffers. This can lead to the use of uninitialized cryptographic keys, affecting the encryption and decryption of SSH traffic. The vulnerability allows an attacker to exploit improper key handling, potentially resulting in data leakage, integrity issues, or denial of service during SSH communication.
— Red Hat
Libssh: incorrect return code handling in sshkdf() in libssh
— Microsoft
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Configuration
In the ssh_kdf() function, do not interpret OpenSSL’s return value 0 (failure) as SSH_OK; adjust the return-code handling so key derivation failures do not proceed with uninitialized output key buffers.
libssh ssh_kdf() return-code handling = Treat OpenSSL return value 0 as failure (not success)
Event History
Frequently Asked Questions
What is the severity of CVE-2025-5372?
CVE-2025-5372 has been assigned a severity rating that indicates a medium level of risk due to potential key derivation errors.
How do I fix CVE-2025-5372?
To fix CVE-2025-5372, upgrade libssh to a version that is compatible with OpenSSL 3.0 or newer.
What software is affected by CVE-2025-5372?
CVE-2025-5372 affects libssh versions built with OpenSSL versions older than 3.0.
What is the impact of CVE-2025-5372?
The impact of CVE-2025-5372 includes the potential for incorrect key derivation, which can lead to security vulnerabilities.
How can I determine if I'm using a vulnerable version related to CVE-2025-5372?
You can determine if you are vulnerable by checking the versions of both libssh and OpenSSL in your environment.