This time Digging into Networking Protocols With a particular - - PowerPoint PPT Presentation

this time
SMART_READER_LITE
LIVE PREVIEW

This time Digging into Networking Protocols With a particular - - PowerPoint PPT Presentation

This time Digging into Networking Protocols With a particular focus on TCP details, a t t a c k s, and defenses Layer 3: (Inter)network layer Bridges multiple subnets to provide end-to-end internet connectivity between nodes 7


slide-1
SLIDE 1

This time

Digging into

Networking

Protocols

With a particular focus on

TCP details,

a t t a c k s,


and defenses

slide-2
SLIDE 2

Layer 3: (Inter)network layer

Application Transport (Inter)network Link Physical

7 4 3 2 1

  • Bridges multiple “subnets” to

provide end-to-end internet connectivity between nodes

  • Provides global addressing (IP

addresses)

  • Only provides best-effort delivery
  • f data (i.e., no retransmissions,

etc.)

  • Works across different link

technologies

slide-3
SLIDE 3

IP packet “header”

4-bit
 Version 4-bit
 Header len 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

20-byte
 header

slide-4
SLIDE 4

IP Packet Header Fields (1)

  • Version number (4 bits)
  • Indicates the version of the IP protocol
  • Necessary for knowing what fields follow
  • “4” (for IPv4) or “6” (for IPv6)
  • Header length (4 bits)
  • How many 32-bit words (rows) in the header
  • Typically 5
  • Can provide IP options, too
  • Type-of-service (8 bits)
  • Allow packets to be treated differently based on different needs
  • Low delay for audio, high bandwidth for bulk transfer, etc.
slide-5
SLIDE 5
  • Two IP addresses
  • Source (32 bits)
  • Destination (32 bits)
  • Destination address
  • Unique identifier/locator for the receiving host
  • Allows each node (end-host and router) to make

forwarding decisions

  • Source address
  • Unique identifier/locator for the sending host
  • Recipient can decide whether to accept the packet
  • Allows destination to reply to the source

IP Packet Header Fields (2)

slide-6
SLIDE 6

IP: “Best effort” packet delivery

  • Routers inspect destination address, determine

“next hop” in the forwarding table

  • Best effort = “I’ll give it a try”
  • Packets may be lost
  • Packets may be corrupted
  • Packets may be delivered out of order

Fixing these is the job of the transport layer!

slide-7
SLIDE 7

Layer 4: Transport layer

Application Transport (Inter)network Link Physical

7 4 3 2 1

  • End-to-end communication

between processes

  • Different types of services

provided:

  • UDP: unreliable datagrams
  • TCP: reliable byte stream
  • “Reliable” = keeps track of what

data were received properly and retransmits as necessary

slide-8
SLIDE 8

TCP: reliability

  • Given best-effort deliver, the goal is to ensure

reliability

  • All packets are delivered to applications
  • … in order
  • … unmodified (with reasonably high probability)
  • Must robustly detect and retransmit lost data
slide-9
SLIDE 9

TCP’s bytestream service

  • Process A on host 1:
  • Send byte 0, byte 1, byte 2, byte 3, …
  • Process B on host 2:
  • Receive byte 0, byte 1, byte 2, byte 3, …
  • The applications do not see:
  • packet boundaries (looks like a stream of bytes)
  • lost or corrupted packets (they’re all correct)
  • retransmissions (they all only appear once)
slide-10
SLIDE 10

TCP bytestream service

byte1 byte 2 byte 3 byte 4 byte 5 byte 6 byte 7 byte 8 byte1 byte 2 byte 3 byte 4 byte 5 byte 6 byte 7 byte 8

Process A on host H1 Process B on host H2 Abstraction: Each byte reliably delivered in order

slide-11
SLIDE 11

TCP bytestream service

byte1 byte 2 byte 3 byte 4 byte 5 byte 6 byte 7 byte 8

Reality: Packets sometimes retransmitted, sometimes arrive out of order Packet 1 Packet 2 Packet 3 Needs to be
 retransmitted Needs to be
 buffered

slide-12
SLIDE 12

TCP bytestream service

byte1 byte 2 byte 3 byte 4 byte 5 byte 6 byte 7 byte 8

Reality: Packets sometimes retransmitted, sometimes arrive out of order Packet 1 Packet 2 Packet 3 Needs to be
 retransmitted Needs to be
 buffered TCP’s first job: achieve the abstraction while
 hiding the reality from the application

slide-13
SLIDE 13

How does TCP achieve reliability?

A B Time Waterfall
 diagram

slide-14
SLIDE 14

How does TCP achieve reliability?

A B

Expecting byte 1000

Time Waterfall
 diagram

slide-15
SLIDE 15

How does TCP achieve reliability?

A B

Bytes 1000-1500

Expecting byte 1000

Time Waterfall
 diagram

slide-16
SLIDE 16

How does TCP achieve reliability?

A B

Bytes 1000-1500

Expecting byte 1000 Expecting byte 1501

Time Waterfall
 diagram

slide-17
SLIDE 17

How does TCP achieve reliability?

A B

Bytes 1000-1500

Expecting byte 1000 Expecting byte 1501

Time Waterfall
 diagram

ACK 1501

slide-18
SLIDE 18

How does TCP achieve reliability?

A B

Bytes 1000-1500

Expecting byte 1000 Expecting byte 1501

Time Waterfall
 diagram

ACK 1501

Reliability through acknowledgments
 to determine whether something was received.

slide-19
SLIDE 19

How does TCP achieve reliability?

A B Time Waterfall
 diagram

slide-20
SLIDE 20

How does TCP achieve reliability?

A B

Expecting byte 1000

Time Waterfall
 diagram

slide-21
SLIDE 21

How does TCP achieve reliability?

A B

Bytes 1000-1500

Expecting byte 1000

Time Waterfall
 diagram

slide-22
SLIDE 22

How does TCP achieve reliability?

A B

Bytes 1000-1500 Bytes 1501-2000

Expecting byte 1000

Time Waterfall
 diagram

slide-23
SLIDE 23

How does TCP achieve reliability?

A B

Bytes 1000-1500 Bytes 1501-2000 Bytes 2001-3000

Expecting byte 1000

Time Waterfall
 diagram

slide-24
SLIDE 24

How does TCP achieve reliability?

A B

Bytes 1000-1500 Bytes 1501-2000 Bytes 2001-3000

Expecting byte 1000 Still expecting byte 1000

Time Waterfall
 diagram

slide-25
SLIDE 25

How does TCP achieve reliability?

A B

Bytes 1000-1500 Bytes 1501-2000 Bytes 2001-3000

Expecting byte 1000 Still expecting byte 1000

Time Waterfall
 diagram

ACK 1000

slide-26
SLIDE 26

How does TCP achieve reliability?

A B

Bytes 1000-1500 Bytes 1501-2000 Bytes 2001-3000

Expecting byte 1000 Still expecting byte 1000 Still expecting byte 1000

Time Waterfall
 diagram

ACK 1000

slide-27
SLIDE 27

How does TCP achieve reliability?

A B

Bytes 1000-1500 Bytes 1501-2000 Bytes 2001-3000

Expecting byte 1000 Still expecting byte 1000 Still expecting byte 1000

Time Waterfall
 diagram

ACK 1000 ACK 1000

slide-28
SLIDE 28

How does TCP achieve reliability?

A B

Bytes 1000-1500 Bytes 1501-2000 Bytes 2001-3000

Expecting byte 1000

Bytes 1000-1500

Still expecting byte 1000 Still expecting byte 1000

Time Waterfall
 diagram

ACK 1000 ACK 1000

slide-29
SLIDE 29

How does TCP achieve reliability?

A B

Bytes 1000-1500 Bytes 1501-2000 Bytes 2001-3000

Expecting byte 1000

Bytes 1000-1500

Still expecting byte 1000 Still expecting byte 1000 Expecting packet 3001

Time Waterfall
 diagram

ACK 1000 ACK 1000

slide-30
SLIDE 30

How does TCP achieve reliability?

A B

Bytes 1000-1500 Bytes 1501-2000 Bytes 2001-3000

Expecting byte 1000

Bytes 1000-1500

Still expecting byte 1000 Still expecting byte 1000 Expecting packet 3001

Time Waterfall
 diagram

ACK 1000 ACK 1000 A C K 3 1

slide-31
SLIDE 31

How does TCP achieve reliability?

A B

Bytes 1000-1500 Bytes 1501-2000 Bytes 2001-3000

Expecting byte 1000

Bytes 1000-1500

Still expecting byte 1000 Still expecting byte 1000 Expecting packet 3001

Time Waterfall
 diagram

ACK 1000 ACK 1000 A C K 3 1

Buffer these until

slide-32
SLIDE 32

TCP congestion control

  • Try to use as much of the network as is safe (does

not adversely affect others’ performance) and efficient (makes use of network capacity)

  • Dynamically adapt how quickly you send based on

the network path’s capacity

  • When an ACK doesn’t come back, the network may

be beyond capacity: slow down. TCP’s second job: don’t break the network!

slide-33
SLIDE 33

TCP header

16-bit
 Source port 16-bit
 Destination port 32-bit Sequence number 32-bit Acknowledgment

4-bit
 Header Length

Reserved

6-bit
 Flags 16-bit
 Advertised window

16-bit
 Checksum 16-bit
 Urgent pointer Options (variable)

Padding Data

slide-34
SLIDE 34

TCP header

16-bit
 Source port 16-bit
 Destination port 32-bit Sequence number 32-bit Acknowledgment

4-bit
 Header Length

Reserved

6-bit
 Flags 16-bit
 Advertised window

16-bit
 Checksum 16-bit
 Urgent pointer Options (variable)

Padding Data

IP Header

slide-35
SLIDE 35

TCP ports

  • Ports are associated with OS processes
  • Sandwiched between IP header and the

application data

  • {src IP/port, dst IP/port} : this 4-tuple uniquely

identifies a TCP connection

  • Some port numbers are well-known
  • 80 = HTTP
  • 53 = DNS
slide-36
SLIDE 36

TCP header

16-bit
 Source port 16-bit
 Destination port 32-bit Sequence number 32-bit Acknowledgment

4-bit
 Header Length

Reserved

6-bit
 Flags 16-bit
 Advertised window

16-bit
 Checksum 16-bit
 Urgent pointer Options (variable)

Padding Data

IP Header

slide-37
SLIDE 37

TCP seqno

  • Each byte in the byte stream has a unique

“sequence number”

  • Unique for both directions
  • “Sequence number” in the header = sequence

number of the first byte in the packet’s data

  • Next sequence number = previous seqno +

previous packet’s data size

  • “Acknowledgment” in the header = the next seqno

you expect from the other end-host

slide-38
SLIDE 38

TCP header

16-bit
 Source port 16-bit
 Destination port 32-bit Sequence number 32-bit Acknowledgment

4-bit
 Header Length

Reserved

6-bit
 Flags 16-bit
 Advertised window

16-bit
 Checksum 16-bit
 Urgent pointer Options (variable)

Padding Data

IP Header

slide-39
SLIDE 39

TCP flags

  • SYN
  • Used for setting up a connection
  • ACK
  • Acknowledgments, for data and “control” packets
  • FIN
  • RST
slide-40
SLIDE 40

Setting up a connection

A B Time Waterfall
 diagram Three-way handshake

slide-41
SLIDE 41

Setting up a connection

A B

SYN

Time Waterfall
 diagram Three-way handshake

slide-42
SLIDE 42

Setting up a connection

A B

SYN

Time Waterfall
 diagram Three-way handshake

Let’s SYNchronize
 sequence numbers

slide-43
SLIDE 43

Setting up a connection

A B

SYN

Time Waterfall
 diagram

SYN + ACK

Three-way handshake

Let’s SYNchronize
 sequence numbers

slide-44
SLIDE 44

Setting up a connection

A B

SYN

Time Waterfall
 diagram

SYN + ACK

Three-way handshake

Let’s SYNchronize
 sequence numbers Got yours; here’s mine

slide-45
SLIDE 45

Setting up a connection

A B

SYN

Time Waterfall
 diagram

SYN + ACK ACK

Three-way handshake

Let’s SYNchronize
 sequence numbers Got yours; here’s mine

slide-46
SLIDE 46

Setting up a connection

A B

SYN

Time Waterfall
 diagram

SYN + ACK ACK

Three-way handshake

Let’s SYNchronize
 sequence numbers Got yours; here’s mine Got yours, too

slide-47
SLIDE 47

Setting up a connection

A B

SYN

Time Waterfall
 diagram

SYN + ACK ACK Data

Three-way handshake

Let’s SYNchronize
 sequence numbers Got yours; here’s mine Got yours, too

slide-48
SLIDE 48

Setting up a connection

A B

SYN

Time Waterfall
 diagram

SYN + ACK ACK Data Data

Three-way handshake

Let’s SYNchronize
 sequence numbers Got yours; here’s mine Got yours, too

slide-49
SLIDE 49

Setting up a connection

A B

SYN

Time Waterfall
 diagram

SYN + ACK ACK Data Data Data

Three-way handshake

Let’s SYNchronize
 sequence numbers Got yours; here’s mine Got yours, too

slide-50
SLIDE 50

Setting up a connection

A B

SYN seqno=x

Time Waterfall
 diagram

SYN seqno=y
 +ACK x+1 ACK y+1 Data Data Data

Three-way handshake

Let’s SYNchronize
 sequence numbers Got yours; here’s mine Got yours, too

slide-51
SLIDE 51

TCP flags

  • SYN
  • ACK
  • FIN: Let’s shut this down (two-way)
  • FIN
  • FIN+ACK
  • RST: I’m shutting you down
  • Says “delete all your local state, because I don’t know

what you’re talking about

slide-52
SLIDE 52

Attacks

  • SYN flooding
  • Injection attacks
  • Opt-ack attack
slide-53
SLIDE 53

SYN flooding

slide-54
SLIDE 54

SYN flooding

A B Time Waterfall
 diagram Recall the three-way handshake:

slide-55
SLIDE 55

SYN flooding

A B

SYN

Time Waterfall
 diagram Recall the three-way handshake:

slide-56
SLIDE 56

SYN flooding

A B

SYN

Time Waterfall
 diagram Recall the three-way handshake: At this point, B allocates state
 for this new
 connection (incl. IP, port,
 maximum
 segment size)

slide-57
SLIDE 57

SYN flooding

A B

SYN

Time Waterfall
 diagram Recall the three-way handshake: At this point, B allocates state
 for this new
 connection (incl. IP, port,
 maximum
 segment size)

IP/port, MSS,…

slide-58
SLIDE 58

SYN flooding

A B

SYN

Time Waterfall
 diagram

SYN + ACK

Recall the three-way handshake: At this point, B allocates state
 for this new
 connection (incl. IP, port,
 maximum
 segment size)

IP/port, MSS,…

slide-59
SLIDE 59

SYN flooding

A B

SYN

Time Waterfall
 diagram

SYN + ACK

Recall the three-way handshake: At this point, B allocates state
 for this new
 connection (incl. IP, port,
 maximum
 segment size)

IP/port, MSS,…

ACK

slide-60
SLIDE 60

SYN flooding

A B

SYN

Time Waterfall
 diagram

SYN + ACK

Recall the three-way handshake: At this point, B allocates state
 for this new
 connection (incl. IP, port,
 maximum
 segment size)

IP/port, MSS,…

ACK SYN + ACK

slide-61
SLIDE 61

SYN flooding

A B

SYN

Time Waterfall
 diagram

SYN + ACK

Recall the three-way handshake: At this point, B allocates state
 for this new
 connection (incl. IP, port,
 maximum
 segment size)

IP/port, MSS,…

ACK

B will hold onto this local state and retransmit SYN+ACK’s
 until it hears back or times out (up to 63 sec).

SYN + ACK

slide-62
SLIDE 62

SYN flooding

A B The attack C

slide-63
SLIDE 63

SYN flooding

A B

SYN

The attack C

slide-64
SLIDE 64

SYN flooding

A B

SYN

The attack

IP/port, MSS,…

C

slide-65
SLIDE 65

SYN flooding

A B

SYN

The attack

IP/port, MSS,…

SYN

C

slide-66
SLIDE 66

SYN flooding

A B

SYN

The attack

IP/port, MSS,…

SYN

IP/port, MSS,…

C

slide-67
SLIDE 67

SYN flooding

A B

SYN

The attack

IP/port, MSS,…

SYN

IP/port, MSS,…

SYN

C

slide-68
SLIDE 68

SYN flooding

A B

SYN

The attack

IP/port, MSS,…

SYN

IP/port, MSS,…

SYN

IP/port, MSS,…

C

slide-69
SLIDE 69

SYN flooding

A B

SYN

The attack

IP/port, MSS,…

SYN

IP/port, MSS,…

SYN

IP/port, MSS,…

SYN SYN SYN SYN SYN SYN SYN SYN

C

slide-70
SLIDE 70

SYN flooding

A B

SYN

The attack

IP/port, MSS,…

SYN

IP/port, MSS,…

SYN

IP/port, MSS,…

SYN SYN SYN SYN SYN SYN SYN SYN

IP/port, MSS,… IP/port, MSS,… IP/port, MSS,… IP/port, MSS,…

C

slide-71
SLIDE 71

SYN flooding

A B

SYN

The attack

IP/port, MSS,…

SYN

IP/port, MSS,…

SYN

IP/port, MSS,…

SYN SYN SYN SYN SYN SYN SYN SYN

IP/port, MSS,… IP/port, MSS,… IP/port, MSS,… IP/port, MSS,…

Exhaust memory
 at the victim B.

C

slide-72
SLIDE 72

SYN flooding

A B

SYN

The attack

IP/port, MSS,…

SYN

IP/port, MSS,…

SYN

IP/port, MSS,…

SYN SYN SYN SYN SYN SYN SYN SYN

IP/port, MSS,… IP/port, MSS,… IP/port, MSS,… IP/port, MSS,…

Exhaust memory
 at the victim B.

C

SYN

slide-73
SLIDE 73

SYN flooding

A B

SYN

The attack

IP/port, MSS,…

SYN

IP/port, MSS,…

SYN

IP/port, MSS,…

SYN SYN SYN SYN SYN SYN SYN SYN

IP/port, MSS,… IP/port, MSS,… IP/port, MSS,… IP/port, MSS,…

Exhaust memory
 at the victim B.

C

SYN

New connections
 will fail (insufficient
 memory)

slide-74
SLIDE 74

SYN flooding details

  • Easy to detect many incomplete handshakes from a

single IP address

  • Spoof the source IP address
  • It’s just a field in a header: set it to whatever you like
  • Problem: the host who really owns that spoofed IP

address may respond to the SYN+ACK with a RST, deleting the local state at the victim

  • Ideally, spoof an IP address of a host you know won’t

respond

slide-75
SLIDE 75

SYN cookies

A B The defense

slide-76
SLIDE 76

SYN cookies

A B

SYN

The defense

slide-77
SLIDE 77

SYN cookies

A B

SYN

The defense

IP/port, MSS,…

slide-78
SLIDE 78

SYN cookies

A B

SYN

The defense

IP/port, MSS,…

Rather than store this data, send it to the host who is initiating the connection and have him return it to you

slide-79
SLIDE 79

SYN cookies

A B

SYN

The defense

IP/port, MSS,…

Rather than store this data, send it to the host who is initiating the connection and have him return it to you

SYN + ACK
 seqno = f(data)

Store the necessary
 state in your seqno

slide-80
SLIDE 80

SYN cookies

A B

SYN

The defense Rather than store this data, send it to the host who is initiating the connection and have him return it to you

SYN + ACK
 seqno = f(data)

Store the necessary
 state in your seqno

slide-81
SLIDE 81

SYN cookies

A B

SYN

The defense Rather than store this data, send it to the host who is initiating the connection and have him return it to you

SYN + ACK
 seqno = f(data)

Store the necessary
 state in your seqno

ACK f(data)+1

slide-82
SLIDE 82

SYN cookies

A B

SYN

The defense Rather than store this data, send it to the host who is initiating the connection and have him return it to you

SYN + ACK
 seqno = f(data)

Store the necessary
 state in your seqno

ACK f(data)+1

Check that f(data) is valid for this connection. Only at that point do you allocate state.

slide-83
SLIDE 83

SYN cookies

A B

SYN

The defense Rather than store this data, send it to the host who is initiating the connection and have him return it to you

SYN + ACK
 seqno = f(data)

Store the necessary
 state in your seqno

ACK f(data)+1

Check that f(data) is valid for this connection. Only at that point do you allocate state.

IP/port, MSS,…

slide-84
SLIDE 84

SYN cookie format

A B

SYN SYN + ACK
 seqno = f(data) ACK f(data)+1

IP/port, MSS,…

The secure hash makes
 it difficult for the attacker
 to guess what f() will be, and therefore the attacker
 cannot guess a correct ACK
 if he spoofs. f(.) =

Slow-moving timestamp MSS Secure hash

Prevents
 replay
 attacks The info we
 need for this
 connection Includes:
 IPs/ports, MSS,
 timestamp

32-bit seqno

slide-85
SLIDE 85

Injection attacks

  • Suppose you are on the path between src and dst;

what can you do?

  • Trivial to inject packets with the correct sequence

number

  • What if you are not on the path?
  • Need to guess the sequence number
  • Is this difficult to do?
slide-86
SLIDE 86

Initial sequence numbers

  • Initial sequence numbers used to be deterministic
  • What havoc can we wreak?
  • Send RSTs
  • Inject data packets into an existing connection (TCP

veto attacks)

  • Initiate and use an entire connection without ever

hearing the other end

slide-87
SLIDE 87

Mitnick attack

X-terminal
 server Server that X- term trusts Attacker Any connection initiated
 from this IP address is
 allowed access to the
 X-terminal server

slide-88
SLIDE 88

Mitnick attack

X-terminal
 server Server that X- term trusts Attacker Any connection initiated
 from this IP address is
 allowed access to the
 X-terminal server

  • 1. SYN flood the trusted server
slide-89
SLIDE 89

Mitnick attack

X-terminal
 server Server that X- term trusts Attacker Any connection initiated
 from this IP address is
 allowed access to the
 X-terminal server

  • 1. SYN flood the trusted server
slide-90
SLIDE 90

Mitnick attack

X-terminal
 server Server that X- term trusts Attacker Any connection initiated
 from this IP address is
 allowed access to the
 X-terminal server

  • 1. SYN flood the trusted server
  • 2. Spoof trusted server’s IP addr


in SYN to X-terminal

slide-91
SLIDE 91

Mitnick attack

X-terminal
 server Server that X- term trusts Attacker Any connection initiated
 from this IP address is
 allowed access to the
 X-terminal server

  • 1. SYN flood the trusted server
  • 2. Spoof trusted server’s IP addr


in SYN to X-terminal SYN src:

slide-92
SLIDE 92

Mitnick attack

X-terminal
 server Server that X- term trusts Attacker Any connection initiated
 from this IP address is
 allowed access to the
 X-terminal server

  • 1. SYN flood the trusted server
  • 2. Spoof trusted server’s IP addr


in SYN to X-terminal SYN src: SYN+ACK
 seqno

slide-93
SLIDE 93

Mitnick attack

X-terminal
 server Server that X- term trusts Attacker Any connection initiated
 from this IP address is
 allowed access to the
 X-terminal server

  • 1. SYN flood the trusted server
  • 2. Spoof trusted server’s IP addr


in SYN to X-terminal SYN src: SYN+ACK
 seqno

  • 3. Trusted server too busy to RST
slide-94
SLIDE 94

Mitnick attack

X-terminal
 server Server that X- term trusts Attacker Any connection initiated
 from this IP address is
 allowed access to the
 X-terminal server

  • 1. SYN flood the trusted server
  • 2. Spoof trusted server’s IP addr


in SYN to X-terminal SYN src: SYN+ACK
 seqno

  • 3. Trusted server too busy to RST
  • 4. ACK with the guessed seqno
slide-95
SLIDE 95

Mitnick attack

X-terminal
 server Server that X- term trusts Attacker Any connection initiated
 from this IP address is
 allowed access to the
 X-terminal server

  • 1. SYN flood the trusted server
  • 2. Spoof trusted server’s IP addr


in SYN to X-terminal SYN src: SYN+ACK
 seqno

  • 3. Trusted server too busy to RST

ACK src:
 seqno+1

  • 4. ACK with the guessed seqno
slide-96
SLIDE 96

Mitnick attack

X-terminal
 server Server that X- term trusts Attacker Any connection initiated
 from this IP address is
 allowed access to the
 X-terminal server

  • 1. SYN flood the trusted server
  • 2. Spoof trusted server’s IP addr


in SYN to X-terminal SYN src: SYN+ACK
 seqno

  • 3. Trusted server too busy to RST

ACK src:
 seqno+1

  • 4. ACK with the guessed seqno

“echo ++ >> ./rhosts”

slide-97
SLIDE 97

Mitnick attack

X-terminal
 server Server that X- term trusts Attacker Any connection initiated
 from this IP address is
 allowed access to the
 X-terminal server

  • 1. SYN flood the trusted server
  • 2. Spoof trusted server’s IP addr


in SYN to X-terminal SYN src: SYN+ACK
 seqno

  • 3. Trusted server too busy to RST

ACK src:
 seqno+1

  • 4. ACK with the guessed seqno

“echo ++ >> ./rhosts”

  • 5. Grant access to all sources
slide-98
SLIDE 98

Mitnick attack

X-terminal
 server Server that X- term trusts Attacker Any connection initiated
 from this IP address is
 allowed access to the
 X-terminal server

  • 1. SYN flood the trusted server
  • 2. Spoof trusted server’s IP addr


in SYN to X-terminal SYN src: SYN+ACK
 seqno

  • 3. Trusted server too busy to RST

ACK src:
 seqno+1

  • 4. ACK with the guessed seqno

“echo ++ >> ./rhosts”

  • 5. Grant access to all sources

ACK

slide-99
SLIDE 99

Mitnick attack

X-terminal
 server Server that X- term trusts Attacker Any connection initiated
 from this IP address is
 allowed access to the
 X-terminal server

  • 1. SYN flood the trusted server
  • 2. Spoof trusted server’s IP addr


in SYN to X-terminal SYN src: SYN+ACK
 seqno

  • 3. Trusted server too busy to RST

ACK src:
 seqno+1

  • 4. ACK with the guessed seqno

“echo ++ >> ./rhosts”

  • 5. Grant access to all sources

ACK

  • 6. RSTs to trusted server (cleanup)
slide-100
SLIDE 100

Mitnick attack

X-terminal
 server Server that X- term trusts Attacker Any connection initiated
 from this IP address is
 allowed access to the
 X-terminal server

  • 1. SYN flood the trusted server
  • 2. Spoof trusted server’s IP addr


in SYN to X-terminal SYN src: SYN+ACK
 seqno

  • 3. Trusted server too busy to RST

ACK src:
 seqno+1

  • 4. ACK with the guessed seqno

“echo ++ >> ./rhosts”

  • 5. Grant access to all sources

ACK

  • 6. RSTs to trusted server (cleanup)
slide-101
SLIDE 101

Defenses

  • Initial sequence number must be difficult to predict!
slide-102
SLIDE 102

Opt-ack attack

A B TCP uses ACKs not only for reliability, but also for
 congestion control:
 the more ACKs come back, the faster I can send

slide-103
SLIDE 103

Opt-ack attack

A B

Expecting byte 1000

TCP uses ACKs not only for reliability, but also for
 congestion control:
 the more ACKs come back, the faster I can send

slide-104
SLIDE 104

Opt-ack attack

A B

Bytes 1000-1500

Expecting byte 1000

TCP uses ACKs not only for reliability, but also for
 congestion control:
 the more ACKs come back, the faster I can send

slide-105
SLIDE 105

Opt-ack attack

A B

Bytes 1000-1500

Expecting byte 1000 Expecting byte 1501

TCP uses ACKs not only for reliability, but also for
 congestion control:
 the more ACKs come back, the faster I can send

slide-106
SLIDE 106

Opt-ack attack

A B

Bytes 1000-1500

Expecting byte 1000 Expecting byte 1501

ACK 1501

TCP uses ACKs not only for reliability, but also for
 congestion control:
 the more ACKs come back, the faster I can send

slide-107
SLIDE 107

Opt-ack attack

A B

Bytes 1000-1500

Expecting byte 1000 Expecting byte 1501

ACK 1501

TCP uses ACKs not only for reliability, but also for
 congestion control:
 the more ACKs come back, the faster I can send

Bytes 1501-2001

slide-108
SLIDE 108

Opt-ack attack

A B

Bytes 1000-1500

Expecting byte 1000 Expecting byte 1501

ACK 1501

TCP uses ACKs not only for reliability, but also for
 congestion control:
 the more ACKs come back, the faster I can send

Bytes 1501-2001 Bytes 2002-2502

slide-109
SLIDE 109

Opt-ack attack

A B

Bytes 1000-1500 ACK 1501 Bytes 1501-2001 Bytes 2002-2502

slide-110
SLIDE 110

Opt-ack attack

A B

Bytes 1000-1500 ACK 1501 Bytes 1501-2001 Bytes 2002-2502

If I could convince you to send
 REALLY quickly, then you would
 effectively DoS your own network!

slide-111
SLIDE 111

Opt-ack attack

A B

Bytes 1000-1500 ACK 1501 Bytes 1501-2001 Bytes 2002-2502

If I could convince you to send
 REALLY quickly, then you would
 effectively DoS your own network! But to get you to send faster, I need
 to get data in order to ACK, so I
 need to receive quickly

slide-112
SLIDE 112

Opt-ack attack

A B

Bytes 1000-1500 ACK 1501 Bytes 1501-2001 Bytes 2002-2502

If I could convince you to send
 REALLY quickly, then you would
 effectively DoS your own network! But to get you to send faster, I need
 to get data in order to ACK, so I
 need to receive quickly …or do I?

slide-113
SLIDE 113

Opt-ack attack

A B

slide-114
SLIDE 114

Opt-ack attack

A B

Bytes 1000-1500

slide-115
SLIDE 115

Opt-ack attack

A B

Bytes 1000-1500

If I can predict what the last seqno will be
 and when A will send it

slide-116
SLIDE 116

Opt-ack attack

A B

Bytes 1000-1500

If I can predict what the last seqno will be
 and when A will send it

ACK 1501

slide-117
SLIDE 117

Opt-ack attack

A B

Bytes 1000-1500

If I can predict what the last seqno will be
 and when A will send it

ACK 1501

Then I could ACK early! (“optimistically”)

slide-118
SLIDE 118

Opt-ack attack

A B

Bytes 1000-1500

If I can predict what the last seqno will be
 and when A will send it

ACK 1501

Then I could ACK early! (“optimistically”)

ACK 2001

slide-119
SLIDE 119

Opt-ack attack

A B

Bytes 1000-1500

If I can predict what the last seqno will be
 and when A will send it

ACK 1501

Then I could ACK early! (“optimistically”)

ACK 2001 ACK 2502

slide-120
SLIDE 120

Opt-ack attack

A B

Bytes 1000-1500

If I can predict what the last seqno will be
 and when A will send it

ACK 1501 Bytes 1501-2001

Then I could ACK early! (“optimistically”)

ACK 2001 ACK 2502

slide-121
SLIDE 121

Opt-ack attack

A B

Bytes 1000-1500

If I can predict what the last seqno will be
 and when A will send it

ACK 1501 Bytes 1501-2001 Bytes 2002-2502

Then I could ACK early! (“optimistically”)

ACK 2001 ACK 2502

slide-122
SLIDE 122

Opt-ack attack

A B

Bytes 1000-1500

If I can predict what the last seqno will be
 and when A will send it

ACK 1501 Bytes 1501-2001 Bytes 2002-2502

Then I could ACK early! (“optimistically”) A will think “what a fast, legit connection!”

ACK 2001 ACK 2502

slide-123
SLIDE 123

Opt-ack attack

A B

Bytes 1000-1500

If I can predict what the last seqno will be
 and when A will send it

ACK 1501 Bytes 1501-2001 Bytes 2002-2502

Then I could ACK early! (“optimistically”) A will think “what a fast, legit connection!”

ACK 2001 ACK 2502

Eventually, A’s outgoing packets will start to
 get dropped.

slide-124
SLIDE 124

Opt-ack attack

A B

Bytes 1000-1500

If I can predict what the last seqno will be
 and when A will send it

ACK 1501 Bytes 1501-2001 Bytes 2002-2502

Then I could ACK early! (“optimistically”) A will think “what a fast, legit connection!”

ACK 2001 ACK 2502

Eventually, A’s outgoing packets will start to
 get dropped.

slide-125
SLIDE 125

Opt-ack attack

A B

Bytes 1000-1500

If I can predict what the last seqno will be
 and when A will send it

ACK 1501 Bytes 1501-2001 Bytes 2002-2502

Then I could ACK early! (“optimistically”) A will think “what a fast, legit connection!”

ACK 2001 ACK 2502 ACK

Eventually, A’s outgoing packets will start to
 get dropped.

slide-126
SLIDE 126

Opt-ack attack

A B

Bytes 1000-1500

If I can predict what the last seqno will be
 and when A will send it

ACK 1501 Bytes 1501-2001 Bytes 2002-2502

Then I could ACK early! (“optimistically”) A will think “what a fast, legit connection!”

ACK 2001 ACK 2502 ACK

Eventually, A’s outgoing packets will start to
 get dropped. But so long as I keep ACKing correctly, it
 doesn’t matter.

slide-127
SLIDE 127

Opt-ack attack

A B

Bytes 1000-1500

If I can predict what the last seqno will be
 and when A will send it

ACK 1501 Bytes 1501-2001 Bytes 2002-2502

Then I could ACK early! (“optimistically”) A will think “what a fast, legit connection!”

ACK 2001 ACK 2502 ACK

Eventually, A’s outgoing packets will start to
 get dropped. But so long as I keep ACKing correctly, it
 doesn’t matter.

slide-128
SLIDE 128

Amplification

  • The big deal with this attack is its Amplification

Factor

  • Attacker sends x bytes of data, causing the victim to

send many more bytes of data in response

  • Recent examples: NTP, DNSSEC
  • Amplified in TCP due to cumulative ACKs
  • “ACK x” says “I’ve seen all bytes up to but not

including x”

slide-129
SLIDE 129

Opt-ack’s amplification factor

  • Max bytes sent by victim per ACK:
  • Max ACKs attacker can send per second:
slide-130
SLIDE 130

Opt-ack’s amplification factor

  • Max bytes sent by victim per ACK:

Max window size MSS x (14 + 40 + MSS)

Packets sent per ACK Bytes per packet

E t h e r n e t T C P / I P P a y l

  • a

d

  • Max ACKs attacker can send per second:
slide-131
SLIDE 131

Opt-ack’s amplification factor

  • Max bytes sent by victim per ACK:

Max window size MSS x (14 + 40 + MSS)

Packets sent per ACK Bytes per packet

E t h e r n e t T C P / I P P a y l

  • a

d

  • Max ACKs attacker can send per second:

Attacker bandwidth (bytes/sec) (14 + 40)

Size of ACK packet

slide-132
SLIDE 132

Opt-ack’s amplification factor

  • Boils down to max window size and MSS
  • Default max window size: 65,536
  • Default MSS: 536
  • Default amp factor: 65536 * (1/536 + 1/54) ~ 1336x
  • Window scaling lets you increase this by a factor of 2^14
  • Window scaling amp factor: ~1336 * 2^14 ~ 22M
  • Using minimum MSS of 88: ~ 32M
slide-133
SLIDE 133

Opt-ack defenses

  • Is there a way we could defend against opt-ack in

a way that is still compatible with existing implementations of TCP?

  • An important goal in networking is incremental

deployment: ideally, we should be able to benefit from a system/modification when even a subset of hosts deploy it.

slide-134
SLIDE 134

Next time

  • We now know how to communicate reliably and

securely with a given destination IP address

  • Next up: Naming
  • How do we get an IP address, and can we attack

that process?

  • DHCP
  • Given bank.com, how do we get its IP address?
  • DNS
  • Kaminsky attack