CVE-2021-21705: Incorrect URL validation in FILTER_VALIDATE_URL

Published Jun 28, 2021
·
Updated

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

23 affected componentsFixes available
PHP PHP>=7.3.0<7.3.29
PHP PHP>=7.4.0<7.4.21
PHP PHP>=8.0.0<8.0.8
NetApp Clustered Data ONTAP
Oracle SD-WAN Aware=8.2
PHP PHP<8.0.8
8.0.8
Microsoft cbl2 php
alpine/php7<7.3.29-r0
7.3.29-r0
alpine/php7<7.4.21-r0
7.4.21-r0
alpine/php7<7.4.21-r0
7.4.21-r0
alpine/php7<7.4.21-r0
7.4.21-r0
alpine/php8<8.0.8-r0
8.0.8-r0
alpine/php8<8.0.8-r0
8.0.8-r0
alpine/php8<8.0.8-r0
8.0.8-r0
alpine/php8<8.0.8-r0
8.0.8-r0
redhat/php<7.3.29
7.3.29
redhat/php<7.4.21
7.4.21
redhat/php<8.0.8
8.0.8
debian/php7.4<7.4.21-1+deb11u1
7.4.21-1+deb11u1
debian/php7.0
7.0.33-0+deb9u11
debian/php7.3
7.3.29-1~deb10u1
debian/php7.4
7.4.21-1+deb11u1
debian/php8.0
8.0.8-1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade PHP to a version that resolves this vulnerability.

    Fixed in 8.0.8
  2. Upgrade

    Upgrade alpine/php7 to a version that resolves this vulnerability.

    Fixed in 7.3.29-r0
  3. Upgrade

    Upgrade alpine/php7 to a version that resolves this vulnerability.

    Fixed in 7.4.21-r0
  4. Upgrade

    Upgrade alpine/php8 to a version that resolves this vulnerability.

    Fixed in 8.0.8-r0
  5. Upgrade

    Upgrade redhat/php to a version that resolves this vulnerability.

    Fixed in 7.3.29
  6. Upgrade

    Upgrade redhat/php to a version that resolves this vulnerability.

    Fixed in 7.4.21
  7. Upgrade

    Upgrade redhat/php to a version that resolves this vulnerability.

    Fixed in 8.0.8
  8. Upgrade

    Upgrade debian/php7.4 to a version that resolves this vulnerability.

    Fixed in 7.4.21-1+deb11u1
  9. Upgrade

    Upgrade debian/php7.0 to a version that resolves this vulnerability.

    Fixed in 7.0.33-0+deb9u11
  10. Upgrade

    Upgrade debian/php7.3 to a version that resolves this vulnerability.

    Fixed in 7.3.29-1~deb10u1
  11. Upgrade

    Upgrade debian/php8.0 to a version that resolves this vulnerability.

    Fixed in 8.0.8-1
  12. Upgrade

    Upgrade PHP to a version that resolves this vulnerability.

    Fixed in 7.3.29
  13. Upgrade

    Upgrade PHP to a version that resolves this vulnerability.

    Fixed in 7.4.21

Event History

Jun 28, 2021
CVE Published
via MITRE·12:00 AM
Data Sourced
via MITRE·12:00 AM
DescriptionSeverityWeakness
Jul 1, 2021
Data Sourced
12:00 AM
DescriptionAffected Software
Updated
12:00 AM
Affected Software
Updated
12:00 AM
DescriptionAffected Software
Jul 2, 2021
Data Sourced
via Red Hat·04:18 PM
DescriptionSeverityAffected Software
Oct 4, 2021
CVE Published
via MITRE·04:00 AM
Data Sourced
via OSV·04:15 AM
DescriptionSeverityAffected Software
Data Sourced
via NVD·04:15 AM
RemedyDescriptionSeverityWeaknessAffected Software
Oct 29, 2022
Data Sourced
02:50 AM
RemedySeverityWeakness
Oct 1, 2025
Data Sourced
via Microsoft·11:11 PM
DescriptionSeverityWeakness
Data Sourced
via Microsoft·11:11 PM
Affected Software
Nov 24, 2026
Withdrawn
via OSV·04:29 AM

Parent advisories

This vulnerability appears in the following advisories.

Peer vulnerabilities

Found alongside the following vulnerabilities.

Frequently Asked Questions

1

What is the vulnerability ID of this bug?

The vulnerability ID of this bug is CVE-2021-21705.

2

What is the severity level of CVE-2021-21705?

The severity level of CVE-2021-21705 is medium (5.3).

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.

4

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.

5

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].

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203