]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Tighten restrictions on caching NS RRsets in authority section
authorMark Andrews <marka@isc.org>
Wed, 9 Jul 2025 23:37:36 +0000 (09:37 +1000)
committerMichał Kępień <michal@isc.org>
Thu, 2 Oct 2025 11:07:06 +0000 (13:07 +0200)
To prevent certain spoofing attacks, a new check has been added
to the existing rules for whether NS data can be cached: the owner
name of the NS RRset must be an ancestor of the name being queried.

(cherry picked from commit fa153f791f9324bf84abf8d259e11c0531fe6e25)

lib/dns/resolver.c

index dc9c5b1c874019c60baaa72aa6a5347587aa7932..eb5d671c8f27240cec7da27608328fbde48774cb 100644 (file)
@@ -9247,7 +9247,9 @@ rctx_authority_positive(respctx_t *rctx) {
                dns_message_currentname(rctx->query->rmessage,
                                        DNS_SECTION_AUTHORITY, &name);
 
-               if (!name_external(name, dns_rdatatype_ns, fctx)) {
+               if (!name_external(name, dns_rdatatype_ns, fctx) &&
+                   dns_name_issubdomain(fctx->name, name))
+               {
                        dns_rdataset_t *rdataset = NULL;
 
                        /*