Network Attacks, Part 1
CS 161: Computer Security
- Prof. Vern Paxson
Network Attacks, Part 1 CS 161: Computer Security Prof. Vern Paxson - - PowerPoint PPT Presentation
Network Attacks, Part 1 CS 161: Computer Security Prof. Vern Paxson TAs: Jethro Beekman, Mobin Javed, Antonio Lupher, Paul Pearce & Matthias Vallentin http://inst.eecs.berkeley.edu/~cs161/ February 7, 2013 Announcements / Game Plan
3
4
Application Transport (Inter)Network Link Physical 7 4 3 2 1
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Application Transport (Inter)Network Link Physical 7 4 3 2 1
4-bit Version 4-bit Header Length 8-bit Type of Service (TOS)
16-bit Total Length (Bytes) 16-bit Identification
3-bit Flags
13-bit Fragment Offset
8-bit Time to Live (TTL)
8-bit Protocol 16-bit Header Checksum 32-bit Source IP Address 32-bit Destination IP Address Payload
IP = Internet Protocol
19
21
Application Transport (Inter)Network Link Physical 7 4 3 2 1
Source port Destination port Sequence number Acknowledgment Advertised window HdrLen Flags Checksum Urgent pointer Options (variable)
22
Application Transport (Inter)Network Link Physical 7 4 3 2 1 Source port Destination port Sequence number Acknowledgment Advertised window HdrLen Flags Checksum Urgent pointer Options (variable)
These plus IP addresses define a given connection
23
Application Transport (Inter)Network Link Physical 7 4 3 2 1 Source port Destination port Sequence number Acknowledgment Advertised window HdrLen Flags Checksum Urgent pointer Options (variable)
Defines where this packet fits within the sender’s bytestream
24
Client (initiator) IP address 1.2.1.2, port 3344 Server IP address 9.8.7.6, port 80
S r c A = 1 . 2 . 1 . 2 , S r c P = 3 3 4 4 , D s t A = 9 . 8 . 7 . 6 , D s t P = 8 , S Y N , S e q = x S r c A = 9 . 8 . 7 . 6 , S r c P = 8 , D s t A = 1 . 2 . 1 . 2 , D s t P = 3 3 4 4 , S Y N + A C K , S e q = y , A c k = x + 1 S r c A = 1 . 2 . 1 . 2 , S r c P = 3 3 4 4 , D s t A = 9 . 8 . 7 . 6 , D s t P = 8 , A C K , A c k = y + 1 S r c A = 1 . 2 . 1 . 2 , S r c P = 3 3 4 4 , D s t A = 9 . 8 . 7 . 6 , D s t P = 8 , A C K , S e q = x + 1 , A c k = y + 1 , D a t a = “ G E T / l
i n . h t m l S r c A = 9 . 8 . 7 . 6 , S r c P = 8 , D s t A = 1 . 2 . 1 . 2 , D s t P = 3 3 4 4 , A C K , S e q = y + 1 , A c k = x + 1 6 , D a t a = “ 2 O K … < h t m l > … ”
25
26
Source port Destination port Sequence number Acknowledgment Advertised window HdrLen Flags Checksum Urgent pointer Options (variable)
27
Source port Destination port Sequence number Acknowledgment Advertised window HdrLen
RST
Checksum Urgent pointer Options (variable)
28
– E.g., because app. process on A crashed – (Could instead be that B sends a RST to A)
expects, That’s It: – B’s user-level process receives: ECONNRESET
– No further communication on connection is possible
SYN SYN ACK ACK D a t a RST ACK
time
X
29
30
Client (initiator) IP address 1.2.1.2, port 3344 Server IP address 9.8.7.6, port 80
S r c A = 1 . 2 . 1 . 2 , S r c P = 3 3 4 4 , D s t A = 9 . 8 . 7 . 6 , D s t P = 8 , A C K , S e q = x + 1 , A c k = y + 1 , D a t a = “ G E T / l
i n . h t m l
Attacker IP address 6.6.6.6, port N/A
SrcA=9.8.7.6, SrcP=80, DstA=1.2.1.2, DstP=3344, RST, Seq = y+1, Ack = x+16
Client dutifully removes connection
31
Client (initiator) IP address 1.2.1.2, port 3344 Server IP address 9.8.7.6, port 80
S r c A = 1 . 2 . 1 . 2 , S r c P = 3 3 4 4 , D s t A = 9 . 8 . 7 . 6 , D s t P = 8 , A C K , S e q = x + 1 , A c k = y + 1 , D a t a = “ G E T / l
i n . h t m l
S r c A = 9 . 8 . 7 . 6 , S r c P = 8 , D s t A = 1 . 2 . 1 . 2 , D s t P = 3 3 4 4 , A C K , S e q = y + 1 , A c k = x + 1 6 , D a t a = “ 2 O K … < h t m l > … ”
Attacker IP address 6.6.6.6, port N/A
SrcA=9.8.7.6, SrcP=80, DstA=1.2.1.2, DstP=3344, RST, Seq = y+1, Ack = x+16
X
Client rejects since no active connection
32
– Again, all that’s required is attacker knows correct ports, seq. numbers – Receiver B is none the wiser!
– A general means to take over an already-established connection!
– Because then they immediately know the port & sequence numbers
SYN SYN ACK ACK D a t a ACK
time
N a s t y D a t a N a s t y D a t a 2
33
Client (initiator) IP address 1.2.1.2, port 3344 Server IP address 9.8.7.6, port 80
S r c A = 1 . 2 . 1 . 2 , S r c P = 3 3 4 4 , D s t A = 9 . 8 . 7 . 6 , D s t P = 8 , A C K , S e q = x + 1 , A c k = y + 1 , D a t a = “ G E T / l
i n . h t m l
Attacker IP address 6.6.6.6, port N/A
SrcA=9.8.7.6, SrcP=80, DstA=1.2.1.2, DstP=3344, ACK, Seq = y+1, Ack = x+16 Data=“200 OK … <poison> …”
Client dutifully processes as server’s response
34
Client (initiator) IP address 1.2.1.2, port 3344 Server IP address 9.8.7.6, port 80
S r c A = 1 . 2 . 1 . 2 , S r c P = 3 3 4 4 , D s t A = 9 . 8 . 7 . 6 , D s t P = 8 , A C K , S e q = x + 1 , A c k = y + 1 , D a t a = “ G E T / l
i n . h t m l
Attacker IP address 6.6.6.6, port N/A
SrcA=9.8.7.6, SrcP=80, DstA=1.2.1.2, DstP=3344, ACK, Seq = y+1, Ack = x+16 Data=“200 OK … <poison> …”
Client ignores since already processed that part of bytestream
S r c A = 9 . 8 . 7 . 6 , S r c P = 8 , D s t A = 1 . 2 . 1 . 2 , D s t P = 3 3 4 4 , A C K , S e q = y + 1 , A c k = x + 1 6 , D a t a = “ 2 O K … < h t m l > … ”
35
36
Alleged Client (not actual) IP address 1.2.1.2, port N/A Server IP address 9.8.7.6, port 80 Blind Attacker
SrcA=1.2.1.2, SrcP=5566, DstA=9.8.7.6, DstP=80, SYN, Seq = z S r c A = 9 . 8 . 7 . 6 , S r c P = 8 , D s t A = 1 . 2 . 1 . 2 , D s t P = 5 5 6 6 , S Y N + A C K , S e q = y , A c k = z + 1
SrcA=1.2.1.2, SrcP=5566, DstA=9.8.7.6, DstP=80, ACK, Seq = z+1, ACK = y+1 SrcA=1.2.1.2, SrcP=5566, DstA=9.8.7.6, DstP=80, ACK, Seq = z+1, ACK = y+1, Data = “GET /transfer-money.html”
37
Alleged Client (not actual) IP address 1.2.1.2, port NA Server IP address 9.8.7.6, port 80 Blind Attacker
SrcA=1.2.1.2, SrcP=5566, DstA=9.8.7.6, DstP=80, SYN, Seq = z S r c A = 9 . 8 . 7 . 6 , S r c P = 8 , D s t A = 1 . 2 . 1 . 2 , D s t P = 5 5 6 6 , S Y N + A C K , S e q = y , A c k = x + 1
Small Note #1: if client receives this, will be confused ⇒ send a RST back to server … … So attacker may need to hurry!
38
Alleged Client (not actual) IP address 1.2.1.2, port NA Server IP address 9.8.7.6, port 80 Blind Attacker
SrcA=1.2.1.2, SrcP=5566, DstA=9.8.7.6, DstP=80, SYN, Seq = z S r c A = 9 . 8 . 7 . 6 , S r c P = 8 , D s t A = 1 . 2 . 1 . 2 , D s t P = 5 5 6 6 , S Y N + A C K , S e q = y , A c k = z + 1
39
Alleged Client (not actual) IP address 1.2.1.2, port N/A Server IP address 9.8.7.6, port 80 Blind Attacker
SrcA=1.2.1.2, SrcP=5566, DstA=9.8.7.6, DstP=80, SYN, Seq = z S r c A = 9 . 8 . 7 . 6 , S r c P = 8 , D s t A = 1 . 2 . 1 . 2 , D s t P = 5 5 6 6 , S Y N + A C K , S e q = y , A c k = z + 1
SrcA=1.2.1.2, SrcP=5566, DstA=9.8.7.6, DstP=80, ACK, Seq = z+1, ACK = y+1 SrcA=1.2.1.2, SrcP=5566, DstA=9.8.7.6, DstP=80, ACK, Seq = z+1, ACK = y+1, Data = “GET /transfer-money.html”
40
SYN
SYN+ACK
ACK
D a t a D a t a
(Spec says to pick based on local clock)
Hmm, any way for the attacker to know this? Sure - make a non-spoofed connection first, and see what server used for ISN y then! How Do We Fix This? Use a (Pseudo)- Random ISN
41
– Forcefully terminate by forging a RST packet – Inject (spoof) data into either direction by forging data packets – Works because they can include in their spoofed traffic the correct sequence numbers (both directions) and TCP ports – Remains a major threat today
42
– Forcefully terminate by forging a RST packet – Inject (spoof) data into either direction by forging data packets – Works because they can include in their spoofed traffic the correct sequence numbers (both directions) and TCP ports – Remains a major threat today
– Makes it appear that host ABC has connected, and has sent data
– Undermines any security based on trusting ABC’s IP address – Allows attacker to “frame” ABC or otherwise avoid detection – Fixed (mostly) today by choosing random ISNs