# CVE-2024-25629: c-ares out of bounds read in ares__read_line()


- **Severity:** Medium 4.4 (`CVSS:3.1/AV:L/AC:L/PR:H/UI:N/S:U/C:N/I:N/A:H`)
- **Exploited in the wild:** Not known
- **Fix available:** Yes
- **Published:** 23 Feb 2024
- **Updated:** 13 Feb 2025
- **Also known as:** ALPINE-CVE-2024-25629, ALSA-2024:3842, ALSA-2024:4249, AZL-34453, AZL-34455, AZL-34456, AZL-34462, AZL-34463, AZL-34578, AZL-34687, AZL-35048, AZL-35132, AZL-38126, AZL-43501, BELL-CVE-2024-25629, CLEANSTART-2025-FK62807, CLSA-2025-1756408700, DEBIAN-CVE-2024-25629, ECHO-b5d8-981b-c7e4, GHSA-mg26-v6qh-x48q, MGASA-2024-0051, OESA-2024-2019, OESA-2024-2020, OESA-2024-2021, RHSA-2024:3842, RHSA-2024:4249, RLSA-2024:3842, RLSA-2024:4249, ROOT-OS-DEBIAN-12-CVE-2024-25629, SUSE-SU-2024:1135-1, SUSE-SU-2024:1136-1, SUSE-SU-2024:1136-2, UBUNTU-CVE-2024-25629, USN-6676-1, openSUSE-SU-2024:13722-1

## What is CVE-2024-25629?

CVE-2024-25629 is a medium-severity vulnerability in Fedoraproject Fedora, published on 23 Feb 2024. 

### Official description

c-ares is a C library for asynchronous DNS requests. `ares__read_line()` is used to parse local configuration files such as `/etc/resolv.conf`, `/etc/nsswitch.conf`, the `HOSTALIASES` file, and if using a c-ares version prior to 1.27.0, the `/etc/hosts` file. If any of these configuration files has an embedded `NULL` character as the first character in a new line, it can lead to attempting to read memory prior to the start of the given buffer which may result in a crash. This issue is fixed in c-ares 1.27.0. No known workarounds exist.

Weakness: CWE-125 (Out-of-bounds Read), CWE-127 (Buffer Under-read)

## Which versions are affected by CVE-2024-25629?

It affects 2 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `c-ares` | AlmaLinux:8 | All versions | 1.13.0-11.el8_10 |
| `c-ares-devel` | AlmaLinux:8 | All versions | 1.13.0-11.el8_10 |
| `c-ares` | AlmaLinux:9 | All versions | 1.19.1-2.el9_4 |
| `c-ares-devel` | AlmaLinux:9 | All versions | 1.19.1-2.el9_4 |
| `c-ares` | Red Hat:enterprise_linux:8::baseos | All versions | 0:1.13.0-11.el8_10 |
| `c-ares-debuginfo` | Red Hat:enterprise_linux:8::baseos | All versions | 0:1.13.0-11.el8_10 |
| `c-ares-debugsource` | Red Hat:enterprise_linux:8::baseos | All versions | 0:1.13.0-11.el8_10 |
| `c-ares-devel` | Red Hat:enterprise_linux:8::baseos | All versions | 0:1.13.0-11.el8_10 |
| `c-ares-debuginfo` | Red Hat:enterprise_linux:9::appstream | All versions | 0:1.19.1-2.el9_4 |
| `c-ares-debugsource` | Red Hat:enterprise_linux:9::appstream | All versions | 0:1.19.1-2.el9_4 |
| `c-ares-devel` | Red Hat:enterprise_linux:9::appstream | All versions | 0:1.19.1-2.el9_4 |
| `c-ares` | Red Hat:enterprise_linux:9::baseos | All versions | 0:1.19.1-2.el9_4 |
| `c-ares-debuginfo` | Red Hat:enterprise_linux:9::baseos | All versions | 0:1.19.1-2.el9_4 |
| `c-ares-debugsource` | Red Hat:enterprise_linux:9::baseos | All versions | 0:1.19.1-2.el9_4 |
| `c-ares` | Rocky Linux:8 | All versions | 0:1.13.0-11.el8_10 |
| `c-ares` | Rocky Linux:9 | All versions | 0:1.19.1-2.el9_4 |
| `c-ares` | SUSE:Linux Enterprise Micro 5.1 | All versions | 1.19.1-150000.3.26.1 |
| `c-ares` | SUSE:Linux Enterprise Micro 5.2 | All versions | 1.19.1-150000.3.26.1 |
| `c-ares` | SUSE:Linux Enterprise Micro 5.3 | All versions | 1.19.1-150000.3.26.1 |
| `c-ares` | SUSE:Linux Enterprise Micro 5.4 | All versions | 1.19.1-150000.3.26.1 |
| `c-ares` | SUSE:Linux Enterprise Micro 5.5 | All versions | 1.19.1-150000.3.26.1 |
| `c-ares` | SUSE:Linux Enterprise Micro 5.5 | All versions | 1.19.1-150000.3.26.1 |
| `c-ares` | SUSE:Linux Enterprise Module for Basesystem 15 SP5 | All versions | 1.19.1-150000.3.26.1 |
| `libcares2` | SUSE:Linux Enterprise Server 12 SP5 | All versions | 1.9.1-9.21.1 |
| `libcares2` | SUSE:Linux Enterprise Server for SAP Applications 12 SP5 | All versions | 1.9.1-9.21.1 |
| `libcares2` | SUSE:Linux Enterprise Software Development Kit 12 SP5 | All versions | 1.9.1-9.21.1 |
| `libcares2` | SUSE:Linux Enterprise Workstation Extension 12 SP5 | All versions | 1.9.1-9.21.1 |
| `c-ares` | openSUSE:Leap 15.5 | All versions | 1.19.1-150000.3.26.1 |
| `c-ares` | openSUSE:Leap Micro 5.3 | All versions | 1.19.1-150000.3.26.1 |
| `c-ares` | openSUSE:Leap Micro 5.4 | All versions | 1.19.1-150000.3.26.1 |
| `c-ares` | openSUSE:Tumbleweed | All versions | 1.27.0-1.1 |

Products: C-Ares C-Ares, Fedoraproject Fedora.

## How do I fix CVE-2024-25629?

Upgrade to a fixed version.

## Is CVE-2024-25629 being exploited?

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

## Other vulnerabilities in Fedoraproject Fedora

- [CVE-2016-5180](https://insights.sbomify.com/CVE-2016-5180/): Memory corruption in n/a (critical 9.8)
- [CVE-2017-1000381](https://insights.sbomify.com/CVE-2017-1000381/): Information disclosure in n/a (high 7.5)
- [CVE-2025-62408](https://insights.sbomify.com/CVE-2025-62408/): c-ares has a Use After Free vulnerability when connection is cleaned up after error (medium 5.9)
- [CVE-2020-22217](https://insights.sbomify.com/CVE-2020-22217/): Memory corruption in n/a (medium 5.9)
- [CVE-2020-14354](https://insights.sbomify.com/CVE-2020-14354/): Use after free in c-ares (low 3.3)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-25629 and fix it if it is affected.

What it is: CVE-2024-25629 is a medium-severity vulnerability in Fedoraproject Fedora, published on 23 Feb 2024. 
Exploitation: There is no known exploitation of CVE-2024-25629 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-2024-25629/ (Markdown: https://insights.sbomify.com/CVE-2024-25629/index.md)
```

## Sources

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

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