Skip to main content

phpseclib CVE-2026-84308

| EUVDEUVD-2026-69576 MEDIUM
Observable Timing Discrepancy (CWE-208)
2026-09-01 GitHub_M GHSA-q97c-8qh3-fpc6
6.3
CVSS 3.1 · Vendor: GitHub_M
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Recon
    Identify PHP application using static X25519 key without ext-sodium
  2. Delivery
    Gain local timing visibility on same host
  3. Exploit
    Submit repeated X25519 operations triggering key reuse
  4. Install
    Measure per-ladder-step timing or libgmp call-count variation
  5. C2
    Apply scalar-recovery analysis to timing trace corpus
  6. Execute
    Recover 251-bit clamped private scalar
  7. Impact
    Decrypt historical traffic or impersonate key holder

Vulnerability Assessment

Weakness
CWE
ASVS 5.0
V6 - Authentication Timing attack prevention
Exploitation Conditions

Exploitation requires four simultaneous conditions to be present. First, the target application must use a reused or long-lived X25519 private key - the description explicitly states that ephemeral keys, including those in phpseclib's SSH key exchange path, are not affected. Second, the pure-PHP arithmetic code path must be active: for the PKCS8 key-load path, ext-sodium must be absent; for the MontgomeryPrivate key loader, the vulnerability was present unconditionally prior to the fix because that loader bypassed native-engine selection entirely. Third, the attacker must be a local observer capable of resolving individual Montgomery ladder step timings or libgmp call-count differences, requiring co-location on the same physical or virtual host with sufficient clock resolution. Fourth, the attacker must know the corresponding public key. Applications using ephemeral keys, running with ext-sodium enabled, or operating on isolated single-tenant infrastructure face no realistic exploitation risk.

Impact

The CVSS base score of 6.3 (AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:N) accurately reflects the constrained exploitation requirements, and the C:H/I:H impact metrics should not be read in isolation. Real-world risk is substantially limited by four simultaneous prerequisites that must all be present: key reuse, the pure-PHP code path being active, local timing access, and knowledge of the public key. EPSS data was not provided, and this CVE is not in CISA KEV; exploitation probability and active exploitation status are unknown. No public proof-of-concept code has been identified. The SSH use case - arguably the most common phpseclib deployment - is explicitly excluded because ephemeral keys are generated per session. The realistic target population is applications that explicitly load and reuse static X25519 keys for persistent encrypted channels, TOFU pinning, or similar long-lived key scenarios, deployed on servers where a co-tenant or privileged local process can achieve the timing resolution needed to distinguish individual ladder-step durations. This attack is academically well-understood but operationally difficult to mount; even a mid-sized IT operation managing static X25519 keys in PHP without ext-sodium should prioritize patching over emergency incident response unless shared-tenancy hosting makes timing attacks more feasible.

Exploit ScenarioDerived

A local attacker co-resident on the same server as a PHP application using phpseclib without ext-sodium measures per-step timing variation across repeated X25519 key-agreement operations that reuse a static private key. By correlating the data-dependent conditional reduction patterns across sufficient observations - exploiting the fact that libgmp invocation counts vary with the secret scalar prefix - the attacker applies lattice-reduction or similar techniques to recover the full 251-bit clamped private scalar, permanently compromising all sessions keyed with that material. No public proof-of-concept is known at time of analysis, though the underlying academic side-channel technique for Montgomery ladder timing recovery is well established.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.2% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Sep 01, 2026

Timing side-channel exposure in phpseclib's pure-PHP X25519 scalar multiplication allows a local observer to recover a reused 251-bit clamped private key. Data-dependent conditional modular reductions in PrimeField/Integer.php cause per-step timing and libgmp call-count variation during the Montgomery ladder, leaking scalar bits when the same private key is used across multiple operations. Only applications using a long-lived or reused X25519 private key on the pure-PHP code path are at risk; phpseclib's standard SSH ephemeral key exchange is explicitly unaffected. Vendor-released patches exist in versions 3.0.57 and 4.0.1; no public exploit has been identified at time of analysis.

RemediationAI

The primary fix is upgrading to phpseclib 3.0.57 (3.x branch) or 4.0.1 (4.x branch), both confirmed available at the GitHub tagged releases. If immediate upgrade is not feasible, the most effective interim control is installing and enabling the PHP ext-sodium extension, which causes phpseclib to route all Curve25519 operations through libsodium's constant-time implementation and fully bypasses the vulnerable pure-PHP path. Alternatively, ensuring the PHP openssl extension is present and functional will route Curve25519 through OpenSSL. After remediating the code path, any long-lived or static X25519 private keys that operated under the vulnerable code path on a shared or multi-tenant host should be rotated, as keys observable during the vulnerable period should be treated as potentially compromised. Refer to the vendor advisory at https://github.com/phpseclib/phpseclib/security/advisories/GHSA-q97c-8qh3-fpc6 and release tags at https://github.com/phpseclib/phpseclib/releases/tag/3.0.57 and https://github.com/phpseclib/phpseclib/releases/tag/4.0.1.

Affected VersionsENISA

phpseclib < 3.0.57
phpseclib 4.0.0, < 4.0.1

Affected Packages

composer phpseclib fix: 3.0.57, 4.0.1
composer phpseclib/phpseclib fix: 3.0.57, 4.0.1

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 2 packages in composer

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

The affected library is phpseclib (CPE: cpe:2.3:a:phpseclib:phpseclib:*:*:*:*:*:*:*:*), a widely used pure-PHP cryptographic library. CWE-208 (Observable Timing Discrepancy) is the root cause: the add() and subtract() methods in phpseclib/Math/PrimeField/Integer.php perform conditional modular reductions using branching logic rather than constant-time bitmasking, so the number of reduction steps - and corresponding libgmp invocations - varies based on intermediate values derived from the secret scalar. During X25519 key agreement, the Montgomery ladder in phpseclib/Crypt/EC/BaseCurves/Montgomery.php calls these methods at every step, allowing a side-channel adversary to correlate per-step timing measurements to scalar bits. The vulnerable code path is reached in two ways: via MontgomeryPrivate.php key loading, which previously called multiplyPoint() directly without checking for a native engine, and via PKCS8.php when ext-sodium is unavailable. The fix replaces branching reductions with a constant-time conditionalAddModulo() function using bitwise masking, and adds explicit engine-selection logic that routes Curve25519 operations through libsodium or OpenSSL in preference to pure-PHP arithmetic.

Know when Phpseclib gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (GitHub_M) PRIMARY 6.3 MEDIUM
AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:N
vuln.today AI 6.3 MEDIUM

Local timing observer required with co-tenancy; multiple non-default conditions must align (key reuse, pure-PHP path); private-key recovery enables both confidentiality and integrity violations.

3.1 AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:N
4.0 AV:L/AC:H/AT:P/PR:L/UI:N/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N

Primary rating from Vendor (GitHub_M).

CVSS VectorVendor: GitHub_M

Attack Vector
Local
Attack Complexity
High
Privileges Required
Low
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
None

Lifecycle Timeline

2
Patch available
Sep 01, 2026 - 21:03 EUVD
CVE Published
Sep 01, 2026 - 19:28 cve.org
MEDIUM 6.3

DescriptionCVE.org

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.

Threat Intelligence Overview

EPSS Score
0.2%
Top 89% exploitable
Prevalence
Medium
widely used PHP cryptography library, ecosystem-standard for SSH and TLS in PHP
Threat Intel
1
1 sources
Exploit
POC
Public exploit code exists
Data Quality
6 sources
Confidence: High
EUVD NVD CVE.org EPSS Vulnrichment GHSA GitHub

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC Yes
EPSS 0.2%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation
Poc
System Exposure· derived
Small
Automatable
No
Human Impact· derived
Medium
Technical Impact
Total

Priority Score

52
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +32
PoC: +20
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Information disclosure occurs when an application unintentionally exposes sensitive data that aids attackers in reconnaissance or directly compromises security.

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy