Vulnerability · Published Jul 7, 2025 · Assigned by redhat
CVE-2025-5987Libssh: invalid return code for chacha20 poly1305 with openssl backend
High 8.1
In plain English
A high-severity security flaw in libssh. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 1.7% (higher than 78% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.
Official 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.
Affected packages & fixed versions
| Ecosystem | Package | Fixed in | Advisory |
|---|---|---|---|
| AlmaLinux:9 | libssh | 0.10.4-17.el9_7 | ALSA-2025:23483 |
| AlmaLinux:10 | libssh-config | 0.11.1-5.el10_1 | ALSA-2025:23484 |
| AlmaLinux:9 | libssh-config | 0.10.4-17.el9_7 | ALSA-2025:23483 |
| AlmaLinux:9 | libssh-devel | 0.10.4-17.el9_7 | ALSA-2025:23483 |
| Alpine:v3.22 | libssh | 0.11.2-r0 | ALPINE-CVE-2025-5987 |
| Alpine:v3.23 | libssh | 0.11.2-r0 | ALPINE-CVE-2025-5987 |
| Alpine:v3.24 | libssh | 0.11.2-r0 | ALPINE-CVE-2025-5987 |
| Debian:12 | libssh | 0.10.6-0+deb12u2 | DEBIAN-CVE-2025-5987 |
| Debian:13 | libssh | 0.11.2-1 | DEBIAN-CVE-2025-5987 |
| Debian:14 | libssh | 0.11.2-1 | DEBIAN-CVE-2025-5987 |
| Rocky Linux:10 | libssh | 0:0.11.1-5.el10_1 | RLSA-2025:23484 |
| Rocky Linux:9 | libssh | 0:0.10.4-17.el9_7 | RLSA-2025:23483 |
| Ubuntu:22.04:LTS | libssh | 0.9.6-2ubuntu0.22.04.4 | USN-7619-1 |
| Ubuntu:24.04:LTS | libssh | 0.10.6-2ubuntu0.1 | UBUNTU-CVE-2025-5987 |
| Ubuntu:24.04:LTS | libssh | 0.10.6-2ubuntu0.1 | USN-7619-1 |
Affected products (as reported)
Weakness: CWE-393 · Vector: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
References
- RHSA-2025:23483 vendor-advisory, x_refsource_REDHAT
- RHSA-2025:23484 vendor-advisory, x_refsource_REDHAT
- RHSA-2026:0427 vendor-advisory, x_refsource_REDHAT
- RHSA-2026:0428 vendor-advisory, x_refsource_REDHAT
- RHSA-2026:0430 vendor-advisory, x_refsource_REDHAT
- RHSA-2026:0431 vendor-advisory, x_refsource_REDHAT
- RHSA-2026:0702 vendor-advisory, x_refsource_REDHAT
- RHSA-2026:0978 vendor-advisory, x_refsource_REDHAT
- RHSA-2026:0980 vendor-advisory, x_refsource_REDHAT
- RHSA-2026:0985 vendor-advisory, x_refsource_REDHAT
- RHSA-2026:0996 vendor-advisory, x_refsource_REDHAT
- RHSA-2026:1539 vendor-advisory, x_refsource_REDHAT
- RHSA-2026:1541 vendor-advisory, x_refsource_REDHAT
- RHSA-2026:3415 vendor-advisory, x_refsource_REDHAT
- https://access.redhat.com/security/cve/CVE-2025-5987 vdb-entry, x_refsource_REDHAT
- RHBZ#2376219 issue-tracking, x_refsource_REDHAT
- https://www.libssh.org/security/advisories/CVE-2025-5987.txt