惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Securelist
Engineering at Meta
Engineering at Meta
MongoDB | Blog
MongoDB | Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
A
About on SuperTechFans
S
Security @ Cisco Blogs
L
LangChain Blog
Cloudbric
Cloudbric
B
Blog
Google Online Security Blog
Google Online Security Blog
I
InfoQ
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
GbyAI
GbyAI
WordPress大学
WordPress大学
月光博客
月光博客
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
小众软件
小众软件
Cyberwarzone
Cyberwarzone
Martin Fowler
Martin Fowler
AWS News Blog
AWS News Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
PCI Perspectives
PCI Perspectives
T
The Exploit Database - CXSecurity.com
Hugging Face - Blog
Hugging Face - Blog
Microsoft Azure Blog
Microsoft Azure Blog
C
CERT Recently Published Vulnerability Notes
博客园 - 司徒正美
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
F
Full Disclosure
P
Palo Alto Networks Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
V2EX - 技术
V2EX - 技术
G
GRAHAM CLULEY
T
Threat Research - Cisco Blogs
P
Privacy International News Feed
S
Schneier on Security
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Attack and Defense Labs
Attack and Defense Labs
V
Visual Studio Blog
N
News and Events Feed by Topic
C
Cybersecurity and Infrastructure Security Agency CISA
S
Security Affairs
Spread Privacy
Spread Privacy
Vercel News
Vercel News
量子位
Apple Machine Learning Research
Apple Machine Learning Research
Security Latest
Security Latest
T
The Blog of Author Tim Ferriss
IT之家
IT之家
Stack Overflow Blog
Stack Overflow Blog

dnsmasq-discuss

[Dnsmasq-discuss] Announce: dnsmasq-2.92rc2 Re: [Dnsmasq-discuss] [PATCH] Fix arguments order for chaos subdomain check Re: [Dnsmasq-discuss] patch: block-file/allow-file - for review/feedback Re: [Dnsmasq-discuss] patch: block-file/allow-file - for review/feedback Re: [Dnsmasq-discuss] patch: block-file/allow-file - for review/feedback Re: [Dnsmasq-discuss] patch: block-file/allow-file - for review/feedback [Dnsmasq-discuss] patch: block-file/allow-file - for review/feedback Re: [Dnsmasq-discuss] server= with interface parameter changes behavior over time [Dnsmasq-discuss] NFTsets and hosts-files [Dnsmasq-discuss] [PATCH] Allow expired RRSIGs when stale caching is enabled [Dnsmasq-discuss] [PATCH] Fix arguments order for chaos subdomain check Re: [Dnsmasq-discuss] Malformed RRSIG Can Crash dnsmasq [Dnsmasq-discuss] Malformed NSEC/NSEC3 Can Hang dnsmasq [Dnsmasq-discuss] Malformed RRSIG Can Crash dnsmasq [Dnsmasq-discuss] Security - IMPORTANT Re: [Dnsmasq-discuss] Issue with circuit-id matching on dhcp requests Re: [Dnsmasq-discuss] Issue with circuit-id matching on dhcp requests Re: [Dnsmasq-discuss] Issue with circuit-id matching on dhcp requests [Dnsmasq-discuss] Issue with circuit-id matching on dhcp requests Re: [Dnsmasq-discuss] [PATCH] bpf.c: fix memory leak in arp_enumerate() on BSD Re: [Dnsmasq-discuss] [PATCH] bpf.c: fix memory leak in arp_enumerate() on BSD Re: [Dnsmasq-discuss] dnssec problem here and now Re: [Dnsmasq-discuss] dnssec problem here and now [Dnsmasq-discuss] dnssec problem here and now Re: [Dnsmasq-discuss] server= with interface parameter changes behavior over time Re: [Dnsmasq-discuss] [PATCH] bpf.c: fix memory leak in arp_enumerate() on BSD Re: [Dnsmasq-discuss] [PATCH] bpf.c: fix memory leak in arp_enumerate() on BSD Re: [Dnsmasq-discuss] [PATCH] Preserve existing log file permissions when adding group-write bit. [Dnsmasq-discuss] server= with interface parameter changes behavior over time [Dnsmasq-discuss] [PATCH] bpf.c: fix memory leak in arp_enumerate() on BSD Re: [Dnsmasq-discuss] [PATCH] Preserve existing log file permissions when adding group-write bit. Re: [Dnsmasq-discuss] [BUG] SIGSEGV when parsing invalid "--interface-name" or "--dynamic-host" options Re: [Dnsmasq-discuss] Suggestion to increase default for max-tcp-connections [Dnsmasq-discuss] server priority clarification after e86d53c [Dnsmasq-discuss] [BUG] SIGSEGV when parsing invalid "--interface-name" or "--dynamic-host" options [Dnsmasq-discuss] Suggestion to increase default for max-tcp-connections Re: [Dnsmasq-discuss] [PATCH] Preserve existing log file permissions when adding group-write bit. [Dnsmasq-discuss] [Bug] Heap buffer overflow in cache_recv_insert() due to pipe de-synchronization Re: [Dnsmasq-discuss] Regression/Feature Request for 2.92 Re: [Dnsmasq-discuss] [PATCH] DHCPv6 network range is not checked well with dhcp-sequential-ip [Dnsmasq-discuss] [Bug] Buffer underflow in hostname_issubdomain() [Dnsmasq-discuss] [PATCH] Don't penalize conditional forwarders for REFUSED responses [Dnsmasq-discuss] BUG:Heap buffer overflow in src/forward.c due to incorrect pointer arithmetic (CWE-122) Re: [Dnsmasq-discuss] Regression/Feature Request for 2.92 Re: [Dnsmasq-discuss] Regression/Feature Request for 2.92 Re: [Dnsmasq-discuss] Regression/Feature Request for 2.92 Re: [Dnsmasq-discuss] Potential privacy issue: filter-rr inefficiency Re: [Dnsmasq-discuss] TCP optimization regressions Re: [Dnsmasq-discuss] Bug: Null pointer dereference in domain-match.c at line 82 (dnsmasq 2.92test21-1-gee09f06) [Dnsmasq-discuss] [PATCH] ubus: add lease management methods [Dnsmasq-discuss] Regression/Feature Request for 2.92 [Dnsmasq-discuss] cotillon por mayor [Dnsmasq-discuss] Por Qué el Alquiler de Plataformas Elevadoras es la Clave del Éxito para Tu Empresa Re: [Dnsmasq-discuss] [PATCH] dnsmasq: failed to create inotify for /etc/resolv.conf: No space left on device [Dnsmasq-discuss] Bug: Null pointer dereference in domain-match.c at line 82 (dnsmasq 2.92test21-1-gee09f06) [Dnsmasq-discuss] TCP optimization regressions Re: [Dnsmasq-discuss] [PATCH] dnsmasq: failed to create inotify for /etc/resolv.conf: No space left on device Re: [Dnsmasq-discuss] dnsmasq 2.92 build-error against Nettle 4.0 Re: [Dnsmasq-discuss] dnsmasq 2.92 build-error against Nettle 4.0 Re: [Dnsmasq-discuss] dnsmasq 2.92 build-error against Nettle 4.0 [Dnsmasq-discuss] dnsmasq 2.92 build-error against Nettle 4.0 [Dnsmasq-discuss] Potential privacy issue: filter-rr inefficiency Re: [Dnsmasq-discuss] Bug with NS records when using dnsmasq as authoritative nameserver without specific auth-interface Re: [Dnsmasq-discuss] Bug with NS records when using dnsmasq as authoritative nameserver without specific auth-interface Re: [Dnsmasq-discuss] segfault with an empty OPTION_SNAME [Dnsmasq-discuss] Bug with NS records when using dnsmasq as authoritative nameserver without specific auth-interface Re: [Dnsmasq-discuss] segfault with an empty OPTION_SNAME [Dnsmasq-discuss] segfault with an empty OPTION_SNAME Re: [Dnsmasq-discuss] Shut down caused by device request address. Re: [Dnsmasq-discuss] Shut down caused by device request address. Re: [Dnsmasq-discuss] Shut down caused by device request address. [Dnsmasq-discuss] Shut down caused by device request address. [Dnsmasq-discuss] [PATCH] dnsmasq: failed to create inotify for /etc/resolv.conf: No space left on device Re: [Dnsmasq-discuss] dnsmasq with high availability and dynamic range [Dnsmasq-discuss] dnsmasq with high availability and dynamic range [Dnsmasq-discuss] PATCH] PXE boot server (PXEBS) responses broken in 2.92 — missing else in dhcp.c [Dnsmasq-discuss] PATCH] PXE boot server (PXEBS) responses broken in 2.92 — missing else in dhcp.c [Dnsmasq-discuss] Potential memory leak Re: [Dnsmasq-discuss] Incorrect SERVFAIL on dnssec and rivcoed.org. domain [Dnsmasq-discuss] Announce: dnsmasq-2.92 Re: [Dnsmasq-discuss] dnsmasq does not forward requests with no default route is set [Dnsmasq-discuss] DNSSEC validation fails for wildcard subdomains [Dnsmasq-discuss] Add an option to not always add a pseudo header? Re: [Dnsmasq-discuss] Announce: 2.92.rc1, rc3 & patches overseen Re: [Dnsmasq-discuss] Portable PXE boot appliance [Dnsmasq-discuss] Portable PXE boot appliance Re: [Dnsmasq-discuss] Question about IPv6 settings [Dnsmasq-discuss] Incorrect SERVFAIL on dnssec and rivcoed.org. domain [Dnsmasq-discuss] Question about IPv6 settings Re: [Dnsmasq-discuss] iPhone 17 Pro Max DHCP not working [Dnsmasq-discuss] iPhone 17 Pro Max DHCP not working Re: [Dnsmasq-discuss] [PATCH 0/3] Announce: 2.92.rc1 [Dnsmasq-discuss] [PATCH 0/3] Announce: 2.92.rc1 [Dnsmasq-discuss] [PATCH 3/3] Fix some issues with the swedish manual page, some causing lintian warnings [Dnsmasq-discuss] [PATCH2/3] Fix typos in the english manual page [Dnsmasq-discuss] [PATCH 1/3] Remove trailing white space from dnsmasq.conf.example [Dnsmasq-discuss] Announce: 2.92.rc1 [Dnsmasq-discuss] dnsmasq rejects TCP queries originating from Kubernetes pods Re: [Dnsmasq-discuss] Git: Is first dhcp.c address_available() for/if code correct? [Dnsmasq-discuss] [PATCH dnsmasq 1/1] fix SIGSEGV in dbus.c when no dhcp-range is configured
[Dnsmasq-discuss] [PATCH] Fix local host records being overridden by upstream NXDOMAIN
Dominik Derigs · 2026-05-16 · via dnsmasq-discuss
Hi Simon,

we've found a bug where locally-configured hostnames (from /etc/hosts, DHCP leases, or host-record) can return NXDOMAIN to clients instead of the expected local answer. The attached patch fixes this.

The problem has two parts:

1) When a client queries a local hostname for a record type that has no local answer (e.g. AAAA when only an A record exists in /etc/hosts), answer_request() returns 0 and the query is forwarded upstream. Since the domain only exists locally, upstream returns NXDOMAIN. The correct response would be NODATA -- the domain exists, it just doesn't have a record of the requested type.

This is particularly visible with modern Linux resolvers like systemd-resolved as they routinely send AAAA and A queries independently at the same time. Most often, modern versions also issue HTTPS queries. The NXDOMAIN response to the AAAA/HTTPS query can cause the client to treat the entire domain as non-existent, even though the A answer comes back correctly.

2) There is already a safety net in process_reply() that converts upstream NXDOMAIN to NODATA for locally-known domains. However, this conversion is inside the !bogusanswer gate (line 793 on current master), so it is skipped when DNSSEC validation fails. For local hostnames under publicly-signed domains, the upstream NXDOMAIN proof can fail validation, bypassing the safety net.

The fix:

- In answer_request(): before the final `return 0`, check whether the domain has any local record with F_HOSTS/F_DHCP/F_CONFIG. If so, return NODATA instead of forwarding. This prevents the upstream query entirely.

- In process_reply(): move the NXDOMAIN-to-NODATA conversion for locally-known domains before the bogusanswer check, so it applies regardless of DNSSEC validation status. Local host records are authoritative for domain existence.

Originally reported and investigated by me in https://github.com/pi-hole/FTL/issues/2841


Cheers,
Dominik
From bb1f182beeb5ca5c8ecc4638d302cb6ed183acc8 Mon Sep 17 00:00:00 2001
From: Dominik <[email protected]>
Date: Sun, 12 Apr 2026 13:17:53 +0200
Subject: [PATCH] Fix local host records being overridden by upstream NXDOMAIN

When a locally-configured hostname (from /etc/hosts, DHCP, or
host-record) is queried for a record type with no local answer
(e.g. AAAA when only A exists), the query is forwarded upstream.
If the domain only exists locally, upstream returns NXDOMAIN,
which incorrectly overrides the local host record's existence.

Fix in two places:

1. answer_request(): When no answer is found for the requested
   type but the domain has local host/DHCP/config records, return
   NODATA instead of forwarding. The domain exists locally, just
   not for the requested type.

2. process_reply(): Move the NXDOMAIN-to-NODATA conversion for
   locally-known domains before the DNSSEC bogus-answer gate.
   Local host records are authoritative for domain existence
   regardless of upstream DNSSEC validation status.
---
 src/forward.c | 24 +++++++++++++-----------
 src/rfc1035.c | 21 +++++++++++++++++++++
 2 files changed, 34 insertions(+), 11 deletions(-)

diff --git a/src/forward.c b/src/forward.c
index 1a7c586..501d8e4 100644
--- a/src/forward.c
+++ b/src/forward.c
@@ -788,21 +788,23 @@ static size_t process_reply(struct dns_header *header, time_t now, struct server
       return resize_packet(header, n, pheader, plen);
     }
   
+  /* Convert NXDOMAIN to NODATA for locally-known domains. This must happen
+     unconditionally, even for DNSSEC BOGUS answers, since local host records
+     are authoritative for domain existence. */
+  if (!(header->hb3 & HB3_TC) && rcode == NXDOMAIN &&
+      extract_name(header, n, NULL, daemon->namebuff, EXTR_NAME_EXTRACT, 0) &&
+      (check_for_local_domain(daemon->namebuff, now) || lookup_domain(daemon->namebuff, F_CONFIG, NULL, NULL)))
+    {
+      header->hb3 |= HB3_AA;
+      SET_RCODE(header, NOERROR);
+      rcode = NOERROR;
+      cache_secure = 0;
+    }
+
   if (header->hb3 & HB3_TC)
     log_query(F_UPSTREAM, NULL, NULL, "truncated", 0);
   else if (!bogusanswer || (header->hb4 & HB4_CD))
     {
-      if (rcode == NXDOMAIN && extract_name(header, n, NULL, daemon->namebuff, EXTR_NAME_EXTRACT, 0) &&
-	  (check_for_local_domain(daemon->namebuff, now) || lookup_domain(daemon->namebuff, F_CONFIG, NULL, NULL)))
-	{
-	  /* if we forwarded a query for a locally known name (because it was for 
-	     an unknown type) and the answer is NXDOMAIN, convert that to NODATA,
-	     since we know that the domain exists, even if upstream doesn't */
-	  header->hb3 |= HB3_AA;
-	  SET_RCODE(header, NOERROR);
-	  cache_secure = 0;
-	}
-      
       if (daemon->doctors && do_doctor(header, n, daemon->namebuff))
 	cache_secure = 0;
       
diff --git a/src/rfc1035.c b/src/rfc1035.c
index 0e31b83..4714d3f 100644
--- a/src/rfc1035.c
+++ b/src/rfc1035.c
@@ -2302,6 +2302,27 @@ size_t answer_request(struct dns_header *header, char *limit, size_t qlen,
 	}
     }
   
+  /* If we couldn't answer (e.g. AAAA query with only A host record, or an
+     unsupported RR type) but the domain has local records from /etc/hosts
+     or DHCP, return NODATA instead of forwarding upstream. This prevents
+     upstream NXDOMAIN responses from overriding local domain existence. */
+  if (!ans)
+    {
+      struct crec *local;
+
+      for (local = cache_find_by_name(NULL, name, now, F_IPV4 | F_IPV6 | F_CNAME);
+	   local;
+	   local = cache_find_by_name(local, name, now, F_IPV4 | F_IPV6 | F_CNAME))
+	if (local->flags & (F_HOSTS | F_DHCP | F_CONFIG))
+	  {
+	    ans = 1;
+	    sec_data = 0;
+	    auth = 0;
+	    log_query(F_NEG | F_CONFIG | (qtype == T_A ? F_IPV4 : F_IPV6), name, NULL, NULL, 0);
+	    break;
+	  }
+    }
+
   if (!ans)
     return 0; /* failed to answer a question */
 
-- 
2.43.0

_______________________________________________
Dnsmasq-discuss mailing list
[email protected]
https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss