CVE-2026-129538

Out-of-bounds Write
Affects
PHP
in
PHP
No items found.
Versions
<8.2.36, >=8.3.0 <8.3.37, >=8.4.0 <8.4.28, >=8.5.0 <8.5.13

Patch Available.

Exclamation circle icon
Patch Available

This Vulnerability has been fixed in the Never-Ending Support (NES) version offered by HeroDevs.

Overview

PHP is a general-purpose scripting language used mostly for web development. It runs behind web servers through server APIs such as Apache mod_php and PHP-FPM, and powers content management systems and frameworks such as WordPress, Drupal, Moodle and Laravel. The PHP CGI binary, php-cgi, runs PHP scripts for a web server in CGI or FastCGI mode. With cgi.fix_pathinfo=1, the default, it corrects the script path and PATH_INFO values that the web server passes.

An Out-of-Bounds Write vulnerability (CVE-2026-129538) has been identified in the PATH_INFO correction of php-cgi, which allows an unauthenticated attacker to make PHP read and write memory before the supplied PATH_INFO value when the web server passes inconsistent script and path values. Depending on the request and configuration, this can crash the PHP process, expose process memory or corrupt memory. The PHP project tracks this issue as GHSA-5j3f-64r7-f564.

Per MITRE CWE-787: The product writes data past the end, or before the beginning, of the intended buffer.

This issue affects all versions of PHP before 8.2.36, PHP 8.3 before 8.3.37, PHP 8.4 before 8.4.28 and PHP 8.5 before 8.5.13, which includes the End-of-Life release lines PHP 5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0 and 8.1 through their final releases.

Details

Module Info

Vulnerability Info

This Medium-severity vulnerability is found in the CGI server API (php-cgi) of all versions of PHP before 8.2.36, PHP 8.3 before 8.3.37, PHP 8.4 before 8.4.28 and PHP 8.5 before 8.5.13, which includes the End-of-Life release lines PHP 5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0 and 8.1 through their final releases. The PHP project scores it 6.9 under CVSS 4.0 (CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N). The PHP project classifies it as CWE-125, CWE-787 and CWE-823.

When php-cgi finds that SCRIPT_FILENAME, or PATH_TRANSLATED in a redirected CGI request, carries a trailing path after the real script, init_request_info() removes that suffix and derives a new PATH_INFO by subtracting the suffix length from the end of the supplied value. In PHP 8.5.12, the code reads:

size_t slen = len - strlen(pt);
size_t pilen = env_path_info ? strlen(env_path_info) : 0;
char *path_info = env_path_info ? env_path_info + pilen - slen : NULL;

if (orig_path_info != path_info) {

If the removed suffix is longer than the supplied PATH_INFO, or PATH_INFO is present but empty, the resulting pointer lies before the PATH_INFO buffer. The path correction that follows reads, writes and copies memory through that pointer.

A single unauthenticated request can crash the php-cgi process that handles it; the advisory reports crashes on default, non-debug builds of PHP 8.2.35, 8.3.36, 8.4.27 and 8.5.12. Unrelated memory can also appear in the PATH_INFO or PATH_TRANSLATED server variables, and reaches the attacker only if the application returns or logs those values. PHP can overwrite memory during the correction. Code execution has been claimed but not confirmed.

Only php-cgi with cgi.fix_pathinfo=1 is affected, in both CGI and FastCGI mode. PHP-FPM and PHP running as an Apache module are not affected. The condition needs particular web server mappings: the advisory gives a legacy Apache CGI setup that uses the Action directive together with a rewrite to an absolute file system path, and FastCGI front ends that build SCRIPT_FILENAME from an unsplit request path while sending a shorter or empty PATH_INFO. A php-cgi FastCGI listener that untrusted clients can reach directly lets them supply these parameters themselves. The same pointer arithmetic is present in the final releases of the End-of-Life PHP 5.6 through 8.1 lines.

The fix checks the lengths before deriving the pointer and skips the rewrite when no valid replacement exists, as PHP-FPM has done since the fix for CVE-2019-11043:

size_t slen = len - strlen(pt);
size_t pilen = env_path_info ? strlen(env_path_info) : 0;
char *path_info = (env_path_info && pilen > slen) ? env_path_info + pilen - slen : NULL;

if (path_info && orig_path_info != path_info) {

Mitigation

The PHP project publishes security fixes only for its supported release lines. PHP 5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0 and 8.1 are End-of-Life and will not receive any public updates to address this issue.

Until an upgrade is possible, set cgi.fix_pathinfo=0 in the configuration used by php-cgi and check that the application's routing still works, or correct the web server mapping so that the script path and the path information are consistent. Restrict direct access to a FastCGI listener to trusted front ends.

Users of the affected components should apply one of the following mitigations:

  • Upgrade to PHP 8.2.36, 8.3.37, 8.4.28, 8.5.13, or later.
  • Leverage a commercial support partner like HeroDevs (NES for PHP) for post-EOL security support.

Credits

Vulnerability Details
Severity
Level
CVSS Assessment
Low
>=0 <4
Medium
>=4 <6
High
>=6 <8
Critical
>=8 <10
Medium
ID
CVE-2026-129538
PROJECT Affected
PHP
Versions Affected
<8.2.36, >=8.3.0 <8.3.37, >=8.4.0 <8.4.28, >=8.5.0 <8.5.13
NES Versions Affected
Published date
November 19, 2026
≈ Fix date
November 19, 2026
Fixed in
Category
Out-of-bounds Write
Vex Document
Download VEXHow do I use it?
Sign up for the latest vulnerability alerts fixed in
PHP
Rss feed icon
Subscribe via RSS
or

By submitting the form I acknowledge receipt of our Privacy Policy.

Thanks for signing up for our Newsletter! We look forward to connecting with you.
Oops! Something went wrong while submitting the form.