Junglewise Threat Intelligence

CVE-2025-5987: libssh improper error handling in ChaCha20 cipher initialization

CVE-2025-5987 · Severity: high · CVSS 8.1 · Published 2025-07-07

Technologies: Red Hat Enterprise Linux 9, Red Hat Enterprise Linux 10, Libssh. Vendors: Red Hat, Libssh.

Executive brief

libssh is a widely used library that allows applications to communicate securely using the SSH protocol. A flaw was found where the library fails to properly detect errors when using specific encryption methods (ChaCha20) in combination with the OpenSSL security toolkit. If an attacker can trigger a memory exhaustion state, they may be able to compromise the confidentiality and integrity of the encrypted data or cause the application to crash.

Technical details

A vulnerability exists in libssh's OpenSSL backend when handling the ChaCha20-Poly1305 cipher. The root cause is a return code aliasing issue where an OpenSSL error code (typically resulting from heap exhaustion during cipher initialization) is incorrectly interpreted as SSH_OK. This leads to the use of a partially initialized or uninitialized cipher context. An attacker who can influence memory pressure or trigger specific allocation failures could potentially cause undefined behavior, including memory corruption, crashes, or the compromise of encrypted communication. The issue is fixed in libssh 0.11.2 and 0.12.0, with backported patches available for various Red Hat Enterprise Linux versions.

Affected products

  • libssh libssh >= 0.10.0, < 0.11.2
  • Red Hat Red Hat Enterprise Linux 9 libssh < 0.10.4-17.el9_7
  • Red Hat Red Hat Enterprise Linux 10 libssh < 0.11.1-5.el10_1

Timeline

  • 2025-07-07: disclosed: Initial CVE publication date
  • 2025-12-17: patched: Red Hat released security advisories RHSA-2025:23483 and RHSA-2025:23484

References

Related threats