<?xml version="1.0" encoding="utf-8"?>
<?xml-model href="rfc7991bis.rnc"?>
<!DOCTYPE rfc [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">
]>

<rfc
  xmlns:xi="http://www.w3.org/2001/XInclude"
  category="bcp"
  docName="draft-qiu-dnsop-enhanced-bailiwick-02"
  ipr="trust200902"
  obsoletes=""
  updates=""
  submissionType="IETF"
  consensus="true"
  xml:lang="en"
  version="3">

  <front>
    <title abbrev="Enhanced Bailiwick Checking">Enhanced Bailiwick Checking for DNS Resolvers to Mitigate Cache Poisoning Vulnerabilities</title>
    
    <seriesInfo name="Internet-Draft" value="draft-qiu-dnsop-enhanced-bailiwick-02"/>
   
    <author fullname="Yuqi Qiu" initials="Y.Q." surname="Qiu">
      <organization>Nankai University</organization>
      <address>
        <postal>
          <street>38 Tongyan Road</street>
          <city>Tianjin</city>
          <region>Tianjin</region>
          <code>300355</code>
          <country>China</country>
        </postal>
        <email>norahqiu@163.com</email>
      </address>
    </author>

    <author fullname="Xiang Li" initials="X.L." surname="Li">
      <organization>Nankai University</organization>
      <address>
        <postal>
          <street>38 Tongyan Road</street>
          <city>Tianjin</city>
          <region>Tianjin</region>
          <code>300355</code>
          <country>China</country>
        </postal>
        <email>lixiang@nankai.edu.cn</email>
      </address>
    </author>
   
    <date year="2026" month="February" day="28"/>
    
    <area>Internet</area>
    <workgroup>DNS Operations (dnsop)</workgroup>
    <keyword>DNS</keyword>
    <keyword>Bailiwick</keyword>
    <keyword>Cache Poisoning</keyword>
    <keyword>Security</keyword>
    <keyword>CDNS</keyword>

    <abstract>
      <t>The Domain Name System (DNS) relies on caching to function
   efficiently. However, DNS cache poisoning remains a significant
   threat. The "bailiwick" rule is a fundamental security mechanism
   intended to prevent resolvers from caching out-of-bailiwick data
   sent by malicious or misconfigured authoritative servers. Current DNS
   standards provide high-level guidance on bailiwick checking but lack
   specific algorithmic definitions, leading to inconsistent
   implementations across different DNS software. These inconsistencies
   can be exploited, particularly in DNS servers that operate in multiple
   modes, such as Conditional DNS Servers (CDNS), which may act as both
   recursive resolvers and forwarders and often share a common cache.</t>
      <t>This document specifies enhanced and more precise rules for bailiwick
   checking in DNS resolvers, including those operating as forwarders or
   CDNS. The goal is to provide clearer guidelines for implementers,
   reduce the attack surface for cache poisoning, and improve the
   overall security and robustness of the DNS infrastructure. The
   recommendations herein are informed by recent research highlighting
   vulnerabilities in existing bailiwick implementations.</t>
    </abstract>
 
  </front>

  <middle>
    <section anchor="introduction">
      <name>Introduction</name>
      <section anchor="motivation">
        <name>Motivation</name>
        <t>Bailiwick checking is a critical defense mechanism in the DNS
   designed to ensure that a DNS server only accepts and caches data for
   which the responding server is authoritative. As defined in
   <xref target="RFC1034"/> and <xref target="RFC1035"/>, authoritative nameservers should not return
   data for zones they do not manage. Resolvers are expected to enforce
   this by discarding "unsolicited" or out-of-bailiwick data.</t>
        <t>However, the precise algorithms for bailiwick checking are not
   rigorously defined in existing standards, leading to diverse
   interpretations and implementations by DNS software vendors. Historically, DNS cache poisoning has evolved from simple transaction ID guessing <xref target="KAMINSKY08"/> <xref target="HITCHHIKERDNS"/> to exploiting side channels <xref target="SADDNS"/> and forwarding devices <xref target="POISONOVERFWD"/>. Recent
   research, such as "The Maginot Line: Attacking the Boundary of DNS
   Caching Protection" <xref target="MAGINOTDNS"/>, has exposed vulnerabilities
   stemming specifically from inconsistencies in bailiwick logic. These vulnerabilities can allow
   attackers to inject malicious records into a resolver's cache,
   potentially hijacking entire DNS zones, including Top-Level Domains
   (TLDs).</t>
        <t>Conditional DNS Servers (CDNS), which combine recursive resolver and
   forwarder functionalities and often share a global cache, present a
   particular challenge. Weaknesses in the bailiwick checks of one mode
   (e.g., forwarding) can be exploited to poison the cache used by
   another, more secure mode (e.g., recursive resolution).</t>
        <t>This document aims to address these issues by providing more
   explicit and robust rules for bailiwick checking. The goal is to
   foster more consistent and secure implementations across DNS resolver
   software, thereby strengthening the overall resilience of the DNS
   ecosystem against cache poisoning attacks.</t>
      <t>This document acknowledges that the diversity of DNS implementations is
   a strength and not a weakness. The exact mitigations detailed herein are
   provided as operational guidance and Best Current Practices, rather than
   rigid Internet Standards. Implementers are encouraged to adapt these
   mechanisms to suit their specific architectures.</t>
      </section>
      <section anchor="requirements-language">
        <name>Requirements Language</name>
        <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL",
          "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT
          RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be
          interpreted as described in BCP 14 <xref target="RFC2119"/>
          <xref target="RFC8174"/> when, and only when, they appear in
          all capitals, as shown here.</t>
      </section>
      <section anchor="terminology">
        <name>Terminology</name>
        <t>This document uses standard DNS terminology as defined in <xref target="RFC1034"/>,
   <xref target="RFC1035"/>, and <xref target="RFC9499"/>. The following terms are central to this
   document:</t>
        <dl newline="true">
          <dt>Bailiwick:</dt>
          <dd><t>The scope of authority a nameserver has. Data is
      considered "in-bailiwick" if it pertains to the zone(s) for
      which the responding nameserver is authoritative in the context of
      the original query.</t></dd>
          <dt>Out-of-Bailiwick:</dt>
          <dd><t>Data that is not within the bailiwick of the
      responding nameserver.</t></dd>
          <dt>Q.NAME:</dt>
          <dd><t>The domain name in the question section of the current query
      being processed by the resolver.</t></dd>
          <dt>Q.TYPE:</dt>
          <dd><t>The type of the resource record (RR) in the question section
      of the current query.</t></dd>
          <dt>Q.ZONE:</dt>
          <dd><t>The closest ancestor zone for which the resolver has (or
      believes it has) authoritative nameserver information relevant to
      Q.NAME. This zone defines the current bailiwick against which
      incoming response records are checked. The determination of
      Q.ZONE is critical and is further detailed in <xref target="determining-qzone"/>.</t></dd>
          <dt>RR (Resource Record):</dt>
          <dd><t>A single record in a DNS response.
      RR.NAME is the owner name of the resource record.
      RR.TYPE is the type of the resource record.
      RR.DATA is the data content of the resource record.</t></dd>
          <dt>CDNS (Conditional DNS Server):</dt>
          <dd>
            <t>A DNS server configured to act as
      both a recursive resolver and a forwarder simultaneously, often
      directing queries to different upstream servers or resolving them
      differently based on the queried domain name. CDNS implementations
      typically use distinct sets of zones:</t>
            <t>$Z_R$ (Recursive DNS Zones): The set of domain names for which the
         CDNS is configured to perform recursive resolution.</t>
            <t>$Z_F$ (Forwarding DNS Zones): The set of domain names for which the
         CDNS is configured to forward queries to specific upstream
         forwarders.</t>
          </dd>
          <dt>Delegation:</dt>
          <dd><t>The process by which a nameserver for a parent zone
      indicates the authoritative nameservers for a child zone,
      typically via NS records.</t></dd>
          <dt>Referral:</dt>
          <dd><t>A DNS response from a nameserver that does not have the
      authoritative answer for a query but provides NS records (and
      potentially glue records) pointing to nameservers that are
      authoritative for a zone closer to the Q.NAME.</t></dd>
          <dt>Sanitize Records:</dt>
          <dd><t>The process of examining each RR in a DNS response
      to determine if it is in-bailiwick and should be processed and
      potentially cached.</t></dd>
        </dl>
      </section>
    </section>
    
    <section anchor="background">
      <name>Background: Bailiwick Checking and its Challenges</name>
      <section anchor="current-understanding">
        <name>Current Understanding of Bailiwick</name>
        <t>The concept of bailiwick is fundamental to DNS security. <xref target="RFC1034"/>
   states that nameservers should not add RRs to the additional section
   unless they are "closely related to an RR in the answer or authority
   sections". More generally, data returned by a nameserver should be
   within the scope of the zones for which it holds authority, relative
   to the query that was made. Resolvers are expected to discard data
   that violates this principle <xref target="RFC2181"/>.</t>
        <t>The primary goal of bailiwick checking is to prevent a malicious
   nameserver authoritative for <tt>example.com</tt> from providing (and a
   resolver from caching) records for <tt>other-example.net</tt>, or worse,
   for TLDs or the root zone.</t>
      </section>
      <section anchor="observed-inconsistencies">
        <name>Observed Implementation Inconsistencies</name>
        <t>Despite the long-standing principle of bailiwick, its implementation
   varies. The <xref target="MAGINOTDNS"/> study highlights several critical areas of
   inconsistency and vulnerability:</t>
        <ol spacing="normal" type="1">
          <li><t>Q.ZONE Initialization: In forwarding mode, some DNS software
       initializes Q.ZONE to overly broad zones (e.g., the root zone ".")
       or an ancestor of Q.NAME that is too high in the DNS hierarchy.
       This effectively weakens or nullifies bailiwick checks for records
       in the authority and additional sections, as almost any record
       would appear to be "in-bailiwick" relative to the root. This is
       referred to as V1 in <xref target="MAGINOTDNS"/>.</t></li>
          <li><t>CNAME Chasing Logic: Flaws in how bailiwick context is
       maintained or re-evaluated during CNAME chasing can lead to
       vulnerabilities where a resolver is tricked into accepting out-of-
       bailiwick data for the CNAME target. This is referred to as V2 in
       <xref target="MAGINOTDNS"/>.</t></li>
          <li><t>Shared Cache in CDNS: When recursive and forwarding modes in a
       CDNS share a global cache, data cached via the potentially weaker
       bailiwick checks of the forwarding mode can pollute the cache for
       the recursive mode.</t></li>
        </ol>
        <t>These inconsistencies underscore the need for more precise normative
   guidance.</t>
      </section>
      <section anchor="cdns-background">
        <name>Conditional DNS Servers (CDNS)</name>
        <t>CDNS are increasingly common in enterprise networks and ISP
   infrastructure. They offer flexible query routing, allowing
   organizations to resolve internal domains locally while forwarding
   external domains to public resolvers, or to implement split-horizon
   DNS, content delivery optimizations, or security policies.</t>
        <t>The dual nature of CDNS, coupled with shared caching, makes them a
   prime target if bailiwick checks are inconsistent between modes. An
   attacker might exploit a vulnerability in the forwarding path's
   bailiwick logic to inject malicious data that subsequently affects
   recursive resolution for other clients or other domains.</t>
      </section>
    </section>
    
    <section anchor="normative-requirements">
      <name>Normative Requirements for Bailiwick Checking</name>
      <section anchor="general-principles">
        <name>General Principles</name>
        <t>The following general principles MUST be applied by DNS resolvers
   when processing responses and considering records for caching:</t>
        <dl newline="true" spacing="normal">
          <dt>GP1:</dt>
          <dd><t>A resolver MUST NOT cache any RR from a response if that RR is
        determined to be out-of-bailiwick according to the rules
        specified in this document.</t></dd>
          <dt>GP2:</dt>
          <dd><t>The bailiwick checks applied to data received in forwarding mode
        MUST be at least as stringent as those applied in recursive
        resolution mode if the forwarded data can be stored in a cache
        that is also accessible by the recursive resolution process.</t></dd>
          <dt>GP3:</dt>
          <dd><t>The Q.ZONE for a query is established at the time the query is
        sent and is used to validate the response. It represents the
        zone for which the queried upstream server is considered
        authoritative in the context of the current Q.NAME.</t></dd>
        </dl>
      </section>
      <section anchor="determining-qzone">
        <name>Determining the Query Zone (Q.ZONE)</name>
        <t>The correct determination of Q.ZONE is paramount for effective
   bailiwick checking.</t>
        <section anchor="recursive-mode-qzone">
          <name>Recursive Resolution Mode</name>
          <t>When a resolver is performing recursive resolution and is about to
   send a query for Q.NAME to a set of selected authoritative
   nameservers:</t>
          <dl newline="true" spacing="normal">
            <dt>RRM1:</dt>
            <dd><t>Q.ZONE MUST be set to the name of the zone for which the
         selected upstream nameservers are authoritative. This is
         typically the closest ancestor of Q.NAME (or Q.NAME itself) for
         which the resolver has NS records in its cache, or the root
         zone (".") if no closer NS records are available.</t></dd>
          </dl>
        </section>
        <section anchor="forwarding-mode-qzone">
          <name>Forwarding Mode</name>
          <t>When a resolver is configured to forward queries for domains within a
   specific forwarding zone ($Z_F$) to a designated set of upstream
   forwarders:</t>
          <dl newline="true" spacing="normal">
            <dt>FM1:</dt>
            <dd><t>If the Q.NAME falls within a configured forwarding zone $Z_F$
        (e.g., <tt>Q.NAME</tt> is <tt>host.internal.example.com</tt> and $Z_F$ is
        <tt>internal.example.com</tt>), then Q.ZONE for the query sent to the
        upstream forwarder SHOULD be set to that $Z_F$
        (<tt>internal.example.com</tt>).</t></dd>
            <dt>FM2:</dt>
            <dd><t>If the resolver is acting as a general-purpose forwarder (e.g.,
        forwarding all queries for which it is not authoritative itself)
        and is configured to forward to a specific recursive resolver
        (e.g., a public DNS service), Q.ZONE SHOULD be considered the
        root zone ("."). However, if this forwarder caches responses and
        that cache is shared with a recursive resolution component (as in
        a CDNS), this broad Q.ZONE definition is insufficient. See
        <xref target="cdns-bailiwick"/> for CDNS-specific rules.</t></dd>
            <dt>FM3:</dt>
            <dd><t>A resolver in forwarding mode, especially if part of a CDNS that
        shares its cache with a recursive component, MUST NOT initialize
        Q.ZONE to the root zone (".") or an overly broad ancestor if a
        more specific zone context (like a configured $Z_F$) is
        available for Q.NAME. Relying on an upstream recursive resolver
        to perform all bailiwick checks is NOT SUFFICIENT if the
        forwarding resolver itself caches the results in a shared cache.</t></dd>
            <dt>FM4:</dt>
            <dd><t>If a forwarder forwards to an authoritative server directly (not
        a recursive resolver), Q.ZONE MUST be the zone for which that
        authoritative server is believed to be authoritative for Q.NAME.</t></dd>
          </dl>
        </section>
      </section>
      <section anchor="sanitizing-records">
        <name>Sanitizing Records in a Response</name>
        <t>Upon receiving a response (R) to a query (Q), each RR in the answer,
   authority, and additional sections of R MUST be checked against
   Q.ZONE.</t>
        <section anchor="answer-section-sanitize">
          <name>Answer Section</name>
          <dl newline="true" spacing="normal">
            <dt>AS1:</dt>
            <dd>
              <t>For an RR in the answer section to be considered in-bailiwick:</t>
              <t>a. RR.NAME MUST be equal to Q.NAME (or an alias of Q.NAME if
           CNAMEs/DNAMEs are involved, see <xref target="cname-chasing"/>).</t>
              <t>b. RR.TYPE MUST be equal to Q.TYPE (unless Q.TYPE is ANY or
           CNAME/DNAME processing is occurring).</t>
              <t>c. If RR.TYPE is CNAME or DNAME, specific CNAME/DNAME processing
           rules apply (see <xref target="cname-chasing"/> and <xref target="RFC6672"/>).</t>
            </dd>
            <dt>AS2:</dt>
            <dd><t>Records in the answer section that do not meet these criteria
        MUST be discarded and NOT cached, unless they are part of a
        valid CNAME/DNAME chain leading to the Q.NAME.</t></dd>
          </dl>
        </section>
        <section anchor="authority-section-sanitize">
          <name>Authority Section</name>
          <t>The authority section typically contains NS records for delegations or
   SOA records for negative answers.</t>
          <dl newline="true" spacing="normal">
            <dt>AuthS1:</dt>
            <dd>
              <t>For an NS record in the authority section (RR.TYPE is NS) to
           be considered in-bailiwick:</t>
              <t>a. RR.NAME (the zone being delegated) MUST be a sub-domain of
              Q.ZONE, or Q.ZONE itself. (e.g., if Q.ZONE is "example.com",
              RR.NAME can be "sub.example.com" or "example.com").</t>
              <t>b. Q.NAME MUST be a sub-domain of RR.NAME, or RR.NAME itself.
              (e.g., if RR.NAME is "sub.example.com", Q.NAME can be
              "host.sub.example.com" or "sub.example.com").</t>
              <t>c. An NS record for Q.ZONE itself (RR.NAME equals Q.ZONE) is
              considered in-bailiwick.</t>
              <t>d. NS records for zones that are not superdomains of or equal
              to Q.NAME are generally out-of-bailiwick for positive
              responses, but may be relevant for referrals if they are
              closer to Q.NAME than Q.ZONE.</t>
            </dd>
            <dt>AuthS2:</dt>
            <dd><t>More precisely, for an NS record (RR.NAME, RR.DATA points to
           NSDNAME) in the authority section of a response from a server
           authoritative for Q.ZONE, where the query was for Q.NAME:
           The NS record is in-bailiwick if RR.NAME is an ancestor of
           Q.NAME (or Q.NAME itself) and RR.NAME is a descendant of
           Q.ZONE (or Q.ZONE itself).
           Example: Q.NAME = <tt>www.sub.example.com</tt>, Q.ZONE = <tt>example.com</tt>.
           An NS record for <tt>sub.example.com</tt> is in-bailiwick.
           An NS record for <tt>example.com</tt> is in-bailiwick.
           An NS record for <tt>com</tt> is NOT in-bailiwick if provided by the
           <tt>example.com</tt> server.</t></dd>
            <dt>AuthS3:</dt>
            <dd><t>For an SOA record in the authority section (typically for
           negative answers or NXDOMAIN), RR.NAME MUST be a superdomain
           of or equal to Q.NAME, and also a subdomain of or equal to
           Q.ZONE.</t></dd>
            <dt>AuthS4:</dt>
            <dd><t>Records in the authority section that do not meet these
           criteria MUST be discarded and NOT cached. This prevents the
           V1 vulnerability where a response for <tt>attacker.com</tt> (Q.NAME)
           with Q.ZONE set to <tt>.</tt> could inject an NS record for <tt>com.</tt>
           into the authority section.</t></dd>
          </dl>
        </section>
        <section anchor="additional-section-sanitize">
          <name>Additional Section</name>
          <t>The additional section typically contains address records (A/AAAA)
   for nameservers listed in the authority or answer sections (glue
   records), or other records deemed helpful by the authoritative
   server.</t>
          <dl newline="true" spacing="normal">
            <dt>AddS1:</dt>
            <dd>
              <t>For an RR in the additional section to be considered in-
           bailiwick:</t>
              <t>a. It MUST be "closely related" to an RR that is itself in-
              bailiwick in the answer or authority sections. "Closely
              related" typically means RR.NAME is the RDATA of an in-
              bailiwick NS record (glue for a nameserver name) or an in-
              bailiwick MX or SRV record.</t>
              <t>b. Specifically for glue records (A/AAAA for an NSDNAME
              appearing in an in-bailiwick NS record's RDATA): RR.NAME
              (the nameserver's name) MUST be within the zone being
              delegated by that NS record (i.e., a sub-domain of or equal
              to the owner name of the NS record) or within Q.ZONE.
              Glue for out-of-zone nameservers is permissible but the
              address records themselves are only authoritative if they
              are also within Q.ZONE. Non-authoritative glue may be
              cached but should be treated with lower trust <xref target="RFC2181"/>.</t>
            </dd>
            <dt>AddS2:</dt>
            <dd><t>Records in the additional section that are not closely related
           to in-bailiwick records in other sections, or whose RR.NAME
           is not justified by Q.ZONE or a valid delegation, MUST be
           discarded and NOT cached.</t></dd>
          </dl>
        </section>
      </section>
      <section anchor="cname-chasing">
        <name>CNAME Chasing</name>
        <t>When a resolver receives a CNAME (or DNAME) record in response to a
   query for Q.NAME:</t>
        <dl newline="true" spacing="normal">
          <dt>CN1:</dt>
          <dd><t>The CNAME/DNAME record itself MUST be validated as per
        <xref target="answer-section-sanitize"/>. (i.e., RR.NAME must match Q.NAME).</t></dd>
          <dt>CN2:</dt>
          <dd><t>The resolver then initiates a new query for the canonical name
        (the target of the CNAME/DNAME). The Q.ZONE for this new query
        MUST be determined based on the new Q.NAME (the canonical name)
        as per rules in <xref target="recursive-mode-qzone"/>. It MUST NOT simply inherit the
        Q.ZONE of the original query if the canonical name falls into a
        different bailiwick context.</t></dd>
          <dt>CN3:</dt>
          <dd><t>Resolvers MUST validate the entire CNAME chain. Each CNAME in
        the chain must point to a name for which the subsequent CNAME or
        the final answer is in-bailiwick with respect to the Q.ZONE
        established for that specific lookup in the chain. This prevents
        exploitation of CNAMEs to inject unrelated data (addressing V2
        from <xref target="MAGINOTDNS"/>).</t></dd>
        </dl>
      </section>
    </section>
    
    <section anchor="cdns-bailiwick">
      <name>Bailiwick Checking in Conditional DNS Servers (CDNS)</name>
      <section anchor="cache-interaction">
        <name>Cache Interaction and Integrity</name>
        <t>CDNS often use a shared global cache for records obtained via both
   recursive resolution and forwarding. This presents a significant risk
   if bailiwick checks for forwarded data are weaker.</t>
        <dl newline="true" spacing="normal">
          <dt>CDNS1:</dt>
          <dd><t>If a CDNS shares a cache between its recursive resolver
          component and its forwarding component, any RR considered for
          caching from a forwarded response MUST undergo bailiwick checks
          that are at least as stringent as those defined for recursive
          resolution mode (<xref target="recursive-mode-qzone"/> and <xref target="sanitizing-records"/>).</t></dd>
          <dt>CDNS2:</dt>
          <dd>
            <t>Specifically, when a response is received from an upstream
          forwarder, and Q.NAME was part of a $Z_F$:</t>
            <t>a. Q.ZONE for validating this response MUST NOT be assumed to
             be "." by default if the cache is shared.</t>
            <t>b. Q.ZONE SHOULD be determined based on the specific $Z_F$
             that Q.NAME matched, or based on knowledge of the upstream
             forwarder's authoritative scope if the forwarder is not a
             full recursive resolver itself.</t>
            <t>c. If the upstream forwarder is a recursive resolver, the CDNS
             MAY rely on the upstream resolver's bailiwick checks ONLY IF
             the CDNS itself does not cache the response or if its
             caching is strictly partitioned from the recursive
             resolver's cache. If cached in a shared manner, the CDNS
             MUST re-validate.</t>
          </dd>
          <dt>CDNS3:</dt>
          <dd><t>To prevent the V1 vulnerability in CDNS, if Q.NAME is in $Z_F$
          and Q.ZONE is determined (e.g., as $Z_F$ itself or an
          ancestor), records in the authority and additional sections of
          the response from the forwarder MUST be validated against this
          Q.ZONE as per <xref target="authority-section-sanitize"/> and <xref target="additional-section-sanitize"/>. For example, if $Z_F$
          is <tt>corp.example.com</tt> and a query for <tt>printer.corp.example.com</tt>
          is forwarded, the response MUST NOT be allowed to cache an NS
          record for <tt>.com</tt> in the authority section if Q.ZONE was effectively
          <tt>corp.example.com</tt>.</t></dd>
        </dl>
      </section>
      <section anchor="forwarding-fallback">
        <name>Forwarding Fallback Considerations</name>
        <t>Some CDNS implement a fallback mechanism where if a forwarded query
   fails (e.g., timeout), the CDNS might attempt to resolve it
   recursively.</t>
        <dl newline="true" spacing="normal">
          <dt>CDNS4:</dt>
          <dd><t>If a query originally intended for forwarding (in $Z_F$) falls
          back to recursive resolution, the recursive resolution process
          MUST determine its Q.ZONE and apply bailiwick checks
          independently, as per <xref target="recursive-mode-qzone"/> and <xref target="sanitizing-records"/>. It MUST NOT
          carry over any relaxed bailiwick assumptions from the failed
          forwarding attempt.</t></dd>
        </dl>
      </section>
    </section>
    
    <section anchor="Security">
      <name>Security Considerations</name>
      <t>The enhanced bailiwick checking rules specified in this document are
   intended to mitigate several DNS cache poisoning attack vectors,
   particularly those identified in <xref target="MAGINOTDNS"/> that exploit
   ambiguities or weaknesses in current bailiwick implementations.</t>
      <t>By requiring a more precise determination of Q.ZONE, especially in
   forwarding mode and within CDNS, these rules make it harder for an
   attacker to inject out-of-bailiwick NS records for parent zones (like
   TLDs) or unrelated zones. Stricter validation of authority and
   additional section records based on a correctly scoped Q.ZONE is key.</t>
      <t>Proper CNAME chain validation with appropriate Q.ZONE adjustments at
   each step helps prevent attacks that leverage CNAMEs to introduce
   malicious data for the canonical target.</t>
      <t>For CDNS, ensuring that data entering a shared cache from forwarding
   operations is subject to rigorous bailiwick checks equivalent to
   those in recursive mode is crucial to prevent cross-mode cache
   pollution.</t>
      <t>While these measures significantly improve resilience against certain
   cache poisoning techniques and align with the forgery resilience measures of <xref target="RFC5452"/>, they do not replace the need for DNSSEC
   (<xref target="RFC4033"/>, <xref target="RFC4034"/>, <xref target="RFC4035"/>). DNSSEC provides cryptographic
   assurance of data origin and integrity and remains the most robust
   defense against cache poisoning. The rules in this document provide
   defense-in-depth and are particularly important for zones that are
   not DNSSEC-signed or for resolvers that do not validate DNSSEC
   signatures.</t>
      <t>Implementation of these stricter rules may cause some currently
   accepted (but technically out-of-bailiwick) data from misconfigured
   authoritative servers to be rejected. This is generally desirable for
   security but operators should be aware of potential compatibility
   issues with non-compliant servers during rollout.</t>
    </section>
    
    <section anchor="IANA">
      <name>IANA Considerations</name>
      <t>This document does not require any IANA actions.</t>
    </section>

  </middle>

  <back>
    <references>
      <name>References</name>
      <references>
        <name>Normative References</name>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.1034.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.1035.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.2181.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.9499.xml"/>
      </references>
 
      <references>
        <name>Informative References</name>
       
        <reference anchor="MAGINOTDNS" target="https://www.usenix.org/conference/usenixsecurity23/presentation/li-xiang">
          <front>
            <title>The Maginot Line: Attacking the Boundary of DNS Caching Protection</title>
            <author initials="X." surname="Li">
              <organization/>
            </author>
            <author initials="C." surname="Lu">
              <organization/>
            </author>
            <author initials="B." surname="Liu">
              <organization/>
            </author>
            <author initials="Q." surname="Zhang">
              <organization/>
            </author>
            <author initials="Z." surname="Li">
              <organization/>
            </author>
            <author initials="H." surname="Duan">
              <organization/>
            </author>
            <author initials="Q." surname="Li">
              <organization/>
            </author>
            <date year="2023" month="August"/>
          </front>
          <seriesInfo name="Proceedings of the 32nd USENIX Security Symposium" value=""/>
        </reference>

        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.4033.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.4034.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.4035.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.5452.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.6672.xml"/>

        <reference anchor="SADDNS">
          <front>
            <title>DNS Cache Poisoning Attack Reloaded: Revolutions with Side Channels</title>
            <author initials="K." surname="Man"><organization/></author>
            <author initials="Z." surname="Qian"><organization/></author>
            <author initials="Z." surname="Wang"><organization/></author>
            <author initials="X." surname="Zheng"><organization/></author>
            <author initials="Y." surname="Huang"><organization/></author>
            <author initials="H." surname="Duan"><organization/></author>
            <date year="2020" month="November"/>
          </front>
          <seriesInfo name="Proceedings of the 2020 ACM SIGSAC Conference on Computer and Communications Security (CCS '20)" value=""/>
        </reference>

        <reference anchor="KAMINSKY08"> 
          <front>
            <title>It's The End Of The Cache As We Know It</title>
            <author initials="D." surname="Kaminsky">
              <organization/>
            </author>
            <date year="2008"/>
          </front>
          <seriesInfo name="Black Hat USA 2008" value=""/>
        </reference>

        <reference anchor="POISONOVERFWD" target="https://www.usenix.org/conference/usenixsecurity20/presentation/zheng">
          <front>
            <title>Poison Over Troubled Forwarders: A Cache Poisoning Attack Targeting DNS Forwarding Devices</title>
            <author initials="X." surname="Zheng"><organization/></author>
            <author initials="C." surname="Lu"><organization/></author>
            <author initials="J." surname="Peng"><organization/></author>
            <author initials="Q." surname="Yang"><organization/></author>
            <author initials="D." surname="Zhou"><organization/></author>
            <author initials="B." surname="Liu"><organization/></author>
            <author initials="K." surname="Man"><organization/></author>
            <author initials="S." surname="Hao"><organization/></author>
            <author initials="H." surname="Duan"><organization/></author>
            <author initials="Z." surname="Qian"><organization/></author>
            <date year="2020" month="August"/>
          </front>
          <seriesInfo name="Proceedings of the 29th USENIX Security Symposium" value=""/>
        </reference>

        <reference anchor="HITCHHIKERDNS">
          <front>
            <title>The Hitchhiker's Guide to DNS Cache Poisoning</title>
            <author initials="S." surname="Son"><organization/></author>
            <author initials="V." surname="Shmatikov"><organization/></author>
            <date year="2010" month="October"/>
          </front>
          <seriesInfo name="Proceedings of the 2010 ACM SIGSAC Conference on Computer and Communications Security (CCS '10)" value=""/>
        </reference>
      </references>
    </references>
    
    </back>
</rfc>