Blame SOURCES/bind-9.11-CVE-2021-25214.patch

814232
From 4eff09c6b1e524b0efc393ee948b5c4cdf16ccb8 Mon Sep 17 00:00:00 2001
814232
From: Mark Andrews <marka@isc.org>
814232
Date: Wed, 3 Feb 2021 11:10:20 +1100
814232
Subject: [PATCH] Check SOA owner names in zone transfers
814232
814232
An IXFR containing SOA records with owner names different than the
814232
transferred zone's origin can result in named serving a version of that
814232
zone without an SOA record at the apex.  This causes a RUNTIME_CHECK
814232
assertion failure the next time such a zone is refreshed.  Fix by
814232
immediately rejecting a zone transfer (either an incremental or
814232
non-incremental one) upon detecting an SOA record not placed at the apex
814232
of the transferred zone.
814232
---
814232
 lib/dns/xfrin.c | 14 ++++++++++++++
814232
 1 file changed, 14 insertions(+)
814232
814232
diff --git a/lib/dns/xfrin.c b/lib/dns/xfrin.c
814232
index 3a3f407289..0ba82e4974 100644
814232
--- a/lib/dns/xfrin.c
814232
+++ b/lib/dns/xfrin.c
814232
@@ -477,6 +477,20 @@ xfr_rr(dns_xfrin_ctx_t *xfr, dns_name_t *name, uint32_t ttl,
814232
 	    dns_rdatatype_ismeta(rdata->type))
814232
 		FAIL(DNS_R_FORMERR);
814232
 
814232
+	/*
814232
+	 * Immediately reject the entire transfer if the RR that is currently
814232
+	 * being processed is an SOA record that is not placed at the zone
814232
+	 * apex.
814232
+	 */
814232
+	if (rdata->type == dns_rdatatype_soa &&
814232
+	    !dns_name_equal(&xfr->name, name)) {
814232
+		char namebuf[DNS_NAME_FORMATSIZE];
814232
+		dns_name_format(name, namebuf, sizeof(namebuf));
814232
+		xfrin_log(xfr, ISC_LOG_DEBUG(3), "SOA name mismatch: '%s'",
814232
+			  namebuf);
814232
+		FAIL(DNS_R_NOTZONETOP);
814232
+	}
814232
+
814232
  redo:
814232
 	switch (xfr->state) {
814232
 	case XFRST_SOAQUERY:
814232
-- 
814232
2.26.3
814232