# CVE-2025-5372: libssh incorrect return code handling in ssh_kdf

Source: https://junglewise.ai/threats/cve-2025-5372-libssh-incorrect-return-code-handling-in-ssh-kdf  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2025-07-04. Updated: 2026-06-08  
License: CC BY 4.0 with a link back

CVE-2025-5372 · Severity: medium · CVSS 5 · Published 2025-07-04

A security flaw has been identified in libssh, a library used by many applications to provide secure encrypted communications. When built with older versions of the OpenSSL security toolkit, the library may fail to properly generate encryption keys but continue as if it had succeeded. This could allow an attacker to compromise the confidentiality and integrity of SSH sessions, potentially leading to the exposure of sensitive data or unauthorized access to systems.

Technologies: [Libssh](https://junglewise.ai/threats/technologies/libssh). Vendors: [Libssh](https://junglewise.ai/threats/vendors/libssh).

## Quick answers

**Is CVE-2025-5372 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2025-5372 being exploited in the wild.

**How severe is CVE-2025-5372?** Medium severity, with a CVSS score of 5, published 4 July 2025.

**Which products and versions are affected?** Libssh < 0.11.2.

**Is there a fix for CVE-2025-5372?** A patch was published on 2025-11-24: Red Hat released initial patches for RHEL 8 Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2025-5372 attacked?** It is attacked over the network, in a software library.

**Am I affected by CVE-2025-5372?** Check whether you run Libssh at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## Technical details

A flaw exists in the ssh_kdf() function of libssh when compiled against OpenSSL versions older than 3.0. The vulnerability stems from an inconsistent interpretation of return values: OpenSSL uses 0 to signal a failure, whereas libssh interprets 0 as success. Consequently, if the key derivation function fails, libssh may proceed using uninitialized cryptographic key buffers. This can be exploited by a network-based attacker to compromise the confidentiality, integrity, and availability of SSH sessions. The issue is addressed in libssh version 0.11.2 and various Red Hat package updates.

## Affected products

- libssh libssh < 0.11.2
- Red Hat Enterprise Linux 6.0, 7.0, 8.0, 9.0, 10.0
- Red Hat OpenShift Container Platform 4.0

## Timeline

- 2025-07-04: disclosed
- 2025-07-04: advisory
- 2025-11-24: patched: Red Hat released initial patches for RHEL 8

## References

- [https://access.redhat.com/errata/RHSA-2025:21977](https://access.redhat.com/errata/RHSA-2025:21977)
- [https://access.redhat.com/errata/RHSA-2025:23024](https://access.redhat.com/errata/RHSA-2025:23024)
- [https://access.redhat.com/errata/RHSA-2026:20610](https://access.redhat.com/errata/RHSA-2026:20610)
- [https://access.redhat.com/errata/RHSA-2026:24349](https://access.redhat.com/errata/RHSA-2026:24349)
- [https://access.redhat.com/security/cve/CVE-2025-5372](https://access.redhat.com/security/cve/CVE-2025-5372)
- [https://bugzilla.redhat.com/show_bug.cgi?id=2369388](https://bugzilla.redhat.com/show_bug.cgi?id=2369388)

## Related threats

- [libssh authentication bypass in GSSAPIKeyExchange](https://junglewise.ai/threats/cve-2026-59851-libssh-authentication-bypass-in-gssapikeyexchange)
- [libssh use-after-free in channel data callbacks](https://junglewise.ai/threats/cve-2026-59850-libssh-use-after-free-in-channel-data-callbacks)
- [libssh infinite loop in certificate-based authentication](https://junglewise.ai/threats/cve-2026-59849-libssh-infinite-loop-in-certificate-based-authentication)
- [libssh denial of service via memory exhaustion in SFTP client](https://junglewise.ai/threats/cve-2026-59848-libssh-denial-of-service-via-memory-exhaustion-in-sftp-client)
- [libssh integrity protection bypass in OpenSSL AES-GCM backend](https://junglewise.ai/threats/cve-2026-59847-libssh-integrity-protection-bypass-in-openssl-aes-gcm-backend)
