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:HCVSS and EPSS are reproduced from their sources (NVD, FIRST EPSS). EPSS, Forum of Incident Response and Security Teams (FIRST), epss.first.org. Risk Priority is our own derived reading, not an NVD score.
Summary
CVE-2025-5987 is a high-severity Return of Wrong Status Code (CWE-393) vulnerability in Libssh. Its CVSS base score is 8.1 (High).
Operationally, exploitation aligns with the MITRE ATT&CK technique Application or System Exploitation (T1499.004); ranked in the top 22% 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
MITRE ATT&CK Enterprise Techniques
MITRE ATT&CK v20.0
CVEs Like This One
Affected Assets
Mitigating Controls
Mitigating Controls (NIST 800-53 r5)
Our mappings, made for this CVE.
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)
Our mappings, derived directly from the weakness types (CWEs) cited in the NVD entry via our CWE→CSF cross-walk — 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)
Our mappings, derived directly from the weakness types (CWEs) cited in the NVD entry via our CWE→ISO cross-walk — links open the control.
Security testing in development can detect functions returning wrong status codes.
Training can make developers more careful about return-value handling and status-code semantics, reducing some instances of this subtle implementation bug, but most occurrences (like the Apple 'goto fail' defect) are accidental code errors that escape review and testing, so training moves only a minority of instances.
Secure coding standards directly address proper return-value handling and error indication.
A.8.8's disclosure/scanning reach catches CWE-393 only where a vulnerable component already has a published CVE or advisory, while most wrong-status-code defects are first-party implementation logic never disclosed, so it finds a minority of latent instances.