mirror of
https://github.com/hickory-dns/hickory-dns.git
synced 2026-04-25 11:15:54 +03:00
[GH-ISSUE #2252] infinite recursion in DnssecDnsHandle when nameservers use an unsupported algorithm #939
Labels
No labels
blocked
breaking-change
bug
bug:critical
bug:tests
cleanup
compliance
compliance
compliance
crate:all
crate:client
crate:native-tls
crate:proto
crate:recursor
crate:resolver
crate:resolver
crate:rustls
crate:server
crate:util
dependencies
docs
duplicate
easy
easy
enhance
enhance
enhance
feature:dns-over-https
feature:dns-over-quic
feature:dns-over-tls
feature:dnsssec
feature:global_lb
feature:mdns
feature:tsig
features:edns
has workaround
ops
perf
platform:WASM
platform:android
platform:fuchsia
platform:linux
platform:macos
platform:windows
pull-request
question
test
tools
tools
trust
unclear
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hickory-dns#939
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @japaric on GitHub (Jun 20, 2024).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/2252
Describe the bug
what the title says
To Reproduce
dns-testset up a network of nameservers whose zone files have been signed using the algorithmRSASHA1NSEC3SHA1.hickory-dnswith the featurednssec-ring(+)hickory-dnsto perform DNSSEC validation (#2234)NS com.with the AD flag sethickory-dnswill enter an infinite recursion loop that results in a stack overflow:Once the PR for #2234 is up I think we'll have at least one test that hits this bug.
I'm not sure if this bug also affects
Resolveras I have not tested that in adns-testenvironment(+) As a workaround, you can use the
dnssec-opensslimplementation to avoid this bug. ring does not support RSASHA1NSEC3SHA1 but openssl does.Expected behavior
hickory-dnsshould not crash and instead it should respond with an error status like SERVFAILSystem:
Version:
Crate:
proto,recursor,server,hickory-dnsVersion:
02a8668fd5@japaric commented on GitHub (Jul 1, 2024):
I found the source of the bug in this function
github.com/hickory-dns/hickory-dns@898f60fbeb/crates/proto/src/xfer/dnssec_dns_handle.rs (L490-L495)this line specifically
github.com/hickory-dns/hickory-dns@898f60fbeb/crates/proto/src/xfer/dnssec_dns_handle.rs (L545)if
zoneis.(root) thenzone.base_name()also returns.and that causesfind_ds_recordto be executed with the exact same arguments as its parent. That results in infinite recursion. Therequest_depthmechanism inDnssecDnsHandledoes not prevent the problem because even when there arelookuperrors the recursive call in line 545 is executed.I think the other condition to trigger this bug is that the query
DS .must return no records which is the case in the conformance tests but I believe it's not the case in the public DNS network.IMO, the function
Zone::base_nameshould return anOptioninstead of returning.for.. That might have made this infinite recursion path more obvious when this code was authored.The fix is easy but to add a regression test along the fix I would need to have #2253 in place as that lets me test this path via the
RecursorAPI. I'll prepare a separate PR that builds on top of #2253