Platform
php
Component
phpseclib
Fixed in
1.0.28
CVE-2026-40194 affects phpseclib SSH2, a PHP library for SSH2 functionality. This vulnerability stems from a variable-time comparison during HMAC verification within the getbinarypacket() function, potentially leading to timing attacks. Affected versions include 0.1.1–>= 3.0.0, < 3.0.51. The vulnerability is mitigated by upgrading to version 3.0.51.
The vulnerability lies in the use of PHP's != operator for comparing HMACs, which, despite utilizing memcmp() for equal-length binary strings, still exhibits variable-time behavior. While memcmp() short-circuits on the first differing byte, the timing difference can still be exploited to leak information about the HMAC key. Although the severity is rated LOW, successful exploitation could allow an attacker to gain insights into the SSH key, potentially enabling further attacks. The inherent security mechanisms of SSH, specifically its disconnect-on-MAC-failure behavior, significantly limit the practical exploitation of this vulnerability over the network.
CVE-2026-40194 has a LOW CVSS score and is considered a defense-in-depth concern. There are currently no publicly available proof-of-concept exploits. The vulnerability was published on 2026-04-10. It is not currently listed on the CISA KEV catalog.
Exploit Status
EPSS
0.01% (2% percentile)
CISA SSVC
CVSS Vector
The primary mitigation for CVE-2026-40194 is to upgrade to phpseclib SSH2 version 3.0.51 or later. This version contains a fix that eliminates the variable-time comparison. If upgrading is not immediately feasible, consider implementing defense-in-depth measures. While SSH's built-in MAC failure handling provides some protection, it's not a substitute for patching. There are no known WAF or proxy rules that can directly address this vulnerability. Monitor SSH logs for unusual connection patterns or disconnections.
Update the phpseclib library to version 3.0.51, 2.0.53, or 1.0.28 to mitigate the vulnerability. The update replaces the insecure comparison with the != operator with the hash_equals() function, which provides a secure binary string comparison.
Vulnerability analysis and critical alerts directly to your inbox.
CVE-2026-40194 is a LOW severity vulnerability in phpseclib SSH2 affecting versions 0.1.1–>= 3.0.0, < 3.0.51, where a variable-time comparison in HMAC verification can leak information.
You are affected if your application uses phpseclib SSH2 version 0.1.1–>= 3.0.0, < 3.0.51. Check your composer.json or application dependencies to confirm.
Upgrade to phpseclib SSH2 version 3.0.51 or later. This resolves the variable-time comparison issue.
There are currently no reports of active exploitation of CVE-2026-40194, but it's crucial to apply the patch proactively.
Refer to the phpseclib project's security advisories on their GitHub repository: https://github.com/phpseclib/phpseclib
Upload your dependency file and we'll tell you instantly if this and other CVEs hit you.