CVE-2026-84308

phpseclib — non-constant-time X25519 scalar multiplication permits full private-key recovery

MEDIUM 6.3

At a glance

Source
NVD
EPSS
EPSS 0.33 % · percentile 26 ()
State
PUBLISHED
Published
Updated
Assigner
GitHub_M
NVD status
Deferred

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.

Weaknesses (CWE)

  • CWE-208 — Observable Timing Discrepancy
  • CWE-385 — Covert Timing Channel

References

Scores

VersionScoreVectorScored by
CVSS 3.1MEDIUM 6.3CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:NGitHub_M
CVSS 3.1MEDIUM 6.3CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:NNVD · security-advisories@github.com (Secondary)

Advisories

European references

Affected products

ProductVersions
phpseclib · phpseclibaffected < 3.0.57 ; affected >= 4.0.0, < 4.0.1

Sources

SourceLicence
CVE List (CVEProject cvelistV5)CVE Program Terms of Use
EPSS (FIRST.org)FIRST — attribution requested
ENISA EUVDENISA — reproduction authorised, source acknowledged
NVD (NIST) via fkie-cad/nvd-json-data-feedsPublic domain — this product uses data from the NVD API but is not endorsed or certified by the NVD