Lecture 6 Network Attacks II. Course Admin
Lecture 6 Network Attacks II. Course Admin
Nitesh Saxena
Adopted from previous lectures by Keith Ross, and Gene Tsudik
Course Admin
• HW/Lab 1
– We are grading (should return by next class)
– Solution will be provided soon
• Lab sessions not active this Friday
• HW/Lab 2 will be posted early next week
– Covers Lecture 5 (network mapping)
• Questions?
•1
Outline
•2
Review of interconnection devices
Hubs
Switches
Routers
Hubs
Hubs are essentially physical-layer repeaters:
bits coming from one link go out all other links
at the same rate
no frame buffering
no CSMA/CD at hub: adapters detect collisions
provides net management functionality
twisted pair
hub
•3
Sniffing
Attacker is inside Grab and file away:
firewall userids and passwords
Requirements credit card numbers
Attacker’s host secret e-mail
connected to shared conversations
medium Island hopping attack:
NIC should be in Take over single
“promiscuous mode” machine (eg virus)
• processes all frames
Install sniffer, observe
that come to NIC
passwords, take over
Sniffer has two more machines, install
components sniffers
Capture
Packet analysis
Passive sniffing
Easy to sniff:
802.11 traffic
Ethernet traffic passing through a hub
• Any packets sent to hub is broadcast to all interfaces
• Not true for a switch
Popular sniffers
Wireshark
tcpdump (for unix)
Snort (sniffing and intrusion detection)
•4
Active Sniffing through a switch
attacker
switch
victim
•5
Sniffing through LAN: poison
victim’s ARP table approach
Idea: have client’s traffic (0) Sniff all frames that arrive.
Configure so that IP packets
diverted to attacker arriving from victim are
attacker
forwarded to default router
•6
Sniffing defenses
Encrypt data: IPsec, SSL, PGP, SSH
Get rid of hubs: complete migration to switched
network
Use encryption for wireless
Configure switches with MAC addresses
Turn off self learning (knowing mappings between ports
and MAC addresses)
Eliminates flooding problem
Honeypot
Create fake account and send password over network
Identify attacker when it uses the password
•7
IP address spoofing (1)
SA: 36.220.9.59
DA: 212.68.212.7
145.13.145.67 212.68.212.7
attacker 36.220.9.59
victim
SA: 212.68.212.7
DA: 36.220.9.59
•8
IP spoofing with TCP?
Can an attacker make a TCP connection to
server with a spoofed IP address?
Not easy: SYNACK and any subsequent
packets sent to spoofed address.
If attacker can guess initial sequence
number, can attempt to send commands
Send ACK with spoofed IP and correct seq #,
say, one second after SYN
But TCP uses random initial sequence
numbers.
Lecture 6 - Network Attacks II 17
127.32.1.1 x
Ingress
filtering
•9
Ingress Filtering: Upstream ISP (1)
12.12/24
BGP update:
12.12/24,
regional 34.34/24
ISP
34.34/24
tier-1 ISP
56.56/24
BGP update:
56.56/24,
78.78/24
regional
ISP
78.78/24
34.34/24
78.78/24
•10
Ingress Filtering: Upstream ISP (3)
12.12/24 Filter all but
12.12/24 and
regional 34.34/24
ISP 56.56.1.1 x
34.34/24
tier-1 ISP
tier-1 ISP
•11
Ingress filtering: summary
Effectiveness depends on widespread
deployment at ISPs
Deployment in upstream ISPs helps, but
does not eliminate IP spoofing
Filtering can impact router forwarding
performance
Even if universally deployed at access,
hacker can still spoof another address in
its access network 12.12/24
See RFC 2827 “Network Ingress Filtering:
Defeating DDoS” Lecture 6 - Network Attacks II 23
•12
Session hijacking
Take control of one side of a TCP connection
Marriage of sniffing and spoofing
Alice telnet
Bob
Alice
Attacker
•13
Session hijacking: limitation
2. to resync, Alice
sends segment with
correct seq #
Netcat
General purpose widget
Very popular
•14
Denial-of-Service
Prevent access by legitimate users or stop
critical system processes
Connection flooding attack
Implementation Overwhelming connection
Vulnerability attack: queue with SYN flood
Send a few crafted Bandwidth flooding attack:
messages to target app Overwhelming
that has vulnerability communications link with
Malicious messages packets
called the “exploit” Strength in flooding attack
Remotely stopping or lies in volume rather than
crashing services content
DDoS
From thousands of nodes
IP addresses often not spoofed
Good book:
Internet Denial of Service by J. Merkovic, D.
Dittrich, P. Reiher, 2005
•15
Interlude: IP datagram format
32 bits total datagram
header length length (bytes)
ver head. type of length
(bytes) len service for
“type” of data fragment fragmentation/
16-bit identifier flgs
offset reassembly
max number time to upper Internet
remaining hops live layer checksum
(decremented at
32 bit source IP address
each router)
32 bit destination IP address
upper layer protocol
to deliver payload to Options (if any)
data
(variable length,
typically a TCP
or UDP segment)
•16
DoS: examples of vulnerability
attacks see http://www.cert.org/advisories/CA-1997-28.html
Land: sends spoofed Teardrop, Newtear,
packet with source and Bonk, Syndrop: tools
dest address/port the send overlapping
same segments, that is,
Ping of death: sends fragment offsets
oversized ping packet incorrect.
Jolt2: sends a stream
of fragments, none of Patches fix the problem,
which have offset of but malformed packet
0. Rebuilding consumes attacks continue to be
all processor capacity. discovered.
LAND
Local Area Network Denial
Spoofed SYN packet with source and
destination both being the victim
On receipt, victim’s machine keep on
responding to itself in a loop
Causes the victim to crash
Many OSs are vulnerable, e.g.,
Windows 95, NT, XP SP2
Mac OS MacTCP
•17
Ping of Death
ICMP Echo Request (Ping) is 56 bytes
If a ping message is more than 65536 bytes
(max for IP packet), this can cause some
machines to crash
Older windows systems
•18
Connection flooding: Overwhelming
connection queue w/ SYN flood
Recall client sends SYN Attack: Send many SYN
packet with initial seq. packets, filling connection
number when initiating a queue with half-open
connection. connections.
TCP on server machine Can spoof source IP
allocates memory on its address!
connection queue, to track When connection queue is
the status of the new half- exhausted, no new
open connection. connections can be
For each half-open initiated by legit users.
connection, server waits
for ACK segment, using a Need to know of open port
timeout that is often > 1 on victim’s machine: Port
minute scanning.
… and more
… and more
38
•19
SYN Flooding Explained
Attacker sends many connection requests (SYNs) with
spoofed source addresses
Victim allocates resources for each request
New thread, connection state maintained until timeout
Fixed bound on half-open connections
Once resources exhausted, requests from legitimate
clients are denied
This is a classic denial of service attack
Common pattern: it costs nothing to TCP client to send a
connection request, but TCP server must spawn a thread for
each request - asymmetry!
What’s another example of this behavior?
39
attacker
Connection queue
freed up with
RST segment
victim
•20
Preventing Denial of Service
(SYN Flood)
DoS is caused by asymmetric state allocation
If server opens new state for each connection
attempt, attacker can initiate many connections
from bogus or forged IP addresses
Cookies allow server to remain stateless until
client produces:
Server state (IP addresses and ports) stored in a
cookie and originally sent to client
•21
SYN Cookies (2)
[Bernstein and Schenk]
C S
SYNC
Listening…
•22
Overwhelming link bandwidth with
packets
Attack traffic can be made similar to
legitimate traffic, hindering detection.
Flow of traffic must consume target’s
bandwidth resources.
Attacker needs to engage more than one
machine => DDoS
May be easier to get target to fill-up its
upstream bandwidth: async access
Example: attacking BitTorrent seeds
bot
attacker Internet
bot victim
bot
•23
DDoS: Reflection attack
DNS server
request reply
request
DNS server reply
request
attacker
reply
DNS server victim
request
reply
Source IP =
victim’s IP
DNS server
“Smurf” Attack
Looks like a legitimate
“Are you alive?” ping
request from the victim
Stream of ping replies
1 ICMP Echo Req overwhelms victim
Src: victim’s address
Dest: broadcast address
•24
DDoS: Reflection attack
Spoof source IP address = victim’s IP
Goal: generate lengthy or numerous replies
for short requests: amplification
Without amplification: would it make sense?
January 2001 attack:
requests for large DNS record
generated 60-90 Mbps of traffic
DDoS Defenses
Don’t let your systems Signature and anomaly
become bots detection and filtering
Keep systems patched Rate limiting
up Limit # of packets sent
Employ egress anti- from source to dest
spoof filtering on
external router.
CAPTCHAs
Filter dangerous Could be useful
•25
DNS attacks
Reflector attack: already discussed
Leverage DNS for attacks on arbitrary targets
•26
DNS attack: redirecting
hub or
WiFi 1
network
client local DNS
2 server
Issues:
attacker • Must spoof IP address: set
to local DNS server (easy)
1. Client sends DNS query to its local •Must match reply ID with
DNS server; sniffed by attacker request ID (easy)
2. Attacker responds with bogus •May need to stop reply
DNS reply from the local DNS server
(harder)
•27
Poisoning local DNS server (2)
authoritative
DNS for uab.edu
2. iterative
DNS queries
Local DNS
1. DNS query
Server (eg, Berkeley)
uab.edu=? 3. DNS reply
uab.edu=
17.32.8.9
Goal: Put bogus IP address for uab.edu
Attacker in
in local Berkeley DNS server
Australia:
1) Attacker queries local DNS server
17.32.8.9
2) Local DNS makes iterative queries
3) Attacker waits for some time;
sends a bogus reply, spoofing
authoritative server for uab.edu.
Lecture 6 - Network Attacks II 55
2. DNS query
uab.edu=?
Attacker
in Australia
17.32.8.9 DNS response can provide IP
address of malicious server!
•28
DNS Poisoning (4)
Issues:
•29