# CVE-2022-4904: Memory corruption in c-ares

> A stack overflow in c-ares allows attackers to cause denial of service or limited data exposure via invalid input.

- **Severity:** High 8.6 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/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:** 6 Mar 2023
- **Updated:** 2 Dec 2025
- **Also known as:** ALSA-2023:7116, AZL-13817, AZL-13827, AZL-13828, AZL-34775, AZL-43921, CLSA-2025-1744116893, CLSA-2026-1776431757, CLSA-2026-1776432133, CLSA-2026-1792443100, DEBIAN-CVE-2022-4904, DLA-3323-1, ECHO-38f2-beda-35a2, GHSA-v7h6-g695-5j7q, MGASA-2023-0069, OESA-2023-1091, OESA-2023-1110, RHSA-2023:6291, RHSA-2023:7116, RHSA-2023:7368, SUSE-SU-2023:0486-1, SUSE-SU-2023:3420-1, UBUNTU-CVE-2022-4904, USN-5907-1, openSUSE-SU-2024:12674-1

## What is CVE-2022-4904?

CVE-2022-4904 is a high-severity memory corruption vulnerability in Fedoraproject Fedora, published on 6 Mar 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

A flaw was found in the c-ares package. The ares_set_sortlist is missing checks about the validity of the input string, which allows a possible arbitrary length stack overflow. This issue may cause a denial of service or a limited impact on confidentiality and integrity.

Weakness: CWE-1284 (Improper Validation of Specified Quantity in Input), CWE-20 (Improper Input Validation)

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

It affects 4 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `c-ares` | AlmaLinux:8 | All versions | 1.13.0-8.el8 |
| `c-ares-devel` | AlmaLinux:8 | All versions | 1.13.0-8.el8 |
| `c-ares` | Red Hat:enterprise_linux:8::baseos | All versions | 0:1.13.0-8.el8 |
| `c-ares-debuginfo` | Red Hat:enterprise_linux:8::baseos | All versions | 0:1.13.0-8.el8 |
| `c-ares-debugsource` | Red Hat:enterprise_linux:8::baseos | All versions | 0:1.13.0-8.el8 |
| `c-ares-devel` | Red Hat:enterprise_linux:8::baseos | All versions | 0:1.13.0-8.el8 |
| `c-ares-debuginfo` | Red Hat:rhel_eus:9.0::appstream | All versions | 0:1.17.1-5.el9_0.2 |
| `c-ares-debugsource` | Red Hat:rhel_eus:9.0::appstream | All versions | 0:1.17.1-5.el9_0.2 |
| `c-ares-devel` | Red Hat:rhel_eus:9.0::appstream | All versions | 0:1.17.1-5.el9_0.2 |
| `c-ares` | Red Hat:rhel_eus:9.0::baseos | All versions | 0:1.17.1-5.el9_0.2 |
| `c-ares-debuginfo` | Red Hat:rhel_eus:9.0::baseos | All versions | 0:1.17.1-5.el9_0.2 |
| `c-ares-debugsource` | Red Hat:rhel_eus:9.0::baseos | All versions | 0:1.17.1-5.el9_0.2 |
| `c-ares-debuginfo` | Red Hat:rhel_eus:9.2::appstream | All versions | 0:1.17.1-5.el9_2.2 |
| `c-ares-debugsource` | Red Hat:rhel_eus:9.2::appstream | All versions | 0:1.17.1-5.el9_2.2 |
| `c-ares-devel` | Red Hat:rhel_eus:9.2::appstream | All versions | 0:1.17.1-5.el9_2.2 |
| `c-ares` | Red Hat:rhel_eus:9.2::baseos | All versions | 0:1.17.1-5.el9_2.2 |
| `c-ares-debuginfo` | Red Hat:rhel_eus:9.2::baseos | All versions | 0:1.17.1-5.el9_2.2 |
| `c-ares-debugsource` | Red Hat:rhel_eus:9.2::baseos | All versions | 0:1.17.1-5.el9_2.2 |
| `c-ares` | SUSE:Enterprise Storage 7 | All versions | 1.19.0-150000.3.20.1 |
| `c-ares` | SUSE:Enterprise Storage 7.1 | All versions | 1.19.0-150000.3.20.1 |
| `c-ares` | SUSE:Linux Enterprise High Performance Computing 15 SP1-LTSS | All versions | 1.19.0-150000.3.20.1 |
| `c-ares` | SUSE:Linux Enterprise High Performance Computing 15 SP2-LTSS | All versions | 1.19.0-150000.3.20.1 |
| `c-ares` | SUSE:Linux Enterprise High Performance Computing 15 SP3-ESPOS | All versions | 1.19.0-150000.3.20.1 |
| `c-ares` | SUSE:Linux Enterprise High Performance Computing 15 SP3-LTSS | All versions | 1.19.0-150000.3.20.1 |
| `c-ares` | SUSE:Linux Enterprise Micro 5.1 | All versions | 1.19.0-150000.3.20.1 |
| `c-ares` | SUSE:Linux Enterprise Micro 5.2 | All versions | 1.19.0-150000.3.20.1 |
| `c-ares` | SUSE:Linux Enterprise Micro 5.3 | All versions | 1.19.0-150000.3.20.1 |
| `c-ares` | SUSE:Linux Enterprise Module for Basesystem 15 SP4 | All versions | 1.19.0-150000.3.20.1 |
| `c-ares` | SUSE:Linux Enterprise Real Time 15 SP3 | All versions | 1.19.0-150000.3.20.1 |
| `libcares2` | SUSE:Linux Enterprise Server 12 SP5 | All versions | 1.9.1-9.15.1 |
| `c-ares` | SUSE:Linux Enterprise Server 15 SP1-LTSS | All versions | 1.19.0-150000.3.20.1 |
| `c-ares` | SUSE:Linux Enterprise Server 15 SP2-LTSS | All versions | 1.19.0-150000.3.20.1 |
| `c-ares` | SUSE:Linux Enterprise Server 15 SP3-LTSS | All versions | 1.19.0-150000.3.20.1 |
| `libcares2` | SUSE:Linux Enterprise Server for SAP Applications 12 SP5 | All versions | 1.9.1-9.15.1 |
| `c-ares` | SUSE:Linux Enterprise Server for SAP Applications 15 SP1 | All versions | 1.19.0-150000.3.20.1 |
| `c-ares` | SUSE:Linux Enterprise Server for SAP Applications 15 SP2 | All versions | 1.19.0-150000.3.20.1 |
| `c-ares` | SUSE:Linux Enterprise Server for SAP Applications 15 SP3 | All versions | 1.19.0-150000.3.20.1 |
| `libcares2` | SUSE:Linux Enterprise Software Development Kit 12 SP5 | All versions | 1.9.1-9.15.1 |
| `libcares2` | SUSE:Linux Enterprise Workstation Extension 12 SP5 | All versions | 1.9.1-9.15.1 |
| `c-ares` | SUSE:Manager Proxy 4.2 | All versions | 1.19.0-150000.3.20.1 |

Products: C-Ares Project C-Ares, Fedoraproject Fedora, Redhat Enterprise Linux, Redhat Software Collections.

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

Apply the vendor's patch.

## Is CVE-2022-4904 being exploited?

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

## Other vulnerabilities in Fedoraproject Fedora

- [CVE-2023-32067](https://insights.sbomify.com/CVE-2023-32067/): 0-byte UDP payload DoS in c-ares (high 7.5)
- [CVE-2020-8277](https://insights.sbomify.com/CVE-2020-8277/): Uncontrolled Resource Consumption in node (high 7.5)
- [CVE-2023-31147](https://insights.sbomify.com/CVE-2023-31147/): Insufficient randomness in generation of DNS query IDs in c-ares (medium 5.9)
- [CVE-2021-3672](https://insights.sbomify.com/CVE-2021-3672/): Other in c-ares (medium 5.6)
- [CVE-2023-31130](https://insights.sbomify.com/CVE-2023-31130/): Buffer Underwrite in ares_inet_net_pton() (medium 4.1)

## Fix prompt for AI coding agents

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

What it is: CVE-2022-4904 is a high-severity memory corruption vulnerability in Fedoraproject Fedora, published on 6 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-4904 in the wild and no public exploit code.

Affected product: Fedoraproject Fedora. No package-level version data is available, so check the vendor advisory linked from the reference page.

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

## Sources

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

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