c-ares has a use-after-free in read_answers()
Key facts
- Attack vector
- Network
- Privileges required
- None
- User interaction
- None
- Attack complexity
- High
- Attack requirements
- None
- Impact type
- —
- Confidentiality · integrity · availability
- Low · Low · High
- Fix status
- Partial Red Hat: 4 fixed, 2 without a fix
Attack profile from CVSS 4.0 · CNA. Fix status from CNA and Red Hat.
Summary
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.
Why it matters now
SSVC decision points
CISA ADP · SSVC 2.0.3
- Exploitation
- None
- Automatable
- No
- Technical impact
- Partial
The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.
Affected products
Remediation
- Fix · CNA c-ares (c-ares) Fixed in 1.34.5
Red Hat 6 advisories
- RHSA-2025:7537 Released 2025-05-14 · Red Hat rating Moderatenodejs:20 security update
- Red Hat Enterprise Linux AppStream EUS (v.9.4) nodejs-1:20.18.2-2.module+el9.4.0+23089+aaa18a20.aarch64::nodejs:20, nodejs-1:20.18.2-2.module+el9.4.0+23089+aaa18a20.ppc64le::nodejs:20, nodejs-1:20.18.2-2.module+el9.4.0+23089+aaa18a20.s390x::nodejs:20 +20
- RHSA-2025:7502 Released 2025-05-13 · Red Hat rating Moderatenodejs22 security update
- Red Hat Enterprise Linux AppStream (v. 10) nodejs-1:22.15.0-1.el10_0, nodejs-devel-1:22.15.0-1.el10_0, nodejs-docs-1:22.15.0-1.el10_0 +4
- RHSA-2025:7433 Released 2025-05-13 · Red Hat rating Importantnodejs:22 security update
- Red Hat Enterprise Linux AppStream (v. 9) nodejs-1:22.15.0-1.module+el9.6.0+23062+9e7801b9.aarch64::nodejs:22, nodejs-1:22.15.0-1.module+el9.6.0+23062+9e7801b9.ppc64le::nodejs:22, nodejs-1:22.15.0-1.module+el9.6.0+23062+9e7801b9.s390x::nodejs:22 +28
Show 3 more Red Hat advisories
- RHSA-2025:7426 Released 2025-05-13 · Red Hat rating Moderatenodejs:20 security update
- Red Hat Enterprise Linux AppStream (v. 9) nodejs-1:20.19.1-1.module+el9.6.0+23053+4195b0b2.aarch64::nodejs:20, nodejs-1:20.19.1-1.module+el9.6.0+23053+4195b0b2.ppc64le::nodejs:20, nodejs-1:20.19.1-1.module+el9.6.0+23053+4195b0b2.s390x::nodejs:20 +20
- RHSA-2025:4461 Released 2025-05-05 · Red Hat rating Moderatenodejs:20 security update
- Red Hat Enterprise Linux AppStream (v. 8) nodejs-1:20.19.1-1.module+el8.10.0+23054+5431297f.aarch64::nodejs:20, nodejs-1:20.19.1-1.module+el8.10.0+23054+5431297f.ppc64le::nodejs:20, nodejs-1:20.19.1-1.module+el8.10.0+23054+5431297f.s390x::nodejs:20 +20
- RHSA-2025:4459 Released 2025-05-05 · Red Hat rating Importantnodejs:22 security update
- Red Hat Enterprise Linux AppStream (v. 8) nodejs-1:22.15.0-1.module+el8.10.0+23068+28ff2340.aarch64::nodejs:22, nodejs-1:22.15.0-1.module+el8.10.0+23068+28ff2340.ppc64le::nodejs:22, nodejs-1:22.15.0-1.module+el8.10.0+23068+28ff2340.s390x::nodejs:22 +28
Vendor assessments
Red Hat
Red Hat rating: Moderate. Red Hat's page for this CVE →
| Product | Status | Plan or fix |
|---|---|---|
| Red Hat Enterprise Linux 6 | Affected | No fix planned: Out of support scope |
| Red Hat Enterprise Linux 7 | Affected | No fix planned: Out of support scope |
| Red Hat Enterprise Linux AppStream (v. 10) | Fixed | RHSA-2025:7502 |
| Red Hat Enterprise Linux AppStream (v. 8) | Fixed | RHSA-2025:4459, RHSA-2025:4461 |
| Red Hat Enterprise Linux AppStream (v. 9) | Fixed | RHSA-2025:7426, RHSA-2025:7433 |
| Red Hat Enterprise Linux AppStream EUS (v.9.4) | Fixed | RHSA-2025:7537 |
Not affected: 4 products
- Red Hat Enterprise Linux 10
- Red Hat Enterprise Linux 8
- Red Hat Enterprise Linux 9
- Red Hat OpenShift Container Platform 4
Timeline
- 2026-10-02 Threatist record created from CVE-2025-31498
References
More c-ares vulnerabilities
- TI-2026-48538 c-ares: Memory-amplification denial of service via unvalidated DNS header record counts CVSS 3.1MEDIUM 5.3
- TI-2020-14305 Buffer overflow vulnerability in c-ares before 1_16_1 thru 1_17_0 via function… CVSS 3.1MEDIUM 5.9
- TI-2016-04481 Heap-based buffer overflow in the ares_create_query function in c-ares 1.x before 1.12.0… CVSS 3.1CRITICAL 9.8
- TI-2023-15371 0-byte UDP payload DoS in c-ares CVSS 3.1HIGH 7.5
- TI-2026-26011 Double free in c-ares CVSS 3.1HIGH 7.5
- TI-2026-48536 c-ares: CPU-exhaustion denial of service via unbounded DNS name compression pointer chains CVSS 3.1HIGH 7.5
Sources
- CVE-2025-31498 · CVE Program
- CVE-2025-31498 · NVD
- FIRST EPSS
- CVE-2025-31498 · Red Hat security data · CC BY 4.0
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences