Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
ReconIdentify PHP application using static X25519 key without ext-sodium
-
DeliveryGain local timing visibility on same host
-
ExploitSubmit repeated X25519 operations triggering key reuse
-
InstallMeasure per-ladder-step timing or libgmp call-count variation
-
C2Apply scalar-recovery analysis to timing trace corpus
-
ExecuteRecover 251-bit clamped private scalar
-
ImpactDecrypt 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. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – 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
Affected Packages
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
AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:N
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.
Primary rating from Vendor (GitHub_M).
CVSS VectorVendor: GitHub_M
Lifecycle Timeline
2DescriptionCVE.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
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.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Information disclosure occurs when an application unintentionally exposes sensitive data that aids attackers in reconnaissance or directly compromises security.
phpseclib versions 1.0.26 and below, 2.0.0 through 2.0.51, and 3.0.0 through 3.0.49 are vulnerable to a padding oracle t
Math/PrimeField.php in phpseclib 3.x before 3.0.19 has an infinite loop with composite primefields. Rated high severity
phpseclib before 2.0.31 and 3.x before 3.0.7 mishandles RSA PKCS#1 v1.5 signature verification. Rated high severity (CVS
Server-side request forgery in phpseclib's X.509 validation allows unauthenticated network attackers to force the valida
phpseclib's SSH2 packet authentication uses PHP's non-constant-time != operator to compare HMACs, enabling timing-based
EUVD-2026-69576
GHSA-q97c-8qh3-fpc6
NVD
CVE.org
EPSS
Vulnrichment
Exploit-DB