Vulnerability · Published Sep 1, 2026 · Assigned by GitHub_M
CVE-2026-84308phpseclib — non-constant-time X25519 scalar multiplication permits full private-key recovery
Medium 6.3
In plain English
A medium-severity security flaw in phpseclib from phpseclib. Proof-of-concept exploit code is public. The chance it is exploited in the next 30 days is estimated at 0.3% (higher than 26% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.
Official 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 packages & fixed versions
| Ecosystem | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian:12 | php-phpseclib3 | no fix listed | DEBIAN-CVE-2026-84308 |
| Debian:13 | php-phpseclib3 | no fix listed | DEBIAN-CVE-2026-84308 |
| Debian:14 | php-phpseclib3 | 3.0.57-1 | DEBIAN-CVE-2026-84308 |
| Debian:14 | php-phpseclib4 | 4.0.1-1 | DEBIAN-CVE-2026-84308 |
| Packagist | phpseclib/phpseclib | 3.0.57 | GHSA-q97c-8qh3-fpc6 |
| Packagist | phpseclib/phpseclib | 4.0.1 | GHSA-q97c-8qh3-fpc6 |
| Ubuntu:26.10 | php-phpseclib | no fix listed | UBUNTU-CVE-2026-84308 |
| Ubuntu:24.04:LTS | php-phpseclib3 | no fix listed | UBUNTU-CVE-2026-84308 |
| Ubuntu:26.04:LTS | php-phpseclib3 | no fix listed | UBUNTU-CVE-2026-84308 |
| Ubuntu:26.10 | php-phpseclib3 | no fix listed | UBUNTU-CVE-2026-84308 |
| Ubuntu:22.04:LTS | phpseclib | no fix listed | UBUNTU-CVE-2026-84308 |
| Ubuntu:26.10 | phpseclib | no fix listed | UBUNTU-CVE-2026-84308 |
Affected products (as reported)
Weakness: CWE-208, CWE-385 · Vector: CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:N
References
- https://github.com/phpseclib/phpseclib/security/advisories/GHSA-q97c-8qh3-fpc6 x_refsource_CONFIRM
- https://github.com/phpseclib/phpseclib/commit/fb56bc5bb9009b54a6c26b31aeec8ed944f17373 x_refsource_MISC
- https://github.com/phpseclib/phpseclib/releases/tag/3.0.57 x_refsource_MISC
- https://github.com/phpseclib/phpseclib/releases/tag/4.0.1 x_refsource_MISC