mirror of
https://github.com/hickory-dns/hickory-dns.git
synced 2026-04-25 03:05:51 +03:00
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#2963
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?
📋 Pull Request Information
Original PR: https://github.com/hickory-dns/hickory-dns/pull/2332
Author: @marcus0x62
Created: 7/30/2024
Status: ✅ Merged
Merged: 8/27/2024
Merged by: @djc
Base:
main← Head:recursor_infinite_recursion📝 Commits (3)
2c76692Add append_ips method to NameServerConfigGroup128859eAdd append_ips_from_lookup function to reduce duplicated and inconsistent boilerplate in9347c47Fix Issue #2306 / infinite recursion in ns_pool_for_zone📊 Changes
4 files changed (+135 additions, -122 deletions)
View changed files
📝
conformance/packages/conformance-tests/src/resolver/dnssec/regression.rs(+0 -1)📝
crates/recursor/src/lib.rs(+2 -1)📝
crates/recursor/src/recursor_dns_handle.rs(+118 -120)📝
crates/resolver/src/config.rs(+15 -0)📄 Description
As described in Issue #2306, it is possible to cause a Hickory server crash under certain conditions:
There are no cached NS pools for a given zone with valid name servers
Querying the parent DNS servers for a given zone only return child NS records. E.g.,
querying IN NS for example.com only returns something like:
example.com. IN NS ns1.example.com.
example.com. IN NS ns2.example.com.
with no non-child NS records. E.g.,
example.com. IN NS ns1.someotherdomain.net.
No glue records are returned with the NS records.
This will cause an infinite loop where ns_pool_for_zone calls resolve to get A/AAAA records for the NS records returned by the parent server, which since there is no pool for example.com will in turn call ns_pool_for_zone again, which triggers another call to resolve, and so on until the stack is exhausted.
This can be seen, as described in the issue if you configure BIND to act as a dummy root server for a hosted zone. It will only return glue records if those are present in its cache -- not the hosted zone. So, if you send the BIND server an A query directly for the delegated nameserver prior to sending the recursive query through Hickory, this bug will not be triggered. If you empty caches on both servers and send a query for the hosted zone to Hickory first, the bug will be triggered.
This patch works by changing the logic in ns_pool_for_zone to only call resolve from within ns_pool_for_zone for non-child NS servers. If, after querying for any non-child NS servers there still are not any NS servers to use for a zone, then queries for child NS servers will be sent to the parent zone of the zone being queried, but these queries are done with NameServerPool.lookup so as to avoid the possibility of infinite recursion. The initial check for glue records is unchanged, so the overall order of priority within ns_pool_for_zone for identifying name servers to use for a pool is:
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.