OpenSSH 9.9p2 Fixes Two Critical MITM Vulnerabilities

OpenSSH provides a rich set of secure tunneling capabilities

Few days ago, Damian Miller (one of the developers of OpenSSH), made it known, through mailing lists, the OpenSSH 9.9p2 maintenance release that fixes two critical vulnerabilities discovered by Qualys, which could be exploited to carry out Man-in-the-Middle (MITM) attacks.

It is mentioned that these faults allowed an attacker to intercept SSH connections and trick the client into accepting a malicious server's key instead of the target server's legitimate key.

CVE-2025-26465: SSH key verification bypass

The first of the vulnerabilities that was fixed in the release of this corrective version is CVE-2025-26465. This vulnerability is due to a logical error in the ssh utility, which allows an attacker to bypass server key verification and successfully execute a MITM attack.

When a client tries to connect to an SSH server, An attacker can redirect traffic to a fake server and cause the client to accept the incorrect key without warning, believing it is connected to the legitimate server.

In addition to this, this vulnerability:

  • It has been present in OpenSSH since version 6.8p1 (December 2014).
  • Triggered when the VerifyHostKeyDNS option is enabled.
  • In the base OpenSSH configuration, this option is disabled by default, but in FreeBSD it was enabled until March 2023.

As for the causes that cause this failure, it is mentioned that This is because the verify_host_key_callback() function calls verify_host_key(), but only checks if the error code returned is -1, ignoring other error codes like -2. When verify_host_key() returns -2 when there is insufficient memory, but due to the omission of the error code, The system mistakenly assumes that the host key has been verified correctly.

An attacker can thus exploit this flaw by creating a fake SSH server that sends a large host key (256 KB), causing excessive memory consumption on the client and triggering the unhandled error condition.

CVE-2025-26466: Memory leak and excessive CPU consumption in SSH

The second vulnerability that was corrected is CVE-2025-26466 and this vulnerability affects both ssh client and sshd server, as allows to exhaust memory of the process and generate high CPU load by repeatedly sending SSH2_MSG_PING packets.

The great impact of this vulnerability lies in the fact that It can be exploited without authentication and affects OpenSSH since version 9.5p1 (August 2023). In addition, it allows an attacker to consume system resources, degrading its performance and even causing a denial of service (DoS).

Regarding the causes that cause this failure, it is mentioned that it is due to the fact that Each incoming 2-byte SSH16_MSG_PING packet causes a 256-byte buffer to be allocated in memory. This buffer is not freed until the key agreement is complete, resulting in a memory leak when multiple PING packets are sent.

Mitigation and solution

As a workaround, It is recommended to set restrictions in sshd_config using the following directives:

  • LoginGraceTime: This limits the timeout for authentication.
  • MaxStartups: restricts the number of unauthenticated connections.
  • PerSourcePenalties: applies penalties to clients that generate multiple connection attempts.

And as for the solutions, The first and most recommended is upgrade OpenSSH to the released version, “9.9p2” as soon as possible to fix these vulnerabilities. However, if immediate updating is not feasible, the mitigation measures mentioned above should be applied. Additionally, it is recommended to disable VerifyHostKeyDNS, unless reliable DNSSEC verification mechanisms are used.

If you are interested in knowing more about it, you can check the details in the following link.

How to install OpenSSH on Linux?

For those who are interested in being able to install this new version of OpenSSH on their systems, for now they can do it downloading the source code of this and performing the compilation on their computers.

This is because the new version has not yet been included in the repositories of the main Linux distributions. To get the source code, you can do from the following link.

Done the download, now we are going to unzip the package with the following command:

tar -xvf openssh-9.9p2.tar.gz

We enter the created directory:

cd openssh-9.9p2

Y we can compile with the following commands:

./configure --prefix = / opt --sysconfdir = / etc / ssh make make install