CVE-2026-84308: phpseclib Vulnerability in X25519 Scalar Multiplication Allows Private-Key Recovery

phpseclib Updated 09 Sep 2026

Summary

08/09/2026
Yes i
Moderate
6.3

CVE-2026-84308: phpseclib — non-constant-time X25519 scalar multiplication permits full private-key recovery. Affects phpseclib across 2 version ranges.

< 3.0.57 >= 4.0.0, < 4.0.1

Fixed in 3.0.57 or 4.0.1, depending on the release line you run. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

phpseclib is a pure-PHP implementation of various cryptographic algorithms, including public key cryptography. It provides an easy-to-use interface for developers to implement secure communications in their applications. However, a vulnerability in its X25519 scalar multiplication implementation has been identified, which can lead to the recovery of private keys under certain conditions.

Vulnerability Detail

The vulnerability arises from the non-constant-time implementation of X25519 scalar multiplication in phpseclib. Specifically, the field addition and subtraction operations perform data-dependent conditional modular reductions, allowing an observer to recover the 251-bit clamped private scalar. This can be exploited through timing attacks or by counting specific function calls, making it possible to recover the private key with as few as one operation in some cases. The vulnerability is not limited to low-order inputs, as it can be exploited with the RFC 7748 base point 'u = 9', which does not require attacker-chosen inputs.

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • < 3.0.57 3.0.57
    composer require phpseclib:3.0.57
  • >= 4.0.0, < 4.0.1 4.0.1
    composer require phpseclib:4.0.1

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Workaround

As a temporary workaround, avoid using the pure-PHP implementation of X25519 scalar multiplication by ensuring that your application uses the sodium or OpenSSL extensions, which are not affected by this vulnerability. You can enforce the use of these extensions in your code by checking for their availability before executing cryptographic operations.

Conclusion

The vulnerability in phpseclib's X25519 scalar multiplication implementation poses a significant risk of private key recovery through timing attacks. It is crucial for developers using this library to update to the patched versions or implement workarounds to mitigate the risk. Regular monitoring for vulnerabilities using tools like Vulert can help maintain the security of your applications.

See every vulnerability recorded for phpseclib →

Share this vulnerability

FAQ

The vulnerability allows an attacker to recover the private key used in X25519 operations, which can lead to a complete compromise of the cryptographic security of the application.

You can use Vulert, which monitors open-source vulnerabilities in your software. By analyzing your composer.lock file, Vulert can alert you to any vulnerabilities, including this one.

Yes, the vulnerability has been confirmed in phpseclib version 3.0.56 and earlier. It has been patched in versions 3.0.57 and 4.0.1.

If an immediate update is not possible, consider using the sodium or OpenSSL extensions for cryptographic operations to mitigate the risk associated with this vulnerability.

The CVSS score for this vulnerability is 6.3, indicating a moderate level of severity.

Related vulnerabilities

Recent vulnerabilities recorded for phpseclib.

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • < 3.0.57 3.0.57
    composer require phpseclib:3.0.57
  • >= 4.0.0, < 4.0.1 4.0.1
    composer require phpseclib:4.0.1

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback