Timing Attack Affecting phpseclib/phpseclib package, versions <3.0.57>=4.0.0, <4.0.1


Severity

Recommended
0.0
high
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.21% (12th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-PHP-PHPSECLIBPHPSECLIB-19666129
  • published10 Sept 2026
  • disclosed1 Sept 2026
  • creditgeostergiop

Introduced: 1 Sep 2026

NewCVE-2026-84308  (opens in a new tab)
CWE-208  (opens in a new tab)

How to fix?

Upgrade phpseclib/phpseclib to version 3.0.57, 4.0.1 or higher.

Overview

phpseclib/phpseclib is a PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.

Affected versions of this package are vulnerable to Timing Attack the pure-PHP X25519 scalar multiplication in Crypt/EC/Formats/Keys/MontgomeryPrivate.php, Crypt/EC/Formats/Keys/PKCS8.php, and Math/PrimeField/Integer.php. An attacker can recover the long-lived X25519 private scalar by measuring per-ladder-step execution time or counting GMP calls while the code multiplies the base point during Montgomery key derivation. The leak comes from data-dependent conditional modular reduction in PrimeField\Integer::add() and subtract(), which makes each ladder step’s cost depend on secret-scalar-dependent field values. In deployments that use phpseclib’s pure-PHP Curve25519 path, this exposes the private key used for ECDH and compromises any shared secret derived from it.

CVSS Base Scores

version 4.0
version 3.1