CVE-2026-102963

Use-after-return in getaddrinfo() when a DNS query that followed a CNAME cannot be cancelled

Published Nov 27, 2026 CVSS 3.1 · 6.5 Medium EPSS n/a KEV · Not listed
Description
dns_resolve_cancel_with_name() in subsys/net/lib/dns/resolve.c looks up the pending query to cancel by DNS id plus a hash of the name the caller originally asked for. When a reply contains only a CNAME, the resolver sends a new query for the alias and overwrites the slot's query_hash with the hash of the alias name. After one or more CNAME hops, cancelling by the original name silently fails with -ENOENT and the query stays pending.

zsock_getaddrinfo() (exec_query() in subsys/net/lib/sockets/getaddrinfo.c) passes a pointer to its stack-local ai_state as the resolver callback context. When its semaphore wait times out, it calls dns_cancel_addr_info_with_name(), ignores the result, and returns. The CNAME re-query restarts the resolver timer, so a CNAME-only response that arrives more than about 100 ms after the query lets the getaddrinfo() wait expire first. The cancel then fails and getaddrinfo() returns. An attacker who can supply DNS responses can trigger this reliably: a malicious or compromised DNS server, an on-path attacker, or any host on the link for mDNS/LLMNR lookups. The device only has to resolve a name with getaddrinfo().

When the orphaned query later times out, dns_resolve_cb() writes the status and calls k_sem_give() on the dead stack frame. If the attacker answers the alias query instead, the callback copies attacker-supplied address data through a stale ai_arr pointer read from the reused stack. The result is a kernel fault (denial of service) or memory corruption in the calling thread's stack and whatever memory the stale pointer references.

Analysis

AI-generated

Technical impact

The vulnerability arises when the DNS resolver in Zephyr’s getaddrinfo() use a stack‑local call context that is reused after a CNAME‑only reply. The resolver updates the query hash during a CNAME hop and later attempts to cancel a query by the original name; the cancel fails silently. When the orphaned query eventually completes, the resolver writes status back to a context that has been freed, causing a stale pointer dereference. This use‑after‑return can trigger a kernel fault or arbitrary memory corruption in the calling thread’s stack, resulting in denial of service or even escalation of privileges within the kernel.

Affected Systems

The affected product is Zephyr RTOS (zephyrproject:zephyr). No specific version ranges are listed in the advisories; any build that includes the getaddrinfo() implementation in subsys/net/lib/sockets/getaddrinfo.c and the resolver code in subsys/net/lib/dns/resolve.c is potentially vulnerable.

Risk and Exploitability

The CVSS score is 6.5, indicating a moderate severity. The EPSS score is not available, and the vulnerability is not listed in the CISA KEV catalog. An attacker who can control or observe DNS responses on the network – such as a compromised DNS server, an on‑path attacker, or a host on the same link for mDNS/LLMNR – can reliably exploit the flaw by sending a CNAME‑only reply that arrives several hundred milliseconds after the initial query, causing the getaddrinfo() call to timeout and the stale pointer to be used. The exploit requires network access to the host performing the resolution, and the attack surface is limited to DNS queries made through getaddrinfo().

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Update Zephyr to a patched release that includes the commit that fixes the resolver; rebuild the system with the updated source.
  • After applying the patch, verify that the getaddrinfo() implementation no longer uses a stack‑local context when canceling queries, ensuring the stale pointer cannot be dereferenced.
  • As a temporary measure, block or quarantine mDNS/LLMNR traffic or configure the local DNS server to avoid long CNAME chains, reducing the likelihood that a CNAME‑only reply could satisfy the timing window for the vulnerability.

Generated by OpenCVE AI on November 27, 2026 at 16:20 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories available
History
Type Values Removed Values Added
First Time appeared Zephyrproject
Zephyrproject zephyr
Vendors & Products Zephyrproject
Zephyrproject zephyr
Type Values Removed Values Added
Description dns_resolve_cancel_with_name() in subsys/net/lib/dns/resolve.c looks up the pending query to cancel by DNS id plus a hash of the name the caller originally asked for. When a reply contains only a CNAME, the resolver sends a new query for the alias and overwrites the slot's query_hash with the hash of the alias name. After one or more CNAME hops, cancelling by the original name silently fails with -ENOENT and the query stays pending. zsock_getaddrinfo() (exec_query() in subsys/net/lib/sockets/getaddrinfo.c) passes a pointer to its stack-local ai_state as the resolver callback context. When its semaphore wait times out, it calls dns_cancel_addr_info_with_name(), ignores the result, and returns. The CNAME re-query restarts the resolver timer, so a CNAME-only response that arrives more than about 100 ms after the query lets the getaddrinfo() wait expire first. The cancel then fails and getaddrinfo() returns. An attacker who can supply DNS responses can trigger this reliably: a malicious or compromised DNS server, an on-path attacker, or any host on the link for mDNS/LLMNR lookups. The device only has to resolve a name with getaddrinfo(). When the orphaned query later times out, dns_resolve_cb() writes the status and calls k_sem_give() on the dead stack frame. If the attacker answers the alias query instead, the callback copies attacker-supplied address data through a stale ai_arr pointer read from the reused stack. The result is a kernel fault (denial of service) or memory corruption in the calling thread's stack and whatever memory the stale pointer references.
Title Use-after-return in getaddrinfo() when a DNS query that followed a CNAME cannot be cancelled
Weaknesses CWE-416
References
Metrics cvssV3_1

{'score': 6.5, 'vector': 'CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:H'}

Weaknesses

Sources

Status
PUBLISHED
Assigner
zephyr
Published
Updated
Nov 27, 2026, 3:42 PM
Reserved
Sep 29, 2026, 8:25 PM
Status
Awaiting Analysis
Published
Nov 27, 2026, 4:18 PM
Modified
Nov 27, 2026, 4:18 PM