Skip to contentSkip to conversation

zabbix: ignore multiple CVEs

PATCH New [email protected] 1 participant 32 messages Sep 10

lore
Share & tools
lore
#0 lore raw

PATCH 1/32 zabbix: ignore multiple CVEs

From: Ankur Tyagi <[email protected]>

CVE-2026-23922
https://support.zabbix.com/browse/ZBX-28067
https://nvd.nist.gov/vuln/detail/cve-2026-23922

CVE-2026-23924
https://support.zabbix.com/browse/ZBX-27642
https://nvd.nist.gov/vuln/detail/cve-2026-23924
https://github.com/zabbix/zabbix/blob/7.4.14/ChangeLog#L1856

CVE-2026-23926
https://support.zabbix.com/browse/ZBX-27758
https://nvd.nist.gov/vuln/detail/cve-2026-23926
https://github.com/zabbix/zabbix/blob/7.4.14/ChangeLog#L1787

CVE-2026-23927
https://support.zabbix.com/browse/ZBX-27759
https://nvd.nist.gov/vuln/detail/cve-2026-23927
https://github.com/zabbix/zabbix/blob/7.4.14/ChangeLog#L1785

CVE-2026-23928
https://support.zabbix.com/browse/ZBX-27760
https://nvd.nist.gov/vuln/detail/cve-2026-23928
https://github.com/zabbix/zabbix/blob/7.4.14/ChangeLog#L1786

CVE-2026-23931
https://support.zabbix.com/browse/ZBX-28070
https://nvd.nist.gov/vuln/detail/cve-2026-23931

CVE-2026-23933
https://support.zabbix.com/browse/ZBX-28071
https://nvd.nist.gov/vuln/detail/cve-2026-23933

CVE-2026-23934
https://support.zabbix.com/browse/ZBX-28072
https://nvd.nist.gov/vuln/detail/cve-2026-23934

---
 meta-oe/recipes-connectivity/zabbix/zabbix_7.0.24.bb | 8 ++++++++
 1 file changed, 8 insertions(+)
meta-oe/recipes-connectivity/zabbix/zabbix_7.0.24.bb +8 -0
index 1ec159cdee..7dcb69b070 100644
@@ -82,3 +82,11 @@ CVE_STATUS[CVE-2026-23919] = "fixed-version: fixed since 7.0.19"
 CVE_STATUS[CVE-2026-23920] = "fixed-version: fixed since 7.0.22"
 CVE_STATUS[CVE-2026-23921] = "fixed-version: fixed since 7.0.22"
 CVE_STATUS[CVE-2026-23923] = "cpe-incorrect: 7.0 versions don't have the vulnerable code"
+CVE_STATUS[CVE-2026-23922] = "cpe-incorrect: Only affects 7.4.x"
+CVE_STATUS[CVE-2026-23924] = "fixed-version: fixed since 7.0.23"
+CVE_STATUS[CVE-2026-23926] = "fixed-version: fixed in 7.0.24"
+CVE_STATUS[CVE-2026-23927] = "fixed-version: fixed in 7.0.24"
+CVE_STATUS[CVE-2026-23928] = "fixed-version: fixed in 7.0.24"
+CVE_STATUS[CVE-2026-23931] = "cpe-incorrect: Only affects 7.4.x"
+CVE_STATUS[CVE-2026-23933] = "cpe-incorrect: Only affects 7.4.x"
+CVE_STATUS[CVE-2026-23934] = "cpe-incorrect: Only affects 7.4.x"
#1 lore raw

PATCH 2/32 unbound: patch CVE-2026-33278

From: Ankur Tyagi <[email protected]>

Details:
https://nvd.nist.gov/vuln/detail/cve-2026-33278

---
 .../unbound/unbound/CVE-2026-33278.patch      | 296 ++++++++++++++++++
 .../recipes-support/unbound/unbound_1.24.2.bb |   1 +
 2 files changed, 297 insertions(+)
 create mode 100644 meta-networking/recipes-support/unbound/unbound/CVE-2026-33278.patch
meta-networking/recipes-support/unbound/unbound/CVE-2026-33278.patch new file +296 -0
new file mode 100644
index 0000000000..b42b613546
@@ -0,0 +1,296 @@
+From f7633e132f79548d71c02ed66d55a82c23ea0a82 Mon Sep 17 00:00:00 2001
+From: "W.C.A. Wijngaards" <[email protected]>
+Date: Wed, 20 May 2026 10:13:08 +0200
+Subject: [PATCH] - Fix CVE-2026-33278, Possible remote code execution during
+ DNSSEC   validation. Thanks to Qifan Zhang, Palo Alto Networks, for the
+ report.
+
+(cherry picked from commit 6a31e470f80a6e5c559ebe7fd4cfc0582d3b6d0a)
+
+CVE: CVE-2026-33278
+Upstream-Status: Backport [https://github.com/NLnetLabs/unbound/commit/6a31e470f80a6e5c559ebe7fd4cfc0582d3b6d0a]
+
+Dropped changes to the Changelog file.
+
+Signed-off-by: Ankur Tyagi <[email protected]>
+---
+ services/cache/dns.c                |  8 +++-
+ testdata/val_nsec3_iter_high.rpl    | 18 ++++----
+ testdata/val_nx_nsec3_collision.rpl | 31 +++++--------
+ testdata/val_nx_nsec3_params.rpl    | 22 +++++----
+ validator/val_nsec3.c               | 71 +++++++++++++++++++++++++++++
+ 5 files changed, 111 insertions(+), 39 deletions(-)
+
+diff --git a/services/cache/dns.c b/services/cache/dns.c
+index 351b3568c..8dae2ffcc 100644
+--- a/services/cache/dns.c
++++ b/services/cache/dns.c
+@@ -675,10 +675,16 @@ struct dns_msg*
+ dns_msg_deepcopy_region(struct dns_msg* origin, struct regional* region)
+ {
+ 	size_t i;
++	struct ub_packed_rrset_key** saved_rrsets;
+ 	struct dns_msg* res = NULL;
++	size_t rep_alloc_size = sizeof(struct reply_info)
++		- sizeof(struct rrset_ref);  /* this is the size of res->rep
++						allocated in gen_dns_msg() */
+ 	res = gen_dns_msg(region, &origin->qinfo, origin->rep->rrset_count);
+ 	if(!res) return NULL;
+-	*res->rep = *origin->rep;
++	saved_rrsets = res->rep->rrsets; /* save rrsets alloc by gen_dns_msg */
++	memcpy(res->rep, origin->rep, rep_alloc_size);
++	res->rep->rrsets = saved_rrsets;
+ 	if(origin->rep->reason_bogus_str) {
+ 		res->rep->reason_bogus_str = regional_strdup(region,
+ 			origin->rep->reason_bogus_str);
+diff --git a/testdata/val_nsec3_iter_high.rpl b/testdata/val_nsec3_iter_high.rpl
+index 2b78f0b7f..703092d89 100644
+--- a/testdata/val_nsec3_iter_high.rpl
++++ b/testdata/val_nsec3_iter_high.rpl
+@@ -120,12 +120,12 @@ example.com.	IN SOA	ns.example.com. hostmaster.example.com. 2007090400 28800 720
+ example.com.    3600    IN      RRSIG   SOA 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFCNGZ+/OfElYQMCZ77O9Lw9rhk7PAhUAmDcvTAst6Bq83qPq3r6c/Dm1nFc= ;{id = 2854}
+ 
+ ; closest encloser, H(example.com).
+-6md8numosa4q9ugkffdo1bmm82t5j39s.example.com. NSEC3 1 1 8 - 6md8numosa4q9ugkffdo1bmm82t5j49s SOA NS MX DNSKEY RRSIG
+-6md8numosa4q9ugkffdo1bmm82t5j39s.example.com.   3600    IN      RRSIG   NSEC3 3 3 3600 20070926135752 20070829135752 2854 example.com. MC0CFQCz/LkFOFcaQzVnyySW9ZoVUnxh7gIUdxyS9vqVDzo8pGhFU+3YogN2ZRk= ;{id = 2854}
++b6fuorg741ufili49mg9j4328ig53sqg.example.com. NSEC3 1 1 123 aabb00123456bbccdd b6fuorg741ufili49mg9j4328ig53sqh SOA NS MX DNSKEY RRSIG
++b6fuorg741ufili49mg9j4328ig53sqg.example.com.	3600	IN	RRSIG	NSEC3 3 3 3600 20070926135752 20070829135752 2854 example.com. AJlV5car66lq5f0ASx7W47A/OADkARAXzKt9ZLojXze+FWK9JjAX+eA=
+ 
+-; wildcard denial, H(*.example.com.) = 4f3cnt8cu22tngec382jj4gde4rb47ub
+-4f3cnt8cu22tngec382jj4gde4rb46ub.example.com. NSEC3 1 1 0 - 4f3cnt8cu22tngec382jj4gde4rb48ub A MX RRSIG
+-4f3cnt8cu22tngec382jj4gde4rb46ub.example.com.   3600    IN      RRSIG   NSEC3 3 3 3600 20070926135752 20070829135752 2854 example.com. MCwCFHS+i/OB/V/gYmS1eQTXieXIXGjsAhQQ0Ql7TW/hsUklrb0DfoyhVPG95Q== ;{id = 2854}
++; wildcard denial, H(*.example.com.) = k1a2vr9c269jummpru5d68qllbfmtdcb.
++k1a2vr9c269jummpru5d68qllbfmtacb.example.com. NSEC3 1 1 123 aabb00123456bbccdd k1a2vr9c269jummpru5d68qllbfmtgcb A MX RRSIG
++k1a2vr9c269jummpru5d68qllbfmtacb.example.com.	3600	IN	RRSIG	NSEC3 3 3 3600 20070926135752 20070829135752 2854 example.com. AARB9z4C1WZUI3WP3QAR7RJXFnN0qEBkEt8ocudxXzms4/7/2l6NNWc=
+ 
+ ; next closer name, H(www.example.com.) = s1unhcti19bkdr98fegs0v46mbu3t4m3.
+ s1unhcti19bkdr98fegs0v46mbu3t4m2.example.com. NSEC3 1 1 123 aabb00123456bbccdd s1unhcti19bkdr98fegs0v46mbu3t4m4 A MX RRSIG
+@@ -152,10 +152,10 @@ SECTION ANSWER
+ SECTION AUTHORITY
+ example.com.	IN SOA	ns.example.com. hostmaster.example.com. 2007090400 28800 7200 604800 18000
+ example.com.    3600    IN      RRSIG   SOA 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFCNGZ+/OfElYQMCZ77O9Lw9rhk7PAhUAmDcvTAst6Bq83qPq3r6c/Dm1nFc= ;{id = 2854}
+-6md8numosa4q9ugkffdo1bmm82t5j39s.example.com. NSEC3 1 1 8 - 6md8numosa4q9ugkffdo1bmm82t5j49s SOA NS MX DNSKEY RRSIG
+-6md8numosa4q9ugkffdo1bmm82t5j39s.example.com.   3600    IN      RRSIG   NSEC3 3 3 3600 20070926135752 20070829135752 2854 example.com. MC0CFQCz/LkFOFcaQzVnyySW9ZoVUnxh7gIUdxyS9vqVDzo8pGhFU+3YogN2ZRk= ;{id = 2854}
+-4f3cnt8cu22tngec382jj4gde4rb46ub.example.com. NSEC3 1 1 0 - 4f3cnt8cu22tngec382jj4gde4rb48ub A MX RRSIG
+-4f3cnt8cu22tngec382jj4gde4rb46ub.example.com.   3600    IN      RRSIG   NSEC3 3 3 3600 20070926135752 20070829135752 2854 example.com. MCwCFHS+i/OB/V/gYmS1eQTXieXIXGjsAhQQ0Ql7TW/hsUklrb0DfoyhVPG95Q== ;{id = 2854}
++b6fuorg741ufili49mg9j4328ig53sqg.example.com. NSEC3 1 1 123 aabb00123456bbccdd b6fuorg741ufili49mg9j4328ig53sqh SOA NS MX DNSKEY RRSIG
++b6fuorg741ufili49mg9j4328ig53sqg.example.com.	3600	IN	RRSIG	NSEC3 3 3 3600 20070926135752 20070829135752 2854 example.com. AJlV5car66lq5f0ASx7W47A/OADkARAXzKt9ZLojXze+FWK9JjAX+eA=
++k1a2vr9c269jummpru5d68qllbfmtacb.example.com. NSEC3 1 1 123 aabb00123456bbccdd k1a2vr9c269jummpru5d68qllbfmtgcb A MX RRSIG
++k1a2vr9c269jummpru5d68qllbfmtacb.example.com.	3600	IN	RRSIG	NSEC3 3 3 3600 20070926135752 20070829135752 2854 example.com. AARB9z4C1WZUI3WP3QAR7RJXFnN0qEBkEt8ocudxXzms4/7/2l6NNWc=
+ s1unhcti19bkdr98fegs0v46mbu3t4m2.example.com. NSEC3 1 1 123 aabb00123456bbccdd s1unhcti19bkdr98fegs0v46mbu3t4m4 A MX RRSIG
+ s1unhcti19bkdr98fegs0v46mbu3t4m2.example.com.   3600    IN      RRSIG   NSEC3 3 3 3600 20070926135752 20070829135752 2854 example.com. MC0CFFSH4klZKke48dYyddYDj17gjTS0AhUAltWicpFLWqW98/Af9Qlx70MH8o4= ;{id = 2854}
+ 
+diff --git a/testdata/val_nx_nsec3_collision.rpl b/testdata/val_nx_nsec3_collision.rpl
+index 87a55f565..1b1f49e80 100644
+--- a/testdata/val_nx_nsec3_collision.rpl
++++ b/testdata/val_nx_nsec3_collision.rpl
+@@ -89,6 +89,17 @@ ns.example.com.         IN      A       1.2.3.4
+ ns.example.com. 3600    IN      RRSIG   A 3 3 3600 20070926135752 20070829135752 2854 example.com. MC0CFQCMSWxVehgOQLoYclB9PIAbNP229AIUeH0vNNGJhjnZiqgIOKvs1EhzqAo= ;{id = 2854}
+ ENTRY_END
+ 
++ENTRY_BEGIN
++MATCH opcode qtype qname
++ADJUST copy_id
++REPLY QR AA NOERROR
++SECTION QUESTION
++ns.example.com. IN AAAA
++SECTION AUTHORITY
++example.com.	IN SOA	ns.example.com. hostmaster.example.com. 2007090400 28800 7200 604800 18000
++example.com.    3600    IN      RRSIG   SOA 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFCNGZ+/OfElYQMCZ77O9Lw9rhk7PAhUAmDcvTAst6Bq83qPq3r6c/Dm1nFc= ;{id = 2854}
++ENTRY_END
++
+ ; response to DNSKEY priming query
+ ENTRY_BEGIN
+ MATCH opcode qtype qname
+@@ -163,29 +174,11 @@ STEP 2 TIME_PASSES ELAPSE 0.05
+ STEP 10 CHECK_ANSWER
+ ENTRY_BEGIN
+ MATCH all
+-REPLY QR RD RA DO NXDOMAIN
++REPLY QR RD RA DO SERVFAIL
+ SECTION QUESTION
+ www.example.com. IN A
+ SECTION ANSWER
+ SECTION AUTHORITY
+-example.com.	IN SOA	ns.example.com. hostmaster.example.com. 2007090400 28800 7200 604800 18000
+-example.com.    3600    IN      RRSIG   SOA 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFCNGZ+/OfElYQMCZ77O9Lw9rhk7PAhUAmDcvTAst6Bq83qPq3r6c/Dm1nFc= ;{id = 2854}
+-6md8numosa4q9ugkffdo1bmm82t5j39s.example.com. NSEC3  1 1 123 aabb00123456bbccdd 6md8numosa4q9ugkffdo1bmm82t5j49s A RRSIG
+-6md8numosa4q9ugkffdo1bmm82t5j39s.example.com. NSEC3 1 1 8 - 6md8numosa4q9ugkffdo1bmm82t5j49s SOA NS MX DNSKEY RRSIG
+-6md8numosa4q9ugkffdo1bmm82t5j39s.example.com.   3600    IN      RRSIG   NSEC3 3 3 3600 20070926135752 20070829135752 2854 example.com. MCwCFHndWrEEbuzezs/4lxeiMgEuUsUbAhR72gJgd/Zmhf80yoxCauw9k5OkCw== ;{id = 2854}
+-4f3cnt8cu22tngec382jj4gde4rb46ub.example.com. NSEC3 1 1 18 - 4f3cnt8cu22tngec382jj4gde4rb87ub A RRSIG
+-4f3cnt8cu22tngec382jj4gde4rb46ub.example.com. NSEC3 1 1 0 - 4f3cnt8cu22tngec382jj4gde4rb48ub A MX RRSIG
+-4f3cnt8cu22tngec382jj4gde4rb46ub.example.com. NSEC3 1 1 19 - 4f3cnt8cu22tngec382jj4gde4rb87ub A RRSIG
+-4f3cnt8cu22tngec382jj4gde4rb46ub.example.com.   3600    IN      RRSIG   NSEC3 3 3 3600 20070926135752 20070829135752 2854 example.com. MCwCFDRwji51WCXJg7W/3+Jx586af5qgAhQPxHegtzu1I/QbvCNrOOON05N1rw== ;{id = 2854}
+-s1unhcti19bkdr98fegs0v46mbu3t4m2.example.com. NSEC3 1 1 18 -  s1unhcti19bkdr98fegs0v46mbu3t4m4 A RRSIG
+-s1unhcti19bkdr98fegs0v46mbu3t4m2.example.com. NSEC3 1 1 19 -  s1unhcti19bkdr98fegs0v46mbu3t4m4 A RRSIG
+-s1unhcti19bkdr98fegs0v46mbu3t4m2.example.com. NSEC3 1 1 20 00  s1unhcti19bkdr98fegs0v46mbu3t4m4 A RRSIG
+-s1unhcti19bkdr98fegs0v46mbu3t4m2.example.com. NSEC3 1 1 123 aabb00123456bbccdd s1unhcti19bkdr98fegs0v46mbu3t4m4 A MX RRSIG
+-s1unhcti19bkdr98fegs0v46mbu3t4m2.example.com. NSEC3 1 1 20 01  s1unhcti19bkdr98fegs0v46mbu3t4m4 A RRSIG
+-s1unhcti19bkdr98fegs0v46mbu3t4m2.example.com. NSEC3 1 1 20 02  s1unhcti19bkdr98fegs0v46mbu3t4m4 A RRSIG
+-s1unhcti19bkdr98fegs0v46mbu3t4m2.example.com. NSEC3 1 1 20 03  s1unhcti19bkdr98fegs0v46mbu3t4m4 A RRSIG
+-s1unhcti19bkdr98fegs0v46mbu3t4m2.example.com.   3600    IN      RRSIG   NSEC3 3 3 3600 20070926135752 20070829135752 2854 example.com. MCwCFDLy4GbR8ZaKHATVJGnGxzpsuq60AhQ1/pRbXi1ZbcYohzHgWzNC50fC5A== ;{id = 2854}
+-
+ SECTION ADDITIONAL
+ ENTRY_END
+ 
+diff --git a/testdata/val_nx_nsec3_params.rpl b/testdata/val_nx_nsec3_params.rpl
+index dd3ab6b57..59bef2be3 100644
+--- a/testdata/val_nx_nsec3_params.rpl
++++ b/testdata/val_nx_nsec3_params.rpl
+@@ -88,6 +88,17 @@ ns.example.com.         IN      A       1.2.3.4
+ ns.example.com. 3600    IN      RRSIG   A 3 3 3600 20070926135752 20070829135752 2854 example.com. MC0CFQCMSWxVehgOQLoYclB9PIAbNP229AIUeH0vNNGJhjnZiqgIOKvs1EhzqAo= ;{id = 2854}
+ ENTRY_END
+ 
++ENTRY_BEGIN
++MATCH opcode qtype qname
++ADJUST copy_id
++REPLY QR AA NOERROR
++SECTION QUESTION
++ns.example.com. IN AAAA
++SECTION AUTHORITY
++example.com.	IN SOA	ns.example.com. hostmaster.example.com. 2007090400 28800 7200 604800 18000
++example.com.    3600    IN      RRSIG   SOA 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFCNGZ+/OfElYQMCZ77O9Lw9rhk7PAhUAmDcvTAst6Bq83qPq3r6c/Dm1nFc= ;{id = 2854}
++ENTRY_END
++
+ ; response to DNSKEY priming query
+ ENTRY_BEGIN
+ MATCH opcode qtype qname
+@@ -144,20 +155,11 @@ ENTRY_END
+ STEP 10 CHECK_ANSWER
+ ENTRY_BEGIN
+ MATCH all
+-REPLY QR RD RA DO NXDOMAIN
++REPLY QR RD RA DO SERVFAIL
+ SECTION QUESTION
+ www.example.com. IN A
+ SECTION ANSWER
+ SECTION AUTHORITY
+-example.com.	IN SOA	ns.example.com. hostmaster.example.com. 2007090400 28800 7200 604800 18000
+-example.com.    3600    IN      RRSIG   SOA 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFCNGZ+/OfElYQMCZ77O9Lw9rhk7PAhUAmDcvTAst6Bq83qPq3r6c/Dm1nFc= ;{id = 2854}
+-6md8numosa4q9ugkffdo1bmm82t5j39s.example.com. NSEC3 1 1 8 - 6md8numosa4q9ugkffdo1bmm82t5j49s SOA NS MX DNSKEY RRSIG
+-6md8numosa4q9ugkffdo1bmm82t5j39s.example.com.   3600    IN      RRSIG   NSEC3 3 3 3600 20070926135752 20070829135752 2854 example.com. MC0CFQCz/LkFOFcaQzVnyySW9ZoVUnxh7gIUdxyS9vqVDzo8pGhFU+3YogN2ZRk= ;{id = 2854}
+-4f3cnt8cu22tngec382jj4gde4rb46ub.example.com. NSEC3 1 1 0 - 4f3cnt8cu22tngec382jj4gde4rb48ub A MX RRSIG
+-4f3cnt8cu22tngec382jj4gde4rb46ub.example.com.   3600    IN      RRSIG   NSEC3 3 3 3600 20070926135752 20070829135752 2854 example.com. MCwCFHS+i/OB/V/gYmS1eQTXieXIXGjsAhQQ0Ql7TW/hsUklrb0DfoyhVPG95Q== ;{id = 2854}
+-s1unhcti19bkdr98fegs0v46mbu3t4m2.example.com. NSEC3 1 1 123 aabb00123456bbccdd s1unhcti19bkdr98fegs0v46mbu3t4m4 A MX RRSIG
+-s1unhcti19bkdr98fegs0v46mbu3t4m2.example.com.   3600    IN      RRSIG   NSEC3 3 3 3600 20070926135752 20070829135752 2854 example.com. MC0CFFSH4klZKke48dYyddYDj17gjTS0AhUAltWicpFLWqW98/Af9Qlx70MH8o4= ;{id = 2854}
+-
+ SECTION ADDITIONAL
+ ENTRY_END
+ 
+diff --git a/validator/val_nsec3.c b/validator/val_nsec3.c
+index 998fcc4e3..92d853825 100644
+--- a/validator/val_nsec3.c
++++ b/validator/val_nsec3.c
+@@ -456,6 +456,67 @@ filter_init(struct nsec3_filter* filter, struct ub_packed_rrset_key** list,
+ 	}
+ }
+ 
++/** Check if the NSEC3s have the same parameter set. */
++static int
++param_set_same(struct nsec3_filter* flt, char** reason)
++{
++	size_t rrsetnum;
++	int rrnum;
++	struct ub_packed_rrset_key* rrset;
++	int have_params = 0;
++	int first_algo = 0;
++	size_t first_iter = 0;
++	uint8_t* first_salt = NULL;
++	size_t first_saltlen = 0;
++
++	/* If the NSEC3 parameter sets have distinct values, then they are
++	 * from different NSEC3 chains, and we do not want that. */
++	for(rrset=filter_first(flt, &rrsetnum, &rrnum); rrset;
++		rrset=filter_next(flt, &rrsetnum, &rrnum)) {
++		if(!have_params) {
++			first_algo = nsec3_get_algo(rrset, rrnum);
++			first_iter = nsec3_get_iter(rrset, rrnum);
++			if(!nsec3_get_salt(rrset, rrnum, &first_salt,
++				&first_saltlen)) {
++				verbose(VERB_ALGO, "NSEC3 salt malformed");
++				if(reason)
++					*reason = "NSEC3 salt malformed";
++				return 0;
++			}
++			have_params = 1;
++		} else {
++			uint8_t* salt = NULL;
++			size_t saltlen = 0;
++			if(nsec3_get_algo(rrset, rrnum) != first_algo) {
++				verbose(VERB_ALGO, "NSEC3 algorithm mismatch");
++				if(reason)
++					*reason = "NSEC3 algorithm mismatch";
++				return 0;
++			}
++			if(nsec3_get_iter(rrset, rrnum) != first_iter) {
++				verbose(VERB_ALGO, "NSEC3 iterations mismatch");
++				if(reason)
++					*reason = "NSEC3 iterations mismatch";
++				return 0;
++			}
++			if(!nsec3_get_salt(rrset, rrnum, &salt, &saltlen)) {
++				verbose(VERB_ALGO, "NSEC3 salt malformed");
++				if(reason)
++					*reason = "NSEC3 salt malformed";
++				return 0;
++			}
++			if(saltlen != first_saltlen ||
++				memcmp(salt, first_salt, saltlen) != 0) {
++				verbose(VERB_ALGO, "NSEC3 salt mismatch");
++				if(reason)
++					*reason = "NSEC3 salt mismatch";
++				return 0;
++			}
++		}
++	}
++	return 1;
++}
++
+ /**
+  * Find max iteration count using config settings and key size
+  * @param ve: validator environment with iteration count config settings.
+@@ -1192,6 +1253,8 @@ nsec3_prove_nameerror(struct module_env* env, struct val_env* ve,
+ 	filter_init(&flt, list, num, qinfo); /* init RR iterator */
+ 	if(!flt.zone)
+ 		return sec_status_bogus; /* no RRs */
++	if(!param_set_same(&flt, NULL))
++		return sec_status_bogus; /* nsec3 params from distinct chains*/
+ 	if(nsec3_iteration_count_high(ve, &flt, kkey))
+ 		return sec_status_insecure; /* iteration count too high */
+ 	log_nametypeclass(VERB_ALGO, "start nsec3 nameerror proof, zone", 
+@@ -1378,6 +1441,8 @@ nsec3_prove_nodata(struct module_env* env, struct val_env* ve,
+ 	filter_init(&flt, list, num, qinfo); /* init RR iterator */
+ 	if(!flt.zone)
+ 		return sec_status_bogus; /* no RRs */
++	if(!param_set_same(&flt, NULL))
++		return sec_status_bogus; /* nsec3 params from distinct chains*/
+ 	if(nsec3_iteration_count_high(ve, &flt, kkey))
+ 		return sec_status_insecure; /* iteration count too high */
+ 	return nsec3_do_prove_nodata(env, &flt, ct, qinfo, calc);
+@@ -1401,6 +1466,8 @@ nsec3_prove_wildcard(struct module_env* env, struct val_env* ve,
+ 	filter_init(&flt, list, num, qinfo); /* init RR iterator */
+ 	if(!flt.zone)
+ 		return sec_status_bogus; /* no RRs */
++	if(!param_set_same(&flt, NULL))
++		return sec_status_bogus; /* nsec3 params from distinct chains*/
+ 	if(nsec3_iteration_count_high(ve, &flt, kkey))
+ 		return sec_status_insecure; /* iteration count too high */
+ 
+@@ -1503,6 +1570,8 @@ nsec3_prove_nods(struct module_env* env, struct val_env* ve,
+ 		*reason = "no NSEC3 records";
+ 		return sec_status_bogus; /* no RRs */
+ 	}
++	if(!param_set_same(&flt, reason))
++		return sec_status_bogus; /* nsec3 params from distinct chains*/
+ 	if(nsec3_iteration_count_high(ve, &flt, kkey))
+ 		return sec_status_insecure; /* iteration count too high */
+ 
+@@ -1596,6 +1665,8 @@ nsec3_prove_nxornodata(struct module_env* env, struct val_env* ve,
+ 	filter_init(&flt, list, num, qinfo); /* init RR iterator */
+ 	if(!flt.zone)
+ 		return sec_status_bogus; /* no RRs */
++	if(!param_set_same(&flt, NULL))
++		return sec_status_bogus; /* nsec3 params from distinct chains*/
+ 	if(nsec3_iteration_count_high(ve, &flt, kkey))
+ 		return sec_status_insecure; /* iteration count too high */
+ 
meta-networking/recipes-support/unbound/unbound_1.24.2.bb +1 -0
index e41e2dc065..d703b27506 100644
@@ -11,6 +11,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=5308494bc0590c0cb036afd781d78f06"
 
 SRC_URI = "git://github.com/NLnetLabs/unbound.git;protocol=https;branch=master;tag=release-${PV} \
            file://run-ptest \
+           file://CVE-2026-33278.patch \
            "
 
 SRCREV = "f6269baa605d31859f28770e01a24e3677e5f82c"
#2 lore raw

PATCH 3/32 unbound: patch CVE-2026-42944

In reply to [email protected]

From: Ankur Tyagi <[email protected]>

Backport commit[1] needed to cherry-pick the fix.

Details:
https://nvd.nist.gov/vuln/detail/cve-2026-42944

[1]https://github.com/NLnetLabs/unbound/commit/44659cb3bf4601d2daa19a0d51ac5af54bc698bc

---
 .../unbound/unbound/CVE-2026-42944-1.patch    |  61 +++++
 .../unbound/unbound/CVE-2026-42944-2.patch    | 231 ++++++++++++++++++
 .../recipes-support/unbound/unbound_1.24.2.bb |   2 +
 3 files changed, 294 insertions(+)
 create mode 100644 meta-networking/recipes-support/unbound/unbound/CVE-2026-42944-1.patch
 create mode 100644 meta-networking/recipes-support/unbound/unbound/CVE-2026-42944-2.patch
meta-networking/recipes-support/unbound/unbound/CVE-2026-42944-1.patch new file +61 -0
new file mode 100644
index 0000000000..211a89d31f
@@ -0,0 +1,61 @@
+From 812df79447b34af62636f65342809027bb6d5b58 Mon Sep 17 00:00:00 2001
+From: Yorgos Thessalonikefs <[email protected]>
+Date: Wed, 31 Dec 2025 16:22:15 +0100
+Subject: [PATCH] - Use the same EDE removal logic when encoding errors as when
+ encoding   replies.
+
+(cherry picked from commit 44659cb3bf4601d2daa19a0d51ac5af54bc698bc)
+
+CVE: CVE-2026-42944
+Upstream-Status: Backport [https://github.com/NLnetLabs/unbound/commit/44659cb3bf4601d2daa19a0d51ac5af54bc698bc]
+
+Dropped changes to the Changelog file.
+
+Signed-off-by: Ankur Tyagi <[email protected]>
+---
+ util/data/msgencode.c | 24 ++++++++++++++++--------
+ 1 file changed, 16 insertions(+), 8 deletions(-)
+
+diff --git a/util/data/msgencode.c b/util/data/msgencode.c
+index 84aa3b9e7..4263aa41e 100644
+--- a/util/data/msgencode.c
++++ b/util/data/msgencode.c
+@@ -1115,22 +1115,30 @@ extended_error_encode(sldns_buffer* buf, uint16_t rcode,
+ 		sldns_buffer_write_u16(buf, qinfo->qclass);
+ 	}
+ 	sldns_buffer_flip(buf);
+-	if(edns) {
++	if(edns && edns->edns_present) {
++		uint16_t edns_field_size, ede_size, ede_txt_size;
+ 		struct edns_data es = *edns;
+ 		es.edns_version = EDNS_ADVERTISED_VERSION;
+ 		es.udp_size = EDNS_ADVERTISED_SIZE;
+ 		es.ext_rcode = (uint8_t)(rcode >> 4);
+ 		es.bits &= EDNS_DO;
+-		if(sldns_buffer_limit(buf) + calc_edns_field_size(&es) >
+-			edns->udp_size) {
++		/* EDEs are optional. If space is a concern try in order:
++		 * - removing any EXTRA-TEXT fields from explicit EDEs, or
++		 * - removing all EDEs,
++		 * to see if EDNS can fit. */
++		edns_field_size = calc_edns_field_size(&es);
++		ede_size = calc_ede_option_size(&es, &ede_txt_size);
++		if(edns->udp_size >= sldns_buffer_limit(buf) + edns_field_size)
++			attach_edns_record_max_msg_sz(buf, &es, edns->udp_size);
++		else if(edns->udp_size >= sldns_buffer_limit(buf) + edns_field_size - ede_txt_size) {
++			ede_trim_text(&es.opt_list_inplace_cb_out);
++			ede_trim_text(&es.opt_list_out);
++			attach_edns_record_max_msg_sz(buf, &es, edns->udp_size);
++		} else if(edns->udp_size >= sldns_buffer_limit(buf) + edns_field_size - ede_size) {
+ 			edns_opt_list_remove(&es.opt_list_inplace_cb_out, LDNS_EDNS_EDE);
+ 			edns_opt_list_remove(&es.opt_list_out, LDNS_EDNS_EDE);
+-			if(sldns_buffer_limit(buf) + calc_edns_field_size(&es) >
+-				edns->udp_size) {
+-				return;
+-			}
++			attach_edns_record_max_msg_sz(buf, &es, edns->udp_size);
+ 		}
+-		attach_edns_record(buf, &es);
+ 	}
+ }
+ 
meta-networking/recipes-support/unbound/unbound/CVE-2026-42944-2.patch new file +231 -0

231 lines not on this page · raw message

meta-networking/recipes-support/unbound/unbound_1.24.2.bb +2 -0
index d703b27506..b8853c9d63 100644
@@ -12,6 +12,8 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=5308494bc0590c0cb036afd781d78f06"
 SRC_URI = "git://github.com/NLnetLabs/unbound.git;protocol=https;branch=master;tag=release-${PV} \
            file://run-ptest \
            file://CVE-2026-33278.patch \
+           file://CVE-2026-42944-1.patch \
+           file://CVE-2026-42944-2.patch \
            "
 
 SRCREV = "f6269baa605d31859f28770e01a24e3677e5f82c"
#3 lore raw

PATCH 4/32 unbound: patch CVE-2026-42959

In reply to [email protected]

From: Ankur Tyagi <[email protected]>

Details:
https://nvd.nist.gov/vuln/detail/cve-2026-42959

---
 .../unbound/unbound/CVE-2026-42959.patch      | 36 +++++++++++++++++++
 .../recipes-support/unbound/unbound_1.24.2.bb |  1 +
 2 files changed, 37 insertions(+)
 create mode 100644 meta-networking/recipes-support/unbound/unbound/CVE-2026-42959.patch
meta-networking/recipes-support/unbound/unbound/CVE-2026-42959.patch new file +36 -0
new file mode 100644
index 0000000000..b8df4f66c4
@@ -0,0 +1,36 @@
+From 42e04de6baba41208c80f8003f2dca58ebf66468 Mon Sep 17 00:00:00 2001
+From: "W.C.A. Wijngaards" <[email protected]>
+Date: Wed, 20 May 2026 10:14:32 +0200
+Subject: [PATCH] - Fix CVE-2026-42959, Crash during DNSSEC validation of
+ malicious   content. Thanks to Qifan Zhang, Palo Alto Networks, for the
+ report.
+
+(cherry picked from commit 94d5babaee22a016e376bdcfee2b9bb40360367c)
+
+CVE: CVE-2026-42959
+Upstream-Status: Backport [https://github.com/NLnetLabs/unbound/commit/94d5babaee22a016e376bdcfee2b9bb40360367c]
+
+Dropped changes to the Changelog file.
+
+Signed-off-by: Ankur Tyagi <[email protected]>
+---
+ validator/val_utils.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/validator/val_utils.c b/validator/val_utils.c
+index 549264d76..4495695ac 100644
+--- a/validator/val_utils.c
++++ b/validator/val_utils.c
+@@ -1066,10 +1066,10 @@ val_fill_reply(struct reply_info* chase, struct reply_info* orig,
+ 			if(query_dname_compare(name, 
+ 				orig->rrsets[i]->rk.dname) == 0)
+ 			    chase->rrsets[chase->an_numrrsets
+-				+orig->ns_numrrsets+chase->ar_numrrsets++] 
++				+chase->ns_numrrsets+chase->ar_numrrsets++]
+ 				= orig->rrsets[i];
+ 		} else if(rrset_has_signer(orig->rrsets[i], name, len)) {
+-			chase->rrsets[chase->an_numrrsets+orig->ns_numrrsets+
++			chase->rrsets[chase->an_numrrsets+chase->ns_numrrsets+
+ 				chase->ar_numrrsets++] = orig->rrsets[i];
+ 		}
+ 	}
meta-networking/recipes-support/unbound/unbound_1.24.2.bb +1 -0
index b8853c9d63..3adc98621e 100644
@@ -14,6 +14,7 @@ SRC_URI = "git://github.com/NLnetLabs/unbound.git;protocol=https;branch=master;t
            file://CVE-2026-33278.patch \
            file://CVE-2026-42944-1.patch \
            file://CVE-2026-42944-2.patch \
+           file://CVE-2026-42959.patch \
            "
 
 SRCREV = "f6269baa605d31859f28770e01a24e3677e5f82c"
#4 lore raw

PATCH 5/32 unbound: patch CVE-2026-32792

In reply to [email protected]

From: Ankur Tyagi <[email protected]>

Details:
https://nvd.nist.gov/vuln/detail/cve-2026-32792

---
 .../unbound/unbound/CVE-2026-32792.patch      | 31 +++++++++++++++++++
 .../recipes-support/unbound/unbound_1.24.2.bb |  1 +
 2 files changed, 32 insertions(+)
 create mode 100644 meta-networking/recipes-support/unbound/unbound/CVE-2026-32792.patch
meta-networking/recipes-support/unbound/unbound/CVE-2026-32792.patch new file +31 -0
new file mode 100644
index 0000000000..5b1a248979
@@ -0,0 +1,31 @@
+From 14bb8321708507fe138d3d6e77e51a9b86ea75b8 Mon Sep 17 00:00:00 2001
+From: "W.C.A. Wijngaards" <[email protected]>
+Date: Wed, 20 May 2026 10:15:30 +0200
+Subject: [PATCH] - Fix CVE-2026-32792, Packet of death with DNSCrypt. Thanks
+ to Andrew   Griffiths from 'calif.io' for the report.
+
+(cherry picked from commit a587535c5dd8a5ea8259507152f055be318367df)
+
+CVE: CVE-2026-32792
+Upstream-Status: Backport [https://github.com/NLnetLabs/unbound/commit/a587535c5dd8a5ea8259507152f055be318367df]
+
+Dropped changes to the Changelog file.
+
+Signed-off-by: Ankur Tyagi <[email protected]>
+---
+ dnscrypt/dnscrypt.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/dnscrypt/dnscrypt.c b/dnscrypt/dnscrypt.c
+index 4902447fd..173484cdf 100644
+--- a/dnscrypt/dnscrypt.c
++++ b/dnscrypt/dnscrypt.c
+@@ -361,7 +361,7 @@ dnscrypt_server_uncurve(struct dnsc_env* env,
+ 
+     len -= DNSCRYPT_QUERY_HEADER_SIZE;
+ 
+-    while (*sldns_buffer_at(buffer, --len) == 0)
++    while (len>0 && *sldns_buffer_at(buffer, --len) == 0)
+         ;
+ 
+     if (*sldns_buffer_at(buffer, len) != 0x80) {
meta-networking/recipes-support/unbound/unbound_1.24.2.bb +1 -0
index 3adc98621e..1225cb99c2 100644
@@ -15,6 +15,7 @@ SRC_URI = "git://github.com/NLnetLabs/unbound.git;protocol=https;branch=master;t
            file://CVE-2026-42944-1.patch \
            file://CVE-2026-42944-2.patch \
            file://CVE-2026-42959.patch \
+           file://CVE-2026-32792.patch \
            "
 
 SRCREV = "f6269baa605d31859f28770e01a24e3677e5f82c"
#5 lore raw

PATCH 6/32 unbound: patch CVE-2026-40622

In reply to [email protected]

From: Ankur Tyagi <[email protected]>

Also backport TTL_IS_EXPIRED macro introduced by commit:
https://github.com/NLnetLabs/unbound/commit/73e408f1d0792267429e9f5f89537cda61297952

Details:
https://nvd.nist.gov/vuln/detail/cve-2026-40622

---
 .../unbound/unbound/CVE-2026-40622.patch      | 58 +++++++++++++++++++
 .../recipes-support/unbound/unbound_1.24.2.bb |  1 +
 2 files changed, 59 insertions(+)
 create mode 100644 meta-networking/recipes-support/unbound/unbound/CVE-2026-40622.patch
meta-networking/recipes-support/unbound/unbound/CVE-2026-40622.patch new file +58 -0
new file mode 100644
index 0000000000..1e338b1709
@@ -0,0 +1,58 @@
+From 8711cb40328a6fab85bebb12be0c2948c0752291 Mon Sep 17 00:00:00 2001
+From: "W.C.A. Wijngaards" <[email protected]>
+Date: Wed, 20 May 2026 10:16:18 +0200
+Subject: [PATCH] - Fix CVE-2026-40622, "Ghost domain name" variant. Thanks to
+ Qifan   Zhang, Palo Alto Networks, for the report.
+
+(cherry picked from commit 8d8fa4226613138f5a244a9f1a2506704e049180)
+
+CVE: CVE-2026-40622
+Upstream-Status: Backport [https://github.com/NLnetLabs/unbound/commit/8d8fa4226613138f5a244a9f1a2506704e049180]
+
+Dropped changes to the Changelog file.
+
+Also backport TTL_IS_EXPIRED macro introduced by commit:
+https://github.com/NLnetLabs/unbound/commit/73e408f1d0792267429e9f5f89537cda61297952
+
+Signed-off-by: Ankur Tyagi <[email protected]>
+---
+ services/cache/rrset.c | 10 ++++++++++
+ util/data/msgparse.h   |  4 ++++
+ 2 files changed, 14 insertions(+)
+
+diff --git a/services/cache/rrset.c b/services/cache/rrset.c
+index 6d5c24f80..81f4e2820 100644
+--- a/services/cache/rrset.c
++++ b/services/cache/rrset.c
+@@ -149,6 +149,16 @@ need_to_update_rrset(void* nd, void* cd, time_t timenow, int equal, int ns)
+ 		if(equal && cached->ttl >= timenow && 
+ 			cached->security == sec_status_bogus)
+ 			return 0;
++		/* ghost-domain: never let an NS overwrite extend lifetime
++		 * past the entry it replaces, regardless of trust. */
++		if(ns && !TTL_IS_EXPIRED(cached->ttl, timenow) &&
++			newd->ttl > cached->ttl) {
++			size_t i;
++			newd->ttl = cached->ttl;
++			for(i=0; i<(newd->count+newd->rrsig_count); i++)
++				if(newd->rr_ttl[i] > newd->ttl)
++					newd->rr_ttl[i] = newd->ttl;
++		}
+                 return 1;
+ 	}
+ 	/*	o item in cache has expired */
+diff --git a/util/data/msgparse.h b/util/data/msgparse.h
+index 7de4e394f..9bfe0225d 100644
+--- a/util/data/msgparse.h
++++ b/util/data/msgparse.h
+@@ -98,6 +98,10 @@ extern time_t SERVE_EXPIRED_REPLY_TTL;
+ /** If we serve the original TTL or decrementing TTLs */
+ extern int SERVE_ORIGINAL_TTL;
+ 
++/** Check if TTL is expired. 0 TTL is considered expired.
++ * Used mainly to identify parts of the code that do this comparison. */
++#define TTL_IS_EXPIRED(ttl, now) ((ttl) <= (now))
++
+ /**
+  * Data stored in scratch pad memory during parsing.
+  * Stores the data that will enter into the msgreply and packet result.
meta-networking/recipes-support/unbound/unbound_1.24.2.bb +1 -0
index 1225cb99c2..1c9a7fa489 100644
@@ -16,6 +16,7 @@ SRC_URI = "git://github.com/NLnetLabs/unbound.git;protocol=https;branch=master;t
            file://CVE-2026-42944-2.patch \
            file://CVE-2026-42959.patch \
            file://CVE-2026-32792.patch \
+           file://CVE-2026-40622.patch \
            "
 
 SRCREV = "f6269baa605d31859f28770e01a24e3677e5f82c"
#6 lore raw

PATCH 7/32 unbound: patch CVE-2026-41292

In reply to [email protected]

From: Ankur Tyagi <[email protected]>

Details:
https://nvd.nist.gov/vuln/detail/cve-2026-41292

---
 .../unbound/unbound/CVE-2026-41292.patch      | 83 +++++++++++++++++++
 .../recipes-support/unbound/unbound_1.24.2.bb |  1 +
 2 files changed, 84 insertions(+)
 create mode 100644 meta-networking/recipes-support/unbound/unbound/CVE-2026-41292.patch
meta-networking/recipes-support/unbound/unbound/CVE-2026-41292.patch new file +83 -0
new file mode 100644
index 0000000000..8ca3ec2716
@@ -0,0 +1,83 @@
+From 97caf75e44191118fcb678f95fca15d3ea2a074f Mon Sep 17 00:00:00 2001
+From: "W.C.A. Wijngaards" <[email protected]>
+Date: Wed, 20 May 2026 10:18:23 +0200
+Subject: [PATCH] - Fix CVE-2026-41292, Parsing a long list of incoming EDNS
+ options   degrades performance. Thanks to GitHub user 'N0zoM1z0', also Qifan 
+  Zhang from Palo Alto Networks, for the report.
+
+(cherry picked from commit ef5ca84360934fa1e857ebc371d4b093aea6355d)
+
+CVE: CVE-2026-41292
+Upstream-Status: Backport [https://github.com/NLnetLabs/unbound/commit/ef5ca84360934fa1e857ebc371d4b093aea6355d]
+
+Dropped changes to the Changelog file.
+
+Signed-off-by: Ankur Tyagi <[email protected]>
+---
+ util/data/msgparse.c | 11 ++++++++---
+ 1 file changed, 8 insertions(+), 3 deletions(-)
+
+diff --git a/util/data/msgparse.c b/util/data/msgparse.c
+index 2d0955631..169709b7e 100644
+--- a/util/data/msgparse.c
++++ b/util/data/msgparse.c
+@@ -53,6 +53,8 @@
+ #include "sldns/parseutil.h"
+ #include "sldns/wire2str.h"
+ 
++#define MAX_PARSED_EDNS_OPTIONS 100
++
+ /** smart comparison of (compressed, valid) dnames from packet */
+ static int
+ smart_compare(sldns_buffer* pkt, uint8_t* dnow, 
+@@ -950,7 +952,7 @@ parse_edns_options_from_query(uint8_t* rdata_ptr, size_t rdata_len,
+ 	struct comm_reply* repinfo, uint32_t now, struct regional* region,
+ 	struct cookie_secrets* cookie_secrets)
+ {
+-	int nsid_seen = 0, cookie_seen = 0, padding_seen = 0;
++	int i = 0, nsid_seen = 0, cookie_seen = 0, padding_seen = 0;
+ 	/* To respond with a Keepalive option, the client connection must have
+ 	 * received one message with a TCP Keepalive EDNS option, and that
+ 	 * option must have 0 length data. Subsequent messages sent on that
+@@ -970,7 +972,7 @@ parse_edns_options_from_query(uint8_t* rdata_ptr, size_t rdata_len,
+ 
+ 	/* while still more options, and have code+len to read */
+ 	/* ignores partial content (i.e. rdata len 3) */
+-	while(rdata_len >= 4) {
++	while(rdata_len >= 4 && i < MAX_PARSED_EDNS_OPTIONS) {
+ 		uint16_t opt_code = sldns_read_uint16(rdata_ptr);
+ 		uint16_t opt_len = sldns_read_uint16(rdata_ptr+2);
+ 		uint8_t server_cookie[40];
+@@ -1150,6 +1152,7 @@ parse_edns_options_from_query(uint8_t* rdata_ptr, size_t rdata_len,
+ 		}
+ 		rdata_ptr += opt_len;
+ 		rdata_len -= opt_len;
++		i++;
+ 	}
+ 	return LDNS_RCODE_NOERROR;
+ }
+@@ -1164,6 +1167,7 @@ parse_extract_edns_from_response_msg(struct msg_parse* msg,
+ 	struct rrset_parse* found_prev = 0;
+ 	size_t rdata_len;
+ 	uint8_t* rdata_ptr;
++	int i = 0;
+ 	/* since the class encodes the UDP size, we cannot use hash table to
+ 	 * find the EDNS OPT record. Scan the packet. */
+ 	while(rrset) {
+@@ -1223,7 +1227,7 @@ parse_extract_edns_from_response_msg(struct msg_parse* msg,
+ 
+ 	/* while still more options, and have code+len to read */
+ 	/* ignores partial content (i.e. rdata len 3) */
+-	while(rdata_len >= 4) {
++	while(rdata_len >= 4 && i < MAX_PARSED_EDNS_OPTIONS) {
+ 		uint16_t opt_code = sldns_read_uint16(rdata_ptr);
+ 		uint16_t opt_len = sldns_read_uint16(rdata_ptr+2);
+ 		rdata_ptr += 4;
+@@ -1238,6 +1242,7 @@ parse_extract_edns_from_response_msg(struct msg_parse* msg,
+ 		}
+ 		rdata_ptr += opt_len;
+ 		rdata_len -= opt_len;
++		i++;
+ 	}
+ 	/* ignore rrsigs */
+ 	return LDNS_RCODE_NOERROR;
meta-networking/recipes-support/unbound/unbound_1.24.2.bb +1 -0
index 1c9a7fa489..0688b8a78b 100644
@@ -17,6 +17,7 @@ SRC_URI = "git://github.com/NLnetLabs/unbound.git;protocol=https;branch=master;t
            file://CVE-2026-42959.patch \
            file://CVE-2026-32792.patch \
            file://CVE-2026-40622.patch \
+           file://CVE-2026-41292.patch \
            "
 
 SRCREV = "f6269baa605d31859f28770e01a24e3677e5f82c"
#7 lore raw

PATCH 8/32 unbound: patch CVE-2026-42534

In reply to [email protected]

From: Ankur Tyagi <[email protected]>

Details:
https://nvd.nist.gov/vuln/detail/cve-2026-42534

---
 .../unbound/unbound/CVE-2026-42534.patch      | 70 +++++++++++++++++++
 .../recipes-support/unbound/unbound_1.24.2.bb |  1 +
 2 files changed, 71 insertions(+)
 create mode 100644 meta-networking/recipes-support/unbound/unbound/CVE-2026-42534.patch
meta-networking/recipes-support/unbound/unbound/CVE-2026-42534.patch new file +70 -0
new file mode 100644
index 0000000000..aed793ec5c
@@ -0,0 +1,70 @@
+From 0d649a36fd3c47f1b75ca90ce10e52cb4ae3d253 Mon Sep 17 00:00:00 2001
+From: "W.C.A. Wijngaards" <[email protected]>
+Date: Wed, 20 May 2026 10:19:08 +0200
+Subject: [PATCH] - Fix CVE-2026-42534, Jostle logic bypass degrades resolution
+   performance. Thanks to Qifan Zhang, Palo Alto Networks, for the   report.
+
+(cherry picked from commit a794c87578c963606a6fb00a54c46fcf935f519a)
+
+CVE: CVE-2026-42534
+Upstream-Status: Backport [https://github.com/NLnetLabs/unbound/commit/a794c87578c963606a6fb00a54c46fcf935f519a]
+
+Dropped changes to the Changelog file.
+
+Signed-off-by: Ankur Tyagi <[email protected]>
+---
+ services/mesh.c | 14 ++++++++++----
+ services/mesh.h |  6 ++++++
+ 2 files changed, 16 insertions(+), 4 deletions(-)
+
+diff --git a/services/mesh.c b/services/mesh.c
+index 3212a6abf..23499dcef 100644
+--- a/services/mesh.c
++++ b/services/mesh.c
+@@ -296,12 +296,14 @@ int mesh_make_new_space(struct mesh_area* mesh, sldns_buffer* qbuf)
+ 	if(mesh->num_reply_states < mesh->max_reply_states)
+ 		return 1;
+ 	/* try to kick out a jostle-list item */
+-	if(m && m->reply_list && m->list_select == mesh_jostle_list) {
++	if(m && m->list_select == mesh_jostle_list) {
+ 		/* how old is it? */
+ 		struct timeval age;
+-		timeval_subtract(&age, mesh->env->now_tv,
+-			&m->reply_list->start_time);
+-		if(timeval_smaller(&mesh->jostle_max, &age)) {
++		if(m->has_first_reply_time)
++			timeval_subtract(&age, mesh->env->now_tv,
++				&m->first_reply_time);
++		if(!m->has_first_reply_time ||
++			timeval_smaller(&mesh->jostle_max, &age)) {
+ 			/* its a goner */
+ 			log_nametypeclass(VERB_ALGO, "query jostled out to "
+ 				"make space for a new one",
+@@ -1960,6 +1962,10 @@ int mesh_state_add_reply(struct mesh_state* s, struct edns_data* edns,
+ 	r->qid = qid;
+ 	r->qflags = qflags;
+ 	r->start_time = *s->s.env->now_tv;
++	if(s->reply_list == NULL && !s->has_first_reply_time) {
++		s->first_reply_time = r->start_time;
++		s->has_first_reply_time = 1;
++	}
+ 	r->next = s->reply_list;
+ 	r->qname = regional_alloc_init(s->s.region, qinfo->qname,
+ 		s->s.qinfo.qname_len);
+diff --git a/services/mesh.h b/services/mesh.h
+index f19f423a8..a61f90993 100644
+--- a/services/mesh.h
++++ b/services/mesh.h
+@@ -189,6 +189,12 @@ struct mesh_state {
+ 	struct module_qstate s;
+ 	/** the list of replies to clients for the results */
+ 	struct mesh_reply* reply_list;
++	/** if it has a first reply time */
++	int has_first_reply_time;
++	/** wall-clock time the first client reply was attached;
++	 *  used by mesh_make_new_space() so duplicate retransmits
++	 *  cannot reset jostle aging. */
++	struct timeval first_reply_time;
+ 	/** the list of callbacks for the results */
+ 	struct mesh_cb* cb_list;
+ 	/** set of superstates (that want this state's result) 
meta-networking/recipes-support/unbound/unbound_1.24.2.bb +1 -0
index 0688b8a78b..a70ae4c9a3 100644
@@ -18,6 +18,7 @@ SRC_URI = "git://github.com/NLnetLabs/unbound.git;protocol=https;branch=master;t
            file://CVE-2026-32792.patch \
            file://CVE-2026-40622.patch \
            file://CVE-2026-41292.patch \
+           file://CVE-2026-42534.patch \
            "
 
 SRCREV = "f6269baa605d31859f28770e01a24e3677e5f82c"
#8 lore raw

PATCH 9/32 unbound: patch CVE-2026-42923

In reply to [email protected]

From: Ankur Tyagi <[email protected]>

Details:
https://nvd.nist.gov/vuln/detail/cve-2026-42923

---
 .../unbound/unbound/CVE-2026-42923.patch      | 114 ++++++++++++++++++
 .../recipes-support/unbound/unbound_1.24.2.bb |   1 +
 2 files changed, 115 insertions(+)
 create mode 100644 meta-networking/recipes-support/unbound/unbound/CVE-2026-42923.patch
meta-networking/recipes-support/unbound/unbound/CVE-2026-42923.patch new file +114 -0
new file mode 100644
index 0000000000..da46770183
@@ -0,0 +1,114 @@
+From 7a2457c979cdc1f0c1bb1fe68010fdd2f46398f2 Mon Sep 17 00:00:00 2001
+From: "W.C.A. Wijngaards" <[email protected]>
+Date: Wed, 20 May 2026 10:20:02 +0200
+Subject: [PATCH] - Fix CVE-2026-42923, Degradation of service with unbounded
+ NSEC3   hash calculations. Thanks to Qifan Zhang, Palo Alto Networks, for  
+ the report.
+
+(cherry picked from commit c343fff3a4de922835fec7232b90faed658b5371)
+
+CVE: CVE-2026-42923
+Upstream-Status: Backport [https://github.com/NLnetLabs/unbound/commit/c343fff3a4de922835fec7232b90faed658b5371]
+
+Dropped changes to the Changelog file.
+
+Signed-off-by: Ankur Tyagi <[email protected]>
+---
+ validator/val_neg.c   | 28 +++++++++++++++++++++++++++-
+ validator/val_nsec3.c |  5 -----
+ validator/val_nsec3.h |  6 ++++++
+ 3 files changed, 33 insertions(+), 6 deletions(-)
+
+diff --git a/validator/val_neg.c b/validator/val_neg.c
+index bc3a83aeb..0f2751121 100644
+--- a/validator/val_neg.c
++++ b/validator/val_neg.c
+@@ -62,6 +62,13 @@
+ #include "sldns/rrdef.h"
+ #include "sldns/sbuffer.h"
+ 
++/**
++ * The maximum salt length that the negative cache is willing to use.
++ * Larger salt increases the computation time, while recommendations are
++ * for zero salt length for zones.
++ */
++#define MAX_SALT_LENGTH 64
++
+ int val_neg_data_compare(const void* a, const void* b)
+ {
+ 	struct val_neg_data* x = (struct val_neg_data*)a;
+@@ -826,7 +833,11 @@ void neg_insert_data(struct val_neg_cache* neg,
+ 			(slen != 0 && zone->nsec3_salt && s
+ 			  && memcmp(zone->nsec3_salt, s, slen) != 0))) {
+ 
+-			if(slen > 0) {
++			if(slen > MAX_SALT_LENGTH) {
++				/* RFC 9276 s3.1: operators SHOULD NOT use a salt; large
++				 * salts inflate per-hash block count. Decline to cache. */
++				return;
++			} else if(slen > 0) {
+ 				uint8_t* sa = memdup(s, slen);
+ 				if(sa) {
+ 					free(zone->nsec3_salt);
+@@ -1169,6 +1180,15 @@ neg_find_nsec3_ce(struct val_neg_zone* zone, uint8_t* qname, size_t qname_len,
+ 	uint8_t hashce[NSEC3_SHA_LEN];
+ 	uint8_t b32[257];
+ 	size_t celen, b32len;
++	int hashmax = MAX_NSEC3_CALCULATIONS;
++	if(qlabs > hashmax) {
++		/* strip leading labels so the walk costs at most
++		 * MAX_NSEC3_CALCULATIONS hashes, mirroring val_nsec3.c */
++		while(qlabs > hashmax) {
++			dname_remove_label(&qname, &qname_len);
++			qlabs--;
++		}
++	}
+ 
+ 	*nclen = 0;
+ 	while(qlabs > 0) {
+@@ -1269,6 +1289,12 @@ neg_nsec3_proof_ds(struct val_neg_zone* zone, uint8_t* qname, size_t qname_len,
+ 	if(!zone->nsec3_hash) 
+ 		return NULL; /* not nsec3 zone */
+ 
++	if(!topname && qlabs > zone->labs + 1)
++		return NULL; /* iterator caller; opt-out proof would be discarded
++			     * at the !topname check below anyway.
++			     * The qlabs check allows the exact-match for
++			     * the one-label-below-zone case. */
++
+ 	if(!(data=neg_find_nsec3_ce(zone, qname, qname_len, qlabs, buf,
+ 		hashnc, &nclen))) {
+ 		return NULL;
+diff --git a/validator/val_nsec3.c b/validator/val_nsec3.c
+index 92d853825..62effde20 100644
+--- a/validator/val_nsec3.c
++++ b/validator/val_nsec3.c
+@@ -59,11 +59,6 @@
+ #include "sldns/sbuffer.h"
+ #include "util/config_file.h"
+ 
+-/**
+- * Max number of NSEC3 calculations at once, suspend query for later.
+- * 8 is low enough and allows for cases where multiple proofs are needed.
+- */
+-#define MAX_NSEC3_CALCULATIONS 8
+ /**
+  * When all allowed NSEC3 calculations at once resulted in error treat as
+  * bogus. NSEC3 hash errors are not cached and this helps breaks loops with
+diff --git a/validator/val_nsec3.h b/validator/val_nsec3.h
+index f668a270f..a13e92991 100644
+--- a/validator/val_nsec3.h
++++ b/validator/val_nsec3.h
+@@ -98,6 +98,12 @@ struct sldns_buffer;
+ /** The SHA1 hash algorithm for NSEC3 */
+ #define NSEC3_HASH_SHA1	0x01
+ 
++/**
++ * Max number of NSEC3 calculations at once, suspend query for later.
++ * 8 is low enough and allows for cases where multiple proofs are needed.
++ */
++#define MAX_NSEC3_CALCULATIONS 8
++
+ /**
+ * Cache table for NSEC3 hashes.
+ * It keeps a *pointer* to the region its items are allocated.
meta-networking/recipes-support/unbound/unbound_1.24.2.bb +1 -0
index a70ae4c9a3..7ed5769c69 100644
@@ -19,6 +19,7 @@ SRC_URI = "git://github.com/NLnetLabs/unbound.git;protocol=https;branch=master;t
            file://CVE-2026-40622.patch \
            file://CVE-2026-41292.patch \
            file://CVE-2026-42534.patch \
+           file://CVE-2026-42923.patch \
            "
 
 SRCREV = "f6269baa605d31859f28770e01a24e3677e5f82c"
#9 lore raw

PATCH 10/32 unbound: patch CVE-2026-42960

In reply to [email protected]

From: Ankur Tyagi <[email protected]>

Details:
https://nvd.nist.gov/vuln/detail/cve-2026-42960

---
 .../unbound/unbound/CVE-2026-42960.patch      | 38 +++++++++++++++++++
 .../recipes-support/unbound/unbound_1.24.2.bb |  1 +
 2 files changed, 39 insertions(+)
 create mode 100644 meta-networking/recipes-support/unbound/unbound/CVE-2026-42960.patch
meta-networking/recipes-support/unbound/unbound/CVE-2026-42960.patch new file +38 -0
new file mode 100644
index 0000000000..13f99d4803
@@ -0,0 +1,38 @@
+From 7bd2ccb4a490b95ee9e8297ebbcb8fec91d11859 Mon Sep 17 00:00:00 2001
+From: "W.C.A. Wijngaards" <[email protected]>
+Date: Wed, 20 May 2026 10:20:45 +0200
+Subject: [PATCH] - Fix CVE-2026-42960, Possible cache poisoning attack while
+ following   delegation. Thanks to TaoFei Guo from Peking University, Yang Luo
+   and JianJun Chen, Tsinghua University, for the report.
+
+(cherry picked from commit 8ae4b4545dccaaabd30b597b0dcb0d9640c8cc39)
+
+CVE: CVE-2026-42960
+Upstream-Status: Backport [https://github.com/NLnetLabs/unbound/commit/8ae4b4545dccaaabd30b597b0dcb0d9640c8cc39]
+
+Dropped changes to the Changelog file.
+
+Signed-off-by: Ankur Tyagi <[email protected]>
+---
+ iterator/iter_scrub.c | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/iterator/iter_scrub.c b/iterator/iter_scrub.c
+index 8507a3fb6..852705db3 100644
+--- a/iterator/iter_scrub.c
++++ b/iterator/iter_scrub.c
+@@ -725,7 +725,13 @@ scrub_normalize(sldns_buffer* pkt, struct msg_parse* msg,
+ 			rrset->rrset_all_next = NULL;
+ 			return 1;
+ 		}
+-		mark_additional_rrset(pkt, msg, rrset);
++		/* Only mark glue as allowed for type NS in the authority
++		 * section. Other RR types do not get glue for them, it
++		 * is allowed from the answer section, but not authority
++		 * so that a message can not have address records cached
++		 * as a side effect to the query. */
++		if(rrset->type==LDNS_RR_TYPE_NS)
++			mark_additional_rrset(pkt, msg, rrset);
+ 		prev = rrset;
+ 		rrset = rrset->rrset_all_next;
+ 	}
meta-networking/recipes-support/unbound/unbound_1.24.2.bb +1 -0
index 7ed5769c69..a6f9b14cab 100644
@@ -20,6 +20,7 @@ SRC_URI = "git://github.com/NLnetLabs/unbound.git;protocol=https;branch=master;t
            file://CVE-2026-41292.patch \
            file://CVE-2026-42534.patch \
            file://CVE-2026-42923.patch \
+           file://CVE-2026-42960.patch \
            "
 
 SRCREV = "f6269baa605d31859f28770e01a24e3677e5f82c"
#10 lore raw

PATCH 11/32 unbound: patch CVE-2026-44390

In reply to [email protected]

From: Ankur Tyagi <[email protected]>

Details:
https://nvd.nist.gov/vuln/detail/cve-2026-44390

---
 .../unbound/unbound/CVE-2026-44390.patch      | 37 +++++++++++++++++++
 .../recipes-support/unbound/unbound_1.24.2.bb |  1 +
 2 files changed, 38 insertions(+)
 create mode 100644 meta-networking/recipes-support/unbound/unbound/CVE-2026-44390.patch
meta-networking/recipes-support/unbound/unbound/CVE-2026-44390.patch new file +37 -0
new file mode 100644
index 0000000000..6c13e90bf0
@@ -0,0 +1,37 @@
+From 166c308b1beba4ecf586d51d63513478d75019a1 Mon Sep 17 00:00:00 2001
+From: "W.C.A. Wijngaards" <[email protected]>
+Date: Wed, 20 May 2026 10:21:26 +0200
+Subject: [PATCH] - Fix CVE-2026-44390, Unbounded name compression in certain
+ cases   causes degradation of service. Thanks to Qifan Zhang, Palo Alto  
+ Networks, for the report.
+
+(cherry picked from commit dae7a3797424607906b132c008fc12dba867b5f3)
+
+CVE: CVE-2026-44390
+Upstream-Status: Backport [https://github.com/NLnetLabs/unbound/commit/dae7a3797424607906b132c008fc12dba867b5f3]
+
+Signed-off-by: Ankur Tyagi <[email protected]>
+---
+ util/data/msgencode.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/util/data/msgencode.c b/util/data/msgencode.c
+index 7bc55a54e..f84c491b1 100644
+--- a/util/data/msgencode.c
++++ b/util/data/msgencode.c
+@@ -352,7 +352,6 @@ compress_any_dname(uint8_t* dname, sldns_buffer* pkt, int labs,
+ 		(p = compress_tree_lookup(tree, dname, labs, &insertpt))) {
+ 		if(!write_compressed_dname(pkt, dname, labs, p))
+ 			return RETVAL_TRUNC;
+-		(*compress_count)++;
+ 	} else {
+ 		if(!dname_buffer_write(pkt, dname))
+ 			return RETVAL_TRUNC;
+@@ -360,6 +359,7 @@ compress_any_dname(uint8_t* dname, sldns_buffer* pkt, int labs,
+ 	if(*compress_count < MAX_COMPRESSION_PER_MESSAGE &&
+ 		!compress_tree_store(dname, labs, pos, region, p, insertpt))
+ 		return RETVAL_OUTMEM;
++	(*compress_count)++;
+ 	return RETVAL_OK;
+ }
+ 
meta-networking/recipes-support/unbound/unbound_1.24.2.bb +1 -0
index a6f9b14cab..9de6a3c88c 100644
@@ -21,6 +21,7 @@ SRC_URI = "git://github.com/NLnetLabs/unbound.git;protocol=https;branch=master;t
            file://CVE-2026-42534.patch \
            file://CVE-2026-42923.patch \
            file://CVE-2026-42960.patch \
+           file://CVE-2026-44390.patch \
            "
 
 SRCREV = "f6269baa605d31859f28770e01a24e3677e5f82c"
#11 lore raw

PATCH 12/32 unbound: patch CVE-2026-44608

In reply to [email protected]

From: Ankur Tyagi <[email protected]>

Details:
https://nvd.nist.gov/vuln/detail/cve-2026-44608

---
 .../unbound/unbound/CVE-2026-44608.patch      | 59 +++++++++++++++++++
 .../recipes-support/unbound/unbound_1.24.2.bb |  1 +
 2 files changed, 60 insertions(+)
 create mode 100644 meta-networking/recipes-support/unbound/unbound/CVE-2026-44608.patch
meta-networking/recipes-support/unbound/unbound/CVE-2026-44608.patch new file +59 -0
new file mode 100644
index 0000000000..0552804051
@@ -0,0 +1,59 @@
+From b70913c1208eda8494e2d6dd81910e92b8640dcc Mon Sep 17 00:00:00 2001
+From: "W.C.A. Wijngaards" <[email protected]>
+Date: Wed, 20 May 2026 10:22:52 +0200
+Subject: [PATCH] - Fix CVE-2026-44608, Use after free and crash in RPZ code.
+ Thanks   to Qifan Zhang, Palo Alto Networks, for the report.
+
+(cherry picked from commit 75b6dba593d4fff000434cd64807c6ebd50bd244)
+
+CVE: CVE-2026-44608
+Upstream-Status: Backport [https://github.com/NLnetLabs/unbound/commit/75b6dba593d4fff000434cd64807c6ebd50bd244]
+
+Dropped changes to the Changelog file.
+
+Signed-off-by: Ankur Tyagi <[email protected]>
+---
+ services/rpz.c | 10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/services/rpz.c b/services/rpz.c
+index f45cf6542..27f7de861 100644
+--- a/services/rpz.c
++++ b/services/rpz.c
+@@ -2468,6 +2468,7 @@ rpz_callback_from_iterator_module(struct module_qstate* ms, struct iter_qstate*
+ {
+ 	struct auth_zones* az;
+ 	struct auth_zone* a;
++	struct dns_msg* ret = NULL;
+ 	struct clientip_synthesized_rr* raddr = NULL;
+ 	struct rpz* r = NULL;
+ 	struct local_zone* z = NULL;
+@@ -2511,13 +2512,11 @@ rpz_callback_from_iterator_module(struct module_qstate* ms, struct iter_qstate*
+ 		z = rpz_delegation_point_zone_lookup(is->dp, r->nsdname_zones,
+ 						     is->qchase.qclass, &match);
+ 		if(z != NULL) {
+-			lock_rw_unlock(&a->lock);
+ 			break;
+ 		}
+ 
+ 		raddr = rpz_delegation_point_ipbased_trigger_lookup(r, is);
+ 		if(raddr != NULL) {
+-			lock_rw_unlock(&a->lock);
+ 			break;
+ 		}
+ 		lock_rw_unlock(&a->lock);
+@@ -2532,9 +2531,12 @@ rpz_callback_from_iterator_module(struct module_qstate* ms, struct iter_qstate*
+ 		if(z) {
+ 			lock_rw_unlock(&z->lock);
+ 		}
+-		return rpz_apply_nsip_trigger(ms, &is->qchase, r, raddr, a);
++		ret = rpz_apply_nsip_trigger(ms, &is->qchase, r, raddr, a);
++	} else {
++		ret = rpz_apply_nsdname_trigger(ms, &is->qchase, r, z, &match, a);
+ 	}
+-	return rpz_apply_nsdname_trigger(ms, &is->qchase, r, z, &match, a);
++	lock_rw_unlock(&a->lock);
++	return ret;
+ }
+ 
+ struct dns_msg* rpz_callback_from_iterator_cname(struct module_qstate* ms,
meta-networking/recipes-support/unbound/unbound_1.24.2.bb +1 -0
index 9de6a3c88c..8bd8732fe4 100644
@@ -22,6 +22,7 @@ SRC_URI = "git://github.com/NLnetLabs/unbound.git;protocol=https;branch=master;t
            file://CVE-2026-42923.patch \
            file://CVE-2026-42960.patch \
            file://CVE-2026-44390.patch \
+           file://CVE-2026-44608.patch \
            "
 
 SRCREV = "f6269baa605d31859f28770e01a24e3677e5f82c"
#12 lore raw

PATCH 13/32 unbound: patch CVE-2026-46582

In reply to [email protected]

From: Ankur Tyagi <[email protected]>

Details:
https://nvd.nist.gov/vuln/detail/cve-2026-46582

---
 .../unbound/unbound/CVE-2026-46582.patch      | 151 ++++++++++++++++++
 .../recipes-support/unbound/unbound_1.24.2.bb |   1 +
 2 files changed, 152 insertions(+)
 create mode 100644 meta-networking/recipes-support/unbound/unbound/CVE-2026-46582.patch
meta-networking/recipes-support/unbound/unbound/CVE-2026-46582.patch new file +151 -0
new file mode 100644
index 0000000000..2091e1622a
@@ -0,0 +1,151 @@
+From 97245ce2852162fbf19cc23b016ee73fe2aec63c Mon Sep 17 00:00:00 2001
+From: "W.C.A. Wijngaards" <[email protected]>
+Date: Wed, 22 Jul 2026 10:07:52 +0200
+Subject: [PATCH] - Fix CVE-2026-46582, A wildcard replay, as another piece of
+ data,   triggers poisoning in the serve expired reply path. Thanks to   Qifan
+ Zhang, Palo Alto Networks, for the report.
+
+(cherry picked from commit fea0ff550bb6193417c9b17ffff409eb6736f90d)
+
+CVE: CVE-2026-46582
+Upstream-Status: Backport [https://github.com/NLnetLabs/unbound/commit/fea0ff550bb6193417c9b17ffff409eb6736f90d]
+
+Signed-off-by: Ankur Tyagi <[email protected]>
+---
+ validator/val_utils.c | 15 ++++++++++++---
+ validator/validator.c | 31 ++++++++++++++++++++++++++++++-
+ 2 files changed, 42 insertions(+), 4 deletions(-)
+
+diff --git a/validator/val_utils.c b/validator/val_utils.c
+index 4495695ac..87c5a034a 100644
+--- a/validator/val_utils.c
++++ b/validator/val_utils.c
+@@ -439,10 +439,15 @@ val_verify_rrset(struct module_env* env, struct val_env* ve,
+ 	 * only improves security status 
+ 	 * and bogus is set only once, even if we rechecked the status */
+ 	if(sec > d->security) {
++		int wc_expanded = 0;
+ 		d->security = sec;
+-		if(sec == sec_status_secure)
++		if(sec == sec_status_secure) {
++			uint8_t* wc = NULL;
++			size_t wclen = 0;
+ 			d->trust = rrset_trust_validated;
+-		else if(sec == sec_status_bogus) {
++			if(val_rrset_wildcard(rrset, &wc, &wclen) && wc)
++				wc_expanded = 1;
++		} else if(sec == sec_status_bogus) {
+ 			size_t i;
+ 			/* update ttl for rrset to fixed value. */
+ 			d->ttl = ve->bogus_ttl;
+@@ -455,7 +460,11 @@ val_verify_rrset(struct module_env* env, struct val_env* ve,
+ 			lock_basic_unlock(&ve->bogus_lock);
+ 		}
+ 		/* if status updated - store in cache for reuse */
+-		rrset_update_sec_status(env->rrset_cache, rrset, *env->now);
++		/* For a wildcard rrset, that is secure, do not store this
++		 * into the cache, because it changes proofs around the
++		 * item. */
++		if(!wc_expanded)
++			rrset_update_sec_status(env->rrset_cache, rrset, *env->now);
+ 	}
+ 
+ 	return sec;
+diff --git a/validator/validator.c b/validator/validator.c
+index 5817fc808..68c4bf643 100644
+--- a/validator/validator.c
++++ b/validator/validator.c
+@@ -1013,6 +1013,9 @@ validate_positive_response(struct module_env* env, struct val_env* ve,
+ 	size_t wl;
+ 	int wc_cached = 0;
+ 	int wc_NSEC_ok = 0;
++	/* This is used to update the RRset cache, with the combination
++	 * of the dname expansion and this wildcard, for security status. */
++	struct ub_packed_rrset_key* wc_rrset = NULL;
+ 	int nsec3s_seen = 0;
+ 	size_t i;
+ 	struct ub_packed_rrset_key* s;
+@@ -1031,6 +1034,9 @@ validate_positive_response(struct module_env* env, struct val_env* ve,
+ 				ntohs(s->rk.type), ntohs(s->rk.rrset_class));
+ 			chase_reply->security = sec_status_bogus;
+ 			update_reason_bogus(chase_reply, LDNS_EDE_DNSSEC_BOGUS);
++			if(wc_rrset)
++				((struct packed_rrset_data*)wc_rrset->
++				entry.data)->security = sec_status_bogus;
+ 			return;
+ 		}
+ 		if(wc && !wc_cached && env->cfg->aggressive_nsec) {
+@@ -1038,7 +1044,7 @@ validate_positive_response(struct module_env* env, struct val_env* ve,
+ 				env->alloc, *env->now);
+ 			wc_cached = 1;
+ 		}
+-
++		if(wc) wc_rrset = s;
+ 	}
+ 
+ 	/* validate the AUTHORITY section as well - this will generally be 
+@@ -1095,6 +1101,9 @@ validate_positive_response(struct module_env* env, struct val_env* ve,
+ 			"did not exist");
+ 		chase_reply->security = sec_status_bogus;
+ 		update_reason_bogus(chase_reply, LDNS_EDE_DNSSEC_BOGUS);
++		if(wc_rrset)
++			((struct packed_rrset_data*)wc_rrset->
++			entry.data)->security = sec_status_bogus;
+ 		return;
+ 	}
+ 
+@@ -1496,6 +1505,16 @@ validate_any_response(struct module_env* env, struct val_env* ve,
+ 			"did not exist");
+ 		chase_reply->security = sec_status_bogus;
+ 		update_reason_bogus(chase_reply, LDNS_EDE_DNSSEC_BOGUS);
++		/* Make the expanded name and wildcard RRSIG rrsets bogus */
++		for(i=0; i<chase_reply->an_numrrsets; i++) {
++			uint8_t* cwc = NULL;
++			size_t cwl = 0;
++			s = chase_reply->rrsets[i];
++			if(val_rrset_wildcard(s, &cwc, &cwl) && cwc) {
++				((struct packed_rrset_data*)s->
++				entry.data)->security = sec_status_bogus;
++			}
++		}
+ 		return;
+ 	}
+ 
+@@ -1533,6 +1552,9 @@ validate_cname_response(struct module_env* env, struct val_env* ve,
+ 	uint8_t* wc = NULL;
+ 	size_t wl;
+ 	int wc_NSEC_ok = 0;
++	/* This is used to update the RRset cache, with the combination
++	 * of the dname expansion and this wildcard, for security status. */
++	struct ub_packed_rrset_key* wc_rrset = NULL;
+ 	int nsec3s_seen = 0;
+ 	size_t i;
+ 	struct ub_packed_rrset_key* s;
+@@ -1553,6 +1575,7 @@ validate_cname_response(struct module_env* env, struct val_env* ve,
+ 			update_reason_bogus(chase_reply, LDNS_EDE_DNSSEC_BOGUS);
+ 			return;
+ 		}
++		if(wc) wc_rrset = s;
+ 		
+ 		/* Refuse wildcarded DNAMEs rfc 4597. 
+ 		 * Do not follow a wildcarded DNAME because 
+@@ -1564,6 +1587,9 @@ validate_cname_response(struct module_env* env, struct val_env* ve,
+ 				ntohs(s->rk.type), ntohs(s->rk.rrset_class));
+ 			chase_reply->security = sec_status_bogus;
+ 			update_reason_bogus(chase_reply, LDNS_EDE_DNSSEC_BOGUS);
++			if(wc_rrset)
++				((struct packed_rrset_data*)wc_rrset->
++				entry.data)->security = sec_status_bogus;
+ 			return;
+ 		}
+ 
+@@ -1628,6 +1654,9 @@ validate_cname_response(struct module_env* env, struct val_env* ve,
+ 			"did not exist");
+ 		chase_reply->security = sec_status_bogus;
+ 		update_reason_bogus(chase_reply, LDNS_EDE_DNSSEC_BOGUS);
++		if(wc_rrset)
++			((struct packed_rrset_data*)wc_rrset->
++			entry.data)->security = sec_status_bogus;
+ 		return;
+ 	}
+ 
meta-networking/recipes-support/unbound/unbound_1.24.2.bb +1 -0
index 8bd8732fe4..bf17c30572 100644
@@ -23,6 +23,7 @@ SRC_URI = "git://github.com/NLnetLabs/unbound.git;protocol=https;branch=master;t
            file://CVE-2026-42960.patch \
            file://CVE-2026-44390.patch \
            file://CVE-2026-44608.patch \
+           file://CVE-2026-46582.patch \
            "
 
 SRCREV = "f6269baa605d31859f28770e01a24e3677e5f82c"
#13 lore raw

PATCH 14/32 unbound: patch CVE-2026-32665

In reply to [email protected]

From: Ankur Tyagi <[email protected]>

Details:
https://nvd.nist.gov/vuln/detail/cve-2026-32665

---
 .../unbound/unbound/CVE-2026-32665.patch      | 119 ++++++++++++++++++
 .../recipes-support/unbound/unbound_1.24.2.bb |   1 +
 2 files changed, 120 insertions(+)
 create mode 100644 meta-networking/recipes-support/unbound/unbound/CVE-2026-32665.patch
meta-networking/recipes-support/unbound/unbound/CVE-2026-32665.patch new file +119 -0
new file mode 100644
index 0000000000..401f8d094d
@@ -0,0 +1,119 @@
+From c9bd4309ec14f767db0d0de5647f0e8fe554b60d Mon Sep 17 00:00:00 2001
+From: "W.C.A. Wijngaards" <[email protected]>
+Date: Wed, 22 Jul 2026 10:09:26 +0200
+Subject: [PATCH] - Fix CVE-2026-32665, Remote DNS-over-QUIC denial of  
+ service due to `quic-size` budget bypass. Thanks to N0zoM1z0  
+ (https://github.com/N0zoM1z0) for the report. In addition, thanks to   Kunta
+ Chu, Kaihua Wang, and Jianjun Chen from Tsinghua University,   for also
+ reporting this issue. In addition, thanks to Qifan Zhang,   Palo Alto
+ Networks, for also reporting this issue. In addition,   thanks to Xuanchao
+ Xie, for also reporting this issue.
+
+(cherry picked from commit 01dfd2f466d383370405d8ecf939570947f3523e)
+
+CVE: CVE-2026-32665
+Upstream-Status: Backport [https://github.com/NLnetLabs/unbound/commit/01dfd2f466d383370405d8ecf939570947f3523e]
+
+Signed-off-by: Ankur Tyagi <[email protected]>
+---
+ services/listen_dnsport.c | 32 ++++++++++++++++++++++----------
+ 1 file changed, 22 insertions(+), 10 deletions(-)
+
+diff --git a/services/listen_dnsport.c b/services/listen_dnsport.c
+index f7fcca194..3c5010b6b 100644
+--- a/services/listen_dnsport.c
++++ b/services/listen_dnsport.c
+@@ -3978,7 +3978,8 @@ doq_stream_close(struct doq_conn* conn, struct doq_stream* stream,
+ 
+ /** doq stream pick up answer data from buffer */
+ static int
+-doq_stream_pickup_answer(struct doq_stream* stream, struct sldns_buffer* buf)
++doq_stream_pickup_answer(struct doq_conn* conn, struct doq_stream* stream,
++	struct sldns_buffer* buf)
+ {
+ 	stream->is_answer_available = 1;
+ 	if(stream->out) {
+@@ -3988,6 +3989,11 @@ doq_stream_pickup_answer(struct doq_stream* stream, struct sldns_buffer* buf)
+ 	}
+ 	stream->nwrite = 0;
+ 	stream->outlen = sldns_buffer_limit(buf);
++	if(!doq_table_quic_size_available(conn->doq_socket->table,
++		conn->doq_socket->cfg, stream->outlen)) {
++		verbose(VERB_ALGO, "doq stream: no space for reply length");
++		return 0;
++	}
+ 	/* For quic the output bytes have to stay allocated and available,
+ 	 * for potential resends, until the remote end has acknowledged them.
+ 	 * This includes the tcplen start uint16_t, in outlen_wire. */
+@@ -4014,7 +4020,7 @@ doq_stream_send_reply(struct doq_conn* conn, struct doq_stream* stream,
+ 	if(stream->out)
+ 		doq_table_quic_size_subtract(conn->doq_socket->table,
+ 			stream->outlen);
+-	if(!doq_stream_pickup_answer(stream, buf))
++	if(!doq_stream_pickup_answer(conn, stream, buf))
+ 		return 0;
+ 	doq_table_quic_size_add(conn->doq_socket->table, stream->outlen);
+ 	doq_stream_on_write_list(conn, stream);
+@@ -4025,13 +4031,19 @@ doq_stream_send_reply(struct doq_conn* conn, struct doq_stream* stream,
+ /** doq stream data length has completed, allocations can be done. False on
+  * allocation failure. */
+ static int
+-doq_stream_datalen_complete(struct doq_stream* stream, struct doq_table* table)
++doq_stream_datalen_complete(struct doq_conn* conn, struct doq_stream* stream,
++	struct doq_table* table)
+ {
+ 	if(stream->inlen > 1024*1024) {
+ 		log_err("doq stream in length too large %d",
+ 			(int)stream->inlen);
+ 		return 0;
+ 	}
++	if(!doq_table_quic_size_available(table, conn->doq_socket->cfg,
++		stream->inlen)) {
++		verbose(VERB_ALGO, "doq stream: no space for query length");
++		return 0;
++	}
+ 	stream->in = calloc(1, stream->inlen);
+ 	if(!stream->in) {
+ 		log_err("doq could not read stream, calloc failed: "
+@@ -4092,8 +4104,9 @@ doq_stream_data_complete(struct doq_conn* conn, struct doq_stream* stream)
+ 
+ /** doq receive data for a stream, more bytes of the incoming data */
+ static int
+-doq_stream_recv_data(struct doq_stream* stream, const uint8_t* data,
+-	size_t datalen, int* recv_done, struct doq_table* table)
++doq_stream_recv_data(struct doq_conn* conn, struct doq_stream* stream,
++	const uint8_t* data, size_t datalen, int* recv_done,
++	struct doq_table* table)
+ {
+ 	int got_data = 0;
+ 	/* read the tcplength uint16_t at the start */
+@@ -4114,7 +4127,7 @@ doq_stream_recv_data(struct doq_stream* stream, const uint8_t* data,
+ 		if(stream->nread == 2) {
+ 			/* the initial length value is completed */
+ 			stream->inlen = ntohs(tcplen);
+-			if(!doq_stream_datalen_complete(stream, table))
++			if(!doq_stream_datalen_complete(conn, stream, table))
+ 				return 0;
+ 		} else {
+ 			/* store for later */
+@@ -4331,8 +4344,7 @@ doq_stream_open_cb(ngtcp2_conn* ATTR_UNUSED(conn), int64_t stream_id,
+ 		verbose(VERB_ALGO, "doq: stream with this id already exists");
+ 		return 0;
+ 	}
+-	if(stream_id != 0 && stream_id != 4 && /* allow one stream on a new connection */
+-		!doq_table_quic_size_available(doq_conn->doq_socket->table,
++	if(!doq_table_quic_size_available(doq_conn->doq_socket->table,
+ 		doq_conn->doq_socket->cfg, sizeof(*stream)
+ 		+ 100 /* estimated query in */
+ 		+ 512 /* estimated response out */
+@@ -4390,8 +4402,8 @@ doq_recv_stream_data_cb(ngtcp2_conn* ATTR_UNUSED(conn), uint32_t flags,
+ 		return 0;
+ 	}
+ 	if(datalen != 0) {
+-		if(!doq_stream_recv_data(stream, data, datalen, &recv_done,
+-			doq_conn->doq_socket->table))
++		if(!doq_stream_recv_data(doq_conn, stream, data, datalen,
++			&recv_done, doq_conn->doq_socket->table))
+ 			return NGTCP2_ERR_CALLBACK_FAILURE;
+ 	}
+ 	if((flags&NGTCP2_STREAM_DATA_FLAG_FIN)!=0) {
meta-networking/recipes-support/unbound/unbound_1.24.2.bb +1 -0
index bf17c30572..12e3deb6e4 100644
@@ -24,6 +24,7 @@ SRC_URI = "git://github.com/NLnetLabs/unbound.git;protocol=https;branch=master;t
            file://CVE-2026-44390.patch \
            file://CVE-2026-44608.patch \
            file://CVE-2026-46582.patch \
+           file://CVE-2026-32665.patch \
            "
 
 SRCREV = "f6269baa605d31859f28770e01a24e3677e5f82c"
#14 lore raw

PATCH 15/32 unbound: patch CVE-2026-42955

In reply to [email protected]

From: Ankur Tyagi <[email protected]>

Details:
https://nvd.nist.gov/vuln/detail/cve-2026-42955

---
 .../unbound/unbound/CVE-2026-42955.patch      | 98 +++++++++++++++++++
 .../recipes-support/unbound/unbound_1.24.2.bb |  1 +
 2 files changed, 99 insertions(+)
 create mode 100644 meta-networking/recipes-support/unbound/unbound/CVE-2026-42955.patch
meta-networking/recipes-support/unbound/unbound/CVE-2026-42955.patch new file +98 -0
new file mode 100644
index 0000000000..aa6c7a1dd5
@@ -0,0 +1,98 @@
+From 40a9f83c64c94b974e6b6f75e4ef350debf86577 Mon Sep 17 00:00:00 2001
+From: "W.C.A. Wijngaards" <[email protected]>
+Date: Wed, 22 Jul 2026 10:11:04 +0200
+Subject: [PATCH] - Fix CVE-2026-42955, Extra fix for CVE-2026-40622 to also
+ clamp   the TTL of A/AAAA records disallowing a one-time 'ghost domain'  
+ delegation renewal via glue records. Thanks to Qifan Zhang, Palo   Alto
+ Networks, for the report.
+
+(cherry picked from commit 13ec8d0f261ee7900ac67cfece551e8a703d14b1)
+
+CVE: CVE-2026-42955
+Upstream-Status: Backport [https://github.com/NLnetLabs/unbound/commit/13ec8d0f261ee7900ac67cfece551e8a703d14b1]
+
+Signed-off-by: Ankur Tyagi <[email protected]>
+---
+ services/cache/rrset.c          | 12 +++++++++---
+ testdata/iter_prefetch_fail.rpl |  8 ++++----
+ 2 files changed, 13 insertions(+), 7 deletions(-)
+
+diff --git a/services/cache/rrset.c b/services/cache/rrset.c
+index 81f4e2820..b5fee1dc9 100644
+--- a/services/cache/rrset.c
++++ b/services/cache/rrset.c
+@@ -126,7 +126,8 @@ rrset_cache_touch(struct rrset_cache* r, struct ub_packed_rrset_key* key,
+ 
+ /** see if rrset needs to be updated in the cache */
+ static int
+-need_to_update_rrset(void* nd, void* cd, time_t timenow, int equal, int ns)
++need_to_update_rrset(void* nd, void* cd, time_t timenow, int equal, int ns,
++	int a_aaaa)
+ {
+ 	struct packed_rrset_data* newd = (struct packed_rrset_data*)nd;
+ 	struct packed_rrset_data* cached = (struct packed_rrset_data*)cd;
+@@ -151,9 +152,13 @@ need_to_update_rrset(void* nd, void* cd, time_t timenow, int equal, int ns)
+ 			return 0;
+ 		/* ghost-domain: never let an NS overwrite extend lifetime
+ 		 * past the entry it replaces, regardless of trust. */
+-		if(ns && !TTL_IS_EXPIRED(cached->ttl, timenow) &&
++		/* Also for A/AAAA and it is glue. */
++		if((ns ||
++			(a_aaaa && cached->trust==rrset_trust_add_noAA))
++			&& !TTL_IS_EXPIRED(cached->ttl, timenow) &&
+ 			newd->ttl > cached->ttl) {
+ 			size_t i;
++			if(a_aaaa) newd->trust=rrset_trust_add_noAA;
+ 			newd->ttl = cached->ttl;
+ 			for(i=0; i<(newd->count+newd->rrsig_count); i++)
+ 				if(newd->rr_ttl[i] > newd->ttl)
+@@ -223,7 +228,8 @@ rrset_cache_update(struct rrset_cache* r, struct rrset_ref* ref,
+ 		equal = rrsetdata_equal((struct packed_rrset_data*)k->entry.
+ 			data, (struct packed_rrset_data*)e->data);
+ 		if(!need_to_update_rrset(k->entry.data, e->data, timenow,
+-			equal, (rrset_type==LDNS_RR_TYPE_NS))) {
++			equal, (rrset_type==LDNS_RR_TYPE_NS),
++			(rrset_type==LDNS_RR_TYPE_A || rrset_type==LDNS_RR_TYPE_AAAA))) {
+ 			/* cache is superior, return that value */
+ 			lock_rw_unlock(&e->lock);
+ 			ub_packed_rrset_parsedelete(k, alloc);
+diff --git a/testdata/iter_prefetch_fail.rpl b/testdata/iter_prefetch_fail.rpl
+index d1e308305..aa94d0fe5 100644
+--- a/testdata/iter_prefetch_fail.rpl
++++ b/testdata/iter_prefetch_fail.rpl
+@@ -319,7 +319,7 @@ example.com.	360 IN NS	ns.example.com.
+ SECTION ADDITIONAL
+ ; this is picked up from the parent (because this simulation has the
+ ; parent respond with servfail, not actually timeout)
+-ns.example.com.	3600 	IN 	A	1.2.3.4
++ns.example.com.	360 	IN 	A	1.2.3.4
+ ENTRY_END
+ 
+ ; another query to see if there is another lookup towards the authority
+@@ -342,7 +342,7 @@ www.example.com. 360 IN A	10.20.30.40
+ SECTION AUTHORITY
+ example.com.	360 IN NS	ns.example.com.
+ SECTION ADDITIONAL
+-ns.example.com.	3600 	IN 	A	1.2.3.4
++ns.example.com.	360 	IN 	A	1.2.3.4
+ ENTRY_END
+ 
+ ; some time later another query, and now it is fine to bother the authority
+@@ -367,7 +367,7 @@ www.example.com. 330 IN A	10.20.30.40
+ SECTION AUTHORITY
+ example.com.	330 IN NS	ns.example.com.
+ SECTION ADDITIONAL
+-ns.example.com.	3570 	IN 	A	1.2.3.4
++ns.example.com.	330 	IN 	A	1.2.3.4
+ ENTRY_END
+ ; now the just-looked-up entry
+ STEP 190 QUERY
+@@ -388,7 +388,7 @@ www.example.com. 3600 IN A	10.20.30.40
+ SECTION AUTHORITY
+ example.com.	3600 IN NS	ns.example.com.
+ SECTION ADDITIONAL
+-ns.example.com.	3570 	IN 	A	1.2.3.4
++ns.example.com.	3600 	IN 	A	1.2.3.4
+ ENTRY_END
+ 
+ 
meta-networking/recipes-support/unbound/unbound_1.24.2.bb +1 -0
index 12e3deb6e4..5c798c00d3 100644
@@ -25,6 +25,7 @@ SRC_URI = "git://github.com/NLnetLabs/unbound.git;protocol=https;branch=master;t
            file://CVE-2026-44608.patch \
            file://CVE-2026-46582.patch \
            file://CVE-2026-32665.patch \
+           file://CVE-2026-42955.patch \
            "
 
 SRCREV = "f6269baa605d31859f28770e01a24e3677e5f82c"
#15 lore raw

PATCH 16/32 unbound: patch CVE-2026-44621

In reply to [email protected]

From: Ankur Tyagi <[email protected]>

Details:
https://nvd.nist.gov/vuln/detail/cve-2026-44621

---
 .../unbound/unbound/CVE-2026-44621.patch      | 98 +++++++++++++++++++
 .../recipes-support/unbound/unbound_1.24.2.bb |  1 +
 2 files changed, 99 insertions(+)
 create mode 100644 meta-networking/recipes-support/unbound/unbound/CVE-2026-44621.patch
meta-networking/recipes-support/unbound/unbound/CVE-2026-44621.patch new file +98 -0
new file mode 100644
index 0000000000..2c581a30be
@@ -0,0 +1,98 @@
+From 3abdb762310bb50ef03f1ee0bbd4e09cb814fbb1 Mon Sep 17 00:00:00 2001
+From: "W.C.A. Wijngaards" <[email protected]>
+Date: Wed, 22 Jul 2026 10:11:26 +0200
+Subject: [PATCH] - Fix CVE-2026-44621, Libunbound applications configured with
+   'unwanted-reply-threshold' could eventually be abruptly   terminated.
+ Thanks to Qifan Zhang, Palo Alto Networks, for the   report.
+
+(cherry picked from commit f52a9e864bfa0f10d8816b64130586b1d224c474)
+
+CVE: CVE-2026-44621
+Upstream-Status: Backport [https://github.com/NLnetLabs/unbound/commit/f52a9e864bfa0f10d8816b64130586b1d224c474]
+
+Signed-off-by: Ankur Tyagi <[email protected]>
+---
+ daemon/worker.c                | 5 +++++
+ dnstap/unbound-dnstap-socket.c | 5 +++++
+ smallapp/worker_cb.c           | 6 ++++++
+ testcode/doqclient.c           | 5 +++++
+ util/fptr_wlist.c              | 1 +
+ 5 files changed, 22 insertions(+)
+
+diff --git a/daemon/worker.c b/daemon/worker.c
+index 8e4a9b3d6..b9fac0406 100644
+--- a/daemon/worker.c
++++ b/daemon/worker.c
+@@ -2560,6 +2560,11 @@ void libworker_event_done_cb(void* ATTR_UNUSED(arg), int ATTR_UNUSED(rcode),
+ 	log_assert(0);
+ }
+ 
++void libworker_alloc_cleanup(void* ATTR_UNUSED(arg))
++{
++	log_assert(0);
++}
++
+ int context_query_cmp(const void* ATTR_UNUSED(a), const void* ATTR_UNUSED(b))
+ {
+ 	log_assert(0);
+diff --git a/dnstap/unbound-dnstap-socket.c b/dnstap/unbound-dnstap-socket.c
+index a01627de9..7d01eb220 100644
+--- a/dnstap/unbound-dnstap-socket.c
++++ b/dnstap/unbound-dnstap-socket.c
+@@ -1725,6 +1725,11 @@ void libworker_event_done_cb(void* ATTR_UNUSED(arg), int ATTR_UNUSED(rcode),
+ 	log_assert(0);
+ }
+ 
++void libworker_alloc_cleanup(void* ATTR_UNUSED(arg))
++{
++	log_assert(0);
++}
++
+ int context_query_cmp(const void* ATTR_UNUSED(a), const void* ATTR_UNUSED(b))
+ {
+ 	log_assert(0);
+diff --git a/smallapp/worker_cb.c b/smallapp/worker_cb.c
+index 92ebe386d..876c7db4e 100644
+--- a/smallapp/worker_cb.c
++++ b/smallapp/worker_cb.c
+@@ -128,6 +128,12 @@ worker_alloc_cleanup(void* ATTR_UNUSED(arg))
+ 	log_assert(0);
+ }
+ 
++void
++libworker_alloc_cleanup(void* ATTR_UNUSED(arg))
++{
++	log_assert(0);
++}
++
+ struct outbound_entry* libworker_send_query(
+ 	struct query_info* ATTR_UNUSED(qinfo), uint16_t ATTR_UNUSED(flags),
+ 	int ATTR_UNUSED(dnssec), int ATTR_UNUSED(want_dnssec),
+diff --git a/testcode/doqclient.c b/testcode/doqclient.c
+index 238a93803..1994cd097 100644
+--- a/testcode/doqclient.c
++++ b/testcode/doqclient.c
+@@ -2671,6 +2671,11 @@ void libworker_event_done_cb(void* ATTR_UNUSED(arg), int ATTR_UNUSED(rcode),
+ 	log_assert(0);
+ }
+ 
++void libworker_alloc_cleanup(void* ATTR_UNUSED(arg))
++{
++	log_assert(0);
++}
++
+ int context_query_cmp(const void* ATTR_UNUSED(a), const void* ATTR_UNUSED(b))
+ {
+ 	log_assert(0);
+diff --git a/util/fptr_wlist.c b/util/fptr_wlist.c
+index c6f3ca24a..3c863d5e1 100644
+--- a/util/fptr_wlist.c
++++ b/util/fptr_wlist.c
+@@ -609,6 +609,7 @@ int
+ fptr_whitelist_alloc_cleanup(void (*fptr)(void*))
+ {
+ 	if(fptr == &worker_alloc_cleanup) return 1;
++	else if(fptr == &libworker_alloc_cleanup) return 1;
+ 	return 0;
+ }
+ 
meta-networking/recipes-support/unbound/unbound_1.24.2.bb +1 -0
index 5c798c00d3..ac8cd281d6 100644
@@ -26,6 +26,7 @@ SRC_URI = "git://github.com/NLnetLabs/unbound.git;protocol=https;branch=master;t
            file://CVE-2026-46582.patch \
            file://CVE-2026-32665.patch \
            file://CVE-2026-42955.patch \
+           file://CVE-2026-44621.patch \
            "
 
 SRCREV = "f6269baa605d31859f28770e01a24e3677e5f82c"
#16 lore raw

PATCH 17/32 unbound: patch CVE-2026-44687

In reply to [email protected]

From: Ankur Tyagi <[email protected]>

Details:
https://nvd.nist.gov/vuln/detail/cve-2026-44687

---
 .../unbound/unbound/CVE-2026-44687.patch      | 31 +++++++++++++++++++
 .../recipes-support/unbound/unbound_1.24.2.bb |  1 +
 2 files changed, 32 insertions(+)
 create mode 100644 meta-networking/recipes-support/unbound/unbound/CVE-2026-44687.patch
meta-networking/recipes-support/unbound/unbound/CVE-2026-44687.patch new file +31 -0
new file mode 100644
index 0000000000..03e57f6327
@@ -0,0 +1,31 @@
+From ac34bce07f66a96baf85e3f25f99623b08b6dd86 Mon Sep 17 00:00:00 2001
+From: "W.C.A. Wijngaards" <[email protected]>
+Date: Wed, 22 Jul 2026 10:12:03 +0200
+Subject: [PATCH] - Fix CVE-2026-44687, Off-by-one error in
+ 'harden-below-nxdomain'   logic can shadow a stub/forward zone by a
+ legitimate parent's   NXDOMAIN. Thanks to Qifan Zhang, Palo Alto Networks,
+ for the report.
+
+(cherry picked from commit 1e1940383ab5ee655fe7fac0da606fe59c76ce86)
+
+CVE: CVE-2026-44687
+Upstream-Status: Backport [https://github.com/NLnetLabs/unbound/commit/1e1940383ab5ee655fe7fac0da606fe59c76ce86]
+
+Signed-off-by: Ankur Tyagi <[email protected]>
+---
+ services/cache/dns.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/services/cache/dns.c b/services/cache/dns.c
+index 8dae2ffcc..121870ee3 100644
+--- a/services/cache/dns.c
++++ b/services/cache/dns.c
+@@ -1019,7 +1019,7 @@ dns_cache_lookup(struct module_env* env,
+ 	if(env->cfg->harden_below_nxdomain) {
+ 		while(!dname_is_root(k.qname)) {
+ 			if(dpname && dpnamelen
+-				&& !dname_subdomain_c(k.qname, dpname))
++				&& !dname_strict_subdomain_c(k.qname, dpname))
+ 				break; /* no synth nxdomain above the stub */
+ 			dname_remove_label(&k.qname, &k.qname_len);
+ 			h = query_info_hash(&k, flags);
meta-networking/recipes-support/unbound/unbound_1.24.2.bb +1 -0
index ac8cd281d6..6cae8632ae 100644
@@ -27,6 +27,7 @@ SRC_URI = "git://github.com/NLnetLabs/unbound.git;protocol=https;branch=master;t
            file://CVE-2026-32665.patch \
            file://CVE-2026-42955.patch \
            file://CVE-2026-44621.patch \
+           file://CVE-2026-44687.patch \
            "
 
 SRCREV = "f6269baa605d31859f28770e01a24e3677e5f82c"
#17 lore raw

PATCH 18/32 unbound: patch CVE-2026-50045

In reply to [email protected]

From: Ankur Tyagi <[email protected]>

Details:
https://nvd.nist.gov/vuln/detail/cve-2026-50045

---
 .../unbound/unbound/CVE-2026-50045.patch      | 278 ++++++++++++++++++
 .../recipes-support/unbound/unbound_1.24.2.bb |   1 +
 2 files changed, 279 insertions(+)
 create mode 100644 meta-networking/recipes-support/unbound/unbound/CVE-2026-50045.patch
meta-networking/recipes-support/unbound/unbound/CVE-2026-50045.patch new file +278 -0
new file mode 100644
index 0000000000..39c786e9a1
@@ -0,0 +1,278 @@
+From ceadb55a62fb7f503b13e238043a68573890db97 Mon Sep 17 00:00:00 2001
+From: "W.C.A. Wijngaards" <[email protected]>
+Date: Wed, 22 Jul 2026 10:13:14 +0200
+Subject: [PATCH] - Fix CVE-2026-50045, 'max-global-quota' reset by DNSSEC
+ validation   restarts. Thanks to Kunjie Shang, University of Science and  
+ Technology of China, for the report.
+
+(cherry picked from commit 364ac737f713b2a606f0fddecddb675d72a6a991)
+
+CVE: CVE-2026-50045
+Upstream-Status: Backport [https://github.com/NLnetLabs/unbound/commit/364ac737f713b2a606f0fddecddb675d72a6a991]
+
+Signed-off-by: Ankur Tyagi <[email protected]>
+---
+ iterator/iterator.c   | 67 ++++++++++++++++++++++++++++++-------------
+ util/module.h         |  6 ++++
+ validator/validator.c | 13 +++++++++
+ 3 files changed, 66 insertions(+), 20 deletions(-)
+
+diff --git a/iterator/iterator.c b/iterator/iterator.c
+index 71e64655f..16dbc19de 100644
+--- a/iterator/iterator.c
++++ b/iterator/iterator.c
+@@ -81,7 +81,8 @@ int BLACKLIST_PENALTY = (120000*4);
+ /** Timeout when only a single probe query per IP is allowed. */
+ int PROBE_MAXRTO = PROBE_MAXRTO_DEFAULT; /* in msec */
+ 
+-static void target_count_increase_nx(struct iter_qstate* iq, int num);
++static void target_count_increase_nx(struct module_qstate* qstate,
++	struct iter_qstate* iq, int num);
+ 
+ int 
+ iter_init(struct module_env* env, int id)
+@@ -250,7 +251,7 @@ error_supers(struct module_qstate* qstate, int id, struct module_qstate* super)
+ 		if((dpns->got4 == 2 || (!ie->supports_ipv4 && !ie->nat64.use_nat64)) &&
+ 			(dpns->got6 == 2 || !ie->supports_ipv6)) {
+ 			dpns->resolved = 1; /* mark as failed */
+-			target_count_increase_nx(super_iq, 1);
++			target_count_increase_nx(super, super_iq, 1);
+ 		}
+ 	}
+ 	if(qstate->qinfo.qtype == LDNS_RR_TYPE_NS) {
+@@ -733,7 +734,7 @@ is_caps_whitelisted(struct iter_env* ie, struct iter_qstate* iq)
+  * created for the parent query.
+  */
+ static void
+-target_count_create(struct iter_qstate* iq)
++target_count_create(struct module_qstate* qstate, struct iter_qstate* iq)
+ {
+ 	if(!iq->target_count) {
+ 		iq->target_count = (int*)calloc(TARGET_COUNT_MAX, sizeof(int));
+@@ -741,33 +742,57 @@ target_count_create(struct iter_qstate* iq)
+ 		if(iq->target_count) {
+ 			iq->target_count[TARGET_COUNT_REF] = 1;
+ 			iq->nxns_dp = (uint8_t**)calloc(1, sizeof(uint8_t*));
++			/* continue global quota from where it was. */
++			if(qstate->global_quota_reached >
++				iq->target_count[TARGET_COUNT_GLOBAL_QUOTA])
++				iq->target_count[TARGET_COUNT_GLOBAL_QUOTA] =
++					qstate->global_quota_reached;
+ 		}
+ 	}
+ }
+ 
+ static void
+-target_count_increase(struct iter_qstate* iq, int num)
++target_count_store(struct module_qstate* qstate, struct iter_qstate* iq)
+ {
+-	target_count_create(iq);
++	if(iq->target_count) {
++		/* By storing the global quota counter, it stays
++		 * there to be picked up if the module is restarted,
++		 * eg. due to a validator retry, and then the
++		 * target_count_create routine picks it up. */
++		if(iq->target_count[TARGET_COUNT_GLOBAL_QUOTA] >
++			qstate->global_quota_reached)
++			qstate->global_quota_reached =
++			  iq->target_count[TARGET_COUNT_GLOBAL_QUOTA];
++	}
++}
++
++static void
++target_count_increase(struct module_qstate* qstate,
++	struct iter_qstate* iq, int num)
++{
++	target_count_create(qstate, iq);
+ 	if(iq->target_count)
+ 		iq->target_count[TARGET_COUNT_QUERIES] += num;
+ 	iq->dp_target_count++;
+ }
+ 
+ static void
+-target_count_increase_nx(struct iter_qstate* iq, int num)
++target_count_increase_nx(struct module_qstate* qstate,
++	struct iter_qstate* iq, int num)
+ {
+-	target_count_create(iq);
++	target_count_create(qstate, iq);
+ 	if(iq->target_count)
+ 		iq->target_count[TARGET_COUNT_NX] += num;
+ }
+ 
+ static void
+-target_count_increase_global_quota(struct iter_qstate* iq, int num)
++target_count_increase_global_quota(struct module_qstate* qstate,
++	struct iter_qstate* iq, int num)
+ {
+-	target_count_create(iq);
++	target_count_create(qstate, iq);
+ 	if(iq->target_count)
+ 		iq->target_count[TARGET_COUNT_GLOBAL_QUOTA] += num;
++	target_count_store(qstate, iq);
+ }
+ 
+ /**
+@@ -860,7 +885,7 @@ generate_sub_request(uint8_t* qname, size_t qnamelen, uint16_t qtype,
+ 		subiq = (struct iter_qstate*)subq->minfo[id];
+ 		memset(subiq, 0, sizeof(*subiq));
+ 		subiq->num_target_queries = 0;
+-		target_count_create(iq);
++		target_count_create(qstate, iq);
+ 		subiq->target_count = iq->target_count;
+ 		if(iq->target_count) {
+ 			iq->target_count[TARGET_COUNT_REF] ++; /* extra reference */
+@@ -2233,7 +2258,7 @@ processLastResort(struct module_qstate* qstate, struct iter_qstate* iq,
+ 			return error_response_cache(qstate, id, LDNS_RCODE_SERVFAIL);
+ 		}
+ 		iq->num_target_queries += qs;
+-		target_count_increase(iq, qs);
++		target_count_increase(qstate, iq, qs);
+ 		if(qs != 0) {
+ 			qstate->ext_state[id] = module_wait_subquery;
+ 			return 0; /* and wait for them */
+@@ -2289,7 +2314,7 @@ processLastResort(struct module_qstate* qstate, struct iter_qstate* iq,
+ 				 * lookups at a time. */
+ 				verbose(VERB_ALGO, "try parent-side glue lookup");
+ 				iq->num_target_queries += query_count;
+-				target_count_increase(iq, query_count);
++				target_count_increase(qstate, iq, query_count);
+ 				qstate->ext_state[id] = module_wait_subquery;
+ 				return 0;
+ 			}
+@@ -2309,7 +2334,7 @@ processLastResort(struct module_qstate* qstate, struct iter_qstate* iq,
+ 		if(query_count != 0) { /* suspend to await results */
+ 			verbose(VERB_ALGO, "try parent-side glue lookup");
+ 			iq->num_target_queries += query_count;
+-			target_count_increase(iq, query_count);
++			target_count_increase(qstate, iq, query_count);
+ 			qstate->ext_state[id] = module_wait_subquery;
+ 			return 0;
+ 		}
+@@ -2789,7 +2814,7 @@ processQueryTargets(struct module_qstate* qstate, struct iter_qstate* iq,
+ 			return error_response_cache(qstate, id, LDNS_RCODE_SERVFAIL);
+ 		}
+ 		iq->num_target_queries += extra;
+-		target_count_increase(iq, extra);
++		target_count_increase(qstate, iq, extra);
+ 		if(iq->num_target_queries > 0) {
+ 			/* wait to get all targets, we want to try em */
+ 			verbose(VERB_ALGO, "wait for all targets for fallback");
+@@ -2840,7 +2865,7 @@ processQueryTargets(struct module_qstate* qstate, struct iter_qstate* iq,
+ 		/* errors ignored, these targets are not strictly necessary for
+ 		 * this result, we do not have to reply with SERVFAIL */
+ 		iq->num_target_queries += extra;
+-		target_count_increase(iq, extra);
++		target_count_increase(qstate, iq, extra);
+ 	}
+ 
+ 	/* Add the current set of unused targets to our queue. */
+@@ -2963,7 +2988,7 @@ processQueryTargets(struct module_qstate* qstate, struct iter_qstate* iq,
+ 						LDNS_RCODE_SERVFAIL);
+ 				}
+ 				iq->num_target_queries += qs;
+-				target_count_increase(iq, qs);
++				target_count_increase(qstate, iq, qs);
+ 			}
+ 			/* Since a target query might have been made, we 
+ 			 * need to check again. */
+@@ -3023,7 +3048,7 @@ processQueryTargets(struct module_qstate* qstate, struct iter_qstate* iq,
+ 		* this result, we do not have to reply with SERVFAIL */
+ 		if(extra > 0) {
+ 			iq->num_target_queries += extra;
+-			target_count_increase(iq, extra);
++			target_count_increase(qstate, iq, extra);
+ 			check_waiting_queries(iq, qstate, id);
+ 			/* undo qname minimise step because we'll get back here
+ 			 * to do it again */
+@@ -3036,7 +3061,7 @@ processQueryTargets(struct module_qstate* qstate, struct iter_qstate* iq,
+ 		}
+ 	}
+ 
+-	target_count_increase_global_quota(iq, 1);
++	target_count_increase_global_quota(qstate, iq, 1);
+ 	if(iq->target_count && iq->target_count[TARGET_COUNT_GLOBAL_QUOTA]
+ 		> MAX_GLOBAL_QUOTA) {
+ 		char s[LDNS_MAX_DOMAINLEN];
+@@ -3880,7 +3905,7 @@ processTargetResponse(struct module_qstate* qstate, int id,
+ 			/* no new addresses, increase the nxns counter, like
+ 			 * this could be a list of wildcards with no new
+ 			 * addresses */
+-			target_count_increase_nx(foriq, 1);
++			target_count_increase_nx(qstate, foriq, 1);
+ 		}
+ 		verbose(VERB_ALGO, "added target response");
+ 		delegpt_log(VERB_ALGO, foriq->dp);
+@@ -3892,7 +3917,7 @@ processTargetResponse(struct module_qstate* qstate, int id,
+ 			dpns->resolved = 1; /* fail the target */
+ 			/* do not count cached answers */
+ 			if(qstate->reply_origin && qstate->reply_origin->len != 0) {
+-				target_count_increase_nx(foriq, 1);
++				target_count_increase_nx(qstate, foriq, 1);
+ 			}
+ 		}
+ 	}
+@@ -4117,6 +4142,7 @@ processFinished(struct module_qstate* qstate, struct iter_qstate* iq,
+ 			iter_store_parentside_neg(qstate->env, &qstate->qinfo,
+ 				iq->deleg_msg?iq->deleg_msg->rep:
+ 				(iq->response?iq->response->rep:NULL));
++	target_count_store(qstate, iq);
+ 	if(!iq->response) {
+ 		verbose(VERB_ALGO, "No response is set, servfail");
+ 		errinf(qstate, "(no response found at query finish)");
+@@ -4532,6 +4558,7 @@ iter_clear(struct module_qstate* qstate, int id)
+ 	iq = (struct iter_qstate*)qstate->minfo[id];
+ 	if(iq) {
+ 		outbound_list_clear(&iq->outlist);
++		target_count_store(qstate, iq);
+ 		if(iq->target_count && --iq->target_count[TARGET_COUNT_REF] == 0) {
+ 			free(iq->target_count);
+ 			if(*iq->nxns_dp) free(*iq->nxns_dp);
+diff --git a/util/module.h b/util/module.h
+index edce4a523..b13b8de2f 100644
+--- a/util/module.h
++++ b/util/module.h
+@@ -712,6 +712,12 @@ struct module_qstate {
+ 
+ 	/** whether the reply should be dropped */
+ 	int is_drop;
++	/** the global quota that was reached, by one of the modules.
++	 * So that continued counting can go on from that point. */
++	int global_quota_reached;
++	/** the global quota that a query started with, it is a subquery,
++	 * so that calling mesh states can see the increase. */
++	int global_quota_started;
+ };
+ 
+ /** 
+diff --git a/validator/validator.c b/validator/validator.c
+index 68c4bf643..c9896e4fb 100644
+--- a/validator/validator.c
++++ b/validator/validator.c
+@@ -517,6 +517,14 @@ generate_request(struct module_qstate* qstate, int id, uint8_t* name,
+ 		/* add our blacklist to the query blacklist */
+ 		sock_list_merge(&(*newq)->blacklist, (*newq)->region,
+ 			vq->chain_blacklist);
++		/* start its global quota counter where this one is. */
++		if(qstate->global_quota_reached >
++			(*newq)->global_quota_reached) {
++			(*newq)->global_quota_started =
++				qstate->global_quota_reached;
++			(*newq)->global_quota_reached =
++				qstate->global_quota_reached;
++		}
+ 	}
+ 	qstate->ext_state[id] = module_wait_subquery;
+ 	return 1;
+@@ -3476,6 +3484,11 @@ val_inform_super(struct module_qstate* qstate, int id,
+ 		verbose(VERB_ALGO, "super: has no validator state");
+ 		return;
+ 	}
++	/* Pick up the global quota limit from the subquery. */
++	if(qstate->global_quota_reached > qstate->global_quota_started) {
++		super->global_quota_reached += qstate->global_quota_reached -
++			qstate->global_quota_started;
++	}
+ 	if(vq->wait_prime_ta) {
+ 		vq->wait_prime_ta = 0;
+ 		process_prime_response(super, vq, id, qstate->return_rcode,
meta-networking/recipes-support/unbound/unbound_1.24.2.bb +1 -0
index 6cae8632ae..28214dea19 100644
@@ -28,6 +28,7 @@ SRC_URI = "git://github.com/NLnetLabs/unbound.git;protocol=https;branch=master;t
            file://CVE-2026-42955.patch \
            file://CVE-2026-44621.patch \
            file://CVE-2026-44687.patch \
+           file://CVE-2026-50045.patch \
            "
 
 SRCREV = "f6269baa605d31859f28770e01a24e3677e5f82c"
#18 lore raw

PATCH 19/32 unbound: patch CVE-2026-50046

In reply to [email protected]

From: Ankur Tyagi <[email protected]>

Details:
https://nvd.nist.gov/vuln/detail/cve-2026-50046

---
 .../unbound/unbound/CVE-2026-50046.patch      | 61 +++++++++++++++++++
 .../recipes-support/unbound/unbound_1.24.2.bb |  1 +
 2 files changed, 62 insertions(+)
 create mode 100644 meta-networking/recipes-support/unbound/unbound/CVE-2026-50046.patch
meta-networking/recipes-support/unbound/unbound/CVE-2026-50046.patch new file +61 -0
new file mode 100644
index 0000000000..018a61cf54
@@ -0,0 +1,61 @@
+From 513f5e4be89d3b139605dfc31c3fb3728f25be2a Mon Sep 17 00:00:00 2001
+From: "W.C.A. Wijngaards" <[email protected]>
+Date: Wed, 22 Jul 2026 10:13:36 +0200
+Subject: [PATCH] - Fix CVE-2026-50046, Possible heap use-after-free in an
+ error path   when a DoT forwarded query is jostled out. Thanks to Qifan
+ Zhang,   Palo Alto Networks, for the report.
+
+(cherry picked from commit 1ad8d4c39594dcb28d636fb4922737a3640c9a65)
+
+CVE: CVE-2026-50046
+Upstream-Status: Backport [https://github.com/NLnetLabs/unbound/commit/1ad8d4c39594dcb28d636fb4922737a3640c9a65]
+
+Signed-off-by: Ankur Tyagi <[email protected]>
+---
+ services/outside_network.c | 12 +++++++++++-
+ services/outside_network.h |  2 +-
+ 2 files changed, 12 insertions(+), 2 deletions(-)
+
+diff --git a/services/outside_network.c b/services/outside_network.c
+index 2b7f7d0a2..bc65d36f7 100644
+--- a/services/outside_network.c
++++ b/services/outside_network.c
+@@ -195,6 +195,7 @@ static void
+ waiting_tcp_delete(struct waiting_tcp* w)
+ {
+ 	if(!w) return;
++	free(w->tls_auth_name);
+ 	if(w->timer)
+ 		comm_timer_delete(w->timer);
+ 	free(w);
+@@ -2489,7 +2490,16 @@ pending_tcp_query(struct serviced_query* sq, sldns_buffer* packet,
+ 	w->cb = callback;
+ 	w->cb_arg = callback_arg;
+ 	w->ssl_upstream = sq->ssl_upstream;
+-	w->tls_auth_name = sq->tls_auth_name;
++	if(sq->tls_auth_name) {
++		w->tls_auth_name = strdup(sq->tls_auth_name);
++		if(!w->tls_auth_name) {
++			comm_timer_delete(w->timer);
++			free(w);
++			return NULL;
++		}
++	} else {
++		w->tls_auth_name = NULL;
++	}
+ 	w->timeout = timeout;
+ 	w->id_node.key = NULL;
+ 	w->write_wait_prev = NULL;
+diff --git a/services/outside_network.h b/services/outside_network.h
+index 0a77e3388..81ebfe3e2 100644
+--- a/services/outside_network.h
++++ b/services/outside_network.h
+@@ -412,7 +412,7 @@ struct waiting_tcp {
+ 	void* cb_arg;
+ 	/** if it uses ssl upstream */
+ 	int ssl_upstream;
+-	/** ref to the tls_auth_name from the serviced_query */
++	/** owned copy of the tls_auth_name (malloced) */
+ 	char* tls_auth_name;
+ 	/** the packet was involved in an error, to stop looping errors */
+ 	int error_count;
meta-networking/recipes-support/unbound/unbound_1.24.2.bb +1 -0
index 28214dea19..cc380f6ae0 100644
@@ -29,6 +29,7 @@ SRC_URI = "git://github.com/NLnetLabs/unbound.git;protocol=https;branch=master;t
            file://CVE-2026-44621.patch \
            file://CVE-2026-44687.patch \
            file://CVE-2026-50045.patch \
+           file://CVE-2026-50046.patch \
            "
 
 SRCREV = "f6269baa605d31859f28770e01a24e3677e5f82c"
#19 lore raw

PATCH 20/32 unbound: patch CVE-2026-50243

In reply to [email protected]

From: Ankur Tyagi <[email protected]>

Details:
https://nvd.nist.gov/vuln/detail/cve-2026-50243

---
 .../unbound/unbound/CVE-2026-50243.patch      | 36 +++++++++++++++++++
 .../recipes-support/unbound/unbound_1.24.2.bb |  1 +
 2 files changed, 37 insertions(+)
 create mode 100644 meta-networking/recipes-support/unbound/unbound/CVE-2026-50243.patch
meta-networking/recipes-support/unbound/unbound/CVE-2026-50243.patch new file +36 -0
new file mode 100644
index 0000000000..761bc9687a
@@ -0,0 +1,36 @@
+From 793f66cb3c63357bd610690151a4859b159f7f5e Mon Sep 17 00:00:00 2001
+From: "W.C.A. Wijngaards" <[email protected]>
+Date: Wed, 22 Jul 2026 10:14:04 +0200
+Subject: [PATCH] - Fix CVE-2026-50243, 'response-ip'/'rpz' can rewrite BOGUS
+ answers   instead of returning SERVFAIL. Thanks to Qifan Zhang, Palo Alto  
+ Networks, for the report.
+
+(cherry picked from commit 02b16de1ae40e43a3e3804e98ab9868da33d72eb)
+
+CVE: CVE-2026-50243
+Upstream-Status: Backport [https://github.com/NLnetLabs/unbound/commit/02b16de1ae40e43a3e3804e98ab9868da33d72eb]
+
+Signed-off-by: Ankur Tyagi <[email protected]>
+---
+ respip/respip.c | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/respip/respip.c b/respip/respip.c
+index 353a0fd78..346f84feb 100644
+--- a/respip/respip.c
++++ b/respip/respip.c
+@@ -1110,7 +1110,13 @@ respip_operate(struct module_qstate* qstate, enum module_ev event, int id,
+ 		if((qstate->qinfo.qtype == LDNS_RR_TYPE_A ||
+ 			qstate->qinfo.qtype == LDNS_RR_TYPE_AAAA ||
+ 			qstate->qinfo.qtype == LDNS_RR_TYPE_ANY) &&
+-			qstate->return_msg && qstate->return_msg->rep) {
++			qstate->return_msg && qstate->return_msg->rep &&
++			!(qstate->env->need_to_validate &&
++			  (!(qstate->query_flags & BIT_CD)
++			    || qstate->env->cfg->ignore_cd) &&
++			  (qstate->return_msg->rep->security <= sec_status_bogus
++			    || qstate->return_msg->rep->security ==
++			    sec_status_secure_sentinel_fail))) {
+ 			struct reply_info* new_rep = qstate->return_msg->rep;
+ 			struct ub_packed_rrset_key* alias_rrset = NULL;
+ 			struct respip_action_info actinfo = {0, 0, 0, 0, NULL, 0, NULL};
meta-networking/recipes-support/unbound/unbound_1.24.2.bb +1 -0
index cc380f6ae0..68d81fc551 100644
@@ -30,6 +30,7 @@ SRC_URI = "git://github.com/NLnetLabs/unbound.git;protocol=https;branch=master;t
            file://CVE-2026-44687.patch \
            file://CVE-2026-50045.patch \
            file://CVE-2026-50046.patch \
+           file://CVE-2026-50243.patch \
            "
 
 SRCREV = "f6269baa605d31859f28770e01a24e3677e5f82c"
#20 lore raw

PATCH 21/32 unbound: patch CVE-2026-50248

In reply to [email protected]

From: Ankur Tyagi <[email protected]>

Details:
https://nvd.nist.gov/vuln/detail/cve-2026-50248

---
 .../unbound/unbound/CVE-2026-50248.patch      | 77 +++++++++++++++++++
 .../recipes-support/unbound/unbound_1.24.2.bb |  1 +
 2 files changed, 78 insertions(+)
 create mode 100644 meta-networking/recipes-support/unbound/unbound/CVE-2026-50248.patch
meta-networking/recipes-support/unbound/unbound/CVE-2026-50248.patch new file +77 -0
new file mode 100644
index 0000000000..04a63d4f48
@@ -0,0 +1,77 @@
+From ad27c1762cd00df8b808925ab240fc4c0766c228 Mon Sep 17 00:00:00 2001
+From: "W.C.A. Wijngaards" <[email protected]>
+Date: Wed, 22 Jul 2026 10:14:35 +0200
+Subject: [PATCH] - Fix CVE-2026-50248, BOGUS configured primary hostname
+ accepted for   XFR in auth/rpz zones. Thanks to Qifan Zhang, Palo Alto
+ Networks,   for the report.
+
+(cherry picked from commit 3530c81e29e64ed19c612ae3dea21c8800d882e1)
+
+CVE: CVE-2026-50248
+Upstream-Status: Backport [https://github.com/NLnetLabs/unbound/commit/3530c81e29e64ed19c612ae3dea21c8800d882e1]
+
+Signed-off-by: Ankur Tyagi <[email protected]>
+---
+ services/authzone.c | 28 ++++++++++++++++++++++------
+ 1 file changed, 22 insertions(+), 6 deletions(-)
+
+diff --git a/services/authzone.c b/services/authzone.c
+index 60ccc8698..357c1c590 100644
+--- a/services/authzone.c
++++ b/services/authzone.c
+@@ -5693,8 +5693,7 @@ xfr_master_add_addrs(struct auth_master* m, struct ub_packed_rrset_key* rrset,
+ 
+ /** callback for task_transfer lookup of host name, of A or AAAA */
+ void auth_xfer_transfer_lookup_callback(void* arg, int rcode, sldns_buffer* buf,
+-	enum sec_status ATTR_UNUSED(sec), char* ATTR_UNUSED(why_bogus),
+-	int ATTR_UNUSED(was_ratelimited))
++	enum sec_status sec, char* why_bogus, int ATTR_UNUSED(was_ratelimited))
+ {
+ 	struct auth_xfer* xfr = (struct auth_xfer*)arg;
+ 	struct module_env* env;
+@@ -5707,7 +5706,16 @@ void auth_xfer_transfer_lookup_callback(void* arg, int rcode, sldns_buffer* buf,
+ 	}
+ 
+ 	/* process result */
+-	if(rcode == LDNS_RCODE_NOERROR) {
++	if(sec == sec_status_bogus || sec == sec_status_secure_sentinel_fail) {
++		if(verbosity >= VERB_OPS) {
++			char zname[LDNS_MAX_DOMAINLEN];
++			dname_str(xfr->name, zname);
++			verbose(VERB_OPS, "auth zone %s: primary %s address lookup is DNSSEC bogus: %s",
++				zname, xfr->task_transfer->lookup_target->host,
++				(why_bogus?why_bogus:""));
++		}
++		/* fall through to next-lookup / next-master */
++	} else if(rcode == LDNS_RCODE_NOERROR) {
+ 		uint16_t wanted_qtype = LDNS_RR_TYPE_A;
+ 		struct regional* temp = env->scratch;
+ 		struct query_info rq;
+@@ -6756,8 +6764,7 @@ xfr_probe_send_or_end(struct auth_xfer* xfr, struct module_env* env)
+ 
+ /** callback for task_probe lookup of host name, of A or AAAA */
+ void auth_xfer_probe_lookup_callback(void* arg, int rcode, sldns_buffer* buf,
+-	enum sec_status ATTR_UNUSED(sec), char* ATTR_UNUSED(why_bogus),
+-	int ATTR_UNUSED(was_ratelimited))
++	enum sec_status sec, char* why_bogus, int ATTR_UNUSED(was_ratelimited))
+ {
+ 	struct auth_xfer* xfr = (struct auth_xfer*)arg;
+ 	struct module_env* env;
+@@ -6770,7 +6777,16 @@ void auth_xfer_probe_lookup_callback(void* arg, int rcode, sldns_buffer* buf,
+ 	}
+ 
+ 	/* process result */
+-	if(rcode == LDNS_RCODE_NOERROR) {
++	if(sec == sec_status_bogus || sec == sec_status_secure_sentinel_fail) {
++		if(verbosity >= VERB_OPS) {
++			char zname[LDNS_MAX_DOMAINLEN];
++			dname_str(xfr->name, zname);
++			verbose(VERB_OPS, "auth zone %s: primary %s address probe lookup is DNSSEC bogus: %s",
++				zname, xfr->task_transfer->lookup_target->host,
++				(why_bogus?why_bogus:""));
++		}
++		/* fall through to next-lookup / next-master */
++	} else if(rcode == LDNS_RCODE_NOERROR) {
+ 		uint16_t wanted_qtype = LDNS_RR_TYPE_A;
+ 		struct regional* temp = env->scratch;
+ 		struct query_info rq;
meta-networking/recipes-support/unbound/unbound_1.24.2.bb +1 -0
index 68d81fc551..b6b6ecef33 100644
@@ -31,6 +31,7 @@ SRC_URI = "git://github.com/NLnetLabs/unbound.git;protocol=https;branch=master;t
            file://CVE-2026-50045.patch \
            file://CVE-2026-50046.patch \
            file://CVE-2026-50243.patch \
+           file://CVE-2026-50248.patch \
            "
 
 SRCREV = "f6269baa605d31859f28770e01a24e3677e5f82c"
#21 lore raw

PATCH 22/32 unbound: patch CVE-2026-50251

In reply to [email protected]

From: Ankur Tyagi <[email protected]>

Details:
https://nvd.nist.gov/vuln/detail/cve-2026-50251

---
 .../unbound/unbound/CVE-2026-50251.patch      | 72 +++++++++++++++++++
 .../recipes-support/unbound/unbound_1.24.2.bb |  1 +
 2 files changed, 73 insertions(+)
 create mode 100644 meta-networking/recipes-support/unbound/unbound/CVE-2026-50251.patch
meta-networking/recipes-support/unbound/unbound/CVE-2026-50251.patch new file +72 -0
new file mode 100644
index 0000000000..5800ea8572
@@ -0,0 +1,72 @@
+From 2a514d577f035b1473d34201290be4394c732ff7 Mon Sep 17 00:00:00 2001
+From: "W.C.A. Wijngaards" <[email protected]>
+Date: Wed, 22 Jul 2026 10:15:02 +0200
+Subject: [PATCH] - Fix CVE-2026-50251, Attacker supplied `0.0.0.0`/`::` glue
+ triggers   defensive full-cache flush. Thanks to Qifan Zhang, Palo Alto  
+ Networks, for the report.
+
+(cherry picked from commit e180b06298d8d39a764d3c5d4d4aca472c3a97d7)
+
+CVE: CVE-2026-50251
+Upstream-Status: Backport [https://github.com/NLnetLabs/unbound/commit/e180b06298d8d39a764d3c5d4d4aca472c3a97d7]
+
+Signed-off-by: Ankur Tyagi <[email protected]>
+---
+ doc/unbound.conf.rst             |  7 +++++++
+ iterator/iter_donotq.c           | 12 ++++++++++++
+ testdata/dns_error_reporting.rpl |  1 +
+ 3 files changed, 20 insertions(+)
+
+diff --git a/doc/unbound.conf.rst b/doc/unbound.conf.rst
+index d83816c6f..ca96a4411 100644
+--- a/doc/unbound.conf.rst
++++ b/doc/unbound.conf.rst
+@@ -1954,6 +1954,13 @@ These options are part of the **server:** clause.
+     flushing away any poison.
+     A value of 10 million is suggested.
+ 
++    It is useful to add 0.0.0.0/8 and '::' to the
++    :ref:`do-not-query-address<unbound.conf.do-not-query-address>` list.
++    Otherwise they may be answered, from localhost, and the different source
++    makes an unwanted reply that unnecessarily ticks up.
++    The :ref:`do-not-query-localhost<unbound.conf.do-not-query-localhost>`
++    option includes them, the zero subnets, when it is enabled.
++
+     Default: 0 (disabled)
+ 
+ 
+diff --git a/iterator/iter_donotq.c b/iterator/iter_donotq.c
+index 40ffb45c4..7eecf1354 100644
+--- a/iterator/iter_donotq.c
++++ b/iterator/iter_donotq.c
+@@ -132,6 +132,18 @@ donotq_apply_cfg(struct iter_donotq* dq, struct config_file* cfg)
+ 		if(cfg->do_ip6) {
+ 			if(!donotq_str_cfg(dq, "::1"))
+ 				return 0;
++			if(!donotq_str_cfg(dq, "::ffff:127.0.0.0/104"))
++				return 0;
++		}
++		/* RFC 1122 3.2.1.3 / RFC 6890 / RFC 4291 2.5.2: not valid as
++		 * destination; on Linux these route to the local host. */
++		if(!donotq_str_cfg(dq, "0.0.0.0/8"))
++			return 0;
++		if(cfg->do_ip6) {
++			if(!donotq_str_cfg(dq, "::"))
++				return 0;
++			if(!donotq_str_cfg(dq, "::ffff:0:0/96"))
++				return 0;
+ 		}
+ 	}
+ 	addr_tree_init_parents(&dq->tree);
+diff --git a/testdata/dns_error_reporting.rpl b/testdata/dns_error_reporting.rpl
+index f1fac12a2..22175cade 100644
+--- a/testdata/dns_error_reporting.rpl
++++ b/testdata/dns_error_reporting.rpl
+@@ -12,6 +12,7 @@ server:
+ 	ede: no  # It is not needed for dns-error-reporting; only for clients to receive EDEs
+ 	dns-error-reporting: yes
+ 	do-ip6: no
++	do-not-query-localhost: no
+ 
+ stub-zone:
+ 	name: domain
meta-networking/recipes-support/unbound/unbound_1.24.2.bb +1 -0
index b6b6ecef33..0a511f767e 100644
@@ -32,6 +32,7 @@ SRC_URI = "git://github.com/NLnetLabs/unbound.git;protocol=https;branch=master;t
            file://CVE-2026-50046.patch \
            file://CVE-2026-50243.patch \
            file://CVE-2026-50248.patch \
+           file://CVE-2026-50251.patch \
            "
 
 SRCREV = "f6269baa605d31859f28770e01a24e3677e5f82c"
#22 lore raw

PATCH 23/32 unbound: patch CVE-2026-50252

In reply to [email protected]

From: Ankur Tyagi <[email protected]>

Details:
https://nvd.nist.gov/vuln/detail/cve-2026-50252

---
 .../unbound/unbound/CVE-2026-50252.patch      | 1294 +++++++++++++++++
 .../recipes-support/unbound/unbound_1.24.2.bb |    1 +
 2 files changed, 1295 insertions(+)
 create mode 100644 meta-networking/recipes-support/unbound/unbound/CVE-2026-50252.patch
meta-networking/recipes-support/unbound/unbound/CVE-2026-50252.patch new file +1294 -0
new file mode 100644
index 0000000000..4e31d1050f
@@ -0,0 +1,1294 @@
+From b1570f42273537ca1d12da0e7c15e66070ebaa68 Mon Sep 17 00:00:00 2001
+From: "W.C.A. Wijngaards" <[email protected]>
+Date: Wed, 22 Jul 2026 10:15:31 +0200
+Subject: [PATCH] - Fix CVE-2026-50252, Possible cache poisoning attack by
+ mapping   source port population per thread. Thanks to Inbal Schussheim and  
+ Amit Klein, Hebrew University, for the report.
+
+(cherry picked from commit 804cff4c152a121961b04605f75132370fc80df4)
+
+CVE: CVE-2026-50252
+Upstream-Status: Backport [https://github.com/NLnetLabs/unbound/commit/804cff4c152a121961b04605f75132370fc80df4]
+
+Signed-off-by: Ankur Tyagi <[email protected]>
+---
+ daemon/daemon.c            |  12 +-
+ daemon/daemon.h            |   3 +
+ daemon/worker.c            |  15 +-
+ daemon/worker.h            |   8 +-
+ libunbound/libworker.c     |  13 +-
+ libunbound/libworker.h     |   3 +
+ services/outside_network.c | 376 ++++++++++++++++++++++++++++++-------
+ services/outside_network.h | 105 ++++++++++-
+ testcode/fake_event.c      |  21 ++-
+ testcode/unittcpreuse.c    | 276 +++++++++++++++++++++++++++
+ 10 files changed, 728 insertions(+), 104 deletions(-)
+
+diff --git a/daemon/daemon.c b/daemon/daemon.c
+index f882bb9ad..a2f1ec7d4 100644
+--- a/daemon/daemon.c
++++ b/daemon/daemon.c
+@@ -79,6 +79,7 @@
+ #include "util/tcp_conn_limit.h"
+ #include "util/edns.h"
+ #include "services/listen_dnsport.h"
++#include "services/outside_network.h"
+ #include "services/cache/rrset.h"
+ #include "services/cache/infra.h"
+ #include "services/localzone.h"
+@@ -556,6 +557,10 @@ daemon_create_workers(struct daemon* daemon)
+ 		fatal_exit("out of memory during daemon init");
+ 	numport = daemon_get_shufport(daemon, shufport);
+ 	verbose(VERB_ALGO, "total of %d outgoing ports available", numport);
++	if(!(daemon->shared_ports = shared_ports_create(daemon->cfg->out_ifs,
++		daemon->cfg->num_out_ifs, daemon->cfg->do_ip4,
++		daemon->cfg->do_ip6, shufport, numport)))
++		fatal_exit("could not setup shared ports: out of memory");
+ 
+ #ifdef HAVE_NGTCP2
+ 	daemon->doq_table = doq_table_create(daemon->cfg, daemon->rand);
+@@ -584,10 +589,7 @@ daemon_create_workers(struct daemon* daemon)
+ #endif
+ 	}
+ 	for(i=0; i<daemon->num; i++) {
+-		if(!(daemon->workers[i] = worker_create(daemon, i,
+-			shufport+numport*i/daemon->num, 
+-			numport*(i+1)/daemon->num - numport*i/daemon->num)))
+-			/* the above is not ports/numthr, due to rounding */
++		if(!(daemon->workers[i] = worker_create(daemon, i)))
+ 			fatal_exit("could not create worker");
+ 	}
+ 	/* create per-worker alloc caches if not reusing existing ones. */
+@@ -908,6 +910,8 @@ daemon_cleanup(struct daemon* daemon)
+ 	if(!daemon->reuse_cache || daemon->need_to_exit)
+ 		daemon_clear_allocs(daemon);
+ 	daemon->num = 0;
++	shared_ports_delete(daemon->shared_ports);
++	daemon->shared_ports = NULL;
+ #ifdef USE_DNSTAP
+ 	dt_delete(daemon->dtenv);
+ 	daemon->dtenv = NULL;
+diff --git a/daemon/daemon.h b/daemon/daemon.h
+index 2295761ab..fb7c9f373 100644
+--- a/daemon/daemon.h
++++ b/daemon/daemon.h
+@@ -62,6 +62,7 @@ struct doq_table;
+ struct cookie_secrets;
+ struct fast_reload_thread;
+ struct fast_reload_printq;
++struct shared_ports;
+ 
+ #include "dnstap/dnstap_config.h"
+ #ifdef USE_DNSTAP
+@@ -97,6 +98,8 @@ struct daemon {
+ 	int rc_port;
+ 	/** listening ports for remote control */
+ 	struct listen_port* rc_ports;
++	/** the shared ports structure, with random ports numbers. */
++	struct shared_ports* shared_ports;
+ 	/** remote control connections management (for first worker) */
+ 	struct daemon_remote* rc;
+ 	/** ssl context for listening to dnstcp over ssl */
+diff --git a/daemon/worker.c b/daemon/worker.c
+index b9fac0406..36ccff859 100644
+--- a/daemon/worker.c
++++ b/daemon/worker.c
+@@ -2144,23 +2144,16 @@ void worker_probe_timer_cb(void* arg)
+ }
+ 
+ struct worker*
+-worker_create(struct daemon* daemon, int id, int* ports, int n)
++worker_create(struct daemon* daemon, int id)
+ {
+ 	unsigned int seed;
+ 	struct worker* worker = (struct worker*)calloc(1,
+ 		sizeof(struct worker));
+ 	if(!worker)
+ 		return NULL;
+-	worker->numports = n;
+-	worker->ports = (int*)memdup(ports, sizeof(int)*n);
+-	if(!worker->ports) {
+-		free(worker);
+-		return NULL;
+-	}
+ 	worker->daemon = daemon;
+ 	worker->thread_num = id;
+ 	if(!(worker->cmd = tube_create())) {
+-		free(worker->ports);
+ 		free(worker);
+ 		return NULL;
+ 	}
+@@ -2168,7 +2161,6 @@ worker_create(struct daemon* daemon, int id, int* ports, int n)
+ 	if(!(worker->rndstate = ub_initstate(daemon->rand))) {
+ 		log_err("could not init random numbers.");
+ 		tube_delete(worker->cmd);
+-		free(worker->ports);
+ 		free(worker);
+ 		return NULL;
+ 	}
+@@ -2270,14 +2262,14 @@ worker_init(struct worker* worker, struct config_file *cfg,
+ 		cfg->out_ifs, cfg->num_out_ifs, cfg->do_ip4, cfg->do_ip6,
+ 		cfg->do_tcp?cfg->outgoing_num_tcp:0, cfg->ip_dscp,
+ 		worker->daemon->env->infra_cache, worker->rndstate,
+-		cfg->use_caps_bits_for_id, worker->ports, worker->numports,
++		cfg->use_caps_bits_for_id,
+ 		cfg->unwanted_threshold, cfg->outgoing_tcp_mss,
+ 		&worker_alloc_cleanup, worker,
+ 		cfg->do_udp || cfg->udp_upstream_without_downstream,
+ 		worker->daemon->connect_dot_sslctx, cfg->delay_close,
+ 		cfg->tls_use_sni, dtenv, cfg->udp_connect,
+ 		cfg->max_reuse_tcp_queries, cfg->tcp_reuse_timeout,
+-		cfg->tcp_auth_query_timeout);
++		cfg->tcp_auth_query_timeout, worker->daemon->shared_ports);
+ 	if(!worker->back) {
+ 		log_err("could not create outgoing sockets");
+ 		worker_delete(worker);
+@@ -2428,7 +2420,6 @@ worker_delete(struct worker* worker)
+ 	tube_delete(worker->cmd);
+ 	comm_timer_delete(worker->stat_timer);
+ 	comm_timer_delete(worker->env.probe_timer);
+-	free(worker->ports);
+ 	if(worker->thread_num == 0) {
+ #ifdef UB_ON_WINDOWS
+ 		wsvc_desetup_worker(worker);
+diff --git a/daemon/worker.h b/daemon/worker.h
+index b7bb52fd7..37f3728ef 100644
+--- a/daemon/worker.h
++++ b/daemon/worker.h
+@@ -104,10 +104,6 @@ struct worker {
+ 	struct listen_dnsport* front;
+ 	/** the backside outside network interface to the auth servers */
+ 	struct outside_network* back;
+-	/** ports to be used by this worker. */
+-	int* ports;
+-	/** number of ports for this worker */
+-	int numports;
+ 	/** the signal handler */
+ 	struct comm_signal* comsig;
+ 	/** commpoint to listen to commands. */
+@@ -146,11 +142,9 @@ struct worker {
+  * with backpointers only. Use worker_init on it later.
+  * @param daemon: the daemon that this worker thread is part of.
+  * @param id: the thread number from 0.. numthreads-1.
+- * @param ports: the ports it is allowed to use, array.
+- * @param n: the number of ports.
+  * @return: the new worker or NULL on alloc failure.
+  */
+-struct worker* worker_create(struct daemon* daemon, int id, int* ports, int n);
++struct worker* worker_create(struct daemon* daemon, int id);
+ 
+ /**
+  * Initialize worker.
+diff --git a/libunbound/libworker.c b/libunbound/libworker.c
+index 6e7244c03..d70527f59 100644
+--- a/libunbound/libworker.c
++++ b/libunbound/libworker.c
+@@ -105,6 +105,7 @@ libworker_delete_env(struct libworker* w)
+ 	SSL_CTX_free(w->sslctx);
+ #endif
+ 	outside_network_delete(w->back);
++	shared_ports_delete(w->shared_ports);
+ }
+ 
+ /** delete libworker struct */
+@@ -219,17 +220,25 @@ libworker_setup(struct ub_ctx* ctx, int is_bg, struct ub_event_base* eb)
+ 		libworker_delete(w);
+ 		return NULL;
+ 	}
++	if(!(w->shared_ports = shared_ports_create(cfg->out_ifs,
++		cfg->num_out_ifs, cfg->do_ip4, cfg->do_ip6, ports, numports))) {
++		if(!w->is_bg || w->is_bg_thread) {
++			lock_basic_unlock(&ctx->cfglock);
++		}
++		libworker_delete(w);
++		return NULL;
++	}
+ 	w->back = outside_network_create(w->base, cfg->msg_buffer_size,
+ 		(size_t)cfg->outgoing_num_ports, cfg->out_ifs,
+ 		cfg->num_out_ifs, cfg->do_ip4, cfg->do_ip6, 
+ 		cfg->do_tcp?cfg->outgoing_num_tcp:0, cfg->ip_dscp,
+ 		w->env->infra_cache, w->env->rnd, cfg->use_caps_bits_for_id,
+-		ports, numports, cfg->unwanted_threshold,
++		cfg->unwanted_threshold,
+ 		cfg->outgoing_tcp_mss, &libworker_alloc_cleanup, w,
+ 		cfg->do_udp || cfg->udp_upstream_without_downstream, w->sslctx,
+ 		cfg->delay_close, cfg->tls_use_sni, NULL, cfg->udp_connect,
+ 		cfg->max_reuse_tcp_queries, cfg->tcp_reuse_timeout,
+-		cfg->tcp_auth_query_timeout);
++		cfg->tcp_auth_query_timeout, w->shared_ports);
+ 	w->env->outnet = w->back;
+ 	if(!w->is_bg || w->is_bg_thread) {
+ 		lock_basic_unlock(&ctx->cfglock);
+diff --git a/libunbound/libworker.h b/libunbound/libworker.h
+index 42aa5bae3..f527cb093 100644
+--- a/libunbound/libworker.h
++++ b/libunbound/libworker.h
+@@ -60,6 +60,7 @@ struct tube;
+ struct sldns_buffer;
+ struct ub_event_base;
+ struct query_info;
++struct shared_ports;
+ 
+ /** 
+  * The library-worker status structure
+@@ -84,6 +85,8 @@ struct libworker {
+ 	struct comm_base* base;
+ 	/** the backside outside network interface to the auth servers */
+ 	struct outside_network* back;
++	/** shared ports structure */
++	struct shared_ports* shared_ports;
+ 	/** random() table for this worker. */
+ 	struct ub_randstate* rndstate;
+ 	/** sslcontext for SSL wrapped DNS over TCP queries */
+diff --git a/services/outside_network.c b/services/outside_network.c
+index bc65d36f7..140ebec1b 100644
+--- a/services/outside_network.c
++++ b/services/outside_network.c
+@@ -1434,7 +1434,7 @@ portcomm_loweruse(struct outside_network* outnet, struct port_comm* pc)
+ 	pif = pc->pif;
+ 	log_assert(pif->inuse > 0);
+ #ifndef DISABLE_EXPLICIT_PORT_RANDOMISATION
+-	pif->avail_ports[pif->avail_total - pif->inuse] = pc->number;
++	shared_ports_return_port(outnet->shared_ports, pif->shpif, pc->number);
+ #endif
+ 	pif->inuse--;
+ 	pif->out[pc->index] = pif->out[pif->inuse];
+@@ -1648,19 +1648,19 @@ create_pending_tcp(struct outside_network* outnet, size_t bufsize)
+ }
+ 
+ /** setup an outgoing interface, ready address */
+-static int setup_if(struct port_if* pif, const char* addrstr, 
+-	int* avail, int numavail, size_t numfd)
++static int setup_if(struct port_if* pif, const char* addrstr, size_t numfd,
++	struct shared_ports* shp)
+ {
+-#ifndef DISABLE_EXPLICIT_PORT_RANDOMISATION
+-	pif->avail_total = numavail;
+-	pif->avail_ports = (int*)memdup(avail, (size_t)numavail*sizeof(int));
+-	if(!pif->avail_ports)
+-		return 0;
+-#endif
+ 	if(!ipstrtoaddr(addrstr, UNBOUND_DNS_PORT, &pif->addr, &pif->addrlen) &&
+ 	   !netblockstrtoaddr(addrstr, UNBOUND_DNS_PORT,
+ 			      &pif->addr, &pif->addrlen, &pif->pfxlen))
+ 		return 0;
++#ifndef DISABLE_EXPLICIT_PORT_RANDOMISATION
++	pif->shpif = shared_ports_find_if(shp, &pif->addr, pif->addrlen,
++		pif->pfxlen);
++#else
++	(void)shp;
++#endif
+ 	pif->maxout = (int)numfd;
+ 	pif->inuse = 0;
+ 	pif->out = (struct port_comm**)calloc(numfd, 
+@@ -1674,12 +1674,12 @@ struct outside_network*
+ outside_network_create(struct comm_base *base, size_t bufsize, 
+ 	size_t num_ports, char** ifs, int num_ifs, int do_ip4, 
+ 	int do_ip6, size_t num_tcp, int dscp, struct infra_cache* infra,
+-	struct ub_randstate* rnd, int use_caps_for_id, int* availports, 
+-	int numavailports, size_t unwanted_threshold, int tcp_mss,
++	struct ub_randstate* rnd, int use_caps_for_id,
++	size_t unwanted_threshold, int tcp_mss,
+ 	void (*unwanted_action)(void*), void* unwanted_param, int do_udp,
+ 	void* sslctx, int delayclose, int tls_use_sni, struct dt_env* dtenv,
+ 	int udp_connect, int max_reuse_tcp_queries, int tcp_reuse_timeout,
+-	int tcp_auth_query_timeout)
++	int tcp_auth_query_timeout, struct shared_ports* shared_ports)
+ {
+ 	struct outside_network* outnet = (struct outside_network*)
+ 		calloc(1, sizeof(struct outside_network));
+@@ -1714,6 +1714,7 @@ outside_network_create(struct comm_base *base, size_t bufsize,
+ 	outnet->do_udp = do_udp;
+ 	outnet->tcp_mss = tcp_mss;
+ 	outnet->ip_dscp = dscp;
++	outnet->shared_ports = shared_ports;
+ #ifndef S_SPLINT_S
+ 	if(delayclose) {
+ 		outnet->delayclose = 1;
+@@ -1724,7 +1725,7 @@ outside_network_create(struct comm_base *base, size_t bufsize,
+ 	if(udp_connect) {
+ 		outnet->udp_connect = 1;
+ 	}
+-	if(numavailports == 0 || num_ports == 0) {
++	if(num_ports == 0) {
+ 		log_err("no outgoing ports available");
+ 		outside_network_delete(outnet);
+ 		return NULL;
+@@ -1785,13 +1786,13 @@ outside_network_create(struct comm_base *base, size_t bufsize,
+ 	/* allocate interfaces */
+ 	if(num_ifs == 0) {
+ 		if(do_ip4 && !setup_if(&outnet->ip4_ifs[0], "0.0.0.0", 
+-			availports, numavailports, num_ports)) {
++			num_ports, outnet->shared_ports)) {
+ 			log_err("malloc failed");
+ 			outside_network_delete(outnet);
+ 			return NULL;
+ 		}
+ 		if(do_ip6 && !setup_if(&outnet->ip6_ifs[0], "::", 
+-			availports, numavailports, num_ports)) {
++			num_ports, outnet->shared_ports)) {
+ 			log_err("malloc failed");
+ 			outside_network_delete(outnet);
+ 			return NULL;
+@@ -1802,7 +1803,7 @@ outside_network_create(struct comm_base *base, size_t bufsize,
+ 		for(i=0; i<num_ifs; i++) {
+ 			if(str_is_ip6(ifs[i]) && do_ip6) {
+ 				if(!setup_if(&outnet->ip6_ifs[done_6], ifs[i],
+-					availports, numavailports, num_ports)){
++					num_ports, outnet->shared_ports)){
+ 					log_err("malloc failed");
+ 					outside_network_delete(outnet);
+ 					return NULL;
+@@ -1811,7 +1812,7 @@ outside_network_create(struct comm_base *base, size_t bufsize,
+ 			}
+ 			if(!str_is_ip6(ifs[i]) && do_ip4) {
+ 				if(!setup_if(&outnet->ip4_ifs[done_4], ifs[i],
+-					availports, numavailports, num_ports)){
++					num_ports, outnet->shared_ports)){
+ 					log_err("malloc failed");
+ 					outside_network_delete(outnet);
+ 					return NULL;
+@@ -1889,9 +1890,6 @@ outside_network_delete(struct outside_network* outnet)
+ 				comm_point_delete(pc->cp);
+ 				free(pc);
+ 			}
+-#ifndef DISABLE_EXPLICIT_PORT_RANDOMISATION
+-			free(outnet->ip4_ifs[i].avail_ports);
+-#endif
+ 			free(outnet->ip4_ifs[i].out);
+ 		}
+ 		free(outnet->ip4_ifs);
+@@ -1905,9 +1903,6 @@ outside_network_delete(struct outside_network* outnet)
+ 				comm_point_delete(pc->cp);
+ 				free(pc);
+ 			}
+-#ifndef DISABLE_EXPLICIT_PORT_RANDOMISATION
+-			free(outnet->ip6_ifs[i].avail_ports);
+-#endif
+ 			free(outnet->ip6_ifs[i].out);
+ 		}
+ 		free(outnet->ip6_ifs);
+@@ -2113,7 +2108,10 @@ static int
+ select_ifport(struct outside_network* outnet, struct pending* pend,
+ 	int num_if, struct port_if* ifs)
+ {
+-	int my_if, my_port, fd, portno, inuse, tries=0;
++	int my_if, fd, portno, inuse, tries=0;
++#ifndef DISABLE_EXPLICIT_PORT_RANDOMISATION
++	int reused;
++#endif
+ 	struct port_if* pif;
+ 	/* randomly select interface and port */
+ 	if(num_if == 0) {
+@@ -2127,37 +2125,35 @@ select_ifport(struct outside_network* outnet, struct pending* pend,
+ 		my_if = ub_random_max(outnet->rnd, num_if);
+ 		pif = &ifs[my_if];
+ #ifndef DISABLE_EXPLICIT_PORT_RANDOMISATION
+-		if(outnet->udp_connect) {
+-			/* if we connect() we cannot reuse fds for a port */
+-			if(pif->inuse >= pif->avail_total) {
+-				tries++;
+-				if(tries < MAX_PORT_RETRY)
+-					continue;
+-				log_err("failed to find an open port, drop msg");
+-				return 0;
+-			}
+-			my_port = pif->inuse + ub_random_max(outnet->rnd,
+-				pif->avail_total - pif->inuse);
+-		} else  {
+-			my_port = ub_random_max(outnet->rnd, pif->avail_total);
+-			if(my_port < pif->inuse) {
+-				/* port already open */
+-				pend->pc = pif->out[my_port];
+-				verbose(VERB_ALGO, "using UDP if=%d port=%d",
+-					my_if, pend->pc->number);
+-				break;
+-			}
++		if(!shared_ports_fetch_random(outnet->shared_ports,
++			pif->shpif, outnet->rnd, outnet->udp_connect,
++			pif->inuse, &portno, &reused)) {
++			tries++;
++			if(tries < MAX_PORT_RETRY)
++				continue;
++			log_err("failed to find an open port, drop msg");
++			return 0;
++		}
++		if(reused) {
++			/* port already open */
++			log_assert(portno < pif->inuse);
++			pend->pc = pif->out[portno];
++			verbose(VERB_ALGO, "using UDP if=%d port=%d",
++				my_if, pend->pc->number);
++			break;
+ 		}
+-		/* try to open new port, if fails, loop to try again */
+-		log_assert(pif->inuse < pif->maxout);
+-		portno = pif->avail_ports[my_port - pif->inuse];
+ #else
+-		my_port = portno = 0;
++		portno = 0;
+ #endif
++		/* try to open new port, if fails, loop to try again */
+ 		fd = udp_sockport(&pif->addr, pif->addrlen, pif->pfxlen,
+ 			portno, &inuse, outnet->rnd, outnet->ip_dscp);
+ 		if(fd == -1 && !inuse) {
+ 			/* nonrecoverable error making socket */
++#ifndef DISABLE_EXPLICIT_PORT_RANDOMISATION
++			shared_ports_return_port(outnet->shared_ports,
++				pif->shpif, portno);
++#endif
+ 			return 0;
+ 		}
+ 		if(fd != -1) {
+@@ -2174,6 +2170,11 @@ select_ifport(struct outside_network* outnet, struct pending* pend,
+ 							pend->addrlen);
+ 					}
+ 					sock_close(fd);
++#ifndef DISABLE_EXPLICIT_PORT_RANDOMISATION
++					shared_ports_return_port(
++						outnet->shared_ports,
++						pif->shpif, portno);
++#endif
+ 					return 0;
+ 				}
+ 			}
+@@ -2191,14 +2192,14 @@ select_ifport(struct outside_network* outnet, struct pending* pend,
+ 
+ 			/* grab port in interface */
+ 			pif->out[pif->inuse] = pend->pc;
+-#ifndef DISABLE_EXPLICIT_PORT_RANDOMISATION
+-			pif->avail_ports[my_port - pif->inuse] =
+-				pif->avail_ports[pif->avail_total-pif->inuse-1];
+-#endif
+ 			pif->inuse++;
+ 			break;
+ 		}
+ 		/* failed, already in use */
++#ifndef DISABLE_EXPLICIT_PORT_RANDOMISATION
++		shared_ports_return_port(outnet->shared_ports, pif->shpif,
++			portno);
++#endif
+ 		verbose(VERB_QUERY, "port %d in use, trying another", portno);
+ 		tries++;
+ 		if(tries == MAX_PORT_RETRY) {
+@@ -3589,13 +3590,16 @@ fd_for_dest(struct outside_network* outnet, struct sockaddr_storage* to_addr,
+ {
+ 	struct sockaddr_storage* addr;
+ 	socklen_t addrlen;
+-	int i, try, pnum, dscp;
++	int i, try, dscp;
+ 	struct port_if* pif;
+ 
+ 	/* create fd */
+ 	dscp = outnet->ip_dscp;
+ 	for(try = 0; try<1000; try++) {
+ 		int port = 0;
++#ifndef DISABLE_EXPLICIT_PORT_RANDOMISATION
++		int reused = 0;
++#endif
+ 		int freebind = 0;
+ 		int noproto = 0;
+ 		int inuse = 0;
+@@ -3624,16 +3628,18 @@ fd_for_dest(struct outside_network* outnet, struct sockaddr_storage* to_addr,
+ 		addr = &pif->addr;
+ 		addrlen = pif->addrlen;
+ #ifndef DISABLE_EXPLICIT_PORT_RANDOMISATION
+-		pnum = ub_random_max(outnet->rnd, pif->avail_total);
+-		if(pnum < pif->inuse) {
+-			/* port already open */
+-			port = pif->out[pnum]->number;
+-		} else {
+-			/* unused ports in start part of array */
+-			port = pif->avail_ports[pnum - pif->inuse];
++		if(!shared_ports_fetch_random(outnet->shared_ports,
++			pif->shpif, outnet->rnd, 0, pif->inuse,
++			&port, &reused)) {
++			/* try again, perhaps another interface. */
++			continue;
++		}
++		if(reused) {
++			log_assert(port < pif->inuse);
++			port = pif->out[port]->number;
+ 		}
+ #else
+-		pnum = port = 0;
++		port = 0;
+ #endif
+ 		if(addr_is_ip6(to_addr, to_addrlen)) {
+ 			struct sockaddr_in6 sa = *(struct sockaddr_in6*)addr;
+@@ -3648,6 +3654,14 @@ fd_for_dest(struct outside_network* outnet, struct sockaddr_storage* to_addr,
+ 				(struct sockaddr*)addr, addrlen, 1, &inuse, &noproto,
+ 				0, 0, 0, NULL, 0, freebind, 0, dscp);
+ 		}
++#ifndef DISABLE_EXPLICIT_PORT_RANDOMISATION
++		if(!reused) {
++			/* Return the port to the pool, since the caller does
++			 * not keep track of it, also have done fd, and bind. */
++			shared_ports_return_port(outnet->shared_ports,
++				pif->shpif, port);
++		}
++#endif
+ 		if(fd != -1) {
+ 			return fd;
+ 		}
+@@ -3878,11 +3892,7 @@ if_get_mem(struct port_if* pif)
+ {
+ 	size_t s;
+ 	int i;
+-	s = sizeof(*pif) +
+-#ifndef DISABLE_EXPLICIT_PORT_RANDOMISATION
+-	    sizeof(int)*pif->avail_total +
+-#endif
+-		sizeof(struct port_comm*)*pif->maxout;
++	s = sizeof(*pif) + sizeof(struct port_comm*)*pif->maxout;
+ 	for(i=0; i<pif->inuse; i++)
+ 		s += sizeof(*pif->out[i]) + 
+ 			comm_point_get_mem(pif->out[i]->cp);
+@@ -3970,3 +3980,237 @@ serviced_get_mem(struct serviced_query* sq)
+ 	return s;
+ }
+ 
++#ifndef DISABLE_EXPLICIT_PORT_RANDOMISATION
++/** Setup shared port interface */
++static int shared_ports_setup_if(struct shared_ports_if* shpif, char* str,
++	int* availports, int numavailports)
++{
++	shpif->avail_ports = (int*)memdup(availports,
++		(size_t)numavailports*sizeof(int));
++	if(!shpif->avail_ports)
++		return 0;
++	shpif->avail_total = numavailports;
++	shpif->inuse = 0;
++	shpif->pfxlen = 0;
++	if(!ipstrtoaddr(str, UNBOUND_DNS_PORT, &shpif->addr, &shpif->addrlen) &&
++	   !netblockstrtoaddr(str, UNBOUND_DNS_PORT, &shpif->addr,
++	   &shpif->addrlen, &shpif->pfxlen))
++		return 0;
++	return 1;
++}
++#endif
++
++#ifndef DISABLE_EXPLICIT_PORT_RANDOMISATION
++/** Allocate shared ports interfaces */
++static int shared_ports_alloc_ifs(struct shared_ports* shp, char** ifs,
++	int num_ifs, int do_ip4, int do_ip6, int* availports,
++	int numavailports)
++{
++#ifndef INET6
++	do_ip6 = 0;
++#endif
++	calc_num46(ifs, num_ifs, do_ip4, do_ip6,
++		&shp->num_ip4, &shp->num_ip6);
++	if(shp->num_ip4 != 0) {
++		if(!(shp->ip4_ifs = (struct shared_ports_if*)calloc(
++			(size_t)shp->num_ip4,
++			sizeof(struct shared_ports_if))))
++			return 0;
++	}
++	if(shp->num_ip6 != 0) {
++		if(!(shp->ip6_ifs = (struct shared_ports_if*)calloc(
++			(size_t)shp->num_ip6,
++			sizeof(struct shared_ports_if))))
++			return 0;
++	}
++	if(num_ifs == 0) {
++		if(do_ip4 && !shared_ports_setup_if(&shp->ip4_ifs[0],
++			"0.0.0.0", availports, numavailports))
++			return 0;
++		if(do_ip6 && !shared_ports_setup_if(&shp->ip6_ifs[0],
++			"::", availports, numavailports))
++			return 0;
++	} else {
++		size_t done_4 = 0, done_6 = 0;
++		int i;
++		for(i=0; i<num_ifs; i++) {
++			if(str_is_ip6(ifs[i]) && do_ip6) {
++				if(!shared_ports_setup_if(&shp->ip6_ifs[done_6],
++					ifs[i], availports, numavailports))
++					return 0;
++				done_6++;
++			}
++			if(!str_is_ip6(ifs[i]) && do_ip4) {
++				if(!shared_ports_setup_if(&shp->ip4_ifs[done_4],
++					ifs[i], availports, numavailports))
++					return 0;
++				done_4++;
++			}
++		}
++	}
++	return 1;
++}
++#endif
++
++struct shared_ports* shared_ports_create(char** ifs, int num_ifs, int do_ip4,
++	int do_ip6, int* availports, int numavailports)
++{
++	struct shared_ports* shp = calloc(1, sizeof(*shp));
++	if(!shp) {
++		log_err("malloc failed");
++		return NULL;
++	}
++	lock_basic_init(&shp->lock);
++	lock_protect(&shp->lock, shp, sizeof(*shp));
++
++#ifndef DISABLE_EXPLICIT_PORT_RANDOMISATION
++	/* Allocate interfaces */
++	if(!shared_ports_alloc_ifs(shp, ifs, num_ifs, do_ip4, do_ip6,
++		availports, numavailports)) {
++		log_err("malloc failed");
++		shared_ports_delete(shp);
++		return NULL;
++	}
++#else
++	(void)ifs; (void)num_ifs; (void)do_ip4; (void)do_ip6;
++	(void)availports; (void)numavailports;
++#endif
++	return shp;
++}
++
++#ifndef DISABLE_EXPLICIT_PORT_RANDOMISATION
++/** Delete shared ports interface structure */
++static void shared_ports_if_delete(struct shared_ports_if* shpif)
++{
++	if(!shpif)
++		return;
++	free(shpif->avail_ports);
++}
++#endif
++
++void shared_ports_delete(struct shared_ports* shp)
++{
++#ifndef DISABLE_EXPLICIT_PORT_RANDOMISATION
++	int i;
++#endif
++	if(!shp)
++		return;
++	lock_basic_destroy(&shp->lock);
++#ifndef DISABLE_EXPLICIT_PORT_RANDOMISATION
++	for(i=0; i<shp->num_ip4; i++) {
++		shared_ports_if_delete(&shp->ip4_ifs[i]);
++	}
++	free(shp->ip4_ifs);
++	for(i=0; i<shp->num_ip6; i++) {
++		shared_ports_if_delete(&shp->ip6_ifs[i]);
++	}
++	free(shp->ip6_ifs);
++#endif
++	free(shp);
++}
++
++struct shared_ports_if* shared_ports_find_if(struct shared_ports* shp,
++	struct sockaddr_storage* addr, socklen_t addrlen, int pfxlen)
++{
++#ifndef DISABLE_EXPLICIT_PORT_RANDOMISATION
++	struct shared_ports_if* ret, *ifs = NULL;
++	int i, num_ifs = 0;
++	lock_basic_lock(&shp->lock);
++	if(addr_is_ip6(addr, addrlen)) {
++		ifs = shp->ip6_ifs;
++		num_ifs = shp->num_ip6;
++	} else {
++		ifs = shp->ip4_ifs;
++		num_ifs = shp->num_ip4;
++	}
++	for(i=0; i<num_ifs; i++) {
++		if(sockaddr_cmp(addr, addrlen, &ifs[i].addr,
++			ifs[i].addrlen) == 0
++			&& pfxlen == ifs[i].pfxlen) {
++			ret = &ifs[i];
++			lock_basic_unlock(&shp->lock);
++			return ret;
++		}
++	}
++	lock_basic_unlock(&shp->lock);
++	return NULL;
++#else
++	(void)shp; (void)addr; (void)addrlen; (void)pfxlen;
++	return NULL;
++#endif
++}
++
++int shared_ports_fetch_random(struct shared_ports* shp,
++	struct shared_ports_if* shpif, struct ub_randstate* rnd,
++	int udp_connect, int reusenum, int* port, int* reused)
++{
++#ifndef DISABLE_EXPLICIT_PORT_RANDOMISATION
++	int portno = 0, my_port = 0;
++	if(!shpif)
++		return 0;
++	lock_basic_lock(&shp->lock);
++	if(udp_connect) {
++		/* if we connect() we cannot reuse fds for a port. */
++		if(shpif->inuse >= shpif->avail_total) {
++			lock_basic_unlock(&shp->lock);
++			return 0;
++		}
++		my_port = ub_random_max(rnd,
++			shpif->avail_total - shpif->inuse);
++	} else {
++		/* select from free ports and open ports on this thread. */
++		if(shpif->inuse >= shpif->avail_total) {
++			lock_basic_unlock(&shp->lock);
++			if(reusenum == 0) {
++				return 0;
++			}
++			my_port = ub_random_max(rnd, reusenum);
++			*port = my_port;
++			*reused = 1;
++			return 1;
++		}
++		my_port = ub_random_max(rnd, shpif->avail_total - shpif->inuse
++			+ reusenum);
++		if(my_port < reusenum) {
++			/* port already open */
++			lock_basic_unlock(&shp->lock);
++			*port = my_port;
++			*reused = 1;
++			return 1;
++		}
++		my_port -= reusenum;
++	}
++	log_assert(shpif->inuse < shpif->avail_total);
++	log_assert(my_port >= 0 && my_port < shpif->avail_total);
++	portno = shpif->avail_ports[my_port];
++	shpif->avail_ports[my_port] =
++		shpif->avail_ports[shpif->avail_total-shpif->inuse-1];
++	shpif->inuse++;
++	lock_basic_unlock(&shp->lock);
++	*port = portno;
++	*reused = 0;
++	return 1;
++#else
++	(void)shp; (void)shpif; (void)rnd; (void)udp_connect;
++	(void)reusenum;
++	*port = 0;
++	*reused = 0;
++	return 1;
++#endif
++}
++
++void shared_ports_return_port(struct shared_ports* shp,
++	struct shared_ports_if* shpif, int port)
++{
++#ifndef DISABLE_EXPLICIT_PORT_RANDOMISATION
++	if(!shpif)
++		return;
++	lock_basic_lock(&shp->lock);
++	log_assert(shpif->inuse > 0);
++	shpif->avail_ports[shpif->avail_total - shpif->inuse] = port;
++	shpif->inuse--;
++	lock_basic_unlock(&shp->lock);
++#else
++	(void)shp; (void)shpif; (void)port;
++#endif
++}
+diff --git a/services/outside_network.h b/services/outside_network.h
+index 81ebfe3e2..e0095c49c 100644
+--- a/services/outside_network.h
++++ b/services/outside_network.h
+@@ -66,6 +66,8 @@ struct module_env;
+ struct module_qstate;
+ struct query_info;
+ struct config_file;
++struct shared_ports;
++struct shared_ports_if;
+ 
+ /**
+  * Send queries to outside servers and wait for answers from servers.
+@@ -115,6 +117,9 @@ struct outside_network {
+ 	int udp_connect;
+ 	/** number of udp packets sent. */
+ 	size_t num_udp_outgoing;
++	/** the shared ports structure, with random ports numbers.
++	 * This is a reference to the member in the daemon structure. */
++	struct shared_ports* shared_ports;
+ 
+ 	/** array of outgoing IP4 interfaces */
+ 	struct port_if* ip4_ifs;
+@@ -207,11 +212,8 @@ struct port_if {
+ 	int pfxlen;
+ 
+ #ifndef DISABLE_EXPLICIT_PORT_RANDOMISATION
+-	/** the available ports array. These are unused.
+-	 * Only the first total-inuse part is filled. */
+-	int* avail_ports;
+-	/** the total number of available ports (size of the array) */
+-	int avail_total;
++	/** the shared port numbers for this interface. */
++	struct shared_ports_if* shpif;
+ #endif
+ 
+ 	/** array of the commpoints currently in use. 
+@@ -241,6 +243,42 @@ struct port_comm {
+ 	struct comm_point* cp;
+ };
+ 
++/**
++ * Shared ports, the list of ports shared across threads
++ */
++struct shared_ports {
++	/** mutex on the ports */
++	lock_basic_type lock;
++	/** array of IP4 interfaces */
++	struct shared_ports_if* ip4_ifs;
++	/** number of outgoing IP4 interfaces */
++	int num_ip4;
++	/** array of IP6 interfaces */
++	struct shared_ports_if* ip6_ifs;
++	/** number of outgoing IP6 interfaces */
++	int num_ip6;
++};
++
++/**
++ * Shared ports for an interface.
++ */
++struct shared_ports_if {
++	/** address ready to allocate new socket (except port no). */
++	struct sockaddr_storage addr;
++	/** length of addr field */
++	socklen_t addrlen;
++	/** if a netblock, the prefix */
++	int pfxlen;
++
++	/** the available ports array. These are unused.
++	 * Only the first total-inuse part is filled. */
++	int* avail_ports;
++	/** the total number of available ports (size of the array) */
++	int avail_total;
++	/** the number in use. */
++	int inuse;
++};
++
+ /**
+  * Reuse TCP connection, still open can be used again.
+  */
+@@ -544,8 +582,6 @@ struct serviced_query {
+  * @param infra: pointer to infra cached used for serviced queries.
+  * @param rnd: stored to create random numbers for serviced queries.
+  * @param use_caps_for_id: enable to use 0x20 bits to encode id randomness.
+- * @param availports: array of available ports. 
+- * @param numavailports: number of available ports in array.
+  * @param unwanted_threshold: when to take defensive action.
+  * @param unwanted_action: the action to take.
+  * @param unwanted_param: user parameter to action.
+@@ -560,17 +596,18 @@ struct serviced_query {
+  * @param max_reuse_tcp_queries: max number of queries on a reuse connection.
+  * @param tcp_reuse_timeout: timeout for REUSE entries in milliseconds.
+  * @param tcp_auth_query_timeout: timeout in milliseconds for TCP queries to auth servers.
++ * @param shared_ports: the shared_ports structure.
+  * @return: the new structure (with no pending answers) or NULL on error.
+  */
+ struct outside_network* outside_network_create(struct comm_base* base,
+ 	size_t bufsize, size_t num_ports, char** ifs, int num_ifs,
+ 	int do_ip4, int do_ip6, size_t num_tcp, int dscp, struct infra_cache* infra, 
+-	struct ub_randstate* rnd, int use_caps_for_id, int* availports, 
+-	int numavailports, size_t unwanted_threshold, int tcp_mss,
++	struct ub_randstate* rnd, int use_caps_for_id,
++	size_t unwanted_threshold, int tcp_mss,
+ 	void (*unwanted_action)(void*), void* unwanted_param, int do_udp,
+ 	void* sslctx, int delayclose, int tls_use_sni, struct dt_env *dtenv,
+ 	int udp_connect, int max_reuse_tcp_queries, int tcp_reuse_timeout,
+-	int tcp_auth_query_timeout);
++	int tcp_auth_query_timeout, struct shared_ports* shared_ports);
+ 
+ /**
+  * Delete outside_network structure.
+@@ -812,6 +849,54 @@ struct comm_point* outnet_comm_point_for_http(struct outside_network* outnet,
+ /** connect tcp connection to addr, 0 on failure */
+ int outnet_tcp_connect(int s, struct sockaddr_storage* addr, socklen_t addrlen);
+ 
++/**
++ * Create new shared ports structure.
++ * @param ifs: interface names (or NULL for default interface).
++ *    These interfaces must be able to access all authoritative servers.
++ * @param num_ifs: number of names in array ifs.
++ * @param do_ip4: service IP4.
++ * @param do_ip6: service IP6.
++ * @param availports: array of available ports.
++ * @param numavailports: number of available ports in array.
++ * @return new, or NULL on failure.
++ */
++struct shared_ports* shared_ports_create(char** ifs, int num_ifs, int do_ip4,
++	int do_ip6, int* availports, int numavailports);
++
++/**
++ * Delete shared ports structure.
++ * @param shp: shared ports structure.
++ */
++void shared_ports_delete(struct shared_ports* shp);
++
++/** Find interface in shared ports. */
++struct shared_ports_if* shared_ports_find_if(struct shared_ports* shp,
++	struct sockaddr_storage* addr, socklen_t addrlen, int pfxlen);
++
++/**
++ * Get a shared port from the list of random ports.
++ * @param shp: shared ports structure.
++ * @param shpif: the shared ports interface.
++ * @param rnd: used to make random numbers.
++ * @param udp_connect: set to true if no reuse is possible.
++ * @param reusenum: number of ports that can be reused (already open).
++ * @param port: the port number is returned.
++ * @param reused: if the port numer is reused, returned.
++ * @return false on failure. That can mean no more free ports to use.
++ */
++int shared_ports_fetch_random(struct shared_ports* shp,
++	struct shared_ports_if* shpif, struct ub_randstate* rnd,
++	int udp_connect, int reusenum, int* port, int* reused);
++
++/**
++ * Return a shared port to the list of random ports.
++ * @param shp: shared ports structure.
++ * @param shpif: the shared ports interface.
++ * @param port: port number to return to be used again.
++ */
++void shared_ports_return_port(struct shared_ports* shp,
++	struct shared_ports_if* shpif, int port);
++
+ /** callback for incoming udp answers from the network */
+ int outnet_udp_cb(struct comm_point* c, void* arg, int error,
+ 	struct comm_reply *reply_info);
+diff --git a/testcode/fake_event.c b/testcode/fake_event.c
+index ce439edd1..6b6ab3731 100644
+--- a/testcode/fake_event.c
++++ b/testcode/fake_event.c
+@@ -1126,15 +1126,16 @@ outside_network_create(struct comm_base* base, size_t bufsize,
+ 	int ATTR_UNUSED(dscp),
+ 	struct infra_cache* infra,
+ 	struct ub_randstate* ATTR_UNUSED(rnd),
+-	int ATTR_UNUSED(use_caps_for_id), int* ATTR_UNUSED(availports),
+-	int ATTR_UNUSED(numavailports), size_t ATTR_UNUSED(unwanted_threshold),
++	int ATTR_UNUSED(use_caps_for_id),
++	size_t ATTR_UNUSED(unwanted_threshold),
+ 	int ATTR_UNUSED(outgoing_tcp_mss),
+ 	void (*unwanted_action)(void*), void* ATTR_UNUSED(unwanted_param),
+ 	int ATTR_UNUSED(do_udp), void* ATTR_UNUSED(sslctx),
+ 	int ATTR_UNUSED(delayclose), int ATTR_UNUSED(tls_use_sni),
+ 	struct dt_env* ATTR_UNUSED(dtenv), int ATTR_UNUSED(udp_connect),
+ 	int ATTR_UNUSED(max_reuse_tcp_queries), int ATTR_UNUSED(tcp_reuse_timeout),
+-	int ATTR_UNUSED(tcp_auth_query_timeout))
++	int ATTR_UNUSED(tcp_auth_query_timeout),
++	struct shared_ports* ATTR_UNUSED(shared_ports))
+ {
+ 	struct replay_runtime* runtime = (struct replay_runtime*)base;
+ 	struct outside_network* outnet =  calloc(1,
+@@ -1980,6 +1981,20 @@ int outnet_tcp_connect(int ATTR_UNUSED(s), struct sockaddr_storage* ATTR_UNUSED(
+ 	return 0;
+ }
+ 
++struct shared_ports* shared_ports_create(char** ATTR_UNUSED(ifs),
++	int ATTR_UNUSED(num_ifs), int ATTR_UNUSED(do_ip4),
++        int ATTR_UNUSED(do_ip6), int* ATTR_UNUSED(availports),
++	int ATTR_UNUSED(numavailports))
++{
++	return calloc(1, sizeof(struct shared_ports));
++}
++
++void shared_ports_delete(struct shared_ports* shp)
++{
++	if(!shp) return;
++	free(shp);
++}
++
+ int tcp_req_info_add_meshstate(struct tcp_req_info* ATTR_UNUSED(req),
+         struct mesh_area* ATTR_UNUSED(mesh), struct mesh_state* ATTR_UNUSED(m))
+ {
+diff --git a/testcode/unittcpreuse.c b/testcode/unittcpreuse.c
+index 5f45a4b45..ce62e3325 100644
+--- a/testcode/unittcpreuse.c
++++ b/testcode/unittcpreuse.c
+@@ -41,6 +41,7 @@
+ #include "config.h"
+ #include "testcode/unitmain.h"
+ #include "util/log.h"
++#include "util/net_help.h"
+ #include "util/random.h"
+ #include "services/outside_network.h"
+ 
+@@ -479,6 +480,278 @@ static void reuse_write_wait_test(void)
+ 	check_reuse_write_wait_removal(1, &reuse, store, 0, 1);
+ }
+ 
++static void shared_port_test_ifs(void)
++{
++	struct shared_ports* shp;
++	struct shared_ports_if* shpif;
++	char* ifs[] = {"1.2.3.4", "1.2.3.5", "::1:2", "::1:3"};
++	int availports[] = {1, 2, 3, 4};
++	struct sockaddr_storage addr;
++	socklen_t addrlen;
++
++	shp = shared_ports_create(ifs, 4, 1, 1, availports, 4);
++	unit_assert(shp);
++
++	if(!ipstrtoaddr("1.2.3.4", UNBOUND_DNS_PORT, &addr, &addrlen))
++		log_err("could not parse");
++	shpif = shared_ports_find_if(shp, &addr, addrlen, 0);
++	unit_assert(shpif);
++
++	if(!ipstrtoaddr("1.2.3.5", UNBOUND_DNS_PORT, &addr, &addrlen))
++		log_err("could not parse");
++	shpif = shared_ports_find_if(shp, &addr, addrlen, 0);
++	unit_assert(shpif);
++
++	if(!ipstrtoaddr("::1:2", UNBOUND_DNS_PORT, &addr, &addrlen))
++		log_err("could not parse");
++	shpif = shared_ports_find_if(shp, &addr, addrlen, 0);
++	unit_assert(shpif);
++
++	if(!ipstrtoaddr("::1:3", UNBOUND_DNS_PORT, &addr, &addrlen))
++		log_err("could not parse");
++	shpif = shared_ports_find_if(shp, &addr, addrlen, 0);
++	unit_assert(shpif);
++
++	shared_ports_delete(shp);
++}
++
++/** See if a port is on the shared_ports ports list */
++static int
++pif_list_contains(struct shared_ports_if* shpif, int item)
++{
++	int i;
++	unit_assert(shpif->inuse >= 0 && shpif->inuse <= shpif->avail_total);
++	for(i=0; i< shpif->avail_total - shpif->inuse; i++) {
++		if(shpif->avail_ports[i] == item)
++			return 1;
++	}
++	return 0;
++}
++
++/** See if a number of ports are on the shared_ports list */
++static int
++pif_list_contains_items(struct shared_ports_if* shpif, int item1,
++	int item2, int item3, int item4)
++{
++	if(item1 != -1 && !pif_list_contains(shpif, item1))
++		return 0;
++	if(item2 != -1 && !pif_list_contains(shpif, item2))
++		return 0;
++	if(item3 != -1 && !pif_list_contains(shpif, item3))
++		return 0;
++	if(item4 != -1 && !pif_list_contains(shpif, item4))
++		return 0;
++	return 1;
++}
++
++static void shared_port_test_port(void)
++{
++	struct shared_ports* shp;
++	struct shared_ports_if* shpif;
++	char* ifs[] = {"1.2.3.4", "1.2.3.5"};
++	int availports[] = {1, 2, 3, 4};
++	struct sockaddr_storage addr;
++	socklen_t addrlen;
++	int p1, p2, p3, reused;
++	struct ub_randstate* rnd;
++
++	rnd = ub_initstate(NULL);
++	unit_assert(rnd);
++
++	shp = shared_ports_create(ifs, 2, 1, 1, availports, 4);
++	unit_assert(shp);
++
++	if(!ipstrtoaddr("1.2.3.4", UNBOUND_DNS_PORT, &addr, &addrlen))
++		log_err("could not parse");
++	shpif = shared_ports_find_if(shp, &addr, addrlen, 0);
++	unit_assert(shpif);
++
++	unit_assert(shpif->avail_total == 4);
++	unit_assert(shpif->inuse == 0);
++	unit_assert(pif_list_contains_items(shpif, 1, 2, 3, 4));
++
++	if(!shared_ports_fetch_random(shp, shpif, rnd,
++		0, 0, &p1, &reused)) {
++		unit_assert(0); /* should succeed */
++	}
++	unit_assert(reused == 0);
++	unit_assert(p1 != 0);
++	unit_assert(!pif_list_contains(shpif, p1));
++	if(p1 != 1) unit_assert(pif_list_contains(shpif, 1));
++	if(p1 != 2) unit_assert(pif_list_contains(shpif, 2));
++	if(p1 != 3) unit_assert(pif_list_contains(shpif, 3));
++	if(p1 != 4) unit_assert(pif_list_contains(shpif, 4));
++	unit_assert(shpif->avail_total == 4);
++	unit_assert(shpif->inuse == 1);
++
++	shared_ports_return_port(shp, shpif, p1);
++	unit_assert(shpif->avail_total == 4);
++	unit_assert(shpif->inuse == 0);
++	unit_assert(pif_list_contains_items(shpif, 1, 2, 3, 4));
++
++	/* pick up two items */
++	if(!shared_ports_fetch_random(shp, shpif, rnd,
++		0, 0, &p1, &reused)) {
++		unit_assert(0); /* should succeed */
++	}
++	unit_assert(reused == 0);
++	unit_assert(p1 != 0);
++	if(!shared_ports_fetch_random(shp, shpif, rnd,
++		0, 0, &p2, &reused)) {
++		unit_assert(0); /* should succeed */
++	}
++	unit_assert(reused == 0);
++	unit_assert(p2 != 0);
++	unit_assert(!pif_list_contains(shpif, p1));
++	unit_assert(!pif_list_contains(shpif, p2));
++	if(p1 != 1 && p2 != 1) unit_assert(pif_list_contains(shpif, 1));
++	if(p1 != 2 && p2 != 2) unit_assert(pif_list_contains(shpif, 2));
++	if(p1 != 3 && p2 != 3) unit_assert(pif_list_contains(shpif, 3));
++	if(p1 != 4 && p2 != 4) unit_assert(pif_list_contains(shpif, 4));
++	unit_assert(shpif->avail_total == 4);
++	unit_assert(shpif->inuse == 2);
++
++	shared_ports_return_port(shp, shpif, p1);
++	unit_assert(pif_list_contains(shpif, p1));
++	unit_assert(shpif->avail_total == 4);
++	unit_assert(shpif->inuse == 1);
++
++	shared_ports_return_port(shp, shpif, p2);
++	unit_assert(pif_list_contains(shpif, p2));
++	unit_assert(shpif->avail_total == 4);
++	unit_assert(shpif->inuse == 0);
++	unit_assert(pif_list_contains_items(shpif, 1, 2, 3, 4));
++
++	/* pick up three items */
++	if(!shared_ports_fetch_random(shp, shpif, rnd,
++		0, 0, &p1, &reused)) {
++		unit_assert(0); /* should succeed */
++	}
++	unit_assert(reused == 0);
++	unit_assert(p1 != 0);
++	if(!shared_ports_fetch_random(shp, shpif, rnd,
++		0, 0, &p2, &reused)) {
++		unit_assert(0); /* should succeed */
++	}
++	unit_assert(reused == 0);
++	unit_assert(p2 != 0);
++	if(!shared_ports_fetch_random(shp, shpif, rnd,
++		0, 0, &p3, &reused)) {
++		unit_assert(0); /* should succeed */
++	}
++	unit_assert(reused == 0);
++	unit_assert(p3 != 0);
++	unit_assert(!pif_list_contains(shpif, p1));
++	unit_assert(!pif_list_contains(shpif, p2));
++	unit_assert(!pif_list_contains(shpif, p3));
++	if(p1 != 1 && p2 != 1 && p3 != 1)
++		unit_assert(pif_list_contains(shpif, 1));
++	if(p1 != 2 && p2 != 2 && p3 != 2)
++		unit_assert(pif_list_contains(shpif, 2));
++	if(p1 != 3 && p2 != 3 && p3 != 3)
++		unit_assert(pif_list_contains(shpif, 3));
++	if(p1 != 4 && p2 != 4 && p3 != 4)
++		unit_assert(pif_list_contains(shpif, 4));
++	unit_assert(shpif->avail_total == 4);
++	unit_assert(shpif->inuse == 3);
++
++	shared_ports_return_port(shp, shpif, p1);
++	unit_assert(pif_list_contains(shpif, p1));
++	unit_assert(shpif->avail_total == 4);
++	unit_assert(shpif->inuse == 2);
++
++	shared_ports_return_port(shp, shpif, p2);
++	unit_assert(pif_list_contains(shpif, p2));
++	unit_assert(shpif->avail_total == 4);
++	unit_assert(shpif->inuse == 1);
++
++	shared_ports_return_port(shp, shpif, p3);
++	unit_assert(pif_list_contains(shpif, p3));
++	unit_assert(shpif->avail_total == 4);
++	unit_assert(shpif->inuse == 0);
++	unit_assert(pif_list_contains_items(shpif, 1, 2, 3, 4));
++
++	/* pick up all four items */
++	if(!shared_ports_fetch_random(shp, shpif, rnd,
++		0, 0, &p1, &reused)) {
++		unit_assert(0); /* should succeed */
++	}
++	unit_assert(reused == 0);
++	unit_assert(p1 != 0);
++
++	if(!shared_ports_fetch_random(shp, shpif, rnd,
++		0, 0, &p1, &reused)) {
++		unit_assert(0); /* should succeed */
++	}
++	unit_assert(reused == 0);
++	unit_assert(p1 != 0);
++
++	if(!shared_ports_fetch_random(shp, shpif, rnd,
++		0, 0, &p1, &reused)) {
++		unit_assert(0); /* should succeed */
++	}
++	unit_assert(reused == 0);
++	unit_assert(p1 != 0);
++
++	if(!shared_ports_fetch_random(shp, shpif, rnd,
++		0, 0, &p1, &reused)) {
++		unit_assert(0); /* should succeed */
++	}
++	unit_assert(reused == 0);
++	unit_assert(p1 != 0);
++	unit_assert(!pif_list_contains(shpif, 1));
++	unit_assert(!pif_list_contains(shpif, 2));
++	unit_assert(!pif_list_contains(shpif, 3));
++	unit_assert(!pif_list_contains(shpif, 4));
++	unit_assert(shpif->avail_total == 4);
++	unit_assert(shpif->inuse == 4);
++
++	/* more fetches fail, it is fully inuse. */
++	unit_assert(!shared_ports_fetch_random(shp, shpif, rnd, 0, 0, &p2,
++		&reused));
++	unit_assert(!shared_ports_fetch_random(shp, shpif, rnd, 0, 0, &p3,
++		&reused));
++	unit_assert(shpif->avail_total == 4);
++	unit_assert(shpif->inuse == 4);
++
++	/* reuse is then always the case */
++	if(!shared_ports_fetch_random(shp, shpif, rnd,
++		0 /* can reuse */, 4 /* reusenum */, &p1, &reused)) {
++		unit_assert(0); /* should succeed */
++	}
++	unit_assert(reused == 1);
++	unit_assert(p1 >= 0 && p1 < 4 /* reusenum */);
++
++	if(!shared_ports_fetch_random(shp, shpif, rnd,
++		0 /* can reuse */, 4 /* reusenum */, &p1, &reused)) {
++		unit_assert(0); /* should succeed */
++	}
++	unit_assert(reused == 1);
++	unit_assert(p1 >= 0 && p1 < 4 /* reusenum */);
++
++	/* return all the ports */
++	shared_ports_return_port(shp, shpif, 1);
++	unit_assert(pif_list_contains(shpif, 1));
++	unit_assert(shpif->avail_total == 4);
++	unit_assert(shpif->inuse == 3);
++	shared_ports_return_port(shp, shpif, 2);
++	unit_assert(pif_list_contains(shpif, 2));
++	unit_assert(shpif->avail_total == 4);
++	unit_assert(shpif->inuse == 2);
++	shared_ports_return_port(shp, shpif, 3);
++	unit_assert(pif_list_contains(shpif, 3));
++	unit_assert(shpif->avail_total == 4);
++	unit_assert(shpif->inuse == 1);
++	shared_ports_return_port(shp, shpif, 4);
++	unit_assert(pif_list_contains(shpif, 4));
++	unit_assert(shpif->avail_total == 4);
++	unit_assert(shpif->inuse == 0);
++	unit_assert(pif_list_contains_items(shpif, 1, 2, 3, 4));
++
++	shared_ports_delete(shp);
++	ub_randfree(rnd);
++}
++
+ void tcpreuse_test(void)
+ {
+     unit_show_feature("tcp_reuse");
+@@ -486,4 +759,7 @@ void tcpreuse_test(void)
+     tcp_reuse_tree_list_test();
+     waiting_tcp_list_test();
+     reuse_write_wait_test();
++    unit_show_feature("shared_ports");
++    shared_port_test_ifs();
++    shared_port_test_port();
+ }
meta-networking/recipes-support/unbound/unbound_1.24.2.bb +1 -0
index 0a511f767e..76dc0655c9 100644
@@ -33,6 +33,7 @@ SRC_URI = "git://github.com/NLnetLabs/unbound.git;protocol=https;branch=master;t
            file://CVE-2026-50243.patch \
            file://CVE-2026-50248.patch \
            file://CVE-2026-50251.patch \
+           file://CVE-2026-50252.patch \
            "
 
 SRCREV = "f6269baa605d31859f28770e01a24e3677e5f82c"
#23 lore raw

PATCH 24/32 unbound: patch CVE-2026-52863

In reply to [email protected]

From: Ankur Tyagi <[email protected]>

Details:
https://nvd.nist.gov/vuln/detail/cve-2026-52863

---
 .../unbound/unbound/CVE-2026-52863.patch      | 132 ++++++++++++++++++
 .../recipes-support/unbound/unbound_1.24.2.bb |   1 +
 2 files changed, 133 insertions(+)
 create mode 100644 meta-networking/recipes-support/unbound/unbound/CVE-2026-52863.patch
meta-networking/recipes-support/unbound/unbound/CVE-2026-52863.patch new file +132 -0
new file mode 100644
index 0000000000..5523faa2f6
@@ -0,0 +1,132 @@
+From da55f7d129bfa01201d8e2bb58b13674f41c572e Mon Sep 17 00:00:00 2001
+From: "W.C.A. Wijngaards" <[email protected]>
+Date: Wed, 22 Jul 2026 10:16:03 +0200
+Subject: [PATCH] - Fix CVE-2026-52863, Memory corruption could lead to crash
+ and   denial of service. Thanks to Qifan Zhang, Palo Alto Networks,   for the
+ report.
+
+(cherry picked from commit 8c702de175cb687d9645603ad3e8dc7c08a925e8)
+
+CVE: CVE-2026-52863
+Upstream-Status: Backport [https://github.com/NLnetLabs/unbound/commit/8c702de175cb687d9645603ad3e8dc7c08a925e8]
+
+Signed-off-by: Ankur Tyagi <[email protected]>
+---
+ services/mesh.c     |  8 +++++--
+ services/mesh.h     |  4 ++++
+ testcode/unitmain.c | 56 +++++++++++++++++++++++++++++++++++++++++++++
+ 3 files changed, 66 insertions(+), 2 deletions(-)
+
+diff --git a/services/mesh.c b/services/mesh.c
+index 23499dcef..6a04bc838 100644
+--- a/services/mesh.c
++++ b/services/mesh.c
+@@ -911,8 +911,7 @@ cfg_region_strlist_copy(struct regional* region, struct config_strlist* list)
+ 	return result;
+ }
+ 
+-/** Copy the client info to the query region. */
+-static struct respip_client_info*
++struct respip_client_info*
+ mesh_copy_client_info(struct regional* region, struct respip_client_info* cinfo)
+ {
+ 	size_t i;
+@@ -957,6 +956,11 @@ mesh_copy_client_info(struct regional* region, struct respip_client_info* cinfo)
+ 			cinfo->view->name);
+ 		if(!client_info->view_name)
+ 			return NULL;
++	} else if(cinfo->view_name) {
++		client_info->view_name = regional_strdup(region,
++			cinfo->view_name);
++		if(!client_info->view_name)
++			return NULL;
+ 	}
+ 	return client_info;
+ }
+diff --git a/services/mesh.h b/services/mesh.h
+index a61f90993..b3e1f0efa 100644
+--- a/services/mesh.h
++++ b/services/mesh.h
+@@ -729,4 +729,8 @@ void mesh_respond_serve_expired(struct mesh_state* mstate);
+ void mesh_remove_callback(struct mesh_area* mesh, struct query_info* qinfo,
+ 	uint16_t qflags, mesh_cb_func_type cb, void* cb_arg);
+ 
++/** Copy the client info to the query region. */
++struct respip_client_info* mesh_copy_client_info(struct regional* region,
++	struct respip_client_info* cinfo);
++
+ #endif /* SERVICES_MESH_H */
+diff --git a/testcode/unitmain.c b/testcode/unitmain.c
+index beb10ba45..edde04875 100644
+--- a/testcode/unitmain.c
++++ b/testcode/unitmain.c
+@@ -1282,6 +1282,61 @@ static void localzone_test(void)
+ 	localzone_parents_test();
+ }
+ 
++#include "services/mesh.h"
++/** mesh unit tests */
++static void mesh_test(void)
++{
++	struct regional* r2, *r3;
++	struct respip_client_info* c1, *c2, *c3;
++	unit_show_func("services/mesh.c", "mesh_copy_client_info");
++	r2 = regional_create();
++	r3 = regional_create();
++	if(!r2 || !r3) fatal_exit("out of memory");
++
++	c1 = calloc(1, sizeof(*c1));
++	if(!c1) fatal_exit("out of memory");
++	c1->view = calloc(1, sizeof(*c1->view));
++	if(!c1->view) fatal_exit("out of memory");
++	c1->view->name = strdup("view1");
++	if(!c1->view->name) fatal_exit("out of memory");
++
++	c2 = mesh_copy_client_info(r2, c1);
++	if(!c2) fatal_exit("out of memory");
++	c3 = mesh_copy_client_info(r3, c2);
++	if(!c3) fatal_exit("out of memory");
++
++	unit_assert(strcmp(c1->view->name, c2->view_name) == 0);
++	unit_assert(strcmp(c1->view->name, c3->view_name) == 0);
++
++	/* make sure that the c3 view_name is in the r3 region. */
++	unit_assert(r3->next == NULL);  /* only the first chunk present atm */
++	if(strlen(c3->view_name) >= r3->large_object_size) {
++		char* a = r3->large_list;
++		int found = 0;
++		while(a) {
++			if(strcmp(c3->view_name,
++				a + /* ALIGNEMENT */ sizeof(uint64_t)) == 0) {
++				found = 1;
++				break;
++			}
++			a = *(char**)a;
++		}
++		unit_assert(found == 1);
++	} else {
++		/* The allocation is expected in the r3 region first chunk */
++		unit_assert((uint8_t*)c3->view_name < ((uint8_t*)r3)+r3->first_size);
++	}
++
++	regional_destroy(r2);
++	/* ASAN should complain for the freed access below */
++	unit_assert(strcmp(c1->view->name, c3->view_name) == 0);
++
++	regional_destroy(r3);
++	free(c1->view->name);
++	free(c1->view);
++	free(c1);
++}
++
+ void unit_show_func(const char* file, const char* func)
+ {
+ 	printf("test %s:%s\n", file, func);
+@@ -1356,6 +1411,7 @@ main(int argc, char* argv[])
+ 	msgparse_test();
+ 	edns_ede_answer_encode_test();
+ 	localzone_test();
++	mesh_test();
+ #ifdef CLIENT_SUBNET
+ 	ecs_test();
+ #endif /* CLIENT_SUBNET */
meta-networking/recipes-support/unbound/unbound_1.24.2.bb +1 -0
index 76dc0655c9..a03dcf4193 100644
@@ -34,6 +34,7 @@ SRC_URI = "git://github.com/NLnetLabs/unbound.git;protocol=https;branch=master;t
            file://CVE-2026-50248.patch \
            file://CVE-2026-50251.patch \
            file://CVE-2026-50252.patch \
+           file://CVE-2026-52863.patch \
            "
 
 SRCREV = "f6269baa605d31859f28770e01a24e3677e5f82c"
#24 lore raw

PATCH 25/32 unbound: patch CVE-2026-54478

In reply to [email protected]

From: Ankur Tyagi <[email protected]>

Details:
https://nvd.nist.gov/vuln/detail/cve-2026-54478

---
 .../unbound/unbound/CVE-2026-54478.patch      | 38 +++++++++++++++++++
 .../recipes-support/unbound/unbound_1.24.2.bb |  1 +
 2 files changed, 39 insertions(+)
 create mode 100644 meta-networking/recipes-support/unbound/unbound/CVE-2026-54478.patch
meta-networking/recipes-support/unbound/unbound/CVE-2026-54478.patch new file +38 -0
new file mode 100644
index 0000000000..3580815477
@@ -0,0 +1,38 @@
+From 44af1c8b392afb7d14ae0814fb9c6c037a5bf18a Mon Sep 17 00:00:00 2001
+From: "W.C.A. Wijngaards" <[email protected]>
+Date: Wed, 22 Jul 2026 10:16:42 +0200
+Subject: [PATCH] - Fix CVE-2026-54478, DNS Cookie bypass when combined with  
+ proxy-protocol use. Thanks to Qifan Zhang, Palo Alto Networks,   for the
+ report.
+
+(cherry picked from commit 8a15ffee620bce05fbfd2c69b0d4c31c10a02431)
+
+CVE: CVE-2026-54478
+Upstream-Status: Backport [https://github.com/NLnetLabs/unbound/commit/8a15ffee620bce05fbfd2c69b0d4c31c10a02431]
+
+Signed-off-by: Ankur Tyagi <[email protected]>
+---
+ util/data/msgparse.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/util/data/msgparse.c b/util/data/msgparse.c
+index 169709b7e..3dc2e1264 100644
+--- a/util/data/msgparse.c
++++ b/util/data/msgparse.c
+@@ -1068,13 +1068,13 @@ parse_edns_options_from_query(uint8_t* rdata_ptr, size_t rdata_len,
+ 			 * purposes. It will be overwritten if (re)creation
+ 			 * is needed.
+ 			 */
+-			if(repinfo->remote_addr.ss_family == AF_INET) {
++			if(repinfo->client_addr.ss_family == AF_INET) {
+ 				memcpy(server_cookie + 16,
+-					&((struct sockaddr_in*)&repinfo->remote_addr)->sin_addr, 4);
++					&((struct sockaddr_in*)&repinfo->client_addr)->sin_addr, 4);
+ 			} else {
+ 				cookie_is_v4 = 0;
+ 				memcpy(server_cookie + 16,
+-					&((struct sockaddr_in6*)&repinfo->remote_addr)->sin6_addr, 16);
++					&((struct sockaddr_in6*)&repinfo->client_addr)->sin6_addr, 16);
+ 			}
+ 
+ 			if(cfg->cookie_secret_file &&
meta-networking/recipes-support/unbound/unbound_1.24.2.bb +1 -0
index a03dcf4193..1e3bd6f5c6 100644
@@ -35,6 +35,7 @@ SRC_URI = "git://github.com/NLnetLabs/unbound.git;protocol=https;branch=master;t
            file://CVE-2026-50251.patch \
            file://CVE-2026-50252.patch \
            file://CVE-2026-52863.patch \
+           file://CVE-2026-54478.patch \
            "
 
 SRCREV = "f6269baa605d31859f28770e01a24e3677e5f82c"
#25 lore raw

PATCH 26/32 unbound: patch CVE-2026-55708

In reply to [email protected]

From: Ankur Tyagi <[email protected]>

Details:
https://nvd.nist.gov/vuln/detail/cve-2026-55708

---
 .../unbound/unbound/CVE-2026-55708.patch      | 51 +++++++++++++++++++
 .../recipes-support/unbound/unbound_1.24.2.bb |  1 +
 2 files changed, 52 insertions(+)
 create mode 100644 meta-networking/recipes-support/unbound/unbound/CVE-2026-55708.patch
meta-networking/recipes-support/unbound/unbound/CVE-2026-55708.patch new file +51 -0
new file mode 100644
index 0000000000..402e38c737
@@ -0,0 +1,51 @@
+From 1138101d9147db0539c27e9c19525223f32de84c Mon Sep 17 00:00:00 2001
+From: "W.C.A. Wijngaards" <[email protected]>
+Date: Wed, 22 Jul 2026 10:17:10 +0200
+Subject: [PATCH] - Fix CVE-2026-55708, Privacy/configuration issue when adding
+ local   data in views through 'unbound-control'. Thanks to Qifan Zhang,  
+ Palo Alto Networks, for the report.
+
+(cherry picked from commit c29ff70f6aa9bb2f02e5f21001832f2b4791bd76)
+
+CVE: CVE-2026-55708
+Upstream-Status: Backport [https://github.com/NLnetLabs/unbound/commit/c29ff70f6aa9bb2f02e5f21001832f2b4791bd76]
+
+Signed-off-by: Ankur Tyagi <[email protected]>
+---
+ daemon/remote.c | 16 ++++++++++++++++
+ 1 file changed, 16 insertions(+)
+
+diff --git a/daemon/remote.c b/daemon/remote.c
+index d8ee7fa7d..8a26dadc7 100644
+--- a/daemon/remote.c
++++ b/daemon/remote.c
+@@ -1634,6 +1634,14 @@ do_view_data_add(RES* ssl, struct worker* worker, char* arg)
+ 			ssl_printf(ssl,"error out of memory\n");
+ 			return;
+ 		}
++		if(!v->isfirst) {
++			/* Global local-zone is not used for this view,
++			 * therefore add defaults to this view-specific
++			 * local-zone. */
++			struct config_file lz_cfg;
++			memset(&lz_cfg, 0, sizeof(lz_cfg));
++			local_zone_enter_defaults(v->local_zones, &lz_cfg);
++		}
+ 	}
+ 	do_data_add(ssl, v->local_zones, arg2);
+ 	lock_rw_unlock(&v->lock);
+@@ -1659,6 +1667,14 @@ do_view_datas_add(struct daemon_remote* rc, RES* ssl, struct worker* worker,
+ 			ssl_printf(ssl,"error out of memory\n");
+ 			return;
+ 		}
++		if(!v->isfirst) {
++			/* Global local-zone is not used for this view,
++			 * therefore add defaults to this view-specific
++			 * local-zone. */
++			struct config_file lz_cfg;
++			memset(&lz_cfg, 0, sizeof(lz_cfg));
++			local_zone_enter_defaults(v->local_zones, &lz_cfg);
++		}
+ 	}
+ 	/* put the view name in the command buf */
+ 	(void)snprintf(buf+strlen(buf), sizeof(buf)-strlen(buf), "%s ", arg);
meta-networking/recipes-support/unbound/unbound_1.24.2.bb +1 -0
index 1e3bd6f5c6..a04080c751 100644
@@ -36,6 +36,7 @@ SRC_URI = "git://github.com/NLnetLabs/unbound.git;protocol=https;branch=master;t
            file://CVE-2026-50252.patch \
            file://CVE-2026-52863.patch \
            file://CVE-2026-54478.patch \
+           file://CVE-2026-55708.patch \
            "
 
 SRCREV = "f6269baa605d31859f28770e01a24e3677e5f82c"
#26 lore raw

PATCH 27/32 unbound: patch CVE-2026-55717

In reply to [email protected]

From: Ankur Tyagi <[email protected]>

Details:
https://nvd.nist.gov/vuln/detail/cve-2026-55717

---
 .../unbound/unbound/CVE-2026-55717.patch      | 90 +++++++++++++++++++
 .../recipes-support/unbound/unbound_1.24.2.bb |  1 +
 2 files changed, 91 insertions(+)
 create mode 100644 meta-networking/recipes-support/unbound/unbound/CVE-2026-55717.patch
meta-networking/recipes-support/unbound/unbound/CVE-2026-55717.patch new file +90 -0
new file mode 100644
index 0000000000..fcb223029d
@@ -0,0 +1,90 @@
+From ff034061b24642e15340b0696e5c9a0aa8410fab Mon Sep 17 00:00:00 2001
+From: "W.C.A. Wijngaards" <[email protected]>
+Date: Wed, 22 Jul 2026 10:17:32 +0200
+Subject: [PATCH] - Fix CVE-2026-55717, 'serve-expired-client-timeout' and
+ 'response-ip'   CNAME redirect could lead to a crash. Thanks to Qifan Zhang,
+ Palo   Alto Networks, for the report. In addition, thanks to Xin Wang,  
+ Jiapeng Li, and Jiajia Liu, Northwestern Polytechnical University,   for also
+ reporting this issue.
+
+(cherry picked from commit 2ce2ca36912644d2dbf97249a41494a9e2500fc3)
+
+CVE: CVE-2026-55717
+Upstream-Status: Backport [https://github.com/NLnetLabs/unbound/commit/2ce2ca36912644d2dbf97249a41494a9e2500fc3]
+
+Signed-off-by: Ankur Tyagi <[email protected]>
+---
+ services/localzone.h     |  2 +-
+ services/mesh.c          | 15 ++++++++++-----
+ util/data/packed_rrset.c |  1 +
+ 3 files changed, 12 insertions(+), 6 deletions(-)
+
+diff --git a/services/localzone.h b/services/localzone.h
+index 66102fd98..9ec57e2a1 100644
+--- a/services/localzone.h
++++ b/services/localzone.h
+@@ -565,7 +565,7 @@ enum respip_action {
+ 	respip_always_nxdomain = local_zone_always_nxdomain,
+         /** answer with nodata response */
+ 	respip_always_nodata = local_zone_always_nodata,
+-        /** answer with nodata response */
++        /** drop query */
+ 	respip_always_deny = local_zone_always_deny,
+ 	/** RPZ: truncate answer in order to force switch to tcp */
+ 	respip_truncate = local_zone_truncate,
+diff --git a/services/mesh.c b/services/mesh.c
+index 6a04bc838..191b1d488 100644
+--- a/services/mesh.c
++++ b/services/mesh.c
+@@ -2391,9 +2391,10 @@ apply_respip_action(struct module_qstate* qstate,
+ 
+ 	/* xxx_deny actions mean dropping the reply, unless the original reply
+ 	 * was redirected to response-ip data. */
+-	if((actinfo->action == respip_deny ||
++	if(actinfo->action == respip_always_deny ||
++		((actinfo->action == respip_deny ||
+ 		actinfo->action == respip_inform_deny) &&
+-		*encode_repp == rep)
++		*encode_repp == rep))
+ 		*encode_repp = NULL;
+ 
+ 	return 1;
+@@ -2458,12 +2459,15 @@ mesh_serve_expired_callback(void* arg)
+ 			qstate->client_info, &actinfo, msg->rep, &alias_rrset, &encode_rep,
+ 			qstate->env->auth_zones)) {
+ 			return;
+-		} else if(partial_rep &&
+-			!respip_merge_cname(partial_rep, &qstate->qinfo, msg->rep,
++		} else if(partial_rep) {
++			if(!respip_merge_cname(partial_rep, &qstate->qinfo, msg->rep,
+ 			qstate->client_info, must_validate, &encode_rep, qstate->region,
+ 			qstate->env->auth_zones, qstate->env->views,
+ 			qstate->env->respip_set)) {
+-			return;
++				return;
++			}
++			/* merge succeeded; final reply, no further alias pass */
++			partial_rep = NULL;
+ 		}
+ 		if(!encode_rep || alias_rrset) {
+ 			if(!encode_rep) {
+@@ -2474,6 +2478,7 @@ mesh_serve_expired_callback(void* arg)
+ 				partial_rep = encode_rep;
+ 			}
+ 		}
++		msg->rep = encode_rep;
+ 		/* We've found a partial reply ending with an
+ 		* alias.  Replace the lookup qinfo for the
+ 		* alias target and lookup the cache again to
+diff --git a/util/data/packed_rrset.c b/util/data/packed_rrset.c
+index d18486cc5..720c56ac3 100644
+--- a/util/data/packed_rrset.c
++++ b/util/data/packed_rrset.c
+@@ -198,6 +198,7 @@ get_cname_target(struct ub_packed_rrset_key* rrset, uint8_t** dname,
+ {
+ 	struct packed_rrset_data* d;
+ 	size_t len;
++	if(!rrset) return;
+ 	if(ntohs(rrset->rk.type) != LDNS_RR_TYPE_CNAME && 
+ 		ntohs(rrset->rk.type) != LDNS_RR_TYPE_DNAME)
+ 		return;
meta-networking/recipes-support/unbound/unbound_1.24.2.bb +1 -0
index a04080c751..0af51973cd 100644
@@ -37,6 +37,7 @@ SRC_URI = "git://github.com/NLnetLabs/unbound.git;protocol=https;branch=master;t
            file://CVE-2026-52863.patch \
            file://CVE-2026-54478.patch \
            file://CVE-2026-55708.patch \
+           file://CVE-2026-55717.patch \
            "
 
 SRCREV = "f6269baa605d31859f28770e01a24e3677e5f82c"
#27 lore raw

PATCH 28/32 unbound: patch CVE-2026-55973

In reply to [email protected]

From: Ankur Tyagi <[email protected]>

Details:
https://nvd.nist.gov/vuln/detail/cve-2026-55973

---
 .../unbound/unbound/CVE-2026-55973.patch      | 47 +++++++++++++++++++
 .../recipes-support/unbound/unbound_1.24.2.bb |  1 +
 2 files changed, 48 insertions(+)
 create mode 100644 meta-networking/recipes-support/unbound/unbound/CVE-2026-55973.patch
meta-networking/recipes-support/unbound/unbound/CVE-2026-55973.patch new file +47 -0
new file mode 100644
index 0000000000..b463663af4
@@ -0,0 +1,47 @@
+From f7511787affcc7f1716f76dcc924c3880fc1f88a Mon Sep 17 00:00:00 2001
+From: "W.C.A. Wijngaards" <[email protected]>
+Date: Wed, 22 Jul 2026 10:18:16 +0200
+Subject: [PATCH] - Fix CVE-2026-55973, 'dns-error-reporting: yes' leads to
+ stack buffer   overflow. Thanks to Qifan Zhang, Palo Alto Networks, for the
+ report.
+
+(cherry picked from commit 96f875552023c0ccf376ebe050519f12f3371dc9)
+
+CVE: CVE-2026-55973
+Upstream-Status: Backport [https://github.com/NLnetLabs/unbound/commit/96f875552023c0ccf376ebe050519f12f3371dc9]
+
+Signed-off-by: Ankur Tyagi <[email protected]>
+---
+ services/cache/dns.c | 2 ++
+ services/mesh.c      | 4 ++--
+ 2 files changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/services/cache/dns.c b/services/cache/dns.c
+index 121870ee3..cb241c6f9 100644
+--- a/services/cache/dns.c
++++ b/services/cache/dns.c
+@@ -259,6 +259,8 @@ find_closest_of_type(struct module_env* env, uint8_t* qname, size_t qnamelen,
+ 
+ 		/* snip off front label */
+ 		lablen = *qname;
++		if(lablen == 0)
++			break;
+ 		qname += lablen + 1;
+ 		qnamelen -= lablen + 1;
+ 	}
+diff --git a/services/mesh.c b/services/mesh.c
+index 191b1d488..432063c0d 100644
+--- a/services/mesh.c
++++ b/services/mesh.c
+@@ -1620,9 +1620,9 @@ static void dns_error_reporting(struct module_qstate* qstate,
+ 	opt = edns_opt_list_find(qstate->edns_opts_back_in,
+ 		LDNS_EDNS_REPORT_CHANNEL);
+ 	if(!opt) return;
+-	agent_domain_len = opt->opt_len;
+ 	agent_domain = opt->opt_data;
+-	if(dname_valid(agent_domain, agent_domain_len) < 3) {
++	agent_domain_len = dname_valid(agent_domain, opt->opt_len);
++	if(agent_domain_len < 3) {
+ 		/* The agent domain needs to be a valid dname that is not the
+ 		 * root; from RFC9567. */
+ 		return;
meta-networking/recipes-support/unbound/unbound_1.24.2.bb +1 -0
index 0af51973cd..b867ea9b73 100644
@@ -38,6 +38,7 @@ SRC_URI = "git://github.com/NLnetLabs/unbound.git;protocol=https;branch=master;t
            file://CVE-2026-54478.patch \
            file://CVE-2026-55708.patch \
            file://CVE-2026-55717.patch \
+           file://CVE-2026-55973.patch \
            "
 
 SRCREV = "f6269baa605d31859f28770e01a24e3677e5f82c"
#28 lore raw

PATCH 29/32 unbound: patch CVE-2026-55990

In reply to [email protected]

From: Ankur Tyagi <[email protected]>

Details:
https://nvd.nist.gov/vuln/detail/cve-2026-55990

---
 .../unbound/unbound/CVE-2026-55990.patch      | 59 +++++++++++++++++++
 .../recipes-support/unbound/unbound_1.24.2.bb |  1 +
 2 files changed, 60 insertions(+)
 create mode 100644 meta-networking/recipes-support/unbound/unbound/CVE-2026-55990.patch
meta-networking/recipes-support/unbound/unbound/CVE-2026-55990.patch new file +59 -0
new file mode 100644
index 0000000000..676f1aa17e
@@ -0,0 +1,59 @@
+From 6e6c039d23afb169991fa489c2010ab0069a2cab Mon Sep 17 00:00:00 2001
+From: "W.C.A. Wijngaards" <[email protected]>
+Date: Wed, 22 Jul 2026 10:18:41 +0200
+Subject: [PATCH] - Fix CVE-2026-55990, Packet of death for a DNSCrypt
+ misconfigured   Unbound. Thanks to Qifan Zhang, Palo Alto Networks, for the
+ report.
+
+(cherry picked from commit ae1b3810cc3a8eb9b43c378289f74020b42aa7f4)
+
+CVE: CVE-2026-55990
+Upstream-Status: Backport [https://github.com/NLnetLabs/unbound/commit/ae1b3810cc3a8eb9b43c378289f74020b42aa7f4]
+
+Signed-off-by: Ankur Tyagi <[email protected]>
+---
+ dnscrypt/dnscrypt.c | 12 +++++++++++-
+ 1 file changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/dnscrypt/dnscrypt.c b/dnscrypt/dnscrypt.c
+index 173484cdf..bf858361f 100644
+--- a/dnscrypt/dnscrypt.c
++++ b/dnscrypt/dnscrypt.c
+@@ -663,6 +663,8 @@ dnsc_find_cert(struct dnsc_env* dnscenv, struct sldns_buffer* buffer)
+ 	}
+ 	dnscrypt_header = (struct dnscrypt_query_header *)sldns_buffer_begin(buffer);
+ 	for (i = 0U; i < dnscenv->signed_certs_count; i++) {
++		if(!certs[i].keypair)
++			continue;
+ 		if (memcmp(certs[i].magic_query, dnscrypt_header->magic_query,
+                    DNSCRYPT_MAGIC_HEADER_LEN) == 0) {
+ 			return &certs[i];
+@@ -804,6 +806,7 @@ dnsc_parse_keys(struct dnsc_env *env, struct config_file *cfg)
+ 		sizeof *env->keypairs);
+ 	env->certs = sodium_allocarray(env->signed_certs_count,
+ 		sizeof *env->certs);
++	memset(env->certs, 0, env->signed_certs_count * sizeof(*env->certs));
+ 
+ 	cert_id = 0U;
+ 	keypair_id = 0U;
+@@ -963,12 +966,19 @@ dnsc_create(void)
+ int
+ dnsc_apply_cfg(struct dnsc_env *env, struct config_file *cfg)
+ {
++    int nkeys;
+     if(dnsc_parse_certs(env, cfg) <= 0) {
+         fatal_exit("dnsc_apply_cfg: no cert file loaded");
+     }
+-    if(dnsc_parse_keys(env, cfg) <= 0) {
++    nkeys = dnsc_parse_keys(env, cfg);
++    if(nkeys <= 0) {
+         fatal_exit("dnsc_apply_cfg: no key file loaded");
+     }
++    if((size_t)nkeys < env->signed_certs_count) {
++	fatal_exit("dnsc_apply_cfg: %u dnscrypt-provider-cert file(s) have no "
++		"matching dnscrypt-secret-key",
++		(unsigned)(env->signed_certs_count - (size_t)nkeys));
++    }
+     randombytes_buf(env->hash_key, sizeof env->hash_key);
+     env->provider_name = cfg->dnscrypt_provider;
+ 
meta-networking/recipes-support/unbound/unbound_1.24.2.bb +1 -0
index b867ea9b73..e4d18e9b2a 100644
@@ -39,6 +39,7 @@ SRC_URI = "git://github.com/NLnetLabs/unbound.git;protocol=https;branch=master;t
            file://CVE-2026-55708.patch \
            file://CVE-2026-55717.patch \
            file://CVE-2026-55973.patch \
+           file://CVE-2026-55990.patch \
            "
 
 SRCREV = "f6269baa605d31859f28770e01a24e3677e5f82c"
#29 lore raw

PATCH 30/32 unbound: patch CVE-2026-55991

In reply to [email protected]

From: Ankur Tyagi <[email protected]>

Details:
https://nvd.nist.gov/vuln/detail/cve-2026-55991

---
 .../unbound/unbound/CVE-2026-55991.patch      | 112 ++++++++++++++++++
 .../recipes-support/unbound/unbound_1.24.2.bb |   1 +
 2 files changed, 113 insertions(+)
 create mode 100644 meta-networking/recipes-support/unbound/unbound/CVE-2026-55991.patch
meta-networking/recipes-support/unbound/unbound/CVE-2026-55991.patch new file +112 -0
new file mode 100644
index 0000000000..7946f5a59f
@@ -0,0 +1,112 @@
+From 355213b9175382db5e86e49731aa939a533b1b03 Mon Sep 17 00:00:00 2001
+From: "W.C.A. Wijngaards" <[email protected]>
+Date: Wed, 22 Jul 2026 10:19:02 +0200
+Subject: [PATCH] - Fix CVE-2026-55991, Remote DNS-over-QUIC (DoQ) flow-control
+   assertion failure in libngtcp2. Thanks to Qifan Zhang, Palo Alto  
+ Networks, for the report. In addition, thanks to Xuanchao Xie,   for also
+ reporting this issue.
+
+(cherry picked from commit aac261cbb3795cbd60af2f37ef57bfa5c186aae6)
+
+CVE: CVE-2026-55991
+Upstream-Status: Backport [https://github.com/NLnetLabs/unbound/commit/aac261cbb3795cbd60af2f37ef57bfa5c186aae6]
+
+Signed-off-by: Ankur Tyagi <[email protected]>
+---
+ services/listen_dnsport.c | 46 +++++++++++++++++++++++++++------------
+ testcode/doqclient.c      |  4 ++--
+ 2 files changed, 34 insertions(+), 16 deletions(-)
+
+diff --git a/services/listen_dnsport.c b/services/listen_dnsport.c
+index 3c5010b6b..d49d4ad4c 100644
+--- a/services/listen_dnsport.c
++++ b/services/listen_dnsport.c
+@@ -4472,6 +4472,29 @@ doq_stream_reset_cb(ngtcp2_conn* ATTR_UNUSED(conn), int64_t stream_id,
+ 	return 0;
+ }
+ 
++/** ngtcp2 extend_max_stream_data function */
++int doq_extend_max_stream_data_cb(ngtcp2_conn* ATTR_UNUSED(conn),
++	int64_t stream_id, uint64_t max_data, void* user_data,
++	void* ATTR_UNUSED(stream_user_data))
++{
++	struct doq_conn* doq_conn = (struct doq_conn*)user_data;
++	struct doq_stream* stream;
++	verbose(VERB_ALGO, "doq extend_max_stream_data stream id %d "
++		"max_data %d ", (int)stream_id, (int)max_data);
++	if(max_data == 0)
++		return 0;
++	stream = doq_stream_find(doq_conn, stream_id);
++	if(!stream) {
++		verbose(VERB_ALGO, "doq: unknown stream %d", (int)stream_id);
++		return 0;
++	}
++	if(!stream->is_answer_available)
++		return 0;
++	doq_stream_on_write_list(doq_conn, stream);
++	doq_conn_write_enable(doq_conn);
++	return 0;
++}
++
+ /** ngtcp2 acked_stream_data_offset callback function */
+ static int
+ doq_acked_stream_data_offset_cb(ngtcp2_conn* ATTR_UNUSED(conn),
+@@ -4846,6 +4869,7 @@ doq_conn_setup(struct doq_conn* conn, uint8_t* scid, size_t scidlen,
+ 	callbacks.stream_open = doq_stream_open_cb;
+ 	callbacks.stream_close = doq_stream_close_cb;
+ 	callbacks.stream_reset = doq_stream_reset_cb;
++	callbacks.extend_max_stream_data = doq_extend_max_stream_data_cb;
+ 	callbacks.acked_stream_data_offset = doq_acked_stream_data_offset_cb;
+ 	callbacks.recv_stream_data = doq_recv_stream_data_cb;
+ 
+@@ -5427,26 +5451,20 @@ doq_conn_write_streams(struct comm_point* c, struct doq_conn* conn,
+ 				continue;
+ 			} else if(ret == NGTCP2_ERR_STREAM_DATA_BLOCKED) {
+ 				verbose(VERB_ALGO, "doq: ngtcp2_conn_writev_stream returned NGTCP2_ERR_STREAM_DATA_BLOCKED");
+-#ifdef HAVE_NGTCP2_CCERR_DEFAULT
+-				ngtcp2_ccerr_set_application_error(
+-					&conn->ccerr, -1, NULL, 0);
+-#else
+-				ngtcp2_connection_close_error_set_application_error(&conn->last_error, -1, NULL, 0);
+-#endif
+-				if(err_drop)
+-					*err_drop = 0;
+-				if(!doq_conn_close_error(c, conn)) {
+-					if(err_drop)
+-						*err_drop = 1;
++				if(stream) {
++					doq_stream_off_write_list(conn, stream);
++					stream = stream->write_next;
++					continue;
++				} else {
++					break;
+ 				}
+-				return 0;
+ 			} else if(ret == NGTCP2_ERR_STREAM_SHUT_WR) {
+ 				verbose(VERB_ALGO, "doq: ngtcp2_conn_writev_stream returned NGTCP2_ERR_STREAM_SHUT_WR");
+ #ifdef HAVE_NGTCP2_CCERR_DEFAULT
+ 				ngtcp2_ccerr_set_application_error(
+-					&conn->ccerr, -1, NULL, 0);
++					&conn->ccerr, DOQ_APP_ERROR_CODE, NULL, 0);
+ #else
+-				ngtcp2_connection_close_error_set_application_error(&conn->last_error, -1, NULL, 0);
++				ngtcp2_connection_close_error_set_application_error(&conn->last_error, DOQ_APP_ERROR_CODE, NULL, 0);
+ #endif
+ 				if(err_drop)
+ 					*err_drop = 0;
+diff --git a/testcode/doqclient.c b/testcode/doqclient.c
+index 1994cd097..3cb25c98b 100644
+--- a/testcode/doqclient.c
++++ b/testcode/doqclient.c
+@@ -1519,9 +1519,9 @@ doq_client_send_pkt(struct doq_client_data* data, uint32_t ecn, uint8_t* buf,
+ 		}
+ 		log_err("doq sendmsg: %s", strerror(errno));
+ #ifdef HAVE_NGTCP2_CCERR_DEFAULT
+-		ngtcp2_ccerr_set_application_error(&data->ccerr, -1, NULL, 0);
++		ngtcp2_ccerr_set_application_error(&data->ccerr, 1, NULL, 0);
+ #else
+-		ngtcp2_connection_close_error_set_application_error(&data->last_error, -1, NULL, 0);
++		ngtcp2_connection_close_error_set_application_error(&data->last_error, 1, NULL, 0);
+ #endif
+ 		return 0;
+ 	}
meta-networking/recipes-support/unbound/unbound_1.24.2.bb +1 -0
index e4d18e9b2a..af848988aa 100644
@@ -40,6 +40,7 @@ SRC_URI = "git://github.com/NLnetLabs/unbound.git;protocol=https;branch=master;t
            file://CVE-2026-55717.patch \
            file://CVE-2026-55973.patch \
            file://CVE-2026-55990.patch \
+           file://CVE-2026-55991.patch \
            "
 
 SRCREV = "f6269baa605d31859f28770e01a24e3677e5f82c"
#30 lore raw

PATCH 31/32 unbound: patch CVE-2026-56416

In reply to [email protected]

From: Ankur Tyagi <[email protected]>

Details:
https://nvd.nist.gov/vuln/detail/cve-2026-56416

---
 .../unbound/unbound/CVE-2026-56416.patch      | 68 +++++++++++++++++++
 .../recipes-support/unbound/unbound_1.24.2.bb |  1 +
 2 files changed, 69 insertions(+)
 create mode 100644 meta-networking/recipes-support/unbound/unbound/CVE-2026-56416.patch
meta-networking/recipes-support/unbound/unbound/CVE-2026-56416.patch new file +68 -0
new file mode 100644
index 0000000000..6002c44924
@@ -0,0 +1,68 @@
+From 984cbdd8761685087f1e20d6e9d9da12d7412916 Mon Sep 17 00:00:00 2001
+From: "W.C.A. Wijngaards" <[email protected]>
+Date: Wed, 22 Jul 2026 10:19:28 +0200
+Subject: [PATCH] - Fix CVE-2026-56416, Possible heap buffer overflow when
+ validator   canonicalizes RDATA that contains domain name. Thanks to Qifan  
+ Zhang, Palo Alto Networks, for the report.
+
+(cherry picked from commit 4b1635e19406fd8040806f0fa4a4488c003b5d0d)
+
+CVE: CVE-2026-56416
+Upstream-Status: Backport [https://github.com/NLnetLabs/unbound/commit/4b1635e19406fd8040806f0fa4a4488c003b5d0d]
+
+Signed-off-by: Ankur Tyagi <[email protected]>
+---
+ util/data/msgparse.c     |  3 +++
+ validator/val_sigcrypt.c | 11 +++++++----
+ 2 files changed, 10 insertions(+), 4 deletions(-)
+
+diff --git a/util/data/msgparse.c b/util/data/msgparse.c
+index 3dc2e1264..9d3ddda7a 100644
+--- a/util/data/msgparse.c
++++ b/util/data/msgparse.c
+@@ -687,6 +687,9 @@ calc_size(sldns_buffer* pkt, uint16_t type, struct rr_parse* rr)
+ 			}
+ 			rdf++;
+ 		}
++		/* rdata ended before all _dname_count names were seen */
++		if(count != 0)
++			return 0; /* the rdata is too short. */
+ 	}
+ 	/* remaining rdata */
+ 	rr->size += pkt_len;
+diff --git a/validator/val_sigcrypt.c b/validator/val_sigcrypt.c
+index 86de6fb8e..cde281870 100644
+--- a/validator/val_sigcrypt.c
++++ b/validator/val_sigcrypt.c
+@@ -1094,6 +1094,7 @@ canonicalize_rdata(sldns_buffer* buf, struct ub_packed_rrset_key* rrset,
+ 	size_t len)
+ {
+ 	uint8_t* datstart = sldns_buffer_current(buf)-len+2;
++	size_t firstlen;
+ 	switch(ntohs(rrset->rk.type)) {
+ 		case LDNS_RR_TYPE_NXT: 
+ 		case LDNS_RR_TYPE_NS:
+@@ -1113,8 +1114,9 @@ canonicalize_rdata(sldns_buffer* buf, struct ub_packed_rrset_key* rrset,
+ 		case LDNS_RR_TYPE_SOA:
+ 			/* two names after another */
+ 			query_dname_tolower(datstart);
+-			query_dname_tolower(datstart + 
+-				dname_valid(datstart, len-2));
++			firstlen = dname_valid(datstart, len-2);
++			if(firstlen && firstlen < len-2)
++				query_dname_tolower(datstart + firstlen);
+ 			return;
+ 		case LDNS_RR_TYPE_RT:
+ 		case LDNS_RR_TYPE_AFSDB:
+@@ -1141,8 +1143,9 @@ canonicalize_rdata(sldns_buffer* buf, struct ub_packed_rrset_key* rrset,
+ 				return;
+ 			datstart += 2;
+ 			query_dname_tolower(datstart);
+-			query_dname_tolower(datstart + 
+-				dname_valid(datstart, len-2-2));
++			firstlen = dname_valid(datstart, len-2-2);
++			if(firstlen && firstlen < len-2-2)
++				query_dname_tolower(datstart + firstlen);
+ 			return;
+ 		case LDNS_RR_TYPE_NAPTR:
+ 			if(len < 2+4)
meta-networking/recipes-support/unbound/unbound_1.24.2.bb +1 -0
index af848988aa..516ea20654 100644
@@ -41,6 +41,7 @@ SRC_URI = "git://github.com/NLnetLabs/unbound.git;protocol=https;branch=master;t
            file://CVE-2026-55973.patch \
            file://CVE-2026-55990.patch \
            file://CVE-2026-55991.patch \
+           file://CVE-2026-56416.patch \
            "
 
 SRCREV = "f6269baa605d31859f28770e01a24e3677e5f82c"
#31 lore raw

PATCH 32/32 unbound: patch CVE-2026-56444

In reply to [email protected]

From: Ankur Tyagi <[email protected]>

Details:
https://nvd.nist.gov/vuln/detail/cve-2026-56444

---
 .../unbound/unbound/CVE-2026-56444.patch      | 51 +++++++++++++++++++
 .../recipes-support/unbound/unbound_1.24.2.bb |  1 +
 2 files changed, 52 insertions(+)
 create mode 100644 meta-networking/recipes-support/unbound/unbound/CVE-2026-56444.patch
meta-networking/recipes-support/unbound/unbound/CVE-2026-56444.patch new file +51 -0
new file mode 100644
index 0000000000..e851bb4f12
@@ -0,0 +1,51 @@
+From 200cd7322d9462025b1d2b9f3e1fe5383735a6c6 Mon Sep 17 00:00:00 2001
+From: "W.C.A. Wijngaards" <[email protected]>
+Date: Wed, 22 Jul 2026 10:19:50 +0200
+Subject: [PATCH] - Fix CVE-2026-56444, Degradation of resolution service when 
+  'discard-timeout' and 'serve-expired-client-timeout' are combined in  
+ unusual configuration. Thanks to Qifan Zhang, Palo Alto Networks,   for the
+ report. In addition, thanks to Xin Wang, Jiapeng Li,   and Jiajia Liu,
+ Northwestern Polytechnical University, for also   reporting this issue. In
+ addition, thanks to Haruki Oyama (Waseda   University), for also reporting
+ this issue.
+
+(cherry picked from commit 84d9682dd0876bc0cd118ecce03661f3443b0222)
+
+CVE: CVE-2026-56444
+Upstream-Status:Backport [https://github.com/NLnetLabs/unbound/commit/84d9682dd0876bc0cd118ecce03661f3443b0222]
+
+Signed-off-by: Ankur Tyagi <[email protected]>
+---
+ services/mesh.c | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+diff --git a/services/mesh.c b/services/mesh.c
+index 432063c0d..a6798953e 100644
+--- a/services/mesh.c
++++ b/services/mesh.c
+@@ -2505,9 +2505,10 @@ mesh_serve_expired_callback(void* arg)
+ 		log_dns_msg("Serve expired lookup", &qstate->qinfo, msg->rep);
+ 
+ 	for(r = mstate->reply_list; r; r = r->next) {
+-		struct timeval old;
+-		timeval_subtract(&old, mstate->s.env->now_tv, &r->start_time);
+-		if(mstate->s.env->cfg->discard_timeout != 0 &&
++		if(mesh_is_udp(r)) {
++		    struct timeval old;
++		    timeval_subtract(&old, mstate->s.env->now_tv, &r->start_time);
++		    if(mstate->s.env->cfg->discard_timeout != 0 &&
+ 			((int)old.tv_sec)*1000+((int)old.tv_usec)/1000 >
+ 			mstate->s.env->cfg->discard_timeout) {
+ 			/* Drop the reply, it is too old */
+@@ -2525,8 +2526,11 @@ mesh_serve_expired_callback(void* arg)
+ 				http2_stream_remove_mesh_state(r->h2_stream);
+ 			comm_point_drop_reply(&r->query_reply);
+ 			mstate->reply_list = reply_list;
++			log_assert(mstate->s.env->mesh->num_reply_addrs > 0);
++			mstate->s.env->mesh->num_reply_addrs--;
+ 			mstate->s.env->mesh->num_queries_discard_timeout++;
+ 			continue;
++		    }
+ 		}
+ 
+ 		i++;
meta-networking/recipes-support/unbound/unbound_1.24.2.bb +1 -0
index 516ea20654..faf315876c 100644
@@ -42,6 +42,7 @@ SRC_URI = "git://github.com/NLnetLabs/unbound.git;protocol=https;branch=master;t
            file://CVE-2026-55990.patch \
            file://CVE-2026-55991.patch \
            file://CVE-2026-56416.patch \
+           file://CVE-2026-56444.patch \
            "
 
 SRCREV = "f6269baa605d31859f28770e01a24e3677e5f82c"