Cloudanix VulnDB

CVE-2025-5987

High · 8.1

CVSS

8.1

EPSS

1.7%

Published

Jul 7, 2025

CISA due date

—

Cloudanix analysis

Monitor only SSVC: Track

A bug in a widely used secure-connection library can let attackers read or change data or crash systems when memory runs low during encryption setup.

Exploitation
Remote Unauthenticated
Attacker needs
None
Complexity
High
Impact
Full Compromise
Component
Library
Class
Memory Corruption
Remediation
Upgrade
Effort
Medium
Patch risk
Low

What it actually does

In libssh using ChaCha20 with OpenSSL, heap exhaustion produces an OpenSSL error code that aliases SSH_OK; the error goes undetected and libssh proceeds with a partially initialized cipher context, yielding undefined behavior that can corrupt confidentiality or integrity or cause crashes.

Why it matters to the business

Systems that rely on libssh for encrypted remote access face elevated risk of data exposure, tampering, or sudden outages; the issue affects multiple Harbor container images and any downstream applications using the vulnerable libssh build.

How an attack unfolds

An attacker forces heap exhaustion during ChaCha20 cipher initialization over an SSH connection; because the OpenSSL error is misinterpreted as success, libssh accepts the malformed context and subsequent packet processing triggers undefined behavior that the attacker can leverage for information disclosure or denial of service.

How to fix it

Upgrade libssh to commit dff6c0821ed54f6fbf5b755af43f54cbb723b1b1 or later; for the listed Harbor-FIPS images update to version 2.11.2-r15 or newer. Disable ChaCha20 in sshd_config as a temporary mitigation if immediate patching is not feasible.

How to confirm the fix worked

Confirm package versions match the fixed releases, run targeted regression tests that simulate heap exhaustion during ChaCha20 cipher setup, and verify that OpenSSL errors are now correctly surfaced as SSH errors.

Typical attack path

  1. Establish an SSH session requesting the ChaCha20 cipher
  2. Induce heap pressure to trigger OpenSSL allocation failure
  3. Send crafted packets that exercise the partially initialized context
  4. Observe or manipulate resulting undefined behavior for data access or crash

How to detect it

Search application and system logs for libssh processes terminating abnormally during SSH handshakes that negotiated ChaCha20; correlate with memory-pressure indicators or failed allocation messages from OpenSSL.

What your security team should do

  • Apply the listed fixed versions to all affected Harbor and libssh deployments within the next maintenance window
  • Review sshd_config files to ensure ChaCha20 is not the sole enabled cipher
  • Increase monitoring of SSH-related crashes and memory-pressure events for the next 30 days given the rising EPSS trend

The record

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

Ecosystem Package Introduced Fixed
AlmaLinux:10 libssh 0 0.11.1-5.el10_1
AlmaLinux:10 libssh-config 0 0.11.1-5.el10_1
AlmaLinux:10 libssh-devel 0 0.11.1-5.el10_1
AlmaLinux:9 libssh 0 0.10.4-17.el9_7
AlmaLinux:9 libssh-config 0 0.10.4-17.el9_7
AlmaLinux:9 libssh-devel 0 0.10.4-17.el9_7
Chainguard libssh 0 0.11.3-r0
Chainguard libssh-dev 0 0.11.3-r0
Chainguard libssh2 0 1.11.1-r1
Chainguard libssh2-dev 0 1.11.1-r1
Chainguard libssh2-doc 0 1.11.1-r1
Debian:11 libssh 0 No fix
Debian:12 libssh 0 No fix
Debian:13 libssh 0 0.11.2-1
Debian:14 libssh 0 0.11.2-1
Wolfi libssh 0 0.11.3-r0
Wolfi libssh-dev 0 0.11.3-r0
Wolfi libssh2 0 1.11.1-r1
Wolfi libssh2-dev 0 1.11.1-r1
Wolfi libssh2-doc 0 1.11.1-r1
openSUSE:Tumbleweed libssh 0 0.11.2-1.1

Related vulnerabilities