CVE-2021-21705: Incorrect URL validation in FILTER_VALIDATE_URL
A security issue was found in PHP in the way it allows to bypass the FILTERVALIDATEURL check via a crafted URL which may lead to SSRF.
Reference: https://bugs.php.net/bug.php?id=81122
Other sources
Fixed bug (SSRF bypass in FILTERVALIDATEURL). (CVE-2021-21705)
— PHP
In PHP versions 7.3.x below 7.3.29, 7.4.x below 7.4.21 and 8.0.x below 8.0.8, when using URL validation functionality via filtervar() function with FILTERVALIDATEURL parameter, an URL with invalid password field can be accepted as valid. This can lead to the code incorrectly parsing the URL and potentially leading to other security implications - like contacting a wrong server or making a wrong access decision.
— MITRE
Incorrect URL validation in FILTERVALIDATEURL
— Microsoft
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
PHPto a version that resolves this vulnerability.Fixed in 8.0.8 - Upgrade
Upgrade
alpine/php7to a version that resolves this vulnerability.Fixed in 7.3.29-r0 - Upgrade
Upgrade
alpine/php7to a version that resolves this vulnerability.Fixed in 7.4.21-r0 - Upgrade
Upgrade
alpine/php8to a version that resolves this vulnerability.Fixed in 8.0.8-r0 - Upgrade
Upgrade
redhat/phpto a version that resolves this vulnerability.Fixed in 7.3.29 - Upgrade
Upgrade
redhat/phpto a version that resolves this vulnerability.Fixed in 7.4.21 - Upgrade
Upgrade
redhat/phpto a version that resolves this vulnerability.Fixed in 8.0.8 - Upgrade
Upgrade
debian/php7.4to a version that resolves this vulnerability.Fixed in 7.4.21-1+deb11u1 - Upgrade
Upgrade
debian/php7.0to a version that resolves this vulnerability.Fixed in 7.0.33-0+deb9u11 - Upgrade
Upgrade
debian/php7.3to a version that resolves this vulnerability.Fixed in 7.3.29-1~deb10u1 - Upgrade
Upgrade
debian/php8.0to a version that resolves this vulnerability.Fixed in 8.0.8-1 - Upgrade
Upgrade
PHPto a version that resolves this vulnerability.Fixed in 7.3.29 - Upgrade
Upgrade
PHPto a version that resolves this vulnerability.Fixed in 7.4.21
Event History
Frequently Asked Questions
What is the vulnerability ID of this bug?
The vulnerability ID of this bug is CVE-2021-21705.
What is the severity level of CVE-2021-21705?
The severity level of CVE-2021-21705 is medium (5.3).
Which PHP versions are affected by CVE-2021-21705?
PHP versions 7.3.x below 7.3.29, 7.4.x below 7.4.21, and 8.0.x below 8.0.8 are affected by CVE-2021-21705.
How can CVE-2021-21705 be exploited?
CVE-2021-21705 can be exploited by using an URL with an invalid password field that is accepted as valid, leading to incorrect parsing of the URL and potential code execution.
Where can I find more information about CVE-2021-21705?
You can find more information about CVE-2021-21705 at the following references: [reference 1], [reference 2], [reference 3].