Network Security: Background CS 161: Computer Security Prof. Vern - - PowerPoint PPT Presentation

network security background
SMART_READER_LITE
LIVE PREVIEW

Network Security: Background CS 161: Computer Security Prof. Vern - - PowerPoint PPT Presentation

Network Security: Background CS 161: Computer Security Prof. Vern Paxson TAs: Paul Bramsen, Apoorva Dornadula, David Fifield, Mia Gil Epner, David Hahn, Warren He, Grant Ho, Frank Li, Nathan Malkin, Mitar Milutinovic, Rishabh Poddar, Rebecca


slide-1
SLIDE 1

Network Security: Background

CS 161: Computer Security

  • Prof. Vern Paxson

TAs: Paul Bramsen, Apoorva Dornadula, David Fifield, Mia Gil Epner, David Hahn, Warren He, Grant Ho, Frank Li, Nathan Malkin, Mitar Milutinovic, Rishabh Poddar, Rebecca Portnoff, Nate Wang

http://inst.eecs.berkeley.edu/~cs161/

March 7, 2017

slide-2
SLIDE 2

Revoca'on, con’t

  • Approach #2: announce revoked certs

– Users periodically download cert revoca)on list (CRL)

  • Issues?

– Lists can get large – Need to authen)cate the list itself – how? Sign it! – Mallory can exploit download lag – What does Alice do if can’t reach CA for download?

  • 1. Assume all certs are invalid (fail-safe defaults)

– Wow, what an unhappy failure mode!

  • 2. Use old list: widens exploitaNon window if Mallory can

“DoS” CA (DoS = denial-of-service)

slide-3
SLIDE 3

Revoca'on, con’t

  • Approach #3: CA provides service to query

– OCSP: Online Cer)ficate Status Protocol

slide-4
SLIDE 4

Bob Alice b* B* Mallory I’d like to talk privately with Bob CA {Bob: : B?}K

  • 1

CA

OCSP = Online Certificate Status Protocol

slide-5
SLIDE 5

Bob Alice b* B* Mallory Yo, CA: Is this cert cool? CA {Bob: : B?}K

  • 1

CA

? ?

OCSP = Online Certificate Status Protocol

slide-6
SLIDE 6

Bob Alice b* B* Mallory CA OCSP = Online Certificate Status Protocol

K

  • 1

CA

K

  • 1

CA

Yo, CA: Is this cert cool? {Bob: : B?}K

  • 1

CA

slide-7
SLIDE 7

Revoca'on, con’t

  • Approach #3: CA provides service to query

– OCSP: Online Cer)ficate Status Protocol

  • Issues?

– Can’t be used if Alice doesn’t have connecNvity to CA – CA learns that Alice talks to Bob – CA had be]er build this in a scalable fashion! – CA outages ⇒ big headaches

  • OR: Alice defaults to trusNng if OCSP inaccessible

– Again creates a DoS threat

slide-8
SLIDE 8

Alice Bob

Bob

Mi b {Bob: : B}K

  • 1

CA

K

  • 1

CA

Good Nll 2:15PM

✔︎

OCSP Stapling I’d like to talk privately with Bob

Bob’s server periodically contacts the CA to update the OCSP attestation for his cert

CA

slide-9
SLIDE 9

Leap-of-Faith Authen'ca'on

  • A completely different approach leverages key

conNnuity

slide-10
SLIDE 10

Alice Bob

Bob

Mi b {Bob: : B}K

  • 1

CA

Leap-of-Faith Authentication Huh I’ve never been to Bob’s site before

slide-11
SLIDE 11

Alice Bob

Bob

Mi b {Bob: : B}K

  • 1

CA

Leap-of-Faith Authentication I’m going to hope that just this one )me, Mallory didn’t show up …

slide-12
SLIDE 12

Alice Bob

Bob

Mi b {Bob: : B}K

  • 1

CA

Leap-of-Faith Authentication But now that I have the cert, any Nme in the future I’ll refuse a different cert if

  • ffered
slide-13
SLIDE 13

Leap-of-Faith Authen'ca'on, con’t

  • A completely different approach leverages key

conNnuity

– Also called TOFU: Trust On First Use – A form of “pinning”

  • Require cert to have specific properNes, like parNcular CA

– Very popular for SSH

  • Web browsers don’t expose an easy equivalent usage

model

slide-14
SLIDE 14

Leap-of-Faith Authen'ca'on, con’t

  • ProperNes/Issues?
  • Doesn’t bug you, just automaNcally gives you a

secure mode of operaNon

– Great design property!

  • Leverages mental expectaNons

– Such as: “hard for a]acker to anNcipate this’ll be my very first visit” (clearly not always true!) – Or: “Bob menNoned he’d be upgrading, so the new key is expected”

  • Bri]le: relies on user to noNce and thoughDully

respond to key changes

slide-15
SLIDE 15

Background on Networking

slide-16
SLIDE 16

Network Security

  • Why study network security?

– Networking greatly extends our overall attack surface

  • Networking = the Internet

– Opportunity to see how large-scale design affects security issues – Protocols a great example of mindless agents in action

  • This lecture: sufficient background in networking

to then explore security issues in next ~5 lectures

  • Complex topic with many facets

– We will omit concepts/details that aren’t very security- relevant – By all means, ask questions when things are unclear

  • (but we may skip if not ultimately relevant for security,
  • r postpone if question itself is directly about security)
slide-17
SLIDE 17

Protocols

  • A protocol is an agreement on how to communicate
  • Includes syntax and semantics

– How a communication is specified & structured

  • Format, order messages are sent and received

– What a communication means

  • Actions taken when transmitting, receiving, or timer expires
  • E.g.: making a comment in lecture?
  • 1. Raise your hand.
  • 2. Wait to be called on.
  • 3. Or: wait for speaker to pause and vocalize
  • 4. If unrecognized (after timeout): vocalize w/ “excuse me”
slide-18
SLIDE 18

So You Walk Into A Coffee Shop, Open Up Your Laptop, And Issue a Google Query ….

slide-19
SLIDE 19
slide-20
SLIDE 20

Your laptop shouts: HEY, DOES WIRELESS NETWORK X EXIST?

  • 1. Join the wireless network
slide-21
SLIDE 21
  • 1. Join the wireless network

Wireless access point(s) conNnually shout: HEY, I’M WIRELESS NETWORK Y, JOIN ME!

slide-22
SLIDE 22
  • 1. Join the wireless network

If either match up, your laptop joins the network. OpNonally performs a cryptographic exchange.

slide-23
SLIDE 23
  • 2. Configure your connecNon

Your laptop shouts: HEY, ANYBODY, WHAT BASIC CONFIG DO I NEED TO USE?

slide-24
SLIDE 24
  • 2. Configure your connecNon

Some system on the local network replies: Here’s your config, enjoy

slide-25
SLIDE 25
  • 2. Configure your connecNon

The configuraNon includes: (1) An Internet address (IP address) your laptop should use; typ. 32 bits (2) The address of a “gateway” system to use to access hosts beyond the local network (3) The address of a DNS server (“resolver”) to map names like google.com to IP addresses

192.168.1.14

slide-26
SLIDE 26
  • 3. Find the address of google.com

Your laptop sends a DNS request asking: “address for google.com?” It’s transmi]ed using the UDP protocol (lightweight, unreliable). The DNS resolver might not be on the local network.

192.168.1.14

slide-27
SLIDE 27

gateway

  • 3. Find the address of google.com

192.168.1.14

slide-28
SLIDE 28

gateway resolver router 172.217.6.78

Ti Tie Rest t of ti tie In e Intf tfrn rnet et

  • 3. Find the address of google.com

192.168.1.14

slide-29
SLIDE 29

gateway resolver router 172.217.6.78

Ti Tie Rest t of ti tie In e Intf tfrn rnet et

google.com?

  • 3. Find the address of google.com

192.168.1.14

slide-30
SLIDE 30

gateway resolver router 172.217.6.78

Ti Tie Rest t of ti tie In e Intf tfrn rnet et

google.com?

(The resolver now itself uses DNS queries to other DNS servers to figure out the address associated with google.com.)

  • 3. Find the address of google.com

192.168.1.14

slide-31
SLIDE 31

gateway resolver router 172.217.6.78

Ti Tie Rest t of ti tie In e Intf tfrn rnet et

google.com’s address is 172.217.6.78

  • 3. Find the address of google.com

192.168.1.14

slide-32
SLIDE 32

gateway resolver router 172.217.6.78

Ti Tie Rest t of ti tie In e Intf tfrn rnet et

  • 4. Connect to google.com server

192.168.1.14

slide-33
SLIDE 33

gateway resolver router 172.217.6.78

Ti Tie Res ti tie In e Intf tf

Your laptop now establishes a connec)on with the web server at 172.217.6.78. It uses TCP for this rather than UDP, to obtain reliability.

  • 4. Connect to google.com server

192.168.1.14

slide-34
SLIDE 34

gateway resolver router 172.217.6.78

Ti Tie Res ti tie In e Intf tf

The first step of establishing the connecNon is to send a TCP connecNon request (“SYN”) to the server.

TCP SYN

  • 4. Connect to google.com server

192.168.1.14

slide-35
SLIDE 35

gateway resolver router 172.217.6.78

Ti Tie Res ti tie In e Intf tf

If the server accepts the connecNon, it replies with a “SYN ACK”.

TCP SYN ACK

  • 4. Connect to google.com server

192.168.1.14

slide-36
SLIDE 36

gateway resolver router 172.217.6.78

Ti Tie Res ti tie In e Intf tf

Your laptop completes the connecNon establishment by likewise sending an acknowledgement.

TCP ACK

  • 4. Connect to google.com server

192.168.1.14

slide-37
SLIDE 37

gateway resolver router 172.217.6.78

Ti Tie Res ti tie In e Intf tf

  • 4. Connect to google.com server

192.168.1.14

At this point the connecNon is established and data can be (reliably) exchanged.

slide-38
SLIDE 38

gateway resolver router 172.217.6.78

Ti Tie Res ti tie In e Intf tf

I want a confidenNal connecNon with integrity & authenNcaNon

  • 5. Establish a

secure connecNon using TLS (h]ps)

192.168.1.14

slide-39
SLIDE 39

gateway resolver router 172.217.6.78

Ti Tie Res ti tie In e Intf tf

Here’s a cerNficate that vouches for my public key, google.com

  • 5. Establish a

secure connecNon using TLS (h]ps)

192.168.1.14

slide-40
SLIDE 40

gateway resolver router 172.217.6.78

Ti Tie Res ti tie In e Intf tf

Well if you really possess the corresponding private key, prove it by decrypNng this blob which we’ll use to establish shared secret keys

  • 5. Establish a

secure connecNon using TLS (h]ps)

192.168.1.14

slide-41
SLIDE 41

gateway resolver router 172.217.6.78

Ti Tie Res ti tie In e Intf tf

Here’s your proof

  • 5. Establish a

secure connecNon using TLS (h]ps)

192.168.1.14

slide-42
SLIDE 42

gateway resolver router 172.217.6.78

Ti Tie Res ti tie In e Intf tf

  • 6. Finally, your laptop can send

along your query! (Using HTTP inside the TLS channel) GET /search?query= great+Spring+Break+beaches …

192.168.1.14

slide-43
SLIDE 43

5 Minute Break

Questions Before We Proceed?

slide-44
SLIDE 44

Internet Layering

slide-45
SLIDE 45

Layering

  • Internet design is strongly partitioned into layers

– Each layer relies on services provided by next layer below … – … and provides services to layer above it

  • Analogy:

– Consider structure of an application you’ve written and the “services” each layer relies on / provides

Code You Write Run-Time Library System Calls Device Drivers Voltage Levels / Magnetic Domains }

Fully isolated from user programs

slide-46
SLIDE 46

Internet Layering (“Protocol Stack”)

Application Transport (Inter)Network Link Physical 7 4 3 2 1

Note on a point of potential confusion: these diagrams are always drawn with lower layers below higher layers … But diagrams showing the layouts of packets are often the opposite, with the lower layers at the top since their headers precede those for higher layers

slide-47
SLIDE 47

Horizontal View of a Single Packet

Link Layer Header (Inter)Network Layer Header (IP) Transport Layer Header First bit transmitted Application Data: structure depends on the application …

slide-48
SLIDE 48

Vertical View of a Single Packet

Link Layer Header (Inter)Network Layer Header (IP) Transport Layer Header First bit transmitted Application Data: structure depends on the application . . . . . . .

slide-49
SLIDE 49

Internet Layering (“Protocol Stack”)

Application Transport (Inter)Network Link Physical 7 4 3 2 1

slide-50
SLIDE 50

Layer 1: Physical Layer

Application Transport (Inter)Network Link Physical 7 4 3 2 1

Encoding bits to send them

  • ver a single physical link

e.g. patterns of voltage levels / photon intensities / RF modulation

slide-51
SLIDE 51

Layer 2: Link Layer

Application Transport (Inter)Network Link Physical 7 4 3 2 1

Framing and transmission of a collection of bits into individual messages sent across a single “subnetwork” (one physical technology) Might involve multiple physical links (e.g., modern Ethernet) Often technology supports broadcast transmission (every “node” connected to subnet receives)

slide-52
SLIDE 52

Layer 3: (Inter)Network Layer (IP)

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

Works across different link technologies

}

Different for each Internet “hop”

slide-53
SLIDE 53

Layer 4: Transport Layer

Application Transport (Inter)Network Link Physical 7 4 3 2 1

End-to-end communication between processes Different services provided: TCP = reliable byte stream UDP = unreliable datagrams

(Datagram = single packet message)

slide-54
SLIDE 54

Layer 7: Application Layer

Application Transport (Inter)Network Link Physical 7 4 3 2 1

Communication of whatever you wish Can use whatever transport(s) is convenient Freely structured E.g.: Skype, SMTP (email),

HTTP (Web), Halo, BitTorrent

slide-55
SLIDE 55

Internet Layering (“Protocol Stack”)

Application Transport (Inter)Network Link Physical 7 4 3 2 1

}

Implemented only at hosts, not at interior routers (“dumb network”)

slide-56
SLIDE 56

Internet Layering (“Protocol Stack”)

Application Transport (Inter)Network Link Physical 7 4 3 2 1

}

Implemented everywhere

slide-57
SLIDE 57

Internet Layering (“Protocol Stack”)

Application Transport (Inter)Network Link Physical 7 4 3 2 1

}

Different for each Internet “hop” ~ Same for each Internet “hop”

}

slide-58
SLIDE 58

Hop-By-Hop vs. End-to-End Layers

Host A Host B Host E Host D Host C Router 1 Router 2 Router 3 Router 4 Router 5 Router 6 Router 7

Host A communicates with Host D

slide-59
SLIDE 59

Hop-By-Hop vs. End-to-End Layers

Host A Host B Host E Host D Host C Router 1 Router 2 Router 3 Router 4 Router 5 Router 6 Router 7

Different Physical & Link Layers (Layers 1 & 2) E.g., Wi-Fi E.g., Ethernet Host A communicates with Host D

slide-60
SLIDE 60

Hop-By-Hop vs. End-to-End Layers

Host A Host B Host E Host D Host C Router 1 Router 2 Router 3 Router 4 Router 5 Router 6 Router 7

Same Network / Transport / Application Layers (3/4/7) (Routers ignore Transport & Application layers) E.g., HTTP over TCP over IP Host A communicates with Host D

slide-61
SLIDE 61

Layer 3: (Inter)Network Layer (IP)

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

Works across different link technologies

slide-62
SLIDE 62

IP Packet Structure

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 Options (if any) Payload

slide-63
SLIDE 63

IP Packet Structure

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 Options (if any) Payload

Specifies the length of the entire IP packet: bytes in this header plus bytes in the Payload

slide-64
SLIDE 64

IP Packet Structure

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 Options (if any) Payload

Specifies how to interpret the start

  • f the Payload, which is the

header of a Transport Protocol such as TCP (6) or UDP (17)

slide-65
SLIDE 65

IP Packet Structure

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)

6 16-bit Header Checksum 32-bit Source IP Address 32-bit Destination IP Address Options (if any) Start of TCP Header

Specifies how to interpret the start

  • f the Payload, which is the

header of a Transport Protocol such as TCP (6) or UDP (17)

slide-66
SLIDE 66

IP Packet Structure

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 Options (if any) Payload

slide-67
SLIDE 67

IP Packet Header (Continued)

  • Two IP addresses

– Source IP address (32 bits in main IP version) – Destination IP address (32 bits, likewise)

  • Destination address

– Unique identifier/locator for the receiving host – Allows each node to make forwarding decisions

  • Source address

– Unique identifier/locator for the sending host – Recipient can decide whether to accept packet – Enables recipient to send reply back to source