Innovate faster and cut risk with PHP experts from Zend Services.
Explore Services
See How Zend Helps Leading Hosting Providers Keep Their Managed Sites on Secure PHP
Read More
Learn PHP from PHP experts with free, on-demand, and instructor led courses.
Explore Training
Submit support requests and browse self-service resources.
Explore Support
php: Filter bypass in filter_var FILTER_VALIDATE_URL
Due to a code logic error, filtering functions such as filter_var when validating URLs (FILTER_VALIDATE_URL) for certain types of URLs the function will result in invalid user information (username + password part of URLs) being treated as valid user information. This may lead to the downstream code accepting invalid URLs as valid and parsing them incorrectly.
This bug impacts users that expect only completely valid URLs to be returned by filter_var (FILTER_VALIDATE_URL). As this function is meant to validate user supplied strings this will be exposed to raw user input often.
One course of mitigation is to switch from using filter_var() with the FILTER_VALIDATE_URL flag to instead using a 3rd-party library that performs URL validation without filter_var(). One good example is league/uri-interfaces, which can be used as follows:
use League\Uri\UriString; use League\Uri\Exceptions\SyntaxError; try { UriString::parse($someUrlToValidate); } catch (SyntaxError $e) { // URL is invalid }
Additionally, we recommend upgrading to a patched version of PHP.
Direct link to CVE-2024-5458 >
< View all CVEs