CVEfocus › CVE database › CVE-2025-5987

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

CVSS 8.1 HighEPSS 2.3% (higher than 84% of CVEs)Published 2025-07-07Updated 2026-11-23Assigner: redhat

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.

CWE-393

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

19Fixed
6Will not fix
4Not affected

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.

ReleasePackageStatusFixed versionAdvisory
Ubuntu 24.04libsshFixed0.10.6-2ubuntu0.1UBUNTU-CVE-2025-5987
Ubuntu 22.04libsshNot affected
vulnerable_code_not_present
Debian 14libsshFixed0.11.2-1DEBIAN-CVE-2025-5987
Debian 13libsshFixed0.11.2-1DEBIAN-CVE-2025-5987
Debian 12libsshFixed0.10.6-0+deb12u2DEBIAN-CVE-2025-5987
Red Hat Enterprise Linux 10libsshFixed0:0.11.1-5.el10_1RHSA-2025:23484
Red Hat Enterprise Linux 10libssh-configFixed0:0.11.1-5.el10_1RHSA-2025:23484
Red Hat Enterprise Linux 10libssh-develFixed0:0.11.1-5.el10_1RHSA-2025:23484
Red Hat Enterprise Linux 9libsshFixed0:0.10.4-17.el9_7RHSA-2025:23483
Red Hat Enterprise Linux 9libssh-configFixed0:0.10.4-17.el9_7RHSA-2025:23483
Red Hat Enterprise Linux 9libssh-develFixed0:0.10.4-17.el9_7RHSA-2025:23483
Red Hat Enterprise Linux 8libsshNot affected
Red Hat Enterprise Linux 8libssh-configNot affected
Red Hat Enterprise Linux 8libssh-develNot affected
Red Hat Enterprise Linux 7libssh2Will not fix
Out of support scope
Red Hat Enterprise Linux 7libssh2-develWill not fix
Out of support scope
Red Hat Enterprise Linux 7libssh2-docsWill not fix
Out of support scope
Red Hat Enterprise Linux 6libssh2Will not fix
Out of support scope
Red Hat Enterprise Linux 6libssh2-develWill not fix
Out of support scope
Red Hat Enterprise Linux 6libssh2-docsWill not fix
Out of support scope
AlmaLinux 10libssh-configFixed0.11.1-5.el10_1ALSA-2025:23484
AlmaLinux 9libsshFixed0.10.4-17.el9_7ALSA-2025:23483
AlmaLinux 9libssh-configFixed0.10.4-17.el9_7ALSA-2025:23483
AlmaLinux 9libssh-develFixed0.10.4-17.el9_7ALSA-2025:23483
Rocky Linux 10libsshFixed0:0.11.1-5.el10_1RLSA-2025:23484
Rocky Linux 9libsshFixed0:0.10.4-17.el9_7RLSA-2025:23483
Alpine Linux 3.24libsshFixed0.11.2-r0ALPINE-CVE-2025-5987
Alpine Linux 3.23libsshFixed0.11.2-r0ALPINE-CVE-2025-5987
Alpine Linux 3.22libsshFixed0.11.2-r0ALPINE-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.

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:

References

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.