# CVE-2025-5987: Libssh: invalid return code for chacha20 poly1305 with openssl backend

- Severity: High 8.1 (CVSS:3.1, scored by redhat) `CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 1.73%, higher than 78% of CVEs (2026-12-01)
- Published: 2025-07-07T14:24:12.576Z
- Modified: 2026-11-23T23:17:00.763Z
- Weaknesses: CWE-393
- SSVC (CISA-ADP): exploitation none, automatable no, technical impact total
- Assigned by: redhat

## Description

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. 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.

(As written by CVE List.)

## Affected

- libssh: from 0.10.0 before 0.11.2 (not affected: from 0:0.11.1-5.el10_1 before *; from 0:0.11.1-4.el10_0.1 before *; from 0:0.10.4-17.el9_7 before *; from 0:0.10.4-9.el9_2.2 before *; from 0:0.10.4-13.el9_4.2 before *; from 0:0.10.4-15.el9_6.1 before *)
- openshift/ose-rhel-coreos-9: no versions given (not affected: from 413.92.202602240113-0 before *; from 414.92.202601191325-0 before *; from 415.92.202601271320-0 before *; from 416.94.202601160124-0 before *; from 417.94.202601120213-0 before *; from 418.94.202601202224-0 before *; from 4.19.9.6.202601260820-0 before *; from 4.20.9.6.202601211057-0 before *)
- libssh2: no versions given
- openshift/ose-rhel-coreos-8: no versions given
- libssh libssh: from 0.10.0 before 0.11.2

## Every score

- redhat: CVSS:3.1 8.1 High `CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H`
- NVD: CVSS:3.1 8.1 High `CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H`

## References

- <https://access.redhat.com/errata/RHSA-2025:23483> (vendor-advisory)
- <https://access.redhat.com/errata/RHSA-2025:23484> (vendor-advisory)
- <https://access.redhat.com/errata/RHSA-2026:0427> (vendor-advisory)
- <https://access.redhat.com/errata/RHSA-2026:0428> (vendor-advisory)
- <https://access.redhat.com/errata/RHSA-2026:0430> (vendor-advisory)
- <https://access.redhat.com/errata/RHSA-2026:0431> (vendor-advisory)
- <https://access.redhat.com/errata/RHSA-2026:0702> (vendor-advisory)
- <https://access.redhat.com/errata/RHSA-2026:0978> (vendor-advisory)
- <https://access.redhat.com/errata/RHSA-2026:0980> (vendor-advisory)
- <https://access.redhat.com/errata/RHSA-2026:0985> (vendor-advisory)
- <https://access.redhat.com/errata/RHSA-2026:0996> (vendor-advisory)
- <https://access.redhat.com/errata/RHSA-2026:1539> (vendor-advisory)
- <https://access.redhat.com/errata/RHSA-2026:1541> (vendor-advisory)
- <https://access.redhat.com/errata/RHSA-2026:3415> (vendor-advisory)
- <https://access.redhat.com/security/cve/CVE-2025-5987> (third-party-advisory, vdb-entry)
- <https://bugzilla.redhat.com/show_bug.cgi?id=2376219> (issue-tracking, third-party-advisory)
- <https://www.libssh.org/security/advisories/CVE-2025-5987.txt>

## Sources

- CVE List: [CVE-2025-5987](https://www.cve.org/CVERecord?id=CVE-2025-5987), CVE Terms of Use, modified 2026-11-23
- NVD: [CVE-2025-5987](https://nvd.nist.gov/vuln/detail/CVE-2025-5987), Public domain, modified 2026-11-23

---

Page: https://cve.day/CVE-2025-5987 · Whole record: https://cve.day/CVE-2025-5987.json · Rebuilt by cve.day 2026-11-25T22:59:00.726Z
