Description
phpseclib is a PHP secure communications library. Prior to 3.0.57 and 4.0.1, pure-PHP X25519 scalar multiplication in phpseclib/Math/PrimeField/Integer.php performs data-dependent conditional modular reductions in add() and subtract(). During the Montgomery ladder in phpseclib/Crypt/EC/BaseCurves/Montgomery.php, the reduction behavior of each step depends on the secret scalar prefix, creating per-step timing and libgmp call-count observations that can reveal a reused 251-bit clamped private scalar. The phpseclib/Crypt/EC/Formats/Keys/MontgomeryPrivate.php derivation path invokes the pure-PHP multiplication without a native-engine check, while phpseclib/Crypt/EC/Formats/Keys/PKCS8.php reaches it when ext-sodium is unavailable. Exploitation requires a reused or long-lived X25519 private key, knowledge of the corresponding public key, execution of the pure-PHP path, and a local observer capable of resolving individual ladder steps or libgmp entry-point calls. Ephemeral X25519 keys, including phpseclib's normal SSH exchange path, are not affected. Recovery of the scalar permanently compromises operations that reuse that key. This issue is fixed in versions 3.0.57 and 4.0.1.
Affected products
| Vendor | Product | Affected | Fixed |
|---|---|---|---|
| phpseclib | phpseclib | < 3.0.57, >= 4.0.0, < 4.0.1 | — |
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.
Debian
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian 14 | php-phpseclib3 | 3.0.57-1 | — |
| Debian 14 | php-phpseclib4 | 4.0.1-1 | — |
| Debian 13 | php-phpseclib3 | No fix yet | — |
| Debian 12 | php-phpseclib3 | No fix yet | — |
Ubuntu
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu 26.10 | phpseclib +2 | No fix yet | — |
| Ubuntu 26.04 LTS | php-phpseclib3 | 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)Fewer releases
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu Pro 26.04 LTS | phpseclib +1 | No fix yet | — |
| Ubuntu Pro 24.04 LTS | phpseclib +1 | No fix yet | — |
| Ubuntu Pro 22.04 LTS | php-phpseclib +1 | No fix yet | — |
| Ubuntu Pro 20.04 LTS | phpseclib +1 | No fix yet | — |
| Ubuntu Pro 18.04 LTS | phpseclib +1 | No fix yet | — |
| Ubuntu Pro 16.04 LTS | phpseclib +1 | No fix yet | — |
Wolfi
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Wolfi rolling | nextcloud-server-33 | No fix yet | — |
Affected packages
| Ecosystem | Package | Affected | Fixed | Record |
|---|---|---|---|---|
| Packagist | phpseclib/phpseclib | < 3.0.57 | 3.0.57 | GHSA-q97c-8qh3-fpc6 |
| Packagist | phpseclib/phpseclib | >= 4.0.0, < 4.0.1 | 4.0.1 | GHSA-q97c-8qh3-fpc6 |
Advisories 1
- WID-SEC-2026-4047 Snipe-IT: Mehrere Schwachstellen BSI CERT-Bund (WID) · Nov 4, 2026