CVE-2025-5987 | Libssh: 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.

Published: 2025-07-07 Last update: 2026-03-20 Assigner: [email protected] Source: [email protected]

Conclusion & alert: CVE-2025-5987 is rated Moderate Risk (59.9/100): CVSS High severity, with medium exploitation likelihood (EPSS 1.23%). Mandatory action: Review affected assets and schedule remediation.

Risk is dynamic; we continuously reassess and refresh what is shown on this page as upstream context changes.

Exploit prediction scoring system (EPSS) score for CVE-2025-5987

EPSS lead: Daily EPSS estimates relative likelihood of exploitation; percentile ranks this CVE among scored vulnerabilities (higher = more severe relative rank).

# Date Old EPSS score New EPSS score Delta (New - Old)
1 2026-05-26 1.49% 1.23% -0.26%
2 2026-05-23 0.29% 1.49% +1.20%
3 2026-05-03 0.29%

Full EPSS history (9 records total)

Common vulnerability scoring system (CVSS) metrics for CVE-2025-5987

CVSS metrics for this CVE.

Base score Version Severity Vector Exploitability Impact Score source
8.1 3.1 HIGH
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H Click to expand
Attack vector (AV:N)
Could be attacked over the internet or any normal routed network—not just someone sitting at the machine.
Attack complexity (AC:H)
Even with access, the exploit needs extra luck, timing, or a fussy environment to actually work.
Privileges required (PR:N)
No account or special rights needed—anonymous or random user is enough.
User interaction (UI:N)
Nobody has to click “OK” or open a trap file; it can work without a victim helping.
Scope (S:U)
Damage stays in the same “trust bubble” as the broken component—no big spill into unrelated systems.
Confidentiality (C:H)
Serious risk that confidential data gets exposed in a big way.
Integrity (I:H)
They could widely tamper with or forge data—trust in the data is badly hurt.
Availability (A:H)
Could take the service down hard or make it unusable for people who depend on it.
2.2 5.9 [email protected]
8.1 3.1 HIGH
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H Click to expand
Attack vector (AV:N)
Could be attacked over the internet or any normal routed network—not just someone sitting at the machine.
Attack complexity (AC:H)
Even with access, the exploit needs extra luck, timing, or a fussy environment to actually work.
Privileges required (PR:N)
No account or special rights needed—anonymous or random user is enough.
User interaction (UI:N)
Nobody has to click “OK” or open a trap file; it can work without a victim helping.
Scope (S:U)
Damage stays in the same “trust bubble” as the broken component—no big spill into unrelated systems.
Confidentiality (C:H)
Serious risk that confidential data gets exposed in a big way.
Integrity (I:H)
They could widely tamper with or forge data—trust in the data is badly hurt.
Availability (A:H)
Could take the service down hard or make it unusable for people who depend on it.
2.2 5.9 [email protected]

Weakness enumeration for CVE-2025-5987

OS Trackers for CVE-2025-5987

vendor priority summary link
alpine CVE-2025-5987: 1 source package rows (libssh); 6 state rows across 2 repos (3.22-community, edge-community); fixed 2, open 4. https://security.alpinelinux.org/vuln/CVE-2025-5987
debian unimportant CVE-2025-5987 unimportant priority: Debian including 1 source packages (libssh), 5 status rows across 5 suites (bookworm, bullseye, forky, sid, trixie): resolved 5. https://security-tracker.debian.org/tracker/CVE-2025-5987
redhat medium https://access.redhat.com/security/cve/CVE-2025-5987
suse medium CVE-2025-5987 severity moderate: SUSE including 259 source package names (2.2.1-5.14:libssh-config-0.10.6-slfo.1.1_2.1, 2.2.1-5.14:libssh4-0.10.6-slfo.1.1_2.1, …), 462 product×package rows across 79 product lines (Container suse/sl-micro/6.1/baremetal-os-container, Container suse/sl-micro/6.1/base-os-container, … (79 product lines)): Known Affected 231, Known Not Affected 135, Fixed 96. https://www.suse.com/security/cve/CVE-2025-5987/
ubuntu medium CVE-2025-5987 medium priority: Ubuntu including 1 source packages (libssh), 8 status rows across 8 suites (bionic, focal, jammy, noble, oracular, plucky, upstream, xenial): not-affected 4, released 4. https://ubuntu.com/security/CVE-2025-5987

Affected software / configurations for CVE-2025-5987

Vendor Product Version Raw CPE
libssh libssh >= 0.10.0, < 0.11.2 cpe:2.3:a:libssh:libssh:*:*:*:*:*:*:*:*

References for CVE-2025-5987

URL Tags
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 Third Party Advisory
https://bugzilla.redhat.com/show_bug.cgi?id=2376219 Issue Tracking Third Party Advisory
https://www.libssh.org/security/advisories/CVE-2025-5987.txt
cvelogic Threat Intelligence