mirror of
https://github.com/hickory-dns/hickory-dns.git
synced 2026-04-25 03:05:51 +03:00
[GH-ISSUE #2210] malformed query can cause assertion failure at encoder.rs:234 #922
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#922
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 @rtmrtmrtmrtm on GitHub (May 13, 2024).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/2210
If a client sends this DNS request to the hickory 0.24.0 DNS server:
08 00 00 00 00 01 00 00 00 00 00 00 c0 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00
i.e.:
08 00 ID
00 00 flags
00 01 QDCOUNT
00 00 ANCOUNT
00 00 NSCOUNT
00 00 ARCOUNT
c0 00 QNAME
00 00 QTYPE
00 00 QCLASS
hickory-dns fails the 2nd assert here while building the reply message
(really while remembering names for pointers):
The name is eight bytes long, but the current message size (after the
current offset of 12) is only six, because QueriesEmitAndCount::emit()
stored just the six bytes of the original encoded query:
So the assert fails.
I've attached a demo program that assumes something like this is
already running:
hickory-dns/target/debug/hickory-dns -d -c hickory-dns/tests/test-data/test_configs/example.toml -z hickory-dns/tests/test-data/test_configs/ -p 24141
hickory1a.txt
@djc commented on GitHub (May 14, 2024):
Thanks for the report! Could you send your test case as a PR adding a unit test in
crates/proto/src/rr/serialize/encoder.rs? Bonus points if you can also come up with a fix, but I can probably find some time to fix it myself. 👍@bluejekyll commented on GitHub (Aug 11, 2024):
I'm working on a patch for this. Thanks for the test case, that helped me construct a unit test that can recreate the same issue. It's definitely related to using the original Query bytes during the encoding of the response.