VulnWatch by ve1ve2
medium 6.3 EPSS 0.56%

GHSA-mg3p-mxj9-g2mm / CVE-2026-129438: Incorrect RFC 3986 URI serialization for oversized input

Source:
PHP releases (GitHub php/php-src tags)
Published:
Fetched:
Updated:
Affects:
php ext-uri

https://github.com/php/php-src/security/advisories/GHSA-mg3p-mxj9-g2mm ↗

repo-advisoryphpCWE-190CWE-252securityrepo:php/php-src

Incorrect RFC 3986 URI serialization for oversized input ### Summary PHP's RFC 3986 URI implementation can return an incorrect string when a very large URI is converted back to text. An application that accepts attacker-controlled URI data and has enough memory to process it may receive a truncated or invalid URI instead of an error. Processing these inputs can also exhaust memory or terminate the PHP process. This affects the `Uri\Rfc3986\Uri` class introduced in PHP 8.5.0. The legacy `parse_url()` function and the separate `Uri\WhatWg\Url` implementation are not affected by this issue. ### Details PHP uses the uriparser library to convert an RFC 3986 URI back to text. The vulnerable implementation does not correctly handle the library's output-size limit or errors returned while calculating or writing the result. For a URI whose string representation is exactly 2,147,483,647 bytes, PHP overflows the size calculation when it reserves space for the terminating byte. The conversion then fails, but PHP can still return the allocated string as a successful result. With longer URIs, PHP can use an incomplete length calculation and return only part of the URI. Testing on a normal, non-debug PHP build confirmed that `toString()` and `toRawString()` could return a 2,147,483,647-byte string containing zeroes. A URI one byte longer returned only its `a://b/` prefix. Other operations that convert an RFC 3986 URI to text can reach the same implementation. The defect is in PHP's handling of uriparser's size limit and return values. Updating uriparser alone does not correct it. Correct handling requires PHP to reject a representation that cannot fit the library's supported output size and report a conversion error instead of returning an invalid string. ### Impact Exploitation requires an application to pass attacker-controlled URI data large enough to reach the approximately 2 GiB boundary to an affected operation. The PHP process must also have enough memory to construct and process the URI. Normal application-level URI length limits prevent the demonstrated inputs from reaching this condition. An application that trusts the resulting string may make an incorrect comparison, validation or routing decision, or store an incomplete URI. The large allocations can also exhaust the request's memory allowance. In the tested development build, exceeding the soft memory limit produced a memory-exhaustion error; exceeding the hard limit immediately terminated the PHP process. This can temporarily reduce service capacity. The allocations remain subject to PHP's memory-limit checks. A memory-limit bypass was not observed. The tests also did not establish disclosure of data from other requests: the large result allocation used fresh operating-system memory and contained zeroes. Arbitrary code execution and broader confidentiality or integrity impact have not been demonstrated. ### Affected versions The affected code was introduced in PHP 8.5.0 together with the `Uri\Rfc3986\Uri` class. P Affected packages: php:ext-uri Patched: ext-uri 8.5.13

Linked vulnerabilities (2)

CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:L/VA:L/SC:N/SI:N/SA:N

Incorrect RFC 3986 URI serialization for oversized input

CWE: CWE-190, CWE-252Aliases: CVE-2026-129438
CVE-2026-129438 medium 6.3 EPSS 0.56% (p48) NVDCVE.orgGHSA
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:L/VA:L/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X

Incorrect RFC 3986 URI serialization for oversized input

CWE: CWE-190, CWE-252Aliases: GHSA-mg3p-mxj9-g2mmNVD: Awaiting Analysis