CVE-2025-5987Libssh: invalid return code for chacha20 poly1305 with openssl backend
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.
What to do
Fixed builds are available from AlmaLinux, Alpine, Debian, Red Hat, Rocky Linux, Ubuntu: see the table below for the fixed version per release.
Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.
curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \ -H "Content-Type: text/plain" --data-binary @inventory.txt
Vendor status at a glance
Status by vendor and release
From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.
| Release | Package | Status | Fixed version | Advisory |
|---|---|---|---|---|
| Ubuntu 24.04 | libssh | Fixed | 0.10.6-2ubuntu0.1 | UBUNTU-CVE-2025-5987 |
| Ubuntu 22.04 | libssh | Not affected vulnerable_code_not_present | ||
| Debian 14 | libssh | Fixed | 0.11.2-1 | DEBIAN-CVE-2025-5987 |
| Debian 13 | libssh | Fixed | 0.11.2-1 | DEBIAN-CVE-2025-5987 |
| Debian 12 | libssh | Fixed | 0.10.6-0+deb12u2 | DEBIAN-CVE-2025-5987 |
| Red Hat Enterprise Linux 10 | libssh | Fixed | 0:0.11.1-5.el10_1 | RHSA-2025:23484 |
| Red Hat Enterprise Linux 10 | libssh-config | Fixed | 0:0.11.1-5.el10_1 | RHSA-2025:23484 |
| Red Hat Enterprise Linux 10 | libssh-devel | Fixed | 0:0.11.1-5.el10_1 | RHSA-2025:23484 |
| Red Hat Enterprise Linux 9 | libssh | Fixed | 0:0.10.4-17.el9_7 | RHSA-2025:23483 |
| Red Hat Enterprise Linux 9 | libssh-config | Fixed | 0:0.10.4-17.el9_7 | RHSA-2025:23483 |
| Red Hat Enterprise Linux 9 | libssh-devel | Fixed | 0:0.10.4-17.el9_7 | RHSA-2025:23483 |
| Red Hat Enterprise Linux 8 | libssh | Not affected | ||
| Red Hat Enterprise Linux 8 | libssh-config | Not affected | ||
| Red Hat Enterprise Linux 8 | libssh-devel | Not affected | ||
| Red Hat Enterprise Linux 7 | libssh2 | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 7 | libssh2-devel | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 7 | libssh2-docs | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 6 | libssh2 | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 6 | libssh2-devel | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 6 | libssh2-docs | Will not fix Out of support scope | ||
| AlmaLinux 10 | libssh-config | Fixed | 0.11.1-5.el10_1 | ALSA-2025:23484 |
| AlmaLinux 9 | libssh | Fixed | 0.10.4-17.el9_7 | ALSA-2025:23483 |
| AlmaLinux 9 | libssh-config | Fixed | 0.10.4-17.el9_7 | ALSA-2025:23483 |
| AlmaLinux 9 | libssh-devel | Fixed | 0.10.4-17.el9_7 | ALSA-2025:23483 |
| Rocky Linux 10 | libssh | Fixed | 0:0.11.1-5.el10_1 | RLSA-2025:23484 |
| Rocky Linux 9 | libssh | Fixed | 0:0.10.4-17.el9_7 | RLSA-2025:23483 |
| Alpine Linux 3.24 | libssh | Fixed | 0.11.2-r0 | ALPINE-CVE-2025-5987 |
| Alpine Linux 3.23 | libssh | Fixed | 0.11.2-r0 | ALPINE-CVE-2025-5987 |
| Alpine Linux 3.22 | libssh | Fixed | 0.11.2-r0 | ALPINE-CVE-2025-5987 |
What the vendor says
As published in the CVE record by redhat, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.
- libssh: affected: 0.10.0 to before 0.11.2; fixed in
0.11.2 - Red Hat Enterprise Linux 10
- Red Hat Enterprise Linux 10.0 Extended Update Support
- Red Hat Enterprise Linux 9
- Red Hat Enterprise Linux 9.2 Update Services for SAP Solutions
- Red Hat Enterprise Linux 9.4 Extended Update Support
- Red Hat Enterprise Linux 9.6 Extended Update Support
- Red Hat OpenShift Container Platform 4.13
- Red Hat OpenShift Container Platform 4.14
- Red Hat OpenShift Container Platform 4.15
- Red Hat OpenShift Container Platform 4.16
- Red Hat OpenShift Container Platform 4.17
Workaround: A workaround for this issue is to disable the chacha20-poly1305@openssh.com cipher in applications using libssh when libssh is compiled with the OpenSSL backend, so the vulnerable ChaCha20-Poly1305 initialization path is not used. Alternatively, upgrade to a version of libssh containing the fix; upstream has released libssh 0.11.2 to correct this defect, and administrators are advised to upgrade or apply the upstream patch as soon as possible.
Vendor advisories:
- 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)
References
- https://access.redhat.com/errata/RHSA-2025:23483
- https://access.redhat.com/errata/RHSA-2025:23484
- https://access.redhat.com/errata/RHSA-2026:0427
- https://access.redhat.com/errata/RHSA-2026:0428
- https://access.redhat.com/errata/RHSA-2026:0430
- https://access.redhat.com/errata/RHSA-2026:0431
- https://access.redhat.com/errata/RHSA-2026:0702
- https://access.redhat.com/errata/RHSA-2026:0978
- https://access.redhat.com/errata/RHSA-2026:0980
- https://access.redhat.com/errata/RHSA-2026:0985
- https://access.redhat.com/errata/RHSA-2026:0996
- https://access.redhat.com/errata/RHSA-2026:1539
- https://access.redhat.com/errata/RHSA-2026:1541
- https://access.redhat.com/errata/RHSA-2026:3415
- https://access.redhat.com/security/cve/CVE-2025-5987
About this page
Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.