Networking and Denial of Service CS461/ECE422 Spring 2012 - - PowerPoint PPT Presentation
Networking and Denial of Service CS461/ECE422 Spring 2012 - - PowerPoint PPT Presentation
Networking and Denial of Service CS461/ECE422 Spring 2012 Reading Material Chapter 7 of text ARP cache poisoning hEp://en.wikipedia.org/wiki/ARP_spoofing
Reading ¡Material ¡
- Chapter ¡7 ¡of ¡text ¡
- ARP ¡cache ¡poisoning ¡
– hEp://en.wikipedia.org/wiki/ARP_spoofing ¡
- Reference ¡to ¡DNS ¡cache ¡poisoning ¡
Outline ¡
- Quick ¡review ¡of ¡network ¡stack ¡
- IP ¡addressing ¡and ¡spoofing ¡
- ARP ¡and ¡ARP ¡cache ¡poisoning ¡
- ICMP ¡and ¡Smurf ¡aEack ¡
- UDP ¡and ¡DHCP ¡
- TCP ¡and ¡SYN ¡flood ¡
- DNS ¡and ¡DNS ¡open ¡relay ¡and ¡cache ¡poisoning ¡
OSI ¡Reference ¡Model ¡
- The ¡layers ¡
– 7: ¡ApplicaUon, ¡e.g., ¡HTTP, ¡SMTP, ¡FTP ¡ – 6: ¡PresentaUon ¡ – 5: ¡Session ¡ – 4: ¡Transport, ¡e.g. ¡TCP, ¡UDP ¡ – 3: ¡Network, ¡e.g. ¡IP, ¡IPX ¡ – 2: ¡Data ¡link, ¡e.g., ¡Ethernet ¡frames, ¡ATM ¡cells ¡ – 1: ¡Physical, ¡e.g., ¡Ethernet ¡media, ¡ATM ¡media ¡
- Standard ¡so[ware ¡engineering ¡reasons ¡for ¡thinking ¡about ¡a ¡
layered ¡design ¡
Message ¡mapping ¡to ¡the ¡layers ¡
SVN ¡update ¡message ¡ ¡Packet2 ¡ DP ¡ SP ¡ DP ¡ SP ¡ ¡Packet1 ¡ DP ¡ SP ¡ DP ¡ SP ¡ DA ¡ SA ¡ ¡Packet1 ¡ DP ¡ SP ¡ DA ¡ SA ¡ Pack 2 ¡ CommunicaUons ¡bit ¡stream ¡ DP ¡ SP ¡ DA ¡ SA ¡ Packet1 ¡ D M ¡ S M ¡ DP ¡ SP ¡ DA ¡ SA ¡ Pack 2 ¡ D M ¡ S M ¡ L7 App L4 TCP L3 IP L2 Eth
Switches ¡
- Original ¡ethernet ¡broadcast ¡all ¡packets ¡
- Layer ¡two ¡means ¡of ¡passing ¡packets ¡
– Learn ¡or ¡config ¡which ¡MAC's ¡live ¡behind ¡which ¡ ports ¡ – Only ¡pass ¡traffic ¡to ¡the ¡appropriate ¡port ¡
- Span ¡ports ¡
– Mirror ¡all ¡traffic ¡
Physical ¡Denial ¡of ¡Service ¡
l Radio ¡
- Jamming ¡
l Cables ¡
- Cubng ¡or ¡muUlaUng ¡
Network ¡Layer ¡-‑ ¡IP ¡
l Moves ¡packets ¡between ¡computers ¡
- Possibly ¡on ¡different ¡physical ¡segments ¡
- Best ¡effort ¡
l Technologies ¡
- RouUng ¡
- Lower ¡level ¡address ¡discovery ¡(ARP) ¡
- Error ¡Messages ¡(ICMP) ¡
IPv4 ¡
- See ¡Wikipedia ¡for ¡field ¡details ¡
– hEp://en.wikipedia.org/wiki/IPv4 ¡ Version IHL Type of service Total length Identification DF MF Frag Offset Time to live Protocol Header checksum Source address Destination Address 0 or more words of options
Ipv4 ¡Addressing ¡
- Each ¡enUty ¡has ¡at ¡least ¡one ¡address ¡
- Addresses ¡divided ¡into ¡subnetwork ¡
– Address ¡and ¡mask ¡combinaUon ¡ – 192.168.1.0/24 ¡or ¡10.0.0.0/8 ¡ – 192.168.1.0 ¡255.255.255.0 ¡or ¡10.0.0.0 ¡255.0.0.0 ¡ – 192.168.1.0-‑192.168.1.255 ¡or ¡10.0.0.0-‑10.255.255.255 ¡
- Addresses ¡in ¡your ¡network ¡are ¡“directly” ¡
connected ¡
– Broadcasts ¡should ¡reach ¡them ¡ – No ¡need ¡to ¡route ¡packets ¡to ¡them ¡
Example ¡Network ¡
Denial ¡of ¡Service ¡
- Basic ¡case ¡
– Use ¡simple ¡flooding ¡ping ¡ – Higher ¡capacity ¡link ¡floods ¡lower ¡capacity ¡link ¡
- E.g ¡Large ¡company ¡floods ¡small ¡company ¡web ¡site ¡
– Problem: ¡Easily ¡traceable ¡
Address ¡spoofing ¡
- Sender ¡can ¡put ¡any ¡source ¡address ¡in ¡packets ¡he ¡
sends: ¡
- Can ¡directly ¡aEack ¡target ¡in ¡a ¡less ¡traceable ¡fashion ¡
- Can ¡be ¡used ¡to ¡send ¡unwelcome ¡return ¡traffic ¡to ¡the ¡
spoofed ¡address ¡
- Can ¡be ¡used ¡to ¡bypass ¡filters ¡to ¡get ¡unwelcome ¡traffic ¡
to ¡the ¡desUnaUon ¡
- Routers ¡can ¡catch ¡some ¡spoofers ¡
- Reverse ¡path ¡verificaUon ¡
- Egress ¡filtering ¡
Example ¡Network ¡
Denial ¡of ¡Service ¡
- Distributed ¡case ¡
– Malware ¡installed ¡on ¡many ¡computers ¡(bots) ¡ – Command ¡and ¡control ¡system ¡direct ¡many ¡bots ¡to ¡ flood ¡common ¡target ¡
- Distributed ¡case ¡2 ¡
– Get ¡many ¡people ¡to ¡use ¡their ¡own ¡computers ¡to ¡ flood ¡a ¡common ¡target ¡ – E.g. ¡Anonymous ¡
Example ¡Network ¡
Flooding ¡Target ¡ProtecUon ¡OpUons ¡
- Plan ¡ahead ¡
– Have ¡addiUonal ¡backup ¡sites ¡that ¡can ¡be ¡enabled ¡ – Reduce ¡targets ¡ – Enforce ¡resource ¡consumpUon ¡policies ¡
- AEack ¡detecUon ¡and ¡filtering ¡
– Detect ¡bad ¡traffic ¡ – Update ¡filters ¡
- AEack ¡source ¡traceback ¡and ¡idenUficaUon ¡
– More ¡of ¡a ¡forensics ¡tool ¡ – Unlikely ¡to ¡be ¡fast ¡enough ¡to ¡stop ¡ongoing ¡aEack ¡
Address ¡ResoluUon ¡Protocol ¡(ARP) ¡
- Used ¡to ¡discover ¡mapping ¡of ¡neighboring ¡
ethernet ¡MAC ¡to ¡IP ¡addresses. ¡
– Need ¡to ¡find ¡MAC ¡for ¡192.168.1.3 ¡which ¡is ¡in ¡your ¡ interface's ¡subnetwork ¡ – Broadcast ¡an ¡ARP ¡request ¡on ¡the ¡link ¡ – Hopefully ¡receive ¡an ¡ARP ¡reply ¡giving ¡the ¡correct ¡ MAC ¡ – The ¡device ¡stores ¡this ¡informaUon ¡in ¡an ¡ARP ¡cache ¡
- r ¡ARP ¡table ¡
ARP ¡Protocol ¡
What ¡is ¡the ¡MAC ¡
- f ¡192.168.100.1? ¡
The ¡MAC ¡of ¡ 192.168.100.1 ¡is ¡ B:B:B:B:B:B ¡ The ¡MAC ¡of ¡ 192.168.100.1 ¡is ¡ C:C:C:C:C:C ¡
ARP ¡cache ¡poisoning ¡
- Bootstrap ¡problem ¡with ¡respect ¡to ¡security. ¡ ¡Anyone ¡can ¡send ¡an ¡
ARP ¡reply ¡
- Classic ¡Man-‑in-‑the-‑middle ¡aEack ¡
– Send ¡ARP ¡reply ¡messages ¡to ¡device ¡so ¡they ¡think ¡your ¡machine ¡is ¡someone ¡else ¡ – BeEer ¡than ¡simple ¡sniffing ¡because ¡not ¡just ¡best ¡effort. ¡
- SoluUons ¡
– Encrypt ¡all ¡traffic ¡ – Monitoring ¡programs ¡like ¡arpwatch ¡to ¡detect ¡mapping ¡changes ¡
- Which ¡might ¡be ¡valid ¡due ¡to ¡DHCP ¡
Internet ¡Control ¡Message ¡Protocol ¡(ICMP) ¡
- Used ¡for ¡diagnosUcs ¡
– DesUnaUon ¡unreachable ¡ – Time ¡exceeded, ¡TTL ¡hit ¡0 ¡ – Parameter ¡problem, ¡bad ¡header ¡field ¡ – Source ¡quench, ¡throEling ¡mechanism ¡rarely ¡used ¡ – Redirect, ¡feedback ¡on ¡potenUal ¡bad ¡route ¡ – Echo ¡Request ¡and ¡Echo ¡reply, ¡ping ¡ – Timestamp ¡request ¡and ¡Timestamp ¡reply, ¡performance ¡ping ¡ – Packet ¡too ¡big ¡
- Can ¡use ¡informaUon ¡to ¡help ¡map ¡out ¡a ¡network ¡
– Some ¡people ¡block ¡ICMP ¡from ¡outside ¡domain ¡
Smurf ¡AEack ¡
- An ¡amplifica(on ¡DoS ¡aEack ¡
– A ¡relaUvely ¡small ¡amount ¡of ¡informaUon ¡sent ¡is ¡expanded ¡to ¡a ¡ large ¡amount ¡of ¡data ¡
- Send ¡ICMP ¡echo ¡request ¡to ¡IP ¡broadcast ¡addresses. ¡ ¡Spoof ¡
the ¡vicUm's ¡address ¡as ¡the ¡source ¡
- The ¡echo ¡request ¡receivers ¡duUfully ¡send ¡echo ¡replies ¡to ¡
the ¡vicUm ¡overwhelming ¡it ¡
- Fraggle ¡is ¡a ¡UDP ¡variant ¡of ¡the ¡same ¡aEack ¡
“Smurf” ¡
Internet Perpetrator Victim
ICMP echo (spoofed source address of victim) Sent to IP broadcast address ICMP echo reply
Transport ¡Level ¡– ¡TCP ¡and ¡UDP ¡
- Service ¡to ¡service ¡communicaUon. ¡ ¡ ¡
– MulUple ¡conversaUons ¡possible ¡between ¡same ¡pair ¡of ¡ computers ¡
- Transport ¡flows ¡are ¡defined ¡by ¡source ¡and ¡desUnaUon ¡ports ¡
- ApplicaUons ¡are ¡associated ¡with ¡ports ¡(generally ¡just ¡desUnaUon ¡
ports) ¡ – IANA ¡organizes ¡port ¡assignments ¡hEp://www.iana.org/ ¡
- Source ¡ports ¡o[en ¡dynamically ¡selected ¡
– Ports ¡under ¡1024 ¡are ¡considered ¡well-‑known ¡ports ¡ – Would ¡not ¡expect ¡source ¡ports ¡to ¡come ¡from ¡the ¡well-‑known ¡ range ¡
Datagram ¡Transport ¡
- User ¡Datagram ¡Protocol ¡(UDP) ¡
– A ¡best-‑effort ¡delivery, ¡no ¡guarantee, ¡no ¡ACK ¡ – Lower ¡overhead ¡than ¡TCP ¡ – Good ¡for ¡best-‑effort ¡traffic ¡like ¡periodic ¡updates ¡ – No ¡long ¡lived ¡connecUon ¡overhead ¡on ¡the ¡endpoints ¡
- Some ¡folks ¡implement ¡their ¡own ¡reliable ¡protocol ¡over ¡UDP ¡to ¡get ¡
“beEer ¡performance” ¡or ¡“less ¡overhead” ¡than ¡TCP ¡
– Such ¡efforts ¡don’t ¡generally ¡pan ¡out ¡
- TFTP ¡and ¡DNS ¡protocols ¡use ¡UDP ¡
- Data ¡channels ¡of ¡some ¡mulUmedia ¡protocols, ¡e.g., ¡H.323 ¡also ¡use ¡
UDP ¡ ¡
UDP ¡Header ¡
Source Port Destination Port UDP Length UDP checksum
DHCP ¡
- Built ¡on ¡older ¡BOOTP ¡protocol ¡(which ¡was ¡built ¡on ¡even ¡older ¡RARP ¡
protocol) ¡ – Used ¡by ¡diskless ¡Suns ¡
- Enables ¡dynamic ¡allocaUon ¡of ¡IP ¡address ¡and ¡related ¡informaUon ¡
- Runs ¡over ¡UDP ¡
- No ¡security ¡considered ¡in ¡the ¡design, ¡obvious ¡problems ¡
– Bogus ¡DHCP ¡servers ¡handing ¡out ¡addresses ¡of ¡aEackers ¡choice ¡ – Bogus ¡clients ¡grabbing ¡addresses ¡
- IETF ¡aEempted ¡to ¡add ¡DHCP ¡authenUcaUon ¡but ¡rather ¡late ¡in ¡the ¡
game ¡to ¡do ¡this. ¡
- Other ¡soluUons ¡
– Physically ¡secure ¡networks ¡ – Use ¡IPSec ¡
Reliable ¡Streams ¡
- Transmission ¡Control ¡Protocol ¡(TCP) ¡
– Guarantees ¡reliable, ¡ordered ¡stream ¡of ¡traffic ¡ – Such ¡guarantees ¡impose ¡overhead ¡ – A ¡fair ¡amount ¡of ¡state ¡is ¡required ¡on ¡both ¡ends ¡
- Most ¡Internet ¡protocols ¡use ¡TCP, ¡e.g., ¡HTTP, ¡
FTP, ¡SSH, ¡H.323 ¡control ¡channels ¡
TCP ¡Header ¡
Source Port Destination Port Sequence Number Acknowledgement number HDR Len U R G A C K P S H R S T S Y N F I N Window Size Checksum Urgent Pointer Options (0 or more words)
Three ¡way ¡handshake ¡
Machine A Machine B
SYN: ¡seqno=100 ¡ SYN: ¡seqno=511 ¡ ACK ¡= ¡100 ¡ ACK=511 ¡
Syn ¡flood ¡
- A ¡resource ¡DoS ¡aEack ¡focused ¡on ¡the ¡TCP ¡three-‑way ¡handshake ¡
- Say ¡A ¡wants ¡to ¡set ¡up ¡a ¡TCP ¡connecUon ¡to ¡B ¡
– A ¡sends ¡SYN ¡with ¡its ¡sequence ¡number ¡X ¡ – B ¡replies ¡with ¡its ¡own ¡SYN ¡and ¡sequence ¡number ¡Y ¡and ¡an ¡ACK ¡of ¡A’s ¡ sequence ¡number ¡X ¡ – A ¡sends ¡data ¡with ¡its ¡sequence ¡number ¡X ¡and ¡ACK’s ¡B’s ¡sequence ¡number ¡Y ¡
– Send ¡many ¡of ¡the ¡first ¡message ¡to ¡B. ¡ ¡Never ¡respond ¡to ¡the ¡ second ¡message. ¡
– This ¡leaves ¡B ¡with ¡a ¡bunch ¡of ¡half ¡open ¡(or ¡embryonic) ¡connecUons ¡that ¡are ¡ filling ¡up ¡memory ¡ – Source ¡IP ¡address ¡can ¡be ¡spoofed ¡in ¡this ¡case ¡ – Firewalls ¡adapted ¡by ¡sebng ¡limits ¡on ¡the ¡number ¡of ¡such ¡half ¡open ¡
- connecUons. ¡
SYN ¡Flood ¡
Machine A Machine B
SYN: ¡seqno=100 ¡ SYN: ¡seqno=511 ¡ ACK ¡= ¡100 ¡ SYN: ¡seqno=89 ¡ SYN: ¡seqno=176 ¡ SYN: ¡seqno=344 ¡
SYN ¡Flood ¡Constrainer ¡
Machine A FW
SYN: ¡seqno=100 ¡ SYN: ¡seqno=511 ¡ ACK ¡= ¡100 ¡ ACK=511 ¡ SYN: ¡seqno=176 ¡ SYN: ¡seqno=344 ¡
Machine B
SYN: ¡seqno=56 ¡ SYN: ¡seqno=677 ¡ ACK ¡= ¡56 ¡ ACK=677 ¡
Another ¡Syn ¡Flood ¡soluUon: ¡ SYN ¡cookie ¡
l Encode ¡informaUon ¡in ¡the ¡sequence ¡number, ¡
so ¡receiver ¡does ¡not ¡need ¡to ¡save ¡anything ¡for ¡ half ¡open ¡connecUon ¡
- t ¡= ¡counter ¡, ¡m ¡= ¡MSS, ¡s ¡= ¡crypto ¡funcUon ¡
computed ¡over ¡IP ¡addresses ¡and ¡server ¡port ¡and ¡t ¡ (24 ¡bits) ¡ ¡
- Seqno ¡= ¡(t ¡mod ¡32) ¡|| ¡m ¡encoded ¡in ¡3 ¡bits ¡|| ¡s ¡(24 ¡
bits) ¡
l On ¡receiving ¡ACK, ¡get ¡original ¡seqno ¡by ¡
subtracUng ¡1 ¡
- Check ¡1 ¡to ¡verify ¡Umeout ¡
- Recompute ¡s ¡to ¡verify ¡addresses ¡and ¡ports ¡
Domain ¡Name ¡System ¡(DNS) ¡
- Hierarchical ¡service ¡to ¡resolve ¡domain ¡names ¡to ¡IP ¡addresses. ¡
– The ¡name ¡space ¡is ¡divided ¡into ¡non-‑overlapping ¡zones ¡ – E.g., ¡consider ¡www.cs.illinois.edu. ¡ – DNS ¡servers ¡in ¡the ¡chain. ¡ ¡One ¡for ¡.edu, ¡one ¡for ¡.illinois.edu, ¡and ¡
- ne ¡for ¡.cs.illinois.edu ¡
- Can ¡have ¡primary ¡and ¡secondary ¡DNS ¡servers ¡per ¡zone. ¡ ¡Use ¡TCP ¡
based ¡zone ¡transfer ¡to ¡keep ¡up ¡to ¡date ¡
- Like ¡DHCP, ¡no ¡security ¡designed ¡in ¡
– But ¡at ¡least ¡the ¡DNS ¡server ¡is ¡not ¡automaUcally ¡discovered ¡ – Although ¡this ¡informaUon ¡can ¡be ¡dynamically ¡set ¡via ¡DHCP ¡
DNS ¡Problems ¡
- DNS ¡Open ¡relays ¡
– Makes ¡it ¡look ¡like ¡good ¡DNS ¡server ¡is ¡authoritaUve ¡ server ¡to ¡bogus ¡name ¡ ¡ – Enables ¡amplifica(on ¡DoS ¡aEack ¡ ¡
l hEp://www.us-‑cert.gov/reading_room/DNS-‑
recursion033006.pdf ¡
¡
l DNS ¡Cache ¡Poisoning ¡
– Change ¡the ¡name ¡to ¡address ¡mapping ¡to ¡something ¡ more ¡desirable ¡to ¡the ¡aEacker ¡ – Dan ¡Kaminsky ¡raised ¡issue ¡again ¡recently ¡
l hEp://www.linuxjournal.com/content/understanding-‑
kaminskys-‑dns-‑bug ¡
DNS ¡TransacUon ¡
DNS Pictures thanks to http://www.lurhq.com/dnscache.pdf
DNS ¡CommunicaUon ¡
l Use ¡UDP ¡ l Requests ¡and ¡responses ¡have ¡matching ¡16 ¡bit ¡
transacUon ¡Ids ¡
l Servers ¡can ¡be ¡configured ¡as ¡
- AuthoritaUve ¡Nameserver ¡
l Officially ¡responsible ¡for ¡answering ¡requests ¡for ¡a ¡
domain ¡
- Recursive ¡
l Pass ¡on ¡requests ¡to ¡other ¡authoritaUve ¡servers ¡
- Both ¡(this ¡can ¡be ¡the ¡problem) ¡
DNS ¡Open ¡Relay ¡
Y: DNS Server Authoritative for big .com Recursion enabled for all
Internet
Z: Attacker X: Victim Src=X dst=Y What is address of bob.com? Src=Y dst=X bob.com=1.2.3.4
Src=X ¡Dst=Z ¡ What ¡is ¡address ¡
- f ¡Bob.com? ¡
Src=Z ¡Dst=X ¡ Bob.com=1.2.3.4 ¡
Good ¡DNS ¡Deployment ¡
Src=X ¡Dst=Z ¡ What ¡is ¡address ¡
- f ¡Bob.com? ¡
I’m ¡not ¡ authoritaUve ¡for ¡ bob.com, ¡you ¡lose ¡
DNS ¡Cache ¡Poisoning ¡
l Older ¡implementaUons ¡would ¡just ¡accept ¡
addiUonal ¡informaUon ¡in ¡a ¡reply ¡
- e.g. ¡A ¡false ¡authoritaUve ¡name ¡server ¡
- Fixed ¡by ¡bailiwick ¡checking. ¡ ¡AddiUonal ¡records ¡
- nly ¡include ¡entries ¡from ¡the ¡requested ¡domain ¡
l Now ¡to ¡spoof ¡a ¡reply ¡must ¡anUcipate ¡the ¡
correct ¡transacUon ¡ID ¡
- Only ¡16 ¡bits ¡
- Random ¡selecUon ¡of ¡ID ¡isn't ¡always ¡the ¡greatest ¡
Bailiwick ¡Checks ¡
$ dig @ns1.example.com www.example.com ;; ANSWER SECTION: www.example.com. 120 IN A 192.168.1.10 ;; AUTHORITY SECTION: example.com. 86400 IN NS ns1.example.com. example.com. 86400 IN NS ns2.example.com. ;; ADDITIONAL SECTION: ns1.example.com. 604800 IN A 192.168.2.20 ns2.example.com. 604800 IN A 192.168.3.30 www.linuxjournal.com. 43200 IN A 66.240.243.113
Tricking ¡the ¡TransacUon ¡ID's ¡
Kaminsky's ¡ObservaUons ¡
l Most ¡implementaUons ¡don't ¡randomize ¡source ¡ports ¡
(making ¡the ¡TID ¡collision ¡more ¡likely) ¡
l Try ¡to ¡poison ¡through ¡the ¡addiUonal ¡informaUon ¡
(side ¡stepping ¡the ¡bailiwick ¡check) ¡
¡
$ dig doesnotexist.example.com ;; ANSWER SECTION: doesnotexist.example.com. 120 IN A 10.10.10.10 ;; AUTHORITY SECTION: example.com. 86400 IN NS www.example.com. ;; ADDITIONAL SECTION: www.example.com. 604800 IN A 10.10.10.20
DNSSEC ¡
- Seeks ¡to ¡solve ¡the ¡trust ¡issues ¡of ¡DNS ¡
- Uses ¡a ¡key ¡hierarchy ¡for ¡verificaUon ¡
- Has ¡been ¡under ¡development ¡for ¡over ¡a ¡
decade ¡and ¡sUll ¡minimally ¡deployed ¡
- This ¡year ¡arUcles ¡say ¡root ¡servers ¡for ¡.edu, ¡.org, ¡
and ¡.com ¡will ¡be ¡deployed ¡in ¡2010, ¡2011 ¡
- Umeframe. ¡
- Provides ¡authenUcaUon, ¡not ¡confidenUality ¡
- DNS ¡Threat ¡Analysis ¡in ¡RFC ¡3833. ¡