CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2024-27354

CVE-2024-27354: Computational Denial of Service via Unbounded Primality Testing in phpseclib

Amit Schendel
Amit Schendel
Senior Security Researcher

May 6, 2026·6 min read·18 visits

Executive Summary (TL;DR)

phpseclib before versions 1.0.23, 2.0.47, and 3.0.36 suffers from a computational DoS flaw where parsing maliciously crafted X.509 certificates with massive explicit primes triggers an unbounded Miller-Rabin primality test, leading to CPU exhaustion.

A computational Denial of Service (DoS) vulnerability in phpseclib allows unauthenticated attackers to exhaust CPU resources by supplying malformed X.509 certificates. The vulnerability arises from missing bit-length upper bounds in the Miller-Rabin primality test implementation when evaluating explicit elliptic curve field parameters.

Vulnerability Overview

The phpseclib library provides cryptographic operations and certificate parsing for PHP applications. Versions 1.x prior to 1.0.23, 2.x prior to 2.0.47, and 3.x prior to 3.0.36 contain an uncontrolled resource consumption vulnerability (CWE-400). Unauthenticated attackers can trigger a denial-of-service condition by supplying maliciously crafted X.509 certificates.

This vulnerability manifests as a computational denial-of-service, specifically targeting the mathematical operations underlying primality testing. The issue was introduced inadvertently as a regression during the remediation of a prior security flaw, CVE-2023-27560. The subsequent patch expanded the circumstances under which the library evaluates primality without enforcing corresponding size boundaries on the integer inputs.

Academic researchers categorized this specific attack vector under the "X.509DoS" class of vulnerabilities. Cryptographic libraries parse explicit Elliptic Curve parameters contained within ASN.1 structures. By abusing the explicit field parameter definition within an X.509 certificate, an attacker forces the server to execute astronomically expensive mathematical validations.

Root Cause Analysis

The root cause lies within the Math_BigInteger::isPrime() and Math_BigInteger::randomPrime() methods. These functions utilize the Miller-Rabin probabilistic primality test to determine if a given large integer is prime. The algorithmic complexity of the Miller-Rabin test scales according to $O(k \cdot \log^3 n)$, where $n$ is the integer under evaluation and $k$ represents the number of iteration witnesses.

As the bit-length of the integer $n$ increases, the CPU time required to compute the necessary modular exponentiations grows cubically. The library failed to implement upper bounds on the bit-length of numbers passed to these primality validation functions. When a system parses an X.509 certificate specifying custom Elliptic Curve (EC) configurations, the library extracts the field prime $p$ from the explicit parameters.

An attacker constructs a DER-encoded X.509 certificate containing an arbitrary, massively sized integer in place of a legitimate field prime. Upon invocation of the getPublicKey() method, phpseclib dynamically validates the extracted parameters. The library passes the unbounded field prime directly into the isPrime() function, immediately monopolizing the CPU thread as the Miller-Rabin algorithm attempts to process millions of bits.

Code Analysis

The remediation strategy introduces static guardrails into the Math_BigInteger::isPrime() function. The maintainers implemented a strict upper limit of 8,196 bits for any integer subjected to primality testing. This threshold derives from the maximum safe RSA key size (16,384 bits), halved to account for the prime factors.

The patch relies on the getLength() method to evaluate the integer size prior to executing the Miller-Rabin iterations. The following code block demonstrates the patched logic introduced in the 3.x branch.

function isPrime($t = false) {
    $length = $this->getLength();
    // Cap at 8196 bits (derived from max RSA key size 16384/2)
    if ($length > 8196) {
        throw new \RuntimeException("Primality testing is not supported for numbers larger than 8196 bits ($length)");
    }
    // ... expensive Miller-Rabin logic proceeds only if under limit
}

A significant discrepancy exists in how the legacy 1.x and 2.x branches implement this patch. Instead of throwing a fatal \RuntimeException, the backported patches utilize the PHP user_error() function. By default, user_error() emits an E_USER_NOTICE and permits execution to continue.

Unless the host application explicitly registers a custom error handler via set_error_handler() to trap E_USER_NOTICE emissions, the vulnerability remains exploitable on the 1.x and 2.x branches. The library generates a notice in the server logs but subsequently proceeds directly into the unbounded primality test, failing to mitigate the computational exhaustion.

Exploitation

Exploiting this vulnerability requires the attacker to submit a malformed DER-encoded X.509 certificate to an application endpoint that utilizes phpseclib for certificate processing. No authentication or privileged access is required to transmit the payload. The attacker merely requires a functional application feature that invokes the X509::loadX509() and X509::getPublicKey() methods.

The malicious certificate must specify the id-ecPublicKey Object Identifier (1.2.840.10045.2.1) and utilize explicit ECParameters. The attacker populates the field prime $p$ within the ASN.1 structure with an artificially large integer, frequently exceeding 100,000 bits.

use phpseclib3\File\X509;
 
$cert = file_get_contents('mal-cert-01.der');
$x509 = new X509();
$x509->loadX509($cert);
$x509->getPublicKey(); // Triggers continuous CPU execution

Execution of the getPublicKey() method triggers the vulnerability synchronously. The targeted PHP process enters a continuous loop executing modular exponentiation. The process consumes 100% of a single CPU core and halts further execution until the server hardware or an operating system timeout terminates the process.

Impact Assessment

The vulnerability carries a CVSS v3.1 base score of 7.5, reflecting a high severity impact strictly limited to system availability. The attack vector is completely network-based and demands low complexity from the adversary. Successful exploitation requires no elevated privileges or user interaction.

In a production environment running PHP-FPM or similar worker pool architectures, this flaw enables asymmetric resource exhaustion. An attacker transmitting a minimal payload forces the server to allocate maximum CPU resources to a single worker indefinitely. Sequential malicious requests rapidly exhaust the entire pool of available worker processes.

Once the worker pool depletes, the application cannot process legitimate traffic, resulting in a total denial of service. The application server returns HTTP 502 or 504 errors to all clients. The exploit operates silently at the process level without causing segmentation faults, making it difficult to detect through standard crash monitoring systems.

Remediation

Organizations must upgrade phpseclib to versions 1.0.23, 2.0.47, or 3.0.36 to receive the length-validation guardrails. Software developers should prioritize migration to the 3.x branch. The 3.x branch correctly terminates execution by throwing a \RuntimeException when it encounters an oversized integer.

Applications constrained to the 1.x or 2.x branches require immediate configuration changes. Developers must implement a custom error handler using set_error_handler() to convert E_USER_NOTICE emissions into fatal exceptions. Failure to implement this handler nullifies the security benefits of the patch.

As a defense-in-depth measure, administrators should configure strict file size limits for any certificate upload functionality. Additionally, enforcing strict max_execution_time directives in php.ini ensures that stalled worker processes eventually terminate. While timeouts do not prevent the initial CPU spike, they prevent permanent worker pool exhaustion.

Fix Analysis (3)

Technical Appendix

CVSS Score
7.5/ 10
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
EPSS Probability
0.20%
Top 58% most exploited

Affected Systems

phpseclib 1.x seriesphpseclib 2.x seriesphpseclib 3.x series

Affected Versions Detail

Product
Affected Versions
Fixed Version
phpseclib
phpseclib
1.x < 1.0.231.0.23
phpseclib
phpseclib
2.x < 2.0.472.0.47
phpseclib
phpseclib
3.x < 3.0.363.0.36
AttributeDetail
CWE IDCWE-400
Attack VectorNetwork
CVSS v3.1 Score7.5 (High)
EPSS Score0.00204 (42.24%)
ImpactDenial of Service (CPU Exhaustion)
Exploit StatusProof of Concept
CISA KEVNo

MITRE ATT&CK Mapping

T1499Endpoint Denial of Service
Impact
T1499.003OS Resource Exhaustion
Impact
CWE-400
Uncontrolled Resource Consumption

Uncontrolled Resource Consumption

Known Exploits & Detection

Research PaperX.509DoS: Exploiting and Detecting Denial-of-Service Vulnerabilities in X.509 Certificate Parsing

References & Sources

  • [1]GitHub Advisory: GHSA-hg35-mp25-qf6h
  • [2]katzj Gist - Technical Write-up
  • [3]USENIX Security '25: X.509DoS Paper
  • [4]phpseclib 3.0 Fix Commit
  • [5]phpseclib 2.0 Fix Commit
  • [6]phpseclib getLength Fix Commit

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•about 10 hours ago•CVE-2026-39922
6.3

CVE-2026-39922: Server-Side Request Forgery in GeoNode Service Registration Endpoint

GeoNode versions prior to 4.4.5 and 5.0.2 are vulnerable to Server-Side Request Forgery (SSRF) in the service registration endpoint. Authenticated attackers with low privileges can exploit insufficient input validation in the Web Map Service (WMS) registration module to force the application server to make outbound network queries to loopback addresses, private RFC1918 subnets, link-local scopes, and cloud metadata endpoints. This technical report details the mechanics of the vulnerability, the underlying architectural flaw, and how to effectively remediate and mitigate the associated security risks.

Alon Barad
Alon Barad
4 views•7 min read
•about 19 hours ago•CVE-2022-0492
7.8

CVE-2022-0492: Privilege Escalation and Container Escape via cgroups v1 release_agent

CVE-2022-0492 is a high-severity missing authorization vulnerability in the Linux kernel's Control Groups (cgroups) v1 implementation. The flaw resides within the cgroup_release_agent_write function in kernel/cgroup/cgroup-v1.c, where the kernel fails to validate if the process writing to the release_agent file possesses administrative capabilities in the initial user namespace. This allows a local attacker inside a container with root privileges (UID 0) to abuse user namespaces, mount a cgroups v1 directory, modify the release_agent parameter, and execute arbitrary commands on the host system as host root, effectively achieving a complete container escape.

Amit Schendel
Amit Schendel
8 views•7 min read
•3 days ago•GHSA-G72G-R7M4-9X4G
6.3

GHSA-G72G-R7M4-9X4G: Insufficient Session Expiration of OAuth Tokens in NocoDB

NocoDB is subject to an insufficient session expiration vulnerability where OAuth access and refresh tokens are not invalidated or revoked during security-sensitive actions such as password changes, forgot-password requests, or password resets. This allows an attacker possessing an active OAuth token to maintain unauthorized persistence.

Amit Schendel
Amit Schendel
11 views•6 min read
•3 days ago•GHSA-FGMC-2HQJ-86V4
6.9

GHSA-FGMC-2HQJ-86V4: Default Administrative Credentials in vantage6-server

A vulnerability in the vantage6 federated learning framework allows unauthenticated remote attackers to gain administrative control of the server via hardcoded default credentials (root/root) when deployed under default configurations in versions 4.2.3 and below.

Amit Schendel
Amit Schendel
8 views•5 min read
•3 days ago•GHSA-X9F6-9RVM-MMRG
6.9

GHSA-X9F6-9RVM-MMRG: Improper Access Control and Volume Mount Isolation Bypass in vantage6 Node

An improper access control vulnerability in the vantage6 node component allows concurrently running algorithm containers to read and modify sensitive input and output files of other tasks. The lack of strict workspace directory isolation exposes a significant attack surface in multi-tenant or federated environments where untrusted algorithms are executed.

Amit Schendel
Amit Schendel
3 views•4 min read
•3 days ago•CVE-2026-47760
8.7

CVE-2026-47760: Cross-Site Scripting (XSS) via SVG Namespace Sanitizer Bypass in TinyMCE

TinyMCE versions 6.8.0 through 7.0.1 contain a high-severity Cross-Site Scripting (XSS) vulnerability. The flaw exists in the custom HTML parser and sanitizer module, which incorrectly manages SVG namespace scopes when parsing nested elements. A low-privileged or unauthenticated attacker can submit a crafted HTML payload containing nested SVG structures to bypass sanitization filters, leading to arbitrary JavaScript execution in the context of the victim's browser session.

Alon Barad
Alon Barad
30 views•7 min read