Skip to contentSkip to conversation

bind: Security fix for CVE-2026-19667

PATCH New Rohini Sangam 1 participant 1 message Nov 2

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bind: Security fix for CVE-2026-19667

Pick patch from [1] and [2] also mentioned at Debian tracker in [3]

[1] https://github.com/isc-projects/bind9/commit/c4203fb70e3985452afddeadb7075aa91ae05d7d
[2] https://github.com/isc-projects/bind9/commit/993d10fe15adbac485d399f1e4144b55ed226ecf
[3] https://security-tracker.debian.org/tracker/CVE-2026-19667

---
 .../bind/bind/CVE-2026-19667-1.patch          | 139 +++++++
 .../bind/bind/CVE-2026-19667-2.patch          | 355 ++++++++++++++++++
 .../recipes-connectivity/bind/bind_9.18.49.bb |   2 +
 3 files changed, 496 insertions(+)
 create mode 100644 meta/recipes-connectivity/bind/bind/CVE-2026-19667-1.patch
 create mode 100644 meta/recipes-connectivity/bind/bind/CVE-2026-19667-2.patch
meta/recipes-connectivity/bind/bind/CVE-2026-19667-1.patch new file +139 -0
new file mode 100644
index 0000000000..5c52e42034
@@ -0,0 +1,139 @@
+From e5c7129b2d312d14759aa8b4a146f78a6a60020e Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= <[email protected]>
+Date: Thu, 6 Aug 2026 17:15:26 +0200
+Subject: [PATCH 1/2] Reject negative cache records that do not fit in a
+ dns_rdata_t
+
+dns_ncache_add() assembles each negative cache record in a 64 KiB stack
+buffer and then stores its size in dns_rdata_t.length, which is 16 bits
+wide.  A record that fills the buffer exactly is recorded as being zero
+bytes long, which is small enough to satisfy the size checks in
+dns_rdataslab_fromrdataset() that would otherwise have rejected it.  The
+truncated record is committed to the cache, and every reader of it then
+fails an assertion.
+
+A response whose authority section repeats one SOA record, with MNAME
+and RNAME compressed against a long QNAME, expands to exactly that size,
+so check the length where the record is produced rather than relying on
+the slab code to notice.  Every other way of building a dns_rdata_t
+already refuses anything longer than DNS_RDATA_MAXLENGTH.
+
+While here, refuse a singleton RRset with more than one record and a
+second SOA RRset as DNS_R_TOOMANYRECORDS, which is now also what more
+than DNS_NCACHE_RDATA records reports instead of ISC_R_NOSPACE.  The
+message parser and the resolver already reject duplicate singletons
+and a second SOA on their own, but dns_ncache_add() should not depend
+on its callers for that.
+
+Co-authored-by: Mark Andrews <[email protected]>
+(cherry picked from commit 8b20ed0a647cd1e9efc3bf442fc5d898f6a4de57)
+
+CVE: CVE-2026-19667
+Upstream-Status: Backport [https://github.com/isc-projects/bind9/commit/c4203fb70e3985452afddeadb7075aa91ae05d7d]
+
+Signed-off-by: Rohini Sangam <[email protected]>
+---
+ lib/dns/ncache.c | 48 +++++++++++++++++++++++++++++++++++++++++++++---
+ 1 file changed, 45 insertions(+), 3 deletions(-)
+
+diff --git a/lib/dns/ncache.c b/lib/dns/ncache.c
+index c99c266..bab42bf 100644
+--- a/lib/dns/ncache.c
++++ b/lib/dns/ncache.c
+@@ -63,14 +63,30 @@ copy_rdataset(dns_rdataset_t *rdataset, isc_buffer_t *buffer) {
+ 		return ISC_R_NOSPACE;
+ 	}
+ 	count = dns_rdataset_count(rdataset);
++
++	/*
++	 * Reject duplicate singleton records.
++	 */
++	if (dns_rdatatype_issingleton(rdataset->type) && count != 1) {
++		return DNS_R_TOOMANYRECORDS;
++	}
++
+ 	INSIST(count <= 65535);
+ 	isc_buffer_putuint16(buffer, (uint16_t)count);
+ 
++	if (ar.length < 2 + count * 2) {
++		/*
++		 * The count took 2 bytes and each rdata needs at least 2
++		 * more for its length.  Bail early if that cannot fit.
++		 */
++		return ISC_R_NOSPACE;
++	}
++
+ 	result = dns_rdataset_first(rdataset);
+ 	while (result == ISC_R_SUCCESS) {
+ 		dns_rdataset_current(rdataset, &rdata);
+ 		dns_rdata_toregion(&rdata, &r);
+-		INSIST(r.length <= 65535);
++		INSIST(r.length <= DNS_RDATA_MAXLENGTH);
+ 		isc_buffer_availableregion(buffer, &ar);
+ 		if (ar.length < 2) {
+ 			return ISC_R_NOSPACE;
+@@ -79,6 +95,7 @@ copy_rdataset(dns_rdataset_t *rdataset, isc_buffer_t *buffer) {
+ 		 * Copy the rdata length to the buffer.
+ 		 */
+ 		isc_buffer_putuint16(buffer, (uint16_t)r.length);
++
+ 		/*
+ 		 * Copy the rdata to the buffer.
+ 		 */
+@@ -129,8 +146,9 @@ addoptout(dns_message_t *message, dns_db_t *cache, dns_dbnode_t *node,
+ 	dns_rdata_t rdata[DNS_NCACHE_RDATA];
+ 	dns_rdataset_t ncrdataset;
+ 	dns_rdatalist_t ncrdatalist;
+-	unsigned char data[65536];
++	unsigned char data[UINT16_MAX];
+ 	unsigned int next = 0;
++	bool seen_soa = false;
+ 
+ 	/*
+ 	 * Convert the authority data from 'message' into a negative cache
+@@ -177,6 +195,20 @@ addoptout(dns_message_t *message, dns_db_t *cache, dns_dbnode_t *node,
+ 					continue;
+ 				}
+ 				type = rdataset->type;
++
++				/*
++				 * A negative response carries one SOA
++				 * RRset.  The resolver rejects a second
++				 * one before it gets here; don't rely on
++				 * that.
++				 */
++				if (type == dns_rdatatype_soa) {
++					if (seen_soa) {
++						return DNS_R_TOOMANYRECORDS;
++					}
++					seen_soa = true;
++				}
++
+ 				if (type == dns_rdatatype_rrsig) {
+ 					type = rdataset->covers;
+ 				}
+@@ -224,10 +256,20 @@ addoptout(dns_message_t *message, dns_db_t *cache, dns_dbnode_t *node,
+ 					}
+ 
+ 					if (next >= DNS_NCACHE_RDATA) {
+-						return ISC_R_NOSPACE;
++						return DNS_R_TOOMANYRECORDS;
+ 					}
+ 					dns_rdata_init(&rdata[next]);
+ 					isc_buffer_remainingregion(&buffer, &r);
++					/*
++					 * dns_rdata_t.length is 16 bits wide,
++					 * so a longer record would be silently
++					 * truncated here and would then pass
++					 * the size checks in
++					 * dns_rdataslab_fromrdataset().
++					 */
++					if (r.length > DNS_RDATA_MAXLENGTH) {
++						return ISC_R_NOSPACE;
++					}
+ 					rdata[next].data = r.base;
+ 					rdata[next].length = r.length;
+ 					rdata[next].rdclass =
+-- 
+2.44.4
+
meta/recipes-connectivity/bind/bind/CVE-2026-19667-2.patch new file +355 -0

355 lines not on this page · raw message

meta/recipes-connectivity/bind/bind_9.18.49.bb +2 -0
index 723a09e739..fef00e363f 100644
@@ -18,6 +18,8 @@ SRC_URI = "https://ftp.isc.org/isc/bind9/${PV}/${BPN}-${PV}.tar.xz \
            file://bind-ensure-searching-for-json-headers-searches-sysr.patch \
            file://0001-named-lwresd-V-and-start-log-hide-build-options.patch \
            file://0001-avoid-start-failure-with-bind-user.patch \
+           file://CVE-2026-19667-1.patch \
+           file://CVE-2026-19667-2.patch \
            "
 
 SRC_URI[sha256sum] = "c43ce4548ebed788cd9df63658a7de105ceafba43fcd63fa352b1093e525cd24"
Signature · 1 line
2.34.1