# CVE-2021-21704: Multiple vulnerabilities in Firebird client extension

> A malicious Firebird database server can trigger memory corruption and denial of service in PHP applications using the Firebird PDO driver.

- **Severity:** Medium 5.0 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:L`)
- **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-21704, BIT-php-2021-21704, BIT-php-min-2021-21704, DEBIAN-CVE-2021-21704, ECHO-fa97-935d-c387, GHSA-q773-v75g-5rqg, SUSE-SU-2021:2638-1, SUSE-SU-2021:2795-1, UBUNTU-CVE-2021-21704, openSUSE-SU-2021:2795-1

## What is CVE-2021-21704?

CVE-2021-21704 is a medium-severity memory corruption 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 Firebird PDO driver extension, a malicious database server could cause crashes in various database functions, such as getAttribute(), execute(), fetch() and others by returning invalid response data that is not parsed correctly by the driver. This can result in crashes, denial of service or potentially memory corruption.

Weakness: CWE-787 (Out-of-bounds Write), CWE-190 (Integer Overflow or Wraparound), CWE-125 (Out-of-bounds Read)

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

3 open source packages ship an affected version, including libphp, php and php-min. It affects 2 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 |
| `php7` | SUSE:Enterprise Storage 6 | All versions | 7.2.5-4.79.1 |
| `php7` | SUSE:Linux Enterprise High Performance Computing 15 SP1-ESPOS | All versions | 7.2.5-4.79.1 |
| `php7` | SUSE:Linux Enterprise High Performance Computing 15 SP1-LTSS | All versions | 7.2.5-4.79.1 |
| `php7` | SUSE:Linux Enterprise High Performance Computing 15-ESPOS | All versions | 7.2.5-4.79.1 |
| `php7` | SUSE:Linux Enterprise High Performance Computing 15-LTSS | All versions | 7.2.5-4.79.1 |
| `php72` | SUSE:Linux Enterprise Module for Web and Scripting 12 | All versions | 7.2.5-1.66.1 |
| `php7` | SUSE:Linux Enterprise Server 15 SP1-BCL | All versions | 7.2.5-4.79.1 |
| `php7` | SUSE:Linux Enterprise Server 15 SP1-LTSS | All versions | 7.2.5-4.79.1 |
| `php7` | SUSE:Linux Enterprise Server 15-LTSS | All versions | 7.2.5-4.79.1 |
| `php7` | SUSE:Linux Enterprise Server for SAP Applications 15 | All versions | 7.2.5-4.79.1 |
| `php7` | SUSE:Linux Enterprise Server for SAP Applications 15 SP1 | All versions | 7.2.5-4.79.1 |
| `php72` | SUSE:Linux Enterprise Software Development Kit 12 SP5 | All versions | 7.2.5-1.66.1 |
| `php7` | SUSE:Manager Proxy 4.0 | All versions | 7.2.5-4.79.1 |
| `php7` | SUSE:Manager Retail Branch Server 4.0 | All versions | 7.2.5-4.79.1 |
| `php7` | SUSE:Manager Server 4.0 | All versions | 7.2.5-4.79.1 |
| `php7` | openSUSE:Leap 15.3 | All versions | 7.2.5-4.79.1 |

Products: Netapp Clustered Data Ontap, Php Php.

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

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

## Is CVE-2021-21704 being exploited?

There is no known exploitation of CVE-2021-21704 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-21704 and fix it if it is affected.

What it is: CVE-2021-21704 is a medium-severity memory corruption 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-21704 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-21704/ (Markdown: https://insights.sbomify.com/CVE-2021-21704/index.md)
```

## Sources

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

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