CVE-2025-8277: Libssh: memory exhaustion via repeated key exchange in libssh
A flaw was found in libssh's handling of key exchange (KEX) processes when a client repeatedly sends incorrect KEX guesses. The library fails to free memory during these rekey operations, which can gradually exhaust system memory. This issue can lead to crashes on the client side, particularly when using libgcrypt, which impacts application stability and availability.
Other sources
Libssh: memory exhaustion via repeated key exchange in libssh
— Microsoft
Memory Exhaustion vulnerability in the key exchange logic of the libssh library. When an authenticated client repeatedly performs rekeying with incorrect firstkexpacketfollows guesses, libssh allocates new ephemeral key pairs without freeing old ones stored in session->nextcrypto. Over time, this results in a memory leak that can exhaust system memory and cause a client-side denial-of-service (DoS). This flaw affects several KEX algorithms (Curve25519, ECDH, sntrup761x25519, DH-GEX) across multiple crypto backends (libgcrypt, OpenSSL, mbedTLS). The issue requires an authenticated client and does not impact the server side. Versions Affected : libssh >= 0.6.0
— Red Hat
Affected Software
Event History
Frequently Asked Questions
What is the severity of CVE-2025-8277?
CVE-2025-8277 is considered a medium severity vulnerability due to its potential to exhaust system memory.
How do I fix CVE-2025-8277?
To fix CVE-2025-8277, update libssh to the latest version after the patch for this vulnerability is released.
What systems are affected by CVE-2025-8277?
CVE-2025-8277 affects all versions of the libssh library that utilize the key exchange (KEX) process.
What are the potential consequences of CVE-2025-8277?
The consequence of CVE-2025-8277 can include application crashes on the client side due to memory exhaustion.
Is there any workaround for CVE-2025-8277?
Currently, there is no known workaround for CVE-2025-8277 other than applying the upcoming patches.