Skip to content
Fencer Vulns
low 3.7

CVE-2026-40194 json

phpseclib has a variable-time HMAC comparison in SSH2::get_binary_packet() using != instead of hash_equals()

published 2026-04-10 6 mo ago modified 2026-09-10 1 mo ago also EUVD-2026-21597 , GHSA-r854-jrxh-36qx

cvss
3.7
version 3.1, CNA
cisa kev
Not listed
not in CISA's catalog
epss
0.4%
EPSS 0.4% chance of exploitation in 30 days, percentile 30%
public exploits
0
none known

Summary

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.

Patch / fix

  • packagist phpseclib/phpseclib 1.0.28, 2.0.53, 3.0.51
  • phpseclib phpseclib 1.0.28, 2.0.53, 3.0.51
  • phpseclib Debian 12 1.0.20-1+deb12u4
  • phpseclib Debian 13 1.0.23-6+deb13u2
  • php-phpseclib Debian 12 2.0.42-1+deb12u4
  • php-phpseclib Debian 13 2.0.48-3+deb13u2
  • php-phpseclib Debian 14 2.0.53-1
  • php-phpseclib3 Debian 12 3.0.19-1+deb12u5
  • php-phpseclib3 Debian 13 3.0.43-2+deb13u2
  • php-phpseclib3 Debian 14 3.0.51-1

debian advisories DEBIAN-CVE-2026-40194

  • php-phpseclib Ubuntu Pro 16.04 LTS 2.0.1-1ubuntu0.1~esm1
  • php-phpseclib Ubuntu Pro 18.04 LTS 2.0.9-1ubuntu0.1~esm3
  • php-phpseclib Ubuntu Pro 20.04 LTS 2.0.23-2ubuntu0.1~esm3
  • php-phpseclib Ubuntu Pro 22.04 LTS 2.0.36-1ubuntu0.1~esm3
  • php-phpseclib Ubuntu Pro 24.04 LTS 2.0.47-1ubuntu0.1~esm1
  • php-phpseclib Ubuntu Pro 26.04 LTS 2.0.51-1ubuntu0.1~esm1

ubuntu advisories UBUNTU-CVE-2026-40194

Ubuntu security data © Canonical Ltd., from https://github.com/canonical/ubuntu-security-notices via OSV; changed: normalised to fixed package versions per release. CC BY-SA 4.0

Vendor advisories

What the vendors themselves say about their products: affected, fixed or not affected, and what to do.

red hat product security vex CVE-2026-40194 updated cvss 3.7

phpseclib: phpseclib: Information disclosure via timing attack in SSH HMAC comparison

  • Red Hat All currently supported Red Hat products
    not affected: vulnerable code not present

Red Hat CSAF VEX © Red Hat, Inc., from https://security.access.redhat.com/data/csaf/v2/vex/; changed: reduced to product statuses and remediations. CC BY 4.0 · csaf

CISA SSVC

Exploitation
Proof of concept is public
Automatable
no
Technical impact
partial
Assessed
6 mo ago

Exploit prediction

0.37% chance of exploitation in the next 30 days, higher than 30% of all scored CVEs (FIRST EPSS, 2026-11-08).

Exploits and checks

  • github.com https://github.com/phpseclib/phpseclib/security/advisories/GHSA-r854-jrxh-36qx referenced PoC, tagged "exploit" by a source, unverified

CVSS scores

assigned by version score vector
CNA 3.1 3.7 CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N
GitHub 3.1 3.7 CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N

Affected packages

ecosystem package affected fixed in
packagist phpseclib/phpseclib
>=0.1.1, <1.0.28
>=2.0.0, <2.0.53
>=3.0.0, <3.0.51
1.0.28
2.0.53
3.0.51

Affected products

  • phpseclib phpseclib

Classification

Weakness
  • CWE-208 Observable Timing Discrepancy

References

Sources

Fencer Vulns keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.

CPEs and fixed versions use Anchore's correction of NVD's data: Added CPE configurations because not yet analyzed by NVD.