05 Dns
05 Dns
Dominik Scholz
Slides by Benjamin Hof
[email protected]
Lab 5 – 18ss
1 / 32
Outline
Resolver
Security
2 / 32
Outline
Resolver
Security
3 / 32
The quest for memorable names
address resolution
1. host files
I file with mappings
I copy between all machines
I /etc/hosts
2. protocol: Domain Name System
I by Paul Mockapetris in 1983
I wide deployment in 1988
4 / 32
Domain Name System
5 / 32
Distributed hierarchical name space
cs ma ei
mail
Fully qualified domain name (FQDN) by label concatenation:
mail.cs.tum.edu.
6 / 32
Distributed hierarchical name space
cs ma ei
mail
Fully qualified domain name (FQDN) by label concatenation:
mail.cs.tum.edu.
6 / 32
Name server
Example
Knot and unbound
7 / 32
Outline
Resolver
Security
8 / 32
Zone
Example
tum.edu. delegated by edu., containing www.tum.edu. and
mail.in.tum.edu.
9 / 32
Authoritative name server
10 / 32
Zones: example
cs ma ei
11 / 32
Resource record
12 / 32
Resource record
12 / 32
Resource record
12 / 32
Resource record
12 / 32
Resource record
12 / 32
Resource records
13 / 32
Resource records
I RRset for i.example.net. type AAAA with more than one record!
I note: TTL and class usually omitted
13 / 32
Zone file and record types
14 / 32
Zone file and record types
14 / 32
Zone file and record types
14 / 32
Zone file and record types
14 / 32
Zone file and record types
14 / 32
Zone file and record types
14 / 32
Zone file and record types
14 / 32
Delegation
sub.example.net. NS ns.sub.example.net.
ns.sub.example.net. A 198.51.100.3
15 / 32
Outline
Resolver
Security
16 / 32
Resolving name server tasks
17 / 32
DNS packet layout
ID, flags,
number of RRs records
header
c,s QR query or response
s AA authoritative answer
s TC truncation (TCP as fallback)
c RD recursion desired
s RA recursion available
s 4 bit response code: no error, name error, server failure, refused
I number of resource records in each section
18 / 32
DNS packet layout
ID, flags,
number of RRs records
record sections
I query: only one record with owner, type, class
I answer: answer RRs
I authoritative section: name server delegation
I additional section: glue records, EDNS pseudo record
18 / 32
Lookup
IP?
in.tum.de.
I recursive queries
19 / 32
Lookup
k.root-servers.net.
2001:7fd::1
in.tum.de. A
de. NS a.nic.de.
a.nic.de. A 194.0.0.53
stub forwarder recursor
in.tum.de.
I recursive queries
I iterative queries
I glue
19 / 32
Lookup
k.root-servers.net.
in.tum.de. A a.nic.de.
in.tum.de.
I recursive queries
I iterative queries
I glue
19 / 32
Lookup
k.root-servers.net.
a.nic.de.
in.tum.de. A
stub forwarder recursor
in.tum.de.
I recursive queries
I iterative queries
I glue
19 / 32
Lookup
k.root-servers.net.
a.nic.de.
dns1.lrz.de.
in.tum.de.
I recursive queries
I iterative queries
I glue
19 / 32
Lookup
k.root-servers.net.
a.nic.de.
dns1.lrz.de.
131.159.0.35
in.tum.de.
I recursive queries
I iterative queries
I glue
19 / 32
Reverse lookup
IPv4
I PTR record type
I special domain in-addr.arpa.
I 198.51.100.5 → 5.100.51.198.in-addr.arpa.
I small subnets require lots of CNAMEs
IPv6
I ip6.arpa.
I can be delegated per nibble
I 2001:db8::1 is:
1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.
20 / 32
Outline
Resolver
Security
21 / 32
Common attacks using DNS
Cache poisoning
I send many packets with fake responses to a resolver
I spoofed source IP: address of an authoritative name server
I try to answer a query before the legitimate server does
Counter: randomize as much as possible: source port, query id
22 / 32
Security extensions in DNS: DNSSEC
Basic idea
I signatures with public key cryptography
I zone owner signs RRsets offline using private key
I full resolvers verify signatures using public key
How do we know that the signing key really belongs to the zone
owner?
23 / 32
Changes
New RR types
I RRSIG: signature over RRset
I signature validity introduces absolute time into DNS
I DS (delegation signer): hash of public key
I DNSKEY: public key
I NSEC, NSEC3: for nonexisting domains
24 / 32
Changes (cont’d)
header bits
c CD checking disabled: request delivery of DNSSEC records
s AD answer authenticated: DNSSEC successfully verified
EDNS extension
I uses pseudo record
I larger UDP payload size
c DO bit: DNSSEC OK: include RRSIGs, DS
25 / 32
Zone signing
parent zone
child zone
RRset public key RRset
RRSIG
child zone
RRset public key RRset
RRSIG
child zone
RRset public key RRset
DNSKEY
RRSIG
RRSIG
child zone
RRset public key RRset
DNSKEY
RRSIG
g.root-servers.net.
torproject.org. AAAA
org. NS a0.org.afilias-nst.info.
org. DS
resolver org. RRSIG DS
+ glue
torproject.org.?
27 / 32
Record collection
g.root-servers.net.
torproject.org. AAAA
resolver a0.org.afilias-nst.info.
torproject.org. NS ns1.torproject.org.
torproject.org. DS
torproject.org. RRSIG DS
+ glue
27 / 32
Record collection
g.root-servers.net.
resolver a0.org.afilias-nst.info.
torproject.org. AAAA
torproject.org. AAAA
torproject.org. RRSIG AAAA
ns1.torproject.org.
27 / 32
Record collection
g.root-servers.net.
. DNSKEY
. DNSKEY
. RRSIG DNSKEY
resolver a0.org.afilias-nst.info.
ns1.torproject.org.
27 / 32
Record collection
g.root-servers.net.
org. DNSKEY
resolver a0.org.afilias-nst.info.
org. DNSKEY
org. RRSIG DNSKEY
ns1.torproject.org.
27 / 32
Record collection
g.root-servers.net.
resolver a0.org.afilias-nst.info.
torproject.org. DNSKEY
torproject.org. DNSKEY
torproject.org. RRSIG DNSKEY
ns1.torproject.org.
27 / 32
Discussion
We have for each zone:
I DS
I RRSIG DS
I DNSKEY
I RRSIG DNSKEY
as well as the RRSIG AAAA.
28 / 32
Alternative signing scheme
child zone
parent zone
DNSKEY: KSK
DS (KSK)
DNSKEY: ZSK
RRSIG
RRSIG
RRset
RRSIG
29 / 32
Deal with nonexisting domains
NSEC
sign the hole between two domains:
alice.example.net. NSEC charlie.example.net. A RRSIG NSEC
I + RRSIG
I no domains between alice and charlie
I alice only has A, RRSIG and NSEC records
I zone walking
NSEC3
I hash all domains
I order by hash value
30 / 32
Operational considerations
I offline signing
I small key sizes recommended for speed
I many parameter choices
I limited key lifetime, frequent rollover required
I best practice: key signing key, zone signing key
⇒ operational complexity
Example
Software like OpenDNSSEC or Knot automates a lot of this.
31 / 32
Security gaps
32 / 32