Skip to content
OpenAdvisories
Low · 3.7 CVE-2026-40194 EUVD-2026-21597GHSA-r854-jrxh-36qx

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

Published Apr 10, 2026 · Updated May 8, 2026 · Assigned by GitHub_M

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.

Affected products

VendorProductAffectedFixed
phpseclib phpseclib >= 0.1.1, < 1.0.28, >= 2.0.0, < 2.0.53, >= 3.0.0, < 3.0.51 —

Fixed in Linux distributions

Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.

ReleasePackageFixed inAdvisory
Debian 14 php-phpseclib 2.0.53-1 —
Debian 14 php-phpseclib3 3.0.51-1 —
Debian 13 php-phpseclib 2.0.48-3+deb13u2 —
Debian 13 php-phpseclib3 3.0.43-2+deb13u2 —
Debian 13 phpseclib 1.0.23-6+deb13u2 —
Debian 12 php-phpseclib 2.0.42-1+deb12u4 —
Debian 12 php-phpseclib3 3.0.19-1+deb12u5 —
Debian 12 phpseclib 1.0.20-1+deb12u4 —
ReleasePackageFixed inAdvisory
Ubuntu 26.10 phpseclib +1 No fix yet —
Ubuntu 26.04 LTS php-phpseclib3 No fix yet —
Ubuntu 25.10 phpseclib +2 No fix yet —
Ubuntu 24.04 LTS php-phpseclib3 No fix yet —
Ubuntu 22.04 LTS phpseclib No fix yet —
Show 6 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
Ubuntu Pro 26.04 LTS php-phpseclib 2.0.51-1ubuntu0.1~esm1 USN-8830-1
Ubuntu Pro 26.04 LTS phpseclib No fix yet —
Ubuntu Pro 24.04 LTS php-phpseclib 2.0.47-1ubuntu0.1~esm1 USN-8830-1
Ubuntu Pro 24.04 LTS phpseclib No fix yet —
Ubuntu Pro 22.04 LTS php-phpseclib 2.0.36-1ubuntu0.1~esm3 USN-8830-1
Ubuntu Pro 22.04 LTS php-phpseclib3 No fix yet —
Ubuntu Pro 20.04 LTS php-phpseclib 2.0.23-2ubuntu0.1~esm3 USN-8830-1
Ubuntu Pro 20.04 LTS phpseclib No fix yet —
Ubuntu Pro 18.04 LTS php-phpseclib 2.0.9-1ubuntu0.1~esm3 USN-8830-1
Ubuntu Pro 18.04 LTS phpseclib No fix yet —
Ubuntu Pro 16.04 LTS php-phpseclib 2.0.1-1ubuntu0.1~esm1 USN-8830-1
Ubuntu Pro 16.04 LTS phpseclib No fix yet —

Wolfi

ReleasePackageFixed inAdvisory
Wolfi rolling nextcloud-server-33 33.0.3-r0 —

Affected packages

EcosystemPackageAffectedFixedRecord
Packagist phpseclib/phpseclib >= 0.1.1, < 1.0.28 1.0.28 GHSA-r854-jrxh-36qx
Packagist phpseclib/phpseclib >= 2.0.0, < 2.0.53 2.0.53 GHSA-r854-jrxh-36qx
Packagist phpseclib/phpseclib >= 3.0.0, < 3.0.51 3.0.51 GHSA-r854-jrxh-36qx

Advisories 2

References