{"vuln_id":"GHSA-ch8v-r6jh-4vvr","aliases":[],"description":"ext/filter: encode 0xFF in FILTER_SANITIZE_ENCODED","published_at":"2026-09-24T10:07:15Z","modified_at":"2026-09-24T10:07:15Z","first_seen_at":"2026-11-22T14:05:37.599483Z","severity":"low","severity_source":"ghsa","cvss_score":3.7,"cvss_vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N","cwe":[],"vendor":null,"product":null,"kev":{"is_kev":false,"date_added":null,"due_date":null,"ransomware":false},"epss":null,"epss_percentile":null,"nvd_status":null,"enriched_at":null,"links":{"nvd":"https://github.com/advisories/GHSA-ch8v-r6jh-4vvr"},"matched_alias":null,"items":[{"id":12632,"source":{"id":"gh-php-src","name":"PHP releases (GitHub php/php-src tags)"},"title":"GHSA-ch8v-r6jh-4vvr: ext/filter: encode 0xFF in FILTER_SANITIZE_ENCODED","summary":"ext/filter: encode 0xFF in FILTER_SANITIZE_ENCODED\n\n### Summary\n\n`php_filter_encode_url()` builds a 256-entry lookup table that decides which bytes `FILTER_SANITIZE_ENCODED` percent-encodes, but initialises only the first 255 entries. Entry 255 is read uninitialised, so whether the byte `0xFF` is encoded or passed through depends on whatever happened to be on the stack.\n\n### Details\n\nThe table is filled with `memset(tmp, 1, sizeof(tmp) - 1)`, which leaves `tmp[255]` untouched:\n\nhttps://github.com/php/php-src/blob/php-8.5.9/ext/filter/sanitizing_filters.c#L73\n\nThe filter then consults `tmp[*s]` for every input byte, so for `0xFF` the decision comes from uninitialised stack memory. Every other byte is handled deterministically.\n\nThe fix changes the `memset()` length to `sizeof(tmp)` so the whole table is initialised.\n\n### PoC\n\n```php\n<?php\n$out = filter_var(\"\\xff\\xfeabc\", FILTER_SANITIZE_ENCODED);\necho \"in : \", bin2hex(\"\\xff\\xfeabc\"), \"\\n\";\necho \"out: \", bin2hex($out), \"\\n\";\n```\n\n```\nin : fffe616263\nout: ff254645616263\n```\n\n`0xFE` is percent-encoded as `%FE` while `0xFF` is passed through raw, showing that `tmp[255]` was read uninitialised.\n\n### Impact\n\nThe impact is low. There is no crash and no memory corruption; the only effect is that the `0xFF` byte is sanitised inconsistently, depending on uninitialised stack contents. A downstream consumer that relies on `FILTER_SANITIZE_ENCODED` producing fully percent-encoded output could in principle be affected as part of a longer chain, but the filter provides no such guarantee on its own.\n\nThis issue was fixed publicly in 8.4.25 and 8.5.10 before it was recognised as security relevant, and is backported here to the branches that receive security fixes only.\n\n\nAffected packages: other:ext-filter\nPatched: ext-filter 8.2.34, ext-filter 8.3.35, ext-filter 8.4.25, ext-filter 8.5.10","url":"https://github.com/php/php-src/security/advisories/GHSA-ch8v-r6jh-4vvr","published_at":"2026-09-24T10:07:15Z","updated_at":"2026-09-24T10:07:15Z","fetched_at":"2026-11-22T14:05:37.431177Z","severity":"low","cvss_score":3.7,"epss":null,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":"php","product":"ext-filter","vuln_id":"GHSA-ch8v-r6jh-4vvr","vuln_ids":["GHSA-CH8V-R6JH-4VVR"],"tags":["repo-advisory","other","security","repo:php/php-src","stack"],"cluster_id":11741,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/12632","html":"https://vulnwatch.ve1ve2.com/item/12632"}}]}