CVE-2025-5372 Libssh: incorrect return code handling in ssh_kdf() in libssh

Medium 5.0 Published Updated

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:8All versions0.9.6-16.el8_10
libssh-config AlmaLinux:8All versions0.9.6-16.el8_10
libssh-devel AlmaLinux:8All versions0.9.6-16.el8_10
libssh-debuginfo Red Hat:enterprise_linux:8::appstreamAll versions0:0.9.6-16.el8_10
libssh-debugsource Red Hat:enterprise_linux:8::appstreamAll versions0:0.9.6-16.el8_10
libssh-devel Red Hat:enterprise_linux:8::appstreamAll versions0:0.9.6-16.el8_10
libssh Red Hat:enterprise_linux:8::baseosAll versions0:0.9.6-16.el8_10
libssh-config Red Hat:enterprise_linux:8::baseosAll versions0:0.9.6-16.el8_10
libssh-debuginfo Red Hat:enterprise_linux:8::baseosAll versions0:0.9.6-16.el8_10
libssh-debugsource Red Hat:enterprise_linux:8::baseosAll versions0:0.9.6-16.el8_10
libssh-debuginfo Red Hat:rhel_aus:8.4::appstreamAll versions0:0.9.4-2.el8_4.2
libssh-debugsource Red Hat:rhel_aus:8.4::appstreamAll versions0:0.9.4-2.el8_4.2
libssh-devel Red Hat:rhel_aus:8.4::appstreamAll versions0:0.9.4-2.el8_4.2
libssh Red Hat:rhel_aus:8.4::baseosAll versions0:0.9.4-2.el8_4.2
libssh-config Red Hat:rhel_aus:8.4::baseosAll versions0:0.9.4-2.el8_4.2
libssh-debuginfo Red Hat:rhel_aus:8.4::baseosAll versions0:0.9.4-2.el8_4.2
libssh-debugsource Red Hat:rhel_aus:8.4::baseosAll versions0:0.9.4-2.el8_4.2
libssh-debuginfo Red Hat:rhel_aus:8.6::appstreamAll versions0:0.9.6-4.el8_6.2
libssh-debugsource Red Hat:rhel_aus:8.6::appstreamAll versions0:0.9.6-4.el8_6.2
libssh-devel Red Hat:rhel_aus:8.6::appstreamAll versions0:0.9.6-4.el8_6.2
libssh Red Hat:rhel_aus:8.6::baseosAll versions0:0.9.6-4.el8_6.2
libssh-config Red Hat:rhel_aus:8.6::baseosAll versions0:0.9.6-4.el8_6.2
libssh-debuginfo Red Hat:rhel_aus:8.6::baseosAll versions0:0.9.6-4.el8_6.2
libssh-debugsource Red Hat:rhel_aus:8.6::baseosAll versions0:0.9.6-4.el8_6.2
libssh-debuginfo Red Hat:rhel_e4s:8.8::appstreamAll versions0:0.9.6-13.el8_8.2
libssh-debugsource Red Hat:rhel_e4s:8.8::appstreamAll versions0:0.9.6-13.el8_8.2
libssh-devel Red Hat:rhel_e4s:8.8::appstreamAll versions0:0.9.6-13.el8_8.2
libssh Red Hat:rhel_e4s:8.8::baseosAll versions0:0.9.6-13.el8_8.2
libssh-config Red Hat:rhel_e4s:8.8::baseosAll versions0:0.9.6-13.el8_8.2
libssh-debuginfo Red Hat:rhel_e4s:8.8::baseosAll versions0:0.9.6-13.el8_8.2
libssh-debugsource Red Hat:rhel_e4s:8.8::baseosAll versions0:0.9.6-13.el8_8.2
libssh-debuginfo Red Hat:rhel_e4s:9.0::appstreamAll versions0:0.9.6-3.el9_0.2
libssh-debugsource Red Hat:rhel_e4s:9.0::appstreamAll versions0:0.9.6-3.el9_0.2
libssh-devel Red Hat:rhel_e4s:9.0::appstreamAll versions0:0.9.6-3.el9_0.2
libssh Red Hat:rhel_e4s:9.0::baseosAll versions0:0.9.6-3.el9_0.2
libssh-config Red Hat:rhel_e4s:9.0::baseosAll versions0:0.9.6-3.el9_0.2
libssh-debuginfo Red Hat:rhel_e4s:9.0::baseosAll versions0:0.9.6-3.el9_0.2
libssh-debugsource Red Hat:rhel_e4s:9.0::baseosAll versions0:0.9.6-3.el9_0.2
libssh-debuginfo Red Hat:rhel_eus_long_life:8.4::appstreamAll versions0:0.9.4-2.el8_4.2
libssh-debugsource Red Hat:rhel_eus_long_life:8.4::appstreamAll versions0: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.

All Redhat Enterprise Linux vulnerabilities

Sources

Also known as ALSA-2025:21977, AZL-64650, AZL-64656, BELL-CVE-2025-5372, CLSA-2025-1759330475, CLSA-2025-1759782399 and 13 more.

Is CVE-2025-5372 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free