mirror of
https://github.com/hickory-dns/hickory-dns.git
synced 2026-04-24 18:55:55 +03:00
[GH-ISSUE #1889] Infinite recursion and stack overflow on handling broken glueless referral #807
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#807
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 @jonasbb on GitHub (Jan 26, 2023).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/1889
Describe the bug
There is an infinite recursion while looking for missing glue data, leading to a stack overflow.
The main stack overflow is this part, which repeats until the crash at the end. After the crash, no further DNS processing is done, effectively causing a denial-of-service.
Debug logs until the first recursion loop
I am performing some DNS tests and encountered this crash with trust-dns. No other resolver seems to have a problem with the glueless delegations.
The DNS client starts with a query
kdig @127.0.0.1 NS .. The log above is the result of the query.trust-dns seems to get stuck on this answer record, since it doesn't contain an IP address:
I think this is technically a wrong response and should be a referral. The referral would have an empty answer, but the
NSin the nameserver section and additional records for the IP addresses. Other resolvers can handle the situation without breaking.To Reproduce
Reproduction requires a custom root server setup. The full trust-dns configuration is under "Additional context". The root DNS server communication is in the log and can be replayed.
Expected behavior
trust-dns should not run into a stack overflow. It should either handle the broken response gracefully, or return a SERVFAIL.
To handle the error gracefully, trust-dns could contact the pre-configured root server, of which it has the IP address, to ask it to provide the missing IP address, i.e.:
Send a query
@127.64.1.1 IN A ns-ns.nsand@127.64.1.1 IN AAAA ns-ns.ns.Use these IP addresses to continue the recursive lookup.
System:
Version:
Crate: recursor
Version: lastest commit
0b6fefea3fAdditional context
I tested BIND9, Knot Resolver, PowerDNS Recursor, Unbound, and Deadwood; all of them can handle the wrong response fine.
root.hints:trust-dns.toml:tcpdump.zip
@bluejekyll commented on GitHub (Jan 26, 2023):
We really need to get some integration tests setup for the recursor. This isn’t surprising, but it would be good to reproduce in some tests and fix there.
I’ll try to take a look when I have some time, but if anyone finds a way to deal with this, please don’t hesitate to put up a PR.