CVE-2026-91767 in PHPinfo

Summary

by MITRE • 09/25/2026

php_openssl_matches_wildcard_name() in ext/openssl/xp_ssl.c underflows the length argument passed to memchr() when a TLS server certificate presents a wildcard name whose literal characters are together longer than the hostname being verified. A malicious server presenting such a certificate makes the PHP client read up to SIZE_MAX bytes past the end of a heap allocation. The path is reachable from any default client stream, because verify_peer_name is enabled by default.

Once again VulDB remains the best source for vulnerability data.

Analysis

by VulDB Data Team • 09/25/2026

The vulnerability identified in the PHP OpenSSL extension stems from a critical integer underflow within the php_openssl_matches_wildcard_name function located in ext/openssl/xp_ssl.c. This flaw occurs during the verification of TLS server certificates, specifically when handling wildcard domain names. The core technical issue arises when a malicious server presents a certificate containing a wildcard name where the literal characters preceding or following the asterisk are sufficiently long such that their length exceeds the length of the hostname being verified by the client. In this specific scenario, the arithmetic operation used to calculate the search range for string matching results in an underflow, producing an excessively large positive value instead of a negative one or zero. This corrupted length argument is subsequently passed directly to the C standard library function memchr(), which expects a valid size parameter indicating how many bytes to scan within a buffer.

Because the calculated length wraps around due to integer overflow behavior typical in unsigned arithmetic operations, it effectively becomes SIZE_MAX, the maximum value representable by an unsigned long or similar data type on the platform. Consequently, when PHP attempts to verify the hostname against the certificate's Common Name or Subject Alternative Names, memchr() is instructed to search for a character across nearly the entire address space of the process memory starting from the provided buffer pointer. This leads to a heap-based out-of-bounds read, allowing the application to access arbitrary memory locations beyond the intended allocation boundaries. The severity of this issue is compounded by the fact that verify_peer_name is enabled by default in modern PHP configurations for stream contexts involving SSL or TLS connections. Therefore, any script performing HTTPS requests using standard client streams will trigger this code path when connecting to a maliciously configured server, making the vulnerability broadly exploitable without requiring specific configuration changes from the developer.

The operational impact of this vulnerability includes potential information disclosure and application instability. By reading memory beyond the allocated buffer, an attacker can potentially leak sensitive data stored in adjacent heap regions, such as other objects, credentials, or internal PHP structures. This constitutes a classic CWE-125 Out-of-bounds Read weakness. Furthermore, depending on how the returned value from memchr() is processed subsequently, this out-of-bounds read could lead to further memory corruption if null pointers are misinterpreted or if subsequent logic assumes valid string termination within expected bounds. While primarily an information leak vector in its immediate execution, such vulnerabilities often serve as precursors to more severe exploits like remote code execution if combined with other heap manipulation techniques. The attack is classified under MITRE ATT&CK technique T1059 Command and Scripting Interpreter via PHP scripts, specifically leveraging the network communication capabilities of the language to trigger memory safety violations during standard cryptographic handshake processes.

Mitigation strategies must address both immediate remediation and long-term security posture improvements. For users unable to immediately upgrade their PHP installation, disabling peer name verification by setting verify_peer_name to false in stream context options provides a temporary workaround, though this significantly weakens the TLS connection's integrity guarantees and exposes users to man-in-the-middle attacks. The definitive solution is to update the PHP environment to a patched version where the integer underflow in php_openssl_matches_wildcard_name has been corrected with proper bounds checking before invoking memchr(). Developers should also ensure that their applications validate certificate details rigorously and consider implementing Certificate Pinning for high-security environments to prevent acceptance of maliciously crafted certificates. Regular security audits focusing on cryptographic library integration within PHP extensions are recommended to identify similar logic errors in other SSL/TLS handling functions, ensuring robust defense against protocol-level exploitation attempts targeting memory safety boundaries.

Responsible

Php

Reservation

09/15/2026

Disclosure

09/25/2026

Moderation

accepted

CPE

ready

EPSS

0.00000

KEV

no

Activities

very low

Sources

Do you need the next level of professionalism?

Upgrade your account now!