# CVE-2022-4899: zstd vulnerable to buffer overrun

> An attacker can cause a buffer overrun and denial of service by supplying an empty string argument to the zstd command line tool.

- **Severity:** High 7.5 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 31 Mar 2023
- **Updated:** 18 Feb 2025
- **Also known as:** AZL-25813, DEBIAN-CVE-2022-4899, ECHO-9a1d-1b7a-719e, GHSA-5c9c-6x87-f9vm, MGASA-2023-0128, OESA-2023-1213, OESA-2023-1214, ROOT-OS-DEBIAN-11-CVE-2022-4899, SUSE-SU-2023:1688-1, SUSE-SU-2023:2074-1, UBUNTU-CVE-2022-4899, openSUSE-SU-2024:13613-1

## What is CVE-2022-4899?

CVE-2022-4899 is a high-severity denial of service vulnerability in zstd, published on 31 Mar 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

A vulnerability was found in zstd v1.4.10, where an attacker can supply empty string as an argument to the command line tool to cause buffer overrun.

Weakness: CWE-400 (Uncontrolled Resource Consumption)

## Which versions are affected by CVE-2022-4899?

4 open source packages ship an affected version, including zstd and github.com/facebook/zstd. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `zstd` | PyPI | All versions | 1.5.4.0 |
| `zstd` | PyPI | All versions | 1.5.4.0 |
| `github.com/facebook/zstd` | SwiftURL | All versions | 1.5.4 |
| `github.com/facebook/zstd` | SwiftURL | All versions | 1.5.4 |
| `zstd` | SUSE:Linux Enterprise Micro 5.1 | All versions | 1.4.4-150000.1.9.1 |
| `zstd` | SUSE:Linux Enterprise Micro 5.2 | All versions | 1.4.4-150000.1.9.1 |
| `zstd` | SUSE:Linux Enterprise Micro 5.3 | All versions | 1.5.0-150400.3.3.1 |
| `zstd` | SUSE:Linux Enterprise Micro 5.4 | All versions | 1.5.0-150400.3.3.1 |
| `zstd` | SUSE:Linux Enterprise Module for Basesystem 15 SP4 | All versions | 1.5.0-150400.3.3.1 |
| `zstd` | SUSE:Linux Enterprise Real Time 15 SP3 | All versions | 1.4.4-150000.1.9.1 |
| `zstd` | openSUSE:Leap 15.4 | All versions | 1.5.0-150400.3.3.1 |
| `zstd` | openSUSE:Leap Micro 5.3 | All versions | 1.5.0-150400.3.3.1 |
| `zstd` | openSUSE:Tumbleweed | All versions | 1.5.5-5.1 |

Products: Facebook Zstandard.

## How do I fix CVE-2022-4899?

Upgrade zstd to 1.5.4.0 or later.

## Is CVE-2022-4899 being exploited?

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

## Other vulnerabilities in zstd

- [CVE-2019-11922](https://insights.sbomify.com/CVE-2019-11922/): Race condition in Zstandard (high 8.1)
- [CVE-2021-24031](https://insights.sbomify.com/CVE-2021-24031/): Information disclosure in Zstandard (medium 5.5)
- [CVE-2021-24032](https://insights.sbomify.com/CVE-2021-24032/): Information disclosure in Zstandard (medium 4.7)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2022-4899 and fix it if it is affected.

What it is: CVE-2022-4899 is a high-severity denial of service vulnerability in zstd, published on 31 Mar 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2022-4899 in the wild and no public exploit code.

Affected packages and fixed versions:
- zstd (PyPI): affected all versions; fixed in 1.5.4.0
- zstd (PyPI): affected all versions; fixed in 1.5.4.0
- github.com/facebook/zstd (SwiftURL): affected all versions; fixed in 1.5.4
- github.com/facebook/zstd (SwiftURL): affected all versions; fixed in 1.5.4

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

## Sources

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

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