1/98
Looks like no tags are added yet.
Application layer
Top layer of the stack where user-facing software runs (browsers and servers and chat clients and games) using protocols like HTTP and DNS and FTP and SSH and TLS
Why do we need DNS?
Humans are good with names and words while computers are good with numbers so DNS maps domain names to IP addresses
Role of ARP in the stack
Maps logical IP addresses to physical hardware addresses (sits between the network layer and the link layer)
TCP vs UDP (transport layer)
Provide different quality of service - TCP is reliable and UDP is unreliable but lightweight
DNS
Domain Name System - an application-layer protocol and distributed database that maps domain names to IP addresses
FTP
File Transfer Protocol - old but still used protocol for uploading and downloading files
HTTP
Hypertext Transfer Protocol - the protocol of the web
Telnet
Early remote access protocol (insecure)
SSH
Secure Shell - more recent secure remote access protocol (the secure successor to Telnet)
SSL/TLS
Protocol for secure encrypted browsing (HTTPS)
IMAP / POP / SMTP
Internet email protocols
BitTorrent
Example of an application-layer file sharing protocol
URL
Uniform Resource Locator - standardised format describing the location and access method of a resource on the internet
URL structure
scheme://user:password@host:port/url-path?query-string
URL scheme
The protocol being used (e.g. https)
Why is putting user:password in a URL a bad idea?
It reveals your credentials to the browser (and its vendor) who may not be trustworthy - log in via the site's form instead
Default port for HTTPS
443 - usually omitted from the URL unless the server uses a non-standard port
URL url-path
The specific page or resource on the server (like a directory structure)
URL query-string
Comes after the ? - input for the server (e.g. a search) and its structure depends on the server
Structure of the host part of a URL
subdomain.domain.topdomain (e.g. profile.facebook.com)
In profile.facebook.com what are .com and facebook and profile?
.com is the top-level domain and facebook is the domain and profile is a subdomain
How can an attacker take a website offline using DNS?
Take out its DNS server so nobody can map the domain name to an IP address
Dyn attack (case study)
Distributed denial of service on DNS provider Dyn - flooded with requests so legitimate lookups got no reply and sites like Twitter became unreachable
Defences against DDoS
Redundancy and lots of bandwidth or hiding behind a provider like Cloudflare
DNS hijacking - New York Times (2013)
Attacker phished an IT admin's account at the DNS provider and changed the IP record for nytimes.com so visitors went to a different server
Two ways to attack DNS covered in lecture
1) DDoS the DNS server (e.g. Dyn) 2) Take over the admin's account (e.g. phishing in the NYT case) and change the records
Basic function of DNS
Map domain names to IP addresses
DNS mapping cardinality
Many to many - one name can have many IPs (google.com) and one IP can have many names (www.ed.ac.uk and edwc.is.ed.ac.uk)
Why is DNS distributed and not on one machine?
If one machine held all records an adversary would only need to take out that one machine to bring down global DNS
Resource record
An entry in the distributed DNS database (main types are A and MX and NS)
A record
Address record - the IP address associated with a host name
MX record
Mail exchange record - the mail server of a domain
NS record
Name server record - the authoritative server for a domain
Why do NS records exist?
They point a domain to its name server so resolvers know where to ask
Domain name
Two or more labels separated by dots (e.g. inf.ed.ac.uk has 4 labels)
TLD
Top-level domain - the rightmost label of a domain name
gTLD
Generic top-level domain (.com and .org and .net)
ccTLD
Country-code top-level domain (.ca and .it and .uk)
Examples of new TLDs
.scot and .tirol
ICANN
Non-profit Internet Corporation for Assigned Names and Numbers - allocates names and keeps the gTLD database and accredits registrars for gTLDs
Who manages gTLDs vs ccTLDs?
gTLDs are managed by ICANN and ccTLDs are managed by government organisations
Registrar (e.g. GoDaddy)
Accredited reseller of domain names - must register with ICANN and follow its rules or can be kicked out
UK domain quirk
You cannot register something.uk directly - it must sit under co.uk or ac.uk etc.
DNS tree
Hierarchy that starts at the root (an invisible dot at the far right) then TLDs then domains then subdomains
Which direction do you read a domain name for resolution?
Right to left - from the root down to the most specific label
Why is DNS a hierarchy?
It spreads load and responsibility and authority across many entities so no single global entity runs it all
Zone
Part of the DNS tree managed by one authority that holds the resource records for it (e.g. the brown.edu zone)
Visibility in the DNS tree
Servers know about names below them but not above them (top-down visibility)
Name server
Keeps a local database of DNS records and answers DNS queries and can ask other name servers if it does not have the record
Authoritative name server
Run by the domain's administrator and stores the reference (true) version of the DNS records for a zone
Examples of authoritative name servers
dns0.ed.ac.uk for ed.ac.uk and dns0.inf.ed.ac.uk for inf.ed.ac.uk
Root servers
Authoritative for the root zone (TLDs) and named [a-m].root-servers.net and supervised by ICANN
How does your computer find the root servers?
Their IP addresses are hardcoded into browsers and network applications
Resolver
Program that retrieves DNS records by querying a name server (default or root or given) and it caches the records it receives
dig and nslookup
Command-line DNS lookup tools - dig on Linux and nslookup on Windows
Iterative resolution
Name server refers the client to the next server (e.g. via an NS record) and the client repeats until it gets the answer
Recursive resolution
Name server queries other servers on the client's behalf and forwards the final answer (e.g. the A record) back to the client
Iterative walk for www.google.com
Local name server -> root (f.root-servers.net) -> .com (d.gtld-servers.net) -> google.com (ns2.google.com) -> A record
Iterative resolution - who can cache the answer?
Only the client's side (resolver and local name server) because the intermediate servers never learn the final answer
Recursive resolution - who can cache the answer?
Every name server along the path learns the answer and can cache it
Why can't your machine connect to a site before DNS finishes?
It needs the IP address first - without it nothing can be reached
Why does DNS use caching?
Traversing the DNS tree for every query would cause too much traffic and overload root and TLD servers (and web pages need many lookups so caching speeds things up)
TTL
Time-to-live - how long a cached record is kept before it expires (short for frequently changing IPs and longer for stable ones)
DNS lookup order with a cache
1) A record for the domain in cache? Answer immediately 2) NS record of the longest suffix in cache? Resume resolution from that name server
Longest suffix example
Looking up bananas.google.com - use the cached NS for google.com rather than the one for .com
What happens when the DNS cache is full?
Evict entries by some policy - e.g. oldest or very specific or least often read
Stale cached record
The IP has changed so the client fails to connect - the stale record is then dropped and refreshed
Why would root servers be overloaded without caching?
Every single lookup (.com and .org and .net etc.) would have to start at the root
Local DNS cache
Maintained by the OS and shared among all applications and all users of that machine
Windows command to view the DNS cache
ipconfig /displaydns
Windows command to clear the DNS cache
ipconfig /flushdns
Privacy issue with the local DNS cache
On a shared machine others can see the domains you visited - and incognito or private browsing does NOT clear it
Why flush the DNS cache before leaving a shared computer?
It hides the domain names you visited and the only cost is extra lookups for the next user
DNS cache poisoning - basic idea
Give a DNS server a false address record and get it cached so users are sent to the attacker's machine
DNS query transport
UDP on port 53 - reliability is not needed because you simply resend a query if no answer comes
16-bit request identifier
Unique ID in the query that matches answers to queries (a page load triggers many lookups) - not a real security feature
Authentication in DNS
None - DNS was designed in a high-trust era and queries are usually unencrypted (visible in Wireshark on UDP port 53)
When can a DNS cache be poisoned?
Predictable identifiers and return ports and/or attacker answers before the authoritative server and/or unsolicited records are accepted
BIND
Popular DNS server software - early versions were vulnerable to cache poisoning (since fixed)
Cache poisoning defence - query randomisation
Use a random 16-bit request identifier and a random 16-bit return port instead of predictable values
Probability of guessing a 16-bit request ID
1/2^16 = 0.0015%
Probability of guessing request ID and return port together
1/2^32 - less than one in four billion for a single guess
Weakness of query randomisation
It only helps against a single guess - an attacker who can make many guesses can still succeed (Kaminsky attack)
Kaminsky attack (subdomain DNS cache poisoning)
Victim is made to request many nonexistent subdomains (000.ed.ac.uk to 999.ed.ac.uk) giving the attacker many guesses at the ID and port
How does the attacker get the victim to send the requests?
Lure them to a web page (via phishing or social media) that loads many nonexistent subdomains of the target domain
Why use nonexistent subdomains in the Kaminsky attack?
They are not cached and the real server just says non-existent so each request gives the attacker a fresh chance to race with forged replies
NXDOMAIN
Response meaning the domain does not exist
Format of a forged response in the Kaminsky attack
Random ID + correct NS record + spoofed glue record pointing to the attacker's name server IP
Glue record
A record giving the IP address of a name server - spoofed in the attack to point at the attacker's server
Goal of the Kaminsky attack
Cache the correct NS name with the wrong IP (e.g. ns2.ed.ac.uk = 66.66.66.66) so all of ed.ac.uk goes to the attacker's name server
Main defence against cache poisoning
DNSSEC
DNSSEC
Secure DNS using public-key cryptography with signed replies at each step
Three goals of DNSSEC
Authenticity of the answer origin and integrity of the reply and authenticity of denial of existence
Authenticity of denial of existence
A signed 'this domain does not exist' answer so a forged earlier reply cannot trick you
How DNSSEC works in a lookup
Each server signs its replies and hands you the public key of the next zone down - you verify every step starting from a key you already know (e.g. .com)
Trust anchor
The one key you already know (burned into your software) - everything else chains from it like TLS root certificates in a browser
DNSSEC deployment status
Slow - root servers support it since 2010 but not every server enables it because key management is hard
DNSSEC vs random IDs and ports
DNSSEC gives real authenticity while randomisation only makes guessing harder
Lecture summary - key DNS topics
Distributed database and resolvers and name servers and iterative vs recursive resolution and caching and cache poisoning and DNSSEC