CVE-2024-27355 Overview
CVE-2024-27355 is a denial of service vulnerability in phpseclib, a widely used pure-PHP cryptography library. The flaw resides in the ASN.1 object identifier (OID) decoder. When decodeOID processes a certificate that contains a maliciously crafted sub-identifier, the function consumes excessive CPU resources. An unauthenticated attacker can trigger this condition remotely by supplying a crafted certificate to any application that parses X.509 data with phpseclib. The issue affects phpseclib 1.x before 1.0.23, 2.x before 2.0.47, and 3.x before 3.0.36, and is tracked under [CWE-400] (Uncontrolled Resource Consumption).
Critical Impact
Remote, unauthenticated attackers can exhaust CPU resources on any service that parses attacker-supplied certificates with vulnerable phpseclib versions, degrading availability of dependent applications.
Affected Products
- phpseclib 1.x prior to 1.0.23
- phpseclib 2.x prior to 2.0.47 and 3.x prior to 3.0.36
- Debian GNU/Linux 10 (buster) packages bundling vulnerable phpseclib
Discovery Timeline
- 2024-03-01 - CVE-2024-27355 published to the National Vulnerability Database
- 2024-03 - Debian LTS security announcements released for affected packages
- 2026-06-17 - Last updated in NVD database
Technical Details for CVE-2024-27355
Vulnerability Analysis
The vulnerability is an algorithmic complexity issue in the ASN.1 parser shipped with phpseclib. The decodeOID routine in phpseclib/File/ASN1.php decodes the variable-length base-128 encoding used for ASN.1 object identifiers. Each sub-identifier is built by accumulating 7-bit groups, with the high bit acting as a continuation marker. The decoder does not enforce an upper bound on the cumulative size of a single sub-identifier, allowing an attacker to supply a sub-identifier composed of many continuation bytes.
Processing such an OID forces the library into expensive arbitrary-precision arithmetic operations to assemble the resulting integer. The cost grows non-linearly with the encoded length, so a small certificate payload can occupy a PHP worker for an extended period. Because certificate parsing typically occurs before authentication, the attack requires no credentials and can be repeated to saturate available workers.
Root Cause
The root cause is missing input validation on ASN.1 OID sub-identifier length within decodeOID. The function trusts the encoded continuation chain and performs unbounded big-integer accumulation, satisfying the conditions for [CWE-400]. Reference implementation context is available in the phpseclib ASN.1 source.
Attack Vector
An attacker delivers a crafted X.509 certificate, CSR, or other ASN.1-encoded structure to any endpoint that uses phpseclib to parse it. Typical vectors include TLS client certificate validation, SAML or JWT signature verification, SSH host key handling, and S/MIME processing. A public proof-of-concept demonstrating the CPU-exhaustion behavior is published as a GitHub Gist PoC.
The vulnerability manifests when decodeOID iterates the malformed sub-identifier and performs repeated big-integer multiplications and additions. Technical details and the exact decoding loop are described in the upstream source linked above; no synthetic exploit code is reproduced here.
Detection Methods for CVE-2024-27355
Indicators of Compromise
- Sustained 100% CPU usage on PHP-FPM or web worker processes following inbound TLS, SAML, or certificate-upload requests.
- HTTP request timeouts, 502/504 gateway errors, or worker pool exhaustion correlated with certificate-processing endpoints.
- Inbound payloads containing ASN.1 OIDs with abnormally long sub-identifier encodings (many bytes with the 0x80 continuation bit set).
Detection Strategies
- Inventory PHP applications and Composer dependencies for phpseclib/phpseclib versions below 1.0.23, 2.0.47, or 3.0.36.
- Instrument certificate-parsing code paths with execution-time metrics and alert on outliers that exceed normal decoding latency.
- Inspect web application firewall logs for repeated requests carrying X.509, CSR, or PKCS structures from a single source.
Monitoring Recommendations
- Monitor PHP worker CPU time and request duration histograms per endpoint that handles certificates.
- Forward application and reverse-proxy logs to a centralized analytics platform and correlate slow requests with client IP and User-Agent.
- Track Composer lockfile changes in CI/CD to detect regressions to vulnerable phpseclib releases.
How to Mitigate CVE-2024-27355
Immediate Actions Required
- Upgrade phpseclib to 1.0.23, 2.0.47, or 3.0.36 or later across all applications and dependent vendor bundles.
- Apply Debian LTS updates as described in the Debian LTS announcement (msg00002) and Debian LTS announcement (msg00003).
- Restart PHP-FPM and dependent services after patching to ensure the updated library is loaded.
Patch Information
The upstream maintainers fixed the issue by enforcing a maximum size on individual ASN.1 OID sub-identifiers in decodeOID. Update to phpseclib1.0.23, 2.0.47, or 3.0.36 via Composer using composer update phpseclib/phpseclib, or install the patched distribution packages provided by your operating system vendor.
Workarounds
- Place a reverse proxy or WAF in front of services that accept certificates and enforce strict size limits on inbound certificate fields.
- Reject ASN.1 OIDs whose sub-identifier encodings exceed a sane threshold before passing data to phpseclib.
- Apply per-request CPU and execution-time limits to PHP workers using max_execution_time and process-manager timeouts to bound impact.
# Configuration example: upgrade phpseclib via Composer and verify version
composer require phpseclib/phpseclib:^3.0.36
composer show phpseclib/phpseclib | grep versions
# Debian/Ubuntu: apply distribution security updates
sudo apt-get update
sudo apt-get install --only-upgrade php-phpseclib
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

