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

> Attackers can recover private X25519 keys via timing side-channels in pure-PHP scalar multiplication when keys are reused and native extensions are unavailable.

- **Severity:** Medium 6.3 (`CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Local or same network only
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 1 Sep 2026
- **Updated:** 3 Sep 2026
- **Also known as:** DEBIAN-CVE-2026-84308, GHSA-q97c-8qh3-fpc6, MINI-c848-5gw4-2v8w, MINI-mp2x-7hpr-gw64, MINI-pm2h-3443-j64j, UBUNTU-CVE-2026-84308

## What is CVE-2026-84308?

CVE-2026-84308 is a medium-severity vulnerability in phpseclib, published on 1 Sep 2026. It can only be exploited from the same machine or local network, with no action from the victim.

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

Weakness: CWE-385 (Covert Timing Channel), CWE-208 (Observable Timing Discrepancy)

## Which versions are affected by CVE-2026-84308?

4 open source packages ship an affected version, including phpseclib/phpseclib.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `phpseclib/phpseclib` | Packagist | All versions | 3.0.57 |
| `phpseclib/phpseclib` | Packagist | All versions | 3.0.57 |
| `phpseclib/phpseclib` | Packagist | From 4.0.0 | 4.0.1 |
| `phpseclib/phpseclib` | Packagist | From 4.0.0 | 4.0.1 |

## How do I fix CVE-2026-84308?

Upgrade phpseclib/phpseclib to a fixed version for your release line: 3.0.57 or 4.0.1.

## Is CVE-2026-84308 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-84308 exists.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-84308 and fix it if it is affected.

What it is: CVE-2026-84308 is a medium-severity vulnerability in phpseclib, published on 1 Sep 2026. It can only be exploited from the same machine or local network, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-84308 exists.

Affected packages and fixed versions:
- phpseclib/phpseclib (Packagist): affected all versions; fixed in 3.0.57
- phpseclib/phpseclib (Packagist): affected all versions; fixed in 3.0.57
- phpseclib/phpseclib (Packagist): affected from 4.0.0; fixed in 4.0.1
- phpseclib/phpseclib (Packagist): affected from 4.0.0; fixed in 4.0.1

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-84308/ (Markdown: https://insights.sbomify.com/CVE-2026-84308/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-84308
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-84308
- OSV: https://osv.dev/vulnerability/CVE-2026-84308

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-84308/
Summaries are generated and may contain mistakes; the official description above is the record.
