Advisories · PHP & Laravel
CVE-2024-5458
Medium
CVSS 5.3
PHP filter_var URL host confusion
Disclosed 2024 · Last reviewed 2 Dec 2026
FILTER_VALIDATE_URL could accept a host that browsers and the application then treated differently.
What happened
The URL filter allowed a host form that did not match how other parsers read the same string.
Affected and patched versions
- Affected
- PHP 8.1 before 8.1.29, 8.2 before 8.2.20, and 8.3 before 8.3.8.
- Patched
- PHP 8.1.29, 8.2.20, 8.3.8, and later.
How to check your server
Check
php -v
How to fix and harden
- Upgrade PHP.
- Do not use filter_var as the only allow-list for a URL you will fetch. Parse the host yourself and allow only the hosts you expect.
Fix
php -v
Sources
Version ranges and fixes follow the vendor advisory. When a distribution backports a fix, trust its security tracker over the upstream version number. New advisories: RSS · JSON