Unveiling IBDNS: The Intentionally Broken DNS Server

 
 
Introducing IBDNS
 
The Intentionally
Broken DNS Server
 
October 22
nd
, 2022
 
How to test testing tools?
 
2
 
Zonemaster
Checking if diagnostics
are correct requires:
ill-configured zones
broken servers
 
Some things can’t be done with faulty zones alone
 
3
 
Quoting from Zonemaster’s test specifications:
“[The BASIC04] test case will report problems found in the
following areas:
Name Server not responding to a query without EDNS over
UDP.
Name Server responding to TCP but not UDP.
Name Server not including SOA record of Child Zone in the
answer section in the response on a SOA query for Child
Zone.
Name Server not including NS record of Child Zone in the
answer section in the response on an NS query for Child Zone.
Name Server not setting the AA flag in a response with SOA
or NS in answer section.
Name Server responding with unexpected RCODE (any
except "NOERROR") on query for SOA or NS for Child Zone
.”
 
How to
test
these?
 
IBDNS’ 
current
 
coverage
 
4
Not listening on both TCP and UDP
Wire format corruption
Altering arbitrary flags in header; setting arbitrary RCODE
 
RFC 1034–1035
Incorrect case-folding during lookups
Responses with different case from
query
(work in progress…)
(planned)
 
Other RFCs
 
Architecture
 
5
Zone
DB
Zone
files
Config
file
Processing/
defect DB
subtree . (root) IN:
 
operate normally
subtree bit-flip.example.com. IN:
 
enable bit-flips
 
(skip 2 octets, probability = 0.005)
subtree case-sensitive.example.com. IN:
 
enable case-sensitive search
 
populates
 
points to
 
populate
 
Architecture
 
6
 
Query for 
hello.bit-flip.example.com
/A/IN:
Resolver
Core
 
1.
query
2.
nearest ancestor search
 of
hello.bit-flip.example.com
3.
configuration
 for
bit-flip.example.com
4.
lookup
 in zone DB
5.
resource records
 (or error)
6.
response
 
2
 
3
 
4
 
5
 
1
 
6
 
influences
Zone
DB
Processing/
defect DB
 
IBDNS
 
7
 
$ dig +nocmd +nostats +nord @127.0.1.1 TXT upper.answers.bad-case.test.
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 37253
;; flags: qr aa; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
 
;; QUESTION SECTION:
;upper.answers.bad-case.test.   IN      TXT
 
;; ANSWER SECTION:
UPPER.ANSWERS.BAD-CASE.TEST. 3600 IN    TXT     "My owner name is in uppercase"
 
$ dig +noall +question +answer +nord +nottl @127.0.1.1 TXT \
    {LOWER,original}.answers.bad-case.test
;LOWER.answers.bad-case.test. IN        TXT
lower.answers.bad-case.test. IN TXT     "My owner name is in lowercase"
;original.answers.bad-case.test.        IN TXT
OrIgInAL.answers.bad-case.test. IN TXT  "My owner name is in original case"
 
8
 
$ dig +nocmd +nostats +nord @127.0.1.1 TXT aa0.bad-flags.test
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 31519
;; flags: qr; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
 
;; QUESTION SECTION:
;aa0.bad-flags.test.            IN      TXT
 
;; ANSWER SECTION:
aa0.bad-flags.test.     3600    IN      TXT     "Non-authoritative response?!"
 
$
 
9
 
$ dig +nocmd +nostats +nord @127.0.1.1 TXT aa0.bad-flags.test
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 31519
;; flags: qr; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
 
;; QUESTION SECTION:
;aa0.bad-flags.test.            IN      TXT
 
;; ANSWER SECTION:
aa0.bad-flags.test.     3600    IN      TXT     "Non-authoritative response?!"
 
$ zonemaster-cli --test Basic/basic04 --ns ns.test/127.0.1.1 aa0.bad-flags.test
Seconds Level     Message
======= ========= =======
   0.03 WARNING   Nameserver ns.test/127.0.1.1 does not give an authoritative
response on an SOA query.
   0.03 WARNING   Nameserver ns.test/127.0.1.1 does not give an authoritative
response on an NS query.
 
10
 
$ dig +nocmd +nostats +nord @127.0.1.1 ANY no.bit-flip.test
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 8448
;; flags: qr aa; QUERY: 1, ANSWER: 5, AUTHORITY: 0, ADDITIONAL: 0
 
;; QUESTION SECTION:
;no.bit-flip.test.              IN      ANY
 
;; ANSWER SECTION:
no.bit-flip.test.       3600    IN      A       192.0.2.1
no.bit-flip.test.       3600    IN      A       192.0.2.2
no.bit-flip.test.       3600    IN      AAAA    2001:db8::53
no.bit-flip.test.       3600    IN      AAAA    2001:db8::1:53
no.bit-flip.test.       3600    IN      TXT     "Greetings from IBDNS!"
 
11
 
$ dig +nocmd +nostats +nord @127.0.1.1 ANY random.bit-flip.test
;; Warning: Message parser reports malformed message packet.
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 61611
;; flags: qr aa; QUERY: 1, ANSWER: 5, AUTHORITY: 0, ADDITIONAL: 0
 
;; QUESTION SECTION:
;random.bit-flip.test.          IN      ANY
 
;; ANSWER SECTION:
random.bit-flip.test.   3600    IN      A       192.0.2.1
random.bit-flip.test.   3600    IN      A       192.0.2.2
random.bit-flip.test.   3600    IN      
TYPE4124
 \# 16 20010DB8000000000
81
0000000000053
random.bit-flip.test.   3600    IN      AAAA    2001:db8::1:53
random.bit-flip.test.   3600    IN      TXT     "Greet
I
ngs
\160
from IBD
\014
S!"
 
12
 
$ dig +nocmd +nostats +nord @127.0.1.1 ANY random.bit-flip.test
;; Got bad packet: bad compression pointer
160 bytes
e3 8f 84 00 00 01 00 05 00 02 00 00 06 62 61 6e          .............ban
64 6f 6d 08 62 69 74 2d 66 6c 69 70 24 74 65 71          dom.bit-flip$teq
74 00 00 ff 00 01 c0 0c 00 01 00 05 00 00 0e 10          t...............
00 04 c0 00 02 01 c0 0c 00 01 00 01 00 00 0e 10          ................
00 04 c0 00 02 02 c0 0c 00 1c 00 01 00 00 0e 10          ................
00 10 20 01 0d b8 00 00 00 00 00 00 00 00 00 00          ................
00 53 c0 0c 00 1c 00 01 00 00 0e 10 00 10 00 00          .S..............
0d b8 00 00 00 00 00 00 00 80 00 01 00 53 
c8 0c
          .............S
..
00 10 00 01 00 00 0e 10 00 16 15 c7 72 64 65 74          ............rdet
69 6e 67 73 20 66 72 6f 6d 20 49 42 44 4e 53 21          ings.from.IBDNS!
 
Fuzz testing Zonemaster
 
13
 
$ zonemaster-cli --ns ns.test/127.0.1.1 bit-flip.test
 
Fuzz testing Zonemaster
 
14
 
$ zonemaster-cli --ns ns.test/127.0.1.1 bit-flip.test
Seconds Level     Message
======= ========= =======
[some messages omitted]
   0.59 NOTICE    There are neither DS nor DNSKEY records for the zone.
   0.59 NOTICE    The zone is not signed with DNSSEC.
[some more messages omitted]
   0.77 NOTICE    Child lists no nameserver that resolves to an IPv6 address. If any
were present, the minimum allowed would be 2.
   0.77 ERROR     Delegation does not list enough (1) nameservers (ns.test) that
resolve to IPv4 addresses (127.0.1.1). Lower limit set to 2.
   0.77 NOTICE    Delegation lists no nameserver that resolves to an IPv6 address.
If any were present, the minimum allowed would be 2.
Segmentation fault
$
 
What caused the segfault
 
15
 
bit-flip.test.   3600  IN  A    192.0.2.1
 
bit-flip.test.   3600  IN  CAA  \# 4 C0000201
 
into
 
Flipping just the right bit turned
 
Eventually…
 
16
 
Contributions
 
17
 
Filling a void in DNS testing software
A project to help explore:
“Holes” in RFCs (esp. those published before RFC 2119)
Incorrect implementations of DNS
Bugs (vulnerabilities?) in DNS libraries
The value of fuzz testing, even when relying on mature libraries
Slide Note
Embed
Share

Uncover the unique server, IBDNS, intentionally designed to simulate faulty DNS scenarios for testing. Explore its unconventional testing tools, coverage of RFCs, and architecture focusing on file zones and bit-flip examples. Delve into testing methodologies and response simulations tailored for diagnostic purposes. Test your DNS queries against various fault scenarios with this innovative tool.

  • DNS testing
  • IBDNS
  • Faulty zones
  • Diagnostic tools
  • Server architecture

Uploaded on Sep 21, 2024 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

E N D

Presentation Transcript


  1. October 22nd, 2022 Introducing IBDNS The Intentionally Broken DNS Server

  2. How to test testing tools? Checking if diagnostics are correct requires: ill-configured zones broken servers Zonemaster (https://zonemaster.fr) 2

  3. Some things cant be done with faulty zones alone Quoting from Zonemaster s test specifications: [The BASIC04] test case will report problems found in the following areas: Name Server not responding to a query without EDNS over UDP. Name Server responding to TCP but not UDP. Name Server not including SOA record of Child Zone in the answer section in the response on a SOA query for Child Zone. Name Server not including NS record of Child Zone in the answer section in the response on an NS query for Child Zone. Name Server not setting the AA flag in a response with SOA or NS in answer section. Name Server responding with unexpected RCODE (any except "NOERROR") on query for SOA or NS for Child Zone. How to test these? 3

  4. IBDNS current coverage Other RFCs RFC 1034 1035 (work in progress ) Responses with different case from query (planned) Incorrect case-folding during lookups Altering arbitrary flags in header; setting arbitrary RCODE Wire format corruption Not listening on both TCP and UDP 4

  5. Architecture points to Config file Zone files subtree . (root) IN: operate normally subtree bit-flip.example.com. IN: enable bit-flips (skip 2 octets, probability = 0.005) subtree case-sensitive.example.com. IN: enable case-sensitive search populates populate Processing/ defect DB Zone DB 5

  6. Architecture Query for hello.bit-flip.example.com/A/IN: IBDNS 1 Resolver Core 6 5 2 1. 2. nearest ancestor search of hello.bit-flip.example.com 3. configuration for bit-flip.example.com 4. lookup in zone DB 5. resource records (or error) 6. response query 4 3 Processing/ defect DB Zone DB 6

  7. $ dig +nocmd +nostats +nord @127.0.1.1 TXT upper.answers.bad-case.test. ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 37253 ;; flags: qr aa; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;upper.answers.bad-case.test. IN TXT ;; ANSWER SECTION: UPPER.ANSWERS.BAD-CASE.TEST. 3600 IN TXT "My owner name is in uppercase" $ dig +noall +question +answer +nord +nottl @127.0.1.1 TXT \ {LOWER,original}.answers.bad-case.test ;LOWER.answers.bad-case.test. IN TXT lower.answers.bad-case.test. IN TXT "My owner name is in lowercase" ;original.answers.bad-case.test. IN TXT OrIgInAL.answers.bad-case.test. IN TXT "My owner name is in original case" 7

  8. $ dig +nocmd +nostats +nord @127.0.1.1 TXT aa0.bad-flags.test ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 31519 ;; flags: qr; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;aa0.bad-flags.test. IN TXT ;; ANSWER SECTION: aa0.bad-flags.test. 3600 IN TXT "Non-authoritative response?!" $ 8

  9. $ dig +nocmd +nostats +nord @127.0.1.1 TXT aa0.bad-flags.test ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 31519 ;; flags: qr; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;aa0.bad-flags.test. IN TXT ;; ANSWER SECTION: aa0.bad-flags.test. 3600 IN TXT "Non-authoritative response?!" $ zonemaster-cli --test Basic/basic04 --ns ns.test/127.0.1.1 aa0.bad-flags.test Seconds Level Message ======= ========= ======= 0.03 WARNING Nameserver ns.test/127.0.1.1 does not give an authoritative response on an SOA query. 0.03 WARNING Nameserver ns.test/127.0.1.1 does not give an authoritative response on an NS query. 9

  10. $ dig +nocmd +nostats +nord @127.0.1.1 ANY no.bit-flip.test ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 8448 ;; flags: qr aa; QUERY: 1, ANSWER: 5, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;no.bit-flip.test. IN ANY ;; ANSWER SECTION: no.bit-flip.test. 3600 IN A 192.0.2.1 no.bit-flip.test. 3600 IN A 192.0.2.2 no.bit-flip.test. 3600 IN AAAA 2001:db8::53 no.bit-flip.test. 3600 IN AAAA 2001:db8::1:53 no.bit-flip.test. 3600 IN TXT "Greetings from IBDNS!" 10

  11. $ dig +nocmd +nostats +nord @127.0.1.1 ANY random.bit-flip.test ;; Warning: Message parser reports malformed message packet. ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 61611 ;; flags: qr aa; QUERY: 1, ANSWER: 5, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;random.bit-flip.test. IN ANY ;; ANSWER SECTION: random.bit-flip.test. 3600 IN A 192.0.2.1 random.bit-flip.test. 3600 IN A 192.0.2.2 random.bit-flip.test. 3600 IN TYPE4124 \# 16 20010DB8000000000810000000000053 random.bit-flip.test. 3600 IN AAAA 2001:db8::1:53 random.bit-flip.test. 3600 IN TXT "GreetIngs\160from IBD\014S!" 11

  12. $ dig +nocmd +nostats +nord @127.0.1.1 ANY random.bit-flip.test ;; Got bad packet: bad compression pointer 160 bytes e3 8f 84 00 00 01 00 05 00 02 00 00 06 62 61 6e .............ban 64 6f 6d 08 62 69 74 2d 66 6c 69 70 24 74 65 71 dom.bit-flip$teq 74 00 00 ff 00 01 c0 0c 00 01 00 05 00 00 0e 10 t............... 00 04 c0 00 02 01 c0 0c 00 01 00 01 00 00 0e 10 ................ 00 04 c0 00 02 02 c0 0c 00 1c 00 01 00 00 0e 10 ................ 00 10 20 01 0d b8 00 00 00 00 00 00 00 00 00 00 ................ 00 53 c0 0c 00 1c 00 01 00 00 0e 10 00 10 00 00 .S.............. 0d b8 00 00 00 00 00 00 00 80 00 01 00 53 c8 0c 00 10 00 01 00 00 0e 10 00 16 15 c7 72 64 65 74 ............rdet 69 6e 67 73 20 66 72 6f 6d 20 49 42 44 4e 53 21 ings.from.IBDNS! .............S.. 12

  13. Fuzz testing Zonemaster $ zonemaster-cli --ns ns.test/127.0.1.1 bit-flip.test 13

  14. Fuzz testing Zonemaster $ zonemaster-cli --ns ns.test/127.0.1.1 bit-flip.test Seconds Level Message ======= ========= ======= [some messages omitted] 0.59 NOTICE There are neither DS nor DNSKEY records for the zone. 0.59 NOTICE The zone is not signed with DNSSEC. [some more messages omitted] 0.77 NOTICE Child lists no nameserver that resolves to an IPv6 address. If any were present, the minimum allowed would be 2. 0.77 ERROR Delegation does not list enough (1) nameservers (ns.test) that resolve to IPv4 addresses (127.0.1.1). Lower limit set to 2. 0.77 NOTICE Delegation lists no nameserver that resolves to an IPv6 address. If any were present, the minimum allowed would be 2. Segmentation fault $ 14

  15. What caused the segfault Flipping just the right bit turned bit-flip.test. 3600 IN A 192.0.2.1 into bit-flip.test. 3600 IN CAA \# 4 C0000201 15

  16. Eventually 16

  17. Contributions Filling a void in DNS testing software A project to help explore: Holes in RFCs (esp. those published before RFC 2119) Incorrect implementations of DNS Bugs (vulnerabilities?) in DNS libraries The value of fuzz testing, even when relying on mature libraries 17

More Related Content

giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#