{"vuln_id":"CVE-2020-7071","aliases":[],"description":"In PHP versions 7.3.x below 7.3.26, 7.4.x below 7.4.14 and 8.0.0, when validating URL with functions like filter_var($url, FILTER_VALIDATE_URL), PHP will accept an URL with invalid password as valid URL. This may lead to functions that rely on URL being valid to mis-parse the URL and produce wrong data as components of the URL.","published_at":"2021-02-15T04:15:12.563000Z","modified_at":"2026-06-17T03:24:18.723000Z","first_seen_at":"2026-11-22T14:05:37.631062Z","severity":"medium","severity_source":"nvd","cvss_score":5.3,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N","cwe":["CWE-20"],"vendor":null,"product":null,"kev":{"is_kev":false,"date_added":null,"due_date":null,"ransomware":false},"epss":0.02937,"epss_percentile":0.87832,"nvd_status":"Modified","enriched_at":"2026-11-22T14:20:40.039976Z","links":{"nvd":"https://nvd.nist.gov/vuln/detail/CVE-2020-7071"},"matched_alias":null,"items":[{"id":12673,"source":{"id":"gh-php-src","name":"PHP releases (GitHub php/php-src tags)"},"title":"GHSA-w8qr-v226-r27w / CVE-2024-5458: Filter bypass in filter_var (FILTER_VALIDATE_URL)","summary":"Filter bypass in filter_var (FILTER_VALIDATE_URL)\n\n### Summary\r\nAn early-return in filter_var (FILTER_VALIDATE_URL) will result in invalid user information (username + password part of URLs) being treated as valid user information.\r\n\r\nThis causes the same problems as CVE-2020-7071, but with IPv6 host parts.\r\n\r\n### Details\r\nThe function `php_filter_validate_url` in [php-src/ext/filter/logical_filters.c](https://github.com/php/php-src/blob/master/ext/filter/logical_filters.c) contains the logic for validating URLs.\r\n\r\nFor HTTP-IPv6 addresses the implementation contains an early return statement that results in further checks on the user_info being skipped.\r\nThe offending return statement is at: https://github.com/php/php-src/blob/master/ext/filter/logical_filters.c#L618\r\n\r\nThis results in invalid user information being passed as valid for URLs with IPv6 Hosts.\r\n\r\nFix: Restructuring the code to include the user_info checks if the IPv6-host part is correct.\r\nThis could be done by only return \"SUCCESS\" if the end of the function is reached.\r\n\r\n### PoC\r\n\r\nTo prove the user info check was skipped I looked for a character that is not allowed in usernames. (Based on the validation code in `is_userinfo_valid`) \r\nI chose `[`.\r\nThe following statements show that the handling of the URLs is different if the \"host\" part of the URL is changed.\r\n\r\n```php\r\nvar_dump(filter_var(\"http://t[est@127.0.0.1\", FILTER_VALIDATE_URL));\r\nvar_dump(filter_var(\"http://t[est@[::1]\", FILTER_VALIDATE_URL));\r\n```\r\nOutput for 7.3.27 - 7.3.33, 7.4.15 - 7.4.33, 8.0.2 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7\r\n```\r\nbool(false)\r\nstring(18) \"http://t[est@[::1]\"\r\n```\r\nOutput for 7.3.26, 7.4.14, 8.0.1 (CVE-2020-7071 was patched here!)\r\n```\r\nbool(false)\r\nbool(false)\r\n```\r\nOutput for 5.2.0 - 5.2.12, 5.3.0 - 5.3.1, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.25, 7.4.0 - 7.4.13, 8.0.0\r\n```\r\nstring(22) \"http://t[est@127.0.0.1\"\r\nstring(18) \"http://t[est@[::1]\"\r\n```\r\nOutput for 5.2.13 - 5.2.17, 5.3.2 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40\r\n```\r\nstring(22) \"http://t[est@127.0.0.1\"\r\nbool(false)\r\n```\r\n\r\n### Impact\r\n\r\nThis bug impacts users that expect only completely valid URLs to be returned by `filter_var` (FILTER_VALIDATE_URL).\r\nAs this function is meant to validate user supplied strings this will be exposed to raw user input often.\r\n\r\nAs this is almost the same vulnerability as CVE-2020-7071 this should also have a MEDIUM impact.\r\n\r\nRelated info:\r\nBugfix for invalid usernames: https://bugs.php.net/bug.php?id=77423 (contains another example POC)\r\n\nPatched:  8.1.29, 8.2.20, 8.3.8.","url":"https://github.com/php/php-src/security/advisories/GHSA-w8qr-v226-r27w","published_at":"2024-06-09T18:13:48Z","updated_at":"2024-06-09T18:13:48Z","fetched_at":"2026-11-22T14:05:37.431200Z","severity":"medium","cvss_score":5.3,"epss":0.12117,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":"php","product":"php-src","vuln_id":"CVE-2024-5458","vuln_ids":["CVE-2020-7071","CVE-2024-5458","GHSA-W8QR-V226-R27W"],"tags":["repo-advisory","security","repo:php/php-src","stack"],"cluster_id":11785,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/12673","html":"https://vulnwatch.ve1ve2.com/item/12673"}}]}