# CVE-2021-46878: Use after free in n/a

> An attacker can execute arbitrary code by tricking a user into opening a crafted file, exploiting a use-after-free vulnerability in Fluent Bit's msgpack parsing.

- **Severity:** High 7.8 (`CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Local or same network only
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 11 Apr 2023
- **Updated:** 11 Feb 2025
- **Also known as:** BIT-fluent-bit-2021-46878, GHSA-r3hq-4h29-qfq9

## What is CVE-2021-46878?

CVE-2021-46878 is a high-severity use after free vulnerability in n/a, published on 11 Apr 2023. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

### Official description

An issue was discovered in Treasure Data Fluent Bit 1.7.1, erroneous parsing in flb_pack_msgpack_to_json_format leads to type confusion bug that interprets whatever is on the stack as msgpack maps and arrays, leading to use-after-free. This can be used by an attacker to craft a specially craft file and trick the victim opening it using the affect software, triggering use-after-free and execute arbitrary code on the target system.

Weakness: CWE-843 (Access of Resource Using Incompatible Type)

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

1 open source package ship an affected version, including fluent-bit. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `fluent-bit` | Bitnami | From 1.7.1 | 1.7.2 |

Products: Treasuredata Fluent Bit.

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

Upgrade fluent-bit to 1.7.2 or later.

## Is CVE-2021-46878 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2021-46878 exists.

## Other vulnerabilities in n/a

- [CVE-2024-4323](https://insights.sbomify.com/CVE-2024-4323/): Fluent Bit Memory Corruption Vulnerability (critical 9.8)
- [CVE-2021-36088](https://insights.sbomify.com/CVE-2021-36088/): Use after free in n/a (critical 9.8)
- [CVE-2025-12977](https://insights.sbomify.com/CVE-2025-12977/): CVE-2025-12977 (critical 9.1)
- [CVE-2025-12970](https://insights.sbomify.com/CVE-2025-12970/): CVE-2025-12970 (high 8.8)
- [CVE-2021-46879](https://insights.sbomify.com/CVE-2021-46879/): Memory corruption in n/a (high 7.8)

## Fix prompt for AI coding agents

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

What it is: CVE-2021-46878 is a high-severity use after free vulnerability in n/a, published on 11 Apr 2023. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2021-46878 exists.

Affected packages and fixed versions:
- fluent-bit (Bitnami): affected from 1.7.1; fixed in 1.7.2

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-46878/ (Markdown: https://insights.sbomify.com/CVE-2021-46878/index.md)
```

## Sources

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

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