# CVE-2021-21705: Incorrect URL validation in FILTER_VALIDATE_URL

> Incorrect URL validation in PHP's filter_var allows accepting invalid URLs, potentially leading to wrong server contact or access decisions.

- **Severity:** Medium 4.3 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:N/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 4 Oct 2021
- **Updated:** 17 Sep 2024
- **Also known as:** BIT-libphp-2021-21705, BIT-php-2021-21705, BIT-php-min-2021-21705, CLSA-2022-1654526233, CLSA-2022-1654526615, DEBIAN-CVE-2021-21705, ECHO-e319-72a4-3c9f, GHSA-rxcr-7xjm-f9c9, SUSE-SU-2021:2564-1, UBUNTU-CVE-2021-21705, openSUSE-SU-2021:2575-1

## What is CVE-2021-21705?

CVE-2021-21705 is a medium-severity vulnerability in Netapp Clustered Data Ontap, published on 4 Oct 2021. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

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 filter_var() function with FILTER_VALIDATE_URL 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.

Weakness: CWE-20 (Improper Input Validation)

## Which versions are affected by CVE-2021-21705?

3 open source packages ship an affected version, including libphp, php and php-min. It affects 3 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `libphp` | Bitnami | From 7.3.0 | 7.3.29, 7.4.21, 8.0.8 |
| `php` | Bitnami | From 7.3.0 | 7.3.29, 7.4.21, 8.0.8 |
| `php-min` | Bitnami | From 7.3.0 | 7.3.29, 7.4.21, 8.0.8 |
| `php72` | SUSE:Linux Enterprise Module for Web and Scripting 12 | All versions | 7.2.5-1.63.2 |
| `php72` | SUSE:Linux Enterprise Software Development Kit 12 SP5 | All versions | 7.2.5-1.63.2 |
| `php7` | openSUSE:Leap 15.3 | All versions | 7.2.5-4.76.5 |

Products: Netapp Clustered Data Ontap, Oracle Sd-Wan Aware, Php Php.

## How do I fix CVE-2021-21705?

Upgrade libphp to a fixed version for your release line: 7.3.29, 7.4.21 or 8.0.8.

## Is CVE-2021-21705 being exploited?

There is no known exploitation of CVE-2021-21705 in the wild and no public exploit code.

## Other vulnerabilities in Netapp Clustered Data Ontap

- [CVE-2015-7853](https://insights.sbomify.com/CVE-2015-7853/): Integer overflow in n/a (critical 9.8)
- [CVE-2017-9119](https://insights.sbomify.com/CVE-2017-9119/): Denial of service in n/a (critical 9.8)
- [CVE-2016-7480](https://insights.sbomify.com/CVE-2016-7480/): Deserialization in PHP before 7.0.12 (critical 9.8)
- [CVE-2017-5340](https://insights.sbomify.com/CVE-2017-5340/): Integer overflow in n/a (critical 9.8)
- [CVE-2017-11147](https://insights.sbomify.com/CVE-2017-11147/): Information disclosure in n/a (critical 9.1)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2021-21705 and fix it if it is affected.

What it is: CVE-2021-21705 is a medium-severity vulnerability in Netapp Clustered Data Ontap, published on 4 Oct 2021. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2021-21705 in the wild and no public exploit code.

Affected packages and fixed versions:
- libphp (Bitnami): affected from 7.3.0; fixed in 7.3.29, 7.4.21, 8.0.8
- php (Bitnami): affected from 7.3.0; fixed in 7.3.29, 7.4.21, 8.0.8
- php-min (Bitnami): affected from 7.3.0; fixed in 7.3.29, 7.4.21, 8.0.8

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2021-21705/ (Markdown: https://insights.sbomify.com/CVE-2021-21705/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2021-21705
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2021-21705
- OSV: https://osv.dev/vulnerability/CVE-2021-21705

---
From sbomify Insights: https://insights.sbomify.com/CVE-2021-21705/
Summaries are generated and may contain mistakes; the official description above is the record.
