CVE-2025-31498c-ares has a use-after-free in read_answers()
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
Fixed builds are available from AlmaLinux, Alpine, Debian, Red Hat, Rocky Linux: see the table below for the fixed version per release.
Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.
curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \ -H "Content-Type: text/plain" --data-binary @inventory.txt
Vendor status at a glance
Status by vendor and release
From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.
| Release | Package | Status | Fixed version | Advisory |
|---|---|---|---|---|
| Ubuntu 24.04 | c-ares | Not affected vulnerable_code_not_present | ||
| Ubuntu 22.04 | c-ares | Not affected vulnerable_code_not_present | ||
| Debian 14 | c-ares | Fixed | 1.34.5-1 | DEBIAN-CVE-2025-31498 |
| Debian 13 | c-ares | Fixed | 1.34.5-1 | DEBIAN-CVE-2025-31498 |
| Red Hat Enterprise Linux 10 | c-ares | Not affected | ||
| Red Hat Enterprise Linux 10 | c-ares-devel | Not affected | ||
| Red Hat Enterprise Linux 10 | nodejs | Fixed | 1:22.15.0-1.el10_0 | RHSA-2025:7502 |
| Red Hat Enterprise Linux 10 | nodejs-devel | Fixed | 1:22.15.0-1.el10_0 | RHSA-2025:7502 |
| Red Hat Enterprise Linux 10 | nodejs-docs | Fixed | 1:22.15.0-1.el10_0 | RHSA-2025:7502 |
| Red Hat Enterprise Linux 10 | nodejs-full-i18n | Fixed | 1:22.15.0-1.el10_0 | RHSA-2025:7502 |
| Red Hat Enterprise Linux 10 | nodejs-libs | Fixed | 1:22.15.0-1.el10_0 | RHSA-2025:7502 |
| Red Hat Enterprise Linux 10 | nodejs-npm | Fixed | 1:10.9.2-1.22.15.0.1.el10_0 | RHSA-2025:7502 |
| Red Hat Enterprise Linux 10 | nodejs22 | Fixed | 1:22.15.0-1.el10_0 | RHSA-2025:7502 |
| Red Hat Enterprise Linux 9 | c-ares | Not affected | ||
| Red Hat Enterprise Linux 9 | c-ares-devel | Not affected | ||
| Red Hat Enterprise Linux 9 | nodejs | Fixed | 1:22.15.0-1.module+el9.6.0+23062+9e7801b9 | RHSA-2025:7426 |
| Red Hat Enterprise Linux 9 | nodejs-devel | Fixed | 1:22.15.0-1.module+el9.6.0+23062+9e7801b9 | RHSA-2025:7426 |
| Red Hat Enterprise Linux 9 | nodejs-docs | Fixed | 1:20.19.1-1.module+el9.6.0+23053+4195b0b2 | RHSA-2025:7433 |
| Red Hat Enterprise Linux 9 | nodejs-full-i18n | Fixed | 1:20.19.1-1.module+el9.6.0+23053+4195b0b2 | RHSA-2025:7433 |
| Red Hat Enterprise Linux 9 | nodejs-libs | Fixed | 1:22.15.0-1.module+el9.6.0+23062+9e7801b9 | RHSA-2025:7433 |
| Red Hat Enterprise Linux 9 | nodejs-nodemon | Fixed | 0:3.0.1-1.module+el9.6.0+23062+9e7801b9 | RHSA-2025:7426 |
| Red Hat Enterprise Linux 9 | nodejs-packaging | Fixed | 0:2021.06-4.module+el9.3.0+19518+63aad52d | RHSA-2025:7433 |
| Red Hat Enterprise Linux 9 | nodejs-packaging-bundler | Fixed | 0:2021.06-4.module+el9.6.0+23062+9e7801b9 | RHSA-2025:7426 |
| Red Hat Enterprise Linux 9 | npm | Fixed | 1:10.8.2-1.20.19.1.1.module+el9.6.0+23053+4195b0b2 | RHSA-2025:7433 |
| Red Hat Enterprise Linux 9 | v8-12.4-devel | Fixed | 3:12.4.254.21-1.22.15.0.1.module+el9.6.0+23062+9e7801b9 | RHSA-2025:7433 |
| Red Hat Enterprise Linux 8 | c-ares | Not affected | ||
| Red Hat Enterprise Linux 8 | c-ares-devel | Not affected | ||
| Red Hat Enterprise Linux 8 | nodejs | Fixed | 1:22.15.0-1.module+el8.10.0+23068+28ff2340 | RHSA-2025:4461 |
| Red Hat Enterprise Linux 8 | nodejs-devel | Fixed | 1:22.15.0-1.module+el8.10.0+23068+28ff2340 | RHSA-2025:4461 |
| Red Hat Enterprise Linux 8 | nodejs-docs | Fixed | 1:20.19.1-1.module+el8.10.0+23054+5431297f | RHSA-2025:4459 |
| Red Hat Enterprise Linux 8 | nodejs-full-i18n | Fixed | 1:22.15.0-1.module+el8.10.0+23068+28ff2340 | RHSA-2025:4461 |
| Red Hat Enterprise Linux 8 | nodejs-libs | Fixed | 1:22.15.0-1.module+el8.10.0+23068+28ff2340 | RHSA-2025:4459 |
| Red Hat Enterprise Linux 8 | nodejs-nodemon | Fixed | 0:3.0.1-1.module+el8.10.0+22904+d0fedeff | RHSA-2025:4459 |
| Red Hat Enterprise Linux 8 | nodejs-packaging | Fixed | 0:2021.06-4.module+el8.10.0+23068+28ff2340 | RHSA-2025:4461 |
| Red Hat Enterprise Linux 8 | nodejs-packaging-bundler | Fixed | 0:2021.06-4.module+el8.10.0+23068+28ff2340 | RHSA-2025:4461 |
| Red Hat Enterprise Linux 8 | npm | Fixed | 1:10.8.2-1.20.19.1.1.module+el8.10.0+23054+5431297f | RHSA-2025:4459 |
| Red Hat Enterprise Linux 8 | v8-12.4-devel | Fixed | 3:12.4.254.21-1.22.15.0.1.module+el8.10.0+23068+28ff2340 | RHSA-2025:4459 |
| Red Hat Enterprise Linux 8 | v8-13.6-devel | Not affected | ||
| Red Hat Enterprise Linux 7 | c-ares | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 7 | c-ares-devel | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 6 | c-ares | Will not fix Out of support scope | ||
| Red Hat Enterprise Linux 6 | c-ares-devel | Will not fix Out of support scope | ||
| AlmaLinux 10 | nodejs | Fixed | 1:22.15.0-1.el10_0 | ALSA-2025:7502 |
| AlmaLinux 10 | nodejs-devel | Fixed | 1:22.15.0-1.el10_0 | ALSA-2025:7502 |
| AlmaLinux 10 | nodejs-docs | Fixed | 1:22.15.0-1.el10_0 | ALSA-2025:7502 |
| AlmaLinux 10 | nodejs-full-i18n | Fixed | 1:22.15.0-1.el10_0 | ALSA-2025:7502 |
| AlmaLinux 10 | nodejs-libs | Fixed | 1:22.15.0-1.el10_0 | ALSA-2025:7502 |
| AlmaLinux 10 | nodejs-npm | Fixed | 1:10.9.2-1.22.15.0.1.el10_0 | ALSA-2025:7502 |
| AlmaLinux 9 | nodejs | Fixed | 1:20.19.1-1.module_el9.6.0+163+d268fe53 | ALSA-2025:7433 |
| AlmaLinux 9 | nodejs-devel | Fixed | 1:20.19.1-1.module_el9.6.0+163+d268fe53 | ALSA-2025:7433 |
| AlmaLinux 9 | nodejs-docs | Fixed | 1:20.19.1-1.module_el9.6.0+163+d268fe53 | ALSA-2025:7433 |
| AlmaLinux 9 | nodejs-full-i18n | Fixed | 1:20.19.1-1.module_el9.6.0+163+d268fe53 | ALSA-2025:7433 |
| AlmaLinux 9 | nodejs-libs | Fixed | 1:22.15.0-1.module_el9.6.0+164+2d89b8ed | ALSA-2025:7433 |
| AlmaLinux 9 | nodejs-nodemon | Fixed | 3.0.1-1.module_el9.5.0+125+8dc38870 | ALSA-2025:7433 |
| AlmaLinux 9 | nodejs-packaging | Fixed | 2021.06-4.module_el9.5.0+139+09296491 | ALSA-2025:7426 |
| AlmaLinux 9 | nodejs-packaging-bundler | Fixed | 2021.06-4.module_el9.6.0+162+8dc602e5 | ALSA-2025:7433 |
| AlmaLinux 9 | npm | Fixed | 1:10.9.2-1.22.15.0.1.module_el9.6.0+164+2d89b8ed | ALSA-2025:7426 |
| AlmaLinux 9 | v8-12.4-devel | Fixed | 3:12.4.254.21-1.22.15.0.1.module_el9.6.0+164+2d89b8ed | ALSA-2025:7433 |
| AlmaLinux 8 | nodejs | Fixed | 1:22.15.0-1.module_el8.10.0+3986+a908e756 | ALSA-2025:4461 |
| AlmaLinux 8 | nodejs-devel | Fixed | 1:20.19.1-1.module_el8.10.0+3987+dbda4426 | ALSA-2025:4459 |
| AlmaLinux 8 | nodejs-docs | Fixed | 1:20.19.1-1.module_el8.10.0+3987+dbda4426 | ALSA-2025:4459 |
| AlmaLinux 8 | nodejs-full-i18n | Fixed | 1:22.15.0-1.module_el8.10.0+3986+a908e756 | ALSA-2025:4461 |
| AlmaLinux 8 | nodejs-libs | Fixed | 1:22.15.0-1.module_el8.10.0+3986+a908e756 | ALSA-2025:4459 |
| AlmaLinux 8 | nodejs-nodemon | Fixed | 3.0.1-1.module_el8.10.0+3983+391a1a04 | ALSA-2025:4461 |
| AlmaLinux 8 | nodejs-packaging | Fixed | 2021.06-4.module_el8.10.0+3961+6a788e57 | ALSA-2025:4461 |
| AlmaLinux 8 | nodejs-packaging-bundler | Fixed | 2021.06-4.module_el8.10.0+3961+6a788e57 | ALSA-2025:4461 |
| AlmaLinux 8 | npm | Fixed | 1:10.8.2-1.20.19.1.1.module_el8.10.0+3987+dbda4426 | ALSA-2025:4459 |
| AlmaLinux 8 | v8-12.4-devel | Fixed | 3:12.4.254.21-1.22.15.0.1.module_el8.10.0+3986+a908e756 | ALSA-2025:4459 |
| Rocky Linux 9 | nodejs-nodemon | Fixed | 0:3.0.1-1.module+el9.5.0+31770+0da7192d | RLSA-2025:7433 |
| Rocky Linux 9 | nodejs-packaging | Fixed | 0:2021.06-4.module+el9.5.0+31785+5534beb0 | RLSA-2025:7433 |
| Rocky Linux 8 | nodejs | Fixed | 1:22.15.0-1.module+el8.10.0+1971+0bb08ece | RLSA-2025:4461 |
| Rocky Linux 8 | nodejs-nodemon | Fixed | 0:3.0.1-1.module+el8.10.0+1988+437f3d23 | RLSA-2025:4459 |
| Rocky Linux 8 | nodejs-packaging | Fixed | 0:2021.06-4.module+el8.10.0+1924+614dc87f | RLSA-2025:4461 |
| Alpine Linux 3.24 | c-ares | Fixed | 1.34.5-r0 | ALPINE-CVE-2025-31498 |
| Alpine Linux 3.23 | c-ares | Fixed | 1.34.5-r0 | ALPINE-CVE-2025-31498 |
| Alpine Linux 3.22 | c-ares | Fixed | 1.34.5-r0 | ALPINE-CVE-2025-31498 |
| Alpine Linux 3.21 | c-ares | Fixed | 1.34.5-r0 | ALPINE-CVE-2025-31498 |
What the vendor says
As published in the CVE record by GitHub_M, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.
- c-ares: affected: >= 1.32.3, < 1.34.5
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
About this page
Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.