CVE-2025-5987
Libssh 0.10.0 – 0.11.2
Raw vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:HSummary
CVE-2025-5987 is a high-severity Return of Wrong Status Code (CWE-393) vulnerability in Libssh Libssh. Its CVSS base score is 8.1 (High).
Operationally, ranked in the top 29% of CVEs by exploit likelihood; it is not currently listed in the CISA KEV catalog.
The strongest mitigations our analysis identified map to SA-11 (Developer Testing and Evaluation) and SI-6 (Security and Privacy Function Verification) — see the control section below for these in your framework.
Deeper analysis AI-assisted summary
Synthesised by an AI model from the NVD description and linked references — a reading aid, not an authoritative source.
A flaw exists in libssh when the ChaCha20 cipher is used together with the OpenSSL library. Heap-exhaustion conditions during cipher initialization are not detected because the OpenSSL error return value aliases with SSH_OK; consequently libssh proceeds with a partially initialized cipher context. The resulting undefined behavior can affect data confidentiality and integrity or cause application crashes. The issue is tracked as CVE-2025-5987 and carries a CVSS 3.1 score of 8.1.
An unauthenticated remote attacker who can reach a libssh-based service and induce heap pressure may trigger the flaw. Successful exploitation can lead to disclosure or manipulation of session data as well as denial-of-service conditions. The attack requires high complexity because the adversary must both control network access and arrange the specific memory-exhaustion state.
Red Hat has published the advisories RHSA-2025:23483, RHSA-2025:23484, RHSA-2026:0427, RHSA-2026:0428 and RHSA-2026:0430 that address the defect; applying the corresponding libssh updates removes the erroneous error-code handling path. The associated EPSS score remains low (current 0.0123, peak 0.0149) with no material upward trajectory after disclosure.
EU & UK References
- 🇪🇺 ENISA EUVD: EUVD-2025-20227
Vulnerability Data
A flaw was found in libssh when using the ChaCha20 cipher with the OpenSSL library. If an attacker manages to exhaust the heap space, this error is not detected and may lead to libssh using a partially initialized cipher context.…
more
This occurs because the OpenSSL error code returned aliases with the SSH_OK code, resulting in libssh not properly detecting the error returned by the OpenSSL library. This issue can lead to undefined behavior, including compromised data confidentiality and integrity or crashes.
- CWE(s)
Related Threats
CVEs Like This One
Affected Assets
Mitigating Controls
Mitigating Controls (NIST 800-53 r5) AI
Developer testing and evaluation at post-design stages directly exercises code paths and can identify functions returning incorrect status codes.
Verification of correct security/privacy function operation will surface incorrect status codes that alter expected behavior.
Mitigating Controls (NIST CSF 2.0) AI
Derived directly from the weakness types (CWEs) cited in the NVD entry via our AI-authored CWE→CSF cross-walk (authority under review) — links open the control.
Secure SDLC practices such as code review, unit testing, and static analysis directly prevent incorrect status codes from being returned.
Mitigating Controls (ISO/IEC 27001:2022 Annex A) AI
Derived directly from the weakness types (CWEs) cited in the NVD entry via our AI-authored CWE→ISO cross-walk (authority under review) — links open the control.
Security testing in development can detect functions returning wrong status codes.
Secure development lifecycle includes code review and testing that can catch incorrect status codes.
Secure coding standards directly address proper return-value handling and error indication.