---
id: CVE-2026-84308
title: phpseclib is a PHP secure communications library
summary: >-
  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(). D…
severity: medium
cvss: 6.3
cvssVector: 'CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:N'
cwe:
  - CWE-208
  - CWE-385
vendor: phpseclib
product: phpseclib
affected:
  - phpseclib < 3.0.57
  - 'phpseclib >= 4.0.0, < 4.0.1'
patched:
  - phpseclib 3.0.57
  - phpseclib 4.0.1
published: '2026-09-01'
updated: '2026-09-09'
sourceUpdated: '2026-09-09T21:09:13.080'
source: NVD
sourceUrl: 'https://nvd.nist.gov/vuln/detail/CVE-2026-84308'
references:
  - url: >-
      https://github.com/phpseclib/phpseclib/commit/fb56bc5bb9009b54a6c26b31aeec8ed944f17373
    label: security-advisories@github.com
  - url: 'https://github.com/phpseclib/phpseclib/releases/tag/3.0.57'
    label: security-advisories@github.com
  - url: 'https://github.com/phpseclib/phpseclib/releases/tag/4.0.1'
    label: security-advisories@github.com
  - url: >-
      https://github.com/phpseclib/phpseclib/security/advisories/GHSA-q97c-8qh3-fpc6
    label: security-advisories@github.com
  - url: >-
      https://github.com/phpseclib/phpseclib/security/advisories/GHSA-q97c-8qh3-fpc6
    label: 134c704f-9b21-4f2e-91b3-4a467353bcc0
  - url: 'https://nvd.nist.gov/vuln/detail/CVE-2026-84308'
  - url: 'https://github.com/advisories/GHSA-q97c-8qh3-fpc6'
  - url: >-
      https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-84308.json
  - url: 'https://access.redhat.com/security/cve/CVE-2026-84308'
  - url: 'https://www.cve.org/CVERecord?id=CVE-2026-84308'
tags:
  - nvd
  - ghsa
  - composer
  - csaf
  - vex
  - red-hat
epss: 0.00327
epssPercentile: 0.23039
aliases:
  - GHSA-q97c-8qh3-fpc6
ecosystem: composer
ingestedAt: '2026-09-08T22:12:30.968Z'
---

## Overview

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.

## Remediation

Refer to the linked advisories for vendor-supplied fixes and affected version ranges.

## Package advisory (CVE-2026-84308)

Affected packages:

- `phpseclib < 3.0.57`
- `phpseclib >= 4.0.0, < 4.0.1`

Patched in:

- `phpseclib 3.0.57`
- `phpseclib 4.0.1`

Source: https://github.com/advisories/GHSA-q97c-8qh3-fpc6

## Vendor advisories

- **Red Hat VEX** · updated 2026-09-15 · [vex](https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-84308.json)
