Out-of-bounds read in urldecode()

Kurzinfo

Metadaten

  • Original (extern): Link oeffnen
  • Veroeffentlicht: 2026-05-07 12:56 UTC
  • Importiert: 2026-10-21 14:15 UTC
  • CVSS: 6.3
  • Quelle-ID: php_sec
  • uid_hash: 7ca41166f2613f9147187e0c5efb29f40108838a080c42cfe4ece998b8eeb8bd

Inhalt

Consider the following snippet within php_url_decode_ex() at ext/standard/url.c, called from PHPs urldecode() function:

https://github.com/php/php-src/blob/dcf653339c245e25ea319248d0fc071a9405d688/ext/standard/url.c#L592-L593

According to the C11 specification, isxdigit()'s (and all other ctype.h functions') only argument is of type int, and any value passed to it must be representable by unsigned char, i.e. 0-255.

§7.4:

The header declares several functions useful for classifying and mapping characters. In all cases the argument is an int, the value of which shall be representable as an unsigned char or shall equal the value of the macro EOF. If the argument has any other value, the behavior is undefined.

On platforms where plain char is signed (which is most), passing a char with a value <0 to int (or casting to int explicitly as in this case) will lead to signed integer extension, leading to a negative int value. Instead, the char value should be cast to unsigned char, so that no sign extension occurs.

Most platforms account for this common mistake. However, on NetBSD passing negative values to isxdigit() lead to an out-of-bounds read, leading to a segfault.

urldecode("%\x80");

Verknuepfte CVEs

CVE-ID Severity (Quelle) CVSS (Quelle) Severity (CVE.org) CVSS (CVE.org) EPSS EPSS-Pctl Veroeffentlicht (CVE.org)

CVE-2026-7258

MEDIUM

6.3

MEDIUM

6.3

2026-05-10

Quellen-Details

Bezeichnung Name Kategorie Tags Zielgruppe Sprache Feed-URL
PHP Security (php/php-src GHSA)

php_sec

vendor_advisory php, runtime - de https://github.com/php/php-src/security/advisories