# CVE-2025-48945: pycares has a Use-After-Free Vulnerability

> An attacker can cause a denial of service by triggering a use-after-free error in pycares when a channel is garbage collected during pending DNS queries.

- **Severity:** High 8.2 (`CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 20 Jun 2025
- **Updated:** 20 Jun 2025
- **Also known as:** AZL-64307, AZL-67074, DEBIAN-CVE-2025-48945, GHSA-5qpg-rh4j-qp35, OESA-2025-1810, OESA-2025-1811, OESA-2025-1812, OESA-2025-1813, OESA-2025-1858, SUSE-SU-2025:03354-1, UBUNTU-CVE-2025-48945, openSUSE-SU-2025:15324-1

## What is CVE-2025-48945?

CVE-2025-48945 is a high-severity use after free vulnerability in aio-libs aiodns, published on 20 Jun 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

pycares is a Python module which provides an interface to c-ares. c-ares is a C library that performs DNS requests and name resolutions asynchronously. Prior to version 4.9.0, pycares is vulnerable to a use-after-free condition that occurs when a Channel object is garbage collected while DNS queries are still pending. This results in a fatal Python error and interpreter crash. The vulnerability has been fixed in pycares 4.9.0 by implementing a safe channel destruction mechanism.

Weakness: CWE-416 (Use After Free)

## Which versions are affected by CVE-2025-48945?

2 open source packages ship an affected version, including pycares.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `pycares` | PyPI | All versions | 4.9.0 |
| `pycares` | PyPI | All versions | 4.9.0 |
| `python-pycares` | SUSE:Linux Enterprise High Performance Computing 15 SP4-ESPOS | All versions | 4.10.0-150400.9.8.1 |
| `python-pycares` | SUSE:Linux Enterprise High Performance Computing 15 SP4-LTSS | All versions | 4.10.0-150400.9.8.1 |
| `python-pycares` | SUSE:Linux Enterprise High Performance Computing 15 SP5-ESPOS | All versions | 4.10.0-150400.9.8.1 |
| `python-pycares` | SUSE:Linux Enterprise High Performance Computing 15 SP5-LTSS | All versions | 4.10.0-150400.9.8.1 |
| `python-pycares` | SUSE:Linux Enterprise Module for Python 3 15 SP6 | All versions | 4.10.0-150400.9.8.1 |
| `python-pycares` | SUSE:Linux Enterprise Module for Python 3 15 SP7 | All versions | 4.10.0-150400.9.8.1 |
| `python-pycares` | SUSE:Linux Enterprise Server 15 SP4-LTSS | All versions | 4.10.0-150400.9.8.1 |
| `python-pycares` | SUSE:Linux Enterprise Server 15 SP5-LTSS | All versions | 4.10.0-150400.9.8.1 |
| `python-pycares` | SUSE:Linux Enterprise Server for SAP Applications 15 SP4 | All versions | 4.10.0-150400.9.8.1 |
| `python-pycares` | SUSE:Linux Enterprise Server for SAP Applications 15 SP5 | All versions | 4.10.0-150400.9.8.1 |
| `python-pycares` | openSUSE:Leap 15.6 | All versions | 4.10.0-150400.9.8.1 |
| `python-pycares` | openSUSE:Tumbleweed | All versions | 4.9.0-1.1 |

## How do I fix CVE-2025-48945?

Upgrade pycares to 4.9.0 or later.

## Is CVE-2025-48945 being exploited?

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

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2025-48945 and fix it if it is affected.

What it is: CVE-2025-48945 is a high-severity use after free vulnerability in aio-libs aiodns, published on 20 Jun 2025. 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-2025-48945 in the wild and no public exploit code.

Affected packages and fixed versions:
- pycares (PyPI): affected all versions; fixed in 4.9.0
- pycares (PyPI): affected all versions; fixed in 4.9.0

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

## Sources

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

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