CVE-2025-5372 Libssh: incorrect return code handling in ssh_kdf() in libssh
Attackers can compromise SSH session confidentiality and integrity due to incorrect return code handling in libssh when using older OpenSSL versions.
- Exploited in the wild
- Not known
- Login needed
- Any signed-in user
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2025-5372?
CVE-2025-5372 is a medium-severity vulnerability in Redhat Enterprise Linux, published on 4 Jul 2025. Any signed-in user can exploit it over the network, with no action from the victim.
Official description
A flaw was found in libssh versions built with OpenSSL versions older than 3.0, specifically in the ssh_kdf() 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.
Weakness: CWE-682
Which versions are affected by CVE-2025-5372?
It affects 3 products.
Linux distribution packages (40)
libssh AlmaLinux:8 | All versions | 0.9.6-16.el8_10 |
libssh-config AlmaLinux:8 | All versions | 0.9.6-16.el8_10 |
libssh-devel AlmaLinux:8 | All versions | 0.9.6-16.el8_10 |
libssh-debuginfo Red Hat:enterprise_linux:8::appstream | All versions | 0:0.9.6-16.el8_10 |
libssh-debugsource Red Hat:enterprise_linux:8::appstream | All versions | 0:0.9.6-16.el8_10 |
libssh-devel Red Hat:enterprise_linux:8::appstream | All versions | 0:0.9.6-16.el8_10 |
libssh Red Hat:enterprise_linux:8::baseos | All versions | 0:0.9.6-16.el8_10 |
libssh-config Red Hat:enterprise_linux:8::baseos | All versions | 0:0.9.6-16.el8_10 |
libssh-debuginfo Red Hat:enterprise_linux:8::baseos | All versions | 0:0.9.6-16.el8_10 |
libssh-debugsource Red Hat:enterprise_linux:8::baseos | All versions | 0:0.9.6-16.el8_10 |
libssh-debuginfo Red Hat:rhel_aus:8.4::appstream | All versions | 0:0.9.4-2.el8_4.2 |
libssh-debugsource Red Hat:rhel_aus:8.4::appstream | All versions | 0:0.9.4-2.el8_4.2 |
libssh-devel Red Hat:rhel_aus:8.4::appstream | All versions | 0:0.9.4-2.el8_4.2 |
libssh Red Hat:rhel_aus:8.4::baseos | All versions | 0:0.9.4-2.el8_4.2 |
libssh-config Red Hat:rhel_aus:8.4::baseos | All versions | 0:0.9.4-2.el8_4.2 |
libssh-debuginfo Red Hat:rhel_aus:8.4::baseos | All versions | 0:0.9.4-2.el8_4.2 |
libssh-debugsource Red Hat:rhel_aus:8.4::baseos | All versions | 0:0.9.4-2.el8_4.2 |
libssh-debuginfo Red Hat:rhel_aus:8.6::appstream | All versions | 0:0.9.6-4.el8_6.2 |
libssh-debugsource Red Hat:rhel_aus:8.6::appstream | All versions | 0:0.9.6-4.el8_6.2 |
libssh-devel Red Hat:rhel_aus:8.6::appstream | All versions | 0:0.9.6-4.el8_6.2 |
libssh Red Hat:rhel_aus:8.6::baseos | All versions | 0:0.9.6-4.el8_6.2 |
libssh-config Red Hat:rhel_aus:8.6::baseos | All versions | 0:0.9.6-4.el8_6.2 |
libssh-debuginfo Red Hat:rhel_aus:8.6::baseos | All versions | 0:0.9.6-4.el8_6.2 |
libssh-debugsource Red Hat:rhel_aus:8.6::baseos | All versions | 0:0.9.6-4.el8_6.2 |
libssh-debuginfo Red Hat:rhel_e4s:8.8::appstream | All versions | 0:0.9.6-13.el8_8.2 |
libssh-debugsource Red Hat:rhel_e4s:8.8::appstream | All versions | 0:0.9.6-13.el8_8.2 |
libssh-devel Red Hat:rhel_e4s:8.8::appstream | All versions | 0:0.9.6-13.el8_8.2 |
libssh Red Hat:rhel_e4s:8.8::baseos | All versions | 0:0.9.6-13.el8_8.2 |
libssh-config Red Hat:rhel_e4s:8.8::baseos | All versions | 0:0.9.6-13.el8_8.2 |
libssh-debuginfo Red Hat:rhel_e4s:8.8::baseos | All versions | 0:0.9.6-13.el8_8.2 |
libssh-debugsource Red Hat:rhel_e4s:8.8::baseos | All versions | 0:0.9.6-13.el8_8.2 |
libssh-debuginfo Red Hat:rhel_e4s:9.0::appstream | All versions | 0:0.9.6-3.el9_0.2 |
libssh-debugsource Red Hat:rhel_e4s:9.0::appstream | All versions | 0:0.9.6-3.el9_0.2 |
libssh-devel Red Hat:rhel_e4s:9.0::appstream | All versions | 0:0.9.6-3.el9_0.2 |
libssh Red Hat:rhel_e4s:9.0::baseos | All versions | 0:0.9.6-3.el9_0.2 |
libssh-config Red Hat:rhel_e4s:9.0::baseos | All versions | 0:0.9.6-3.el9_0.2 |
libssh-debuginfo Red Hat:rhel_e4s:9.0::baseos | All versions | 0:0.9.6-3.el9_0.2 |
libssh-debugsource Red Hat:rhel_e4s:9.0::baseos | All versions | 0:0.9.6-3.el9_0.2 |
libssh-debuginfo Red Hat:rhel_eus_long_life:8.4::appstream | All versions | 0:0.9.4-2.el8_4.2 |
libssh-debugsource Red Hat:rhel_eus_long_life:8.4::appstream | All versions | 0:0.9.4-2.el8_4.2 |
Products include Libssh Libssh, Redhat Enterprise Linux, Redhat Openshift Container Platform.
How do I fix CVE-2025-5372?
Apply the vendor's patch.
Is CVE-2025-5372 being exploited?
There is no known exploitation of CVE-2025-5372 in the wild and no public exploit code.
Other vulnerabilities in Redhat Enterprise Linux
- CVE-2026-59851 Libssh: libssh: authentication bypass via missing gssapi principal check
- CVE-2025-5987 Libssh: invalid return code for chacha20 poly1305 with openssl backend
- CVE-2025-14821 Libssh: libssh: insecure default configuration leads to local man-in-the-middle attacks on windows
- CVE-2012-4560 Memory corruption in n/a
- CVE-2012-4562 Integer overflow in n/a
Sources
Also known as ALSA-2025:21977, AZL-64650, AZL-64656, BELL-CVE-2025-5372, CLSA-2025-1759330475, CLSA-2025-1759782399 and 13 more.