Fix possible DNSSEC bypass in prove_non_existence_nsec()

Thanks to 전승훈 <snowjeon2@cau.ac.kr> for finding this bug, it's
a repeat of the problems seen in CVE-2026-4891.

Their explanation:
In prove_non_existence_nsec() around line 1296 of dnssec.c,
the second extract_name() call uses plen as its bound instead of
psave+rdlen. So if a crafted NSEC record has a Next Domain Name
that's longer than rdlen declares, extract_name() happily reads
past the rdata boundary (still within the packet, so no crash), and then
rdlen -= (p - psave) goes negative. The while (rdlen > 0) bitmap loop
never runs, and the function returns 0 as if non-existence was proven,
without ever checking the type bitmap.
This commit is contained in:
Simon Kelley committed 2026-11-30 21:13:33 +00:00
1 parent 5ec80aa6c8
commit 5ef5406a0c
2 files changed
+8 -1

No files matched your search

+5
View File
@@ -19,6 +19,11 @@ version 2.94
which arrises from the same mistake, Credit to
Georgi Steffenhagen (ServerTec IT Engineering) for this one.
Fix possible DNSSEC bypass in prove_non_existence_nsec()
Thanks to 전승훈 <snowjeon2@cau.ac.kr> for finding this bug, it's
a repeat of the problems seen in CVE-2026-4891.
version 2.93
Fix a corner-case in DNSSEC validation with wildcards. If we have
a wildcard record *.example.com and receive a query for
+3 -1
View File
@@ -1292,7 +1292,9 @@ static int prove_non_existence_nsec(struct dns_header *header, size_t plen, unsi
GETSHORT(rdlen, p);
psave = p;
if (!extract_name(header, plen, &p, workspace2, EXTR_NAME_EXTRACT, 0))
/* If the name is longer that rdlen, then our bitmap code gets
very confused. Doing that deliberately can bypass type bitmap checks. */
if (!extract_name(header, plen, &p, workspace2, EXTR_NAME_EXTRACT, 0) || (p - psave > rdlen))
return DNSSEC_FAIL_BADPACKET;
/* If NSEC comes from wildcard expansion, use original wildcard