Securing Internet Communication: TLS CS 161: Computer Security Prof. - - PowerPoint PPT Presentation

securing internet communication tls
SMART_READER_LITE
LIVE PREVIEW

Securing Internet Communication: TLS CS 161: Computer Security Prof. - - PowerPoint PPT Presentation

Securing Internet Communication: TLS 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,


slide-1
SLIDE 1

Securing Internet Communication: TLS

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

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

April 6, 2017

slide-2
SLIDE 2

Today’s Lecture

  • Finish discussion of Denial-of-Service (DoS)
  • Begin discussion of crypto technology in practice
  • Goal #1: overview of the most prominent Internet

security protocol

– SSL/TLS: transport-level (process-to-process)

  • n top of TCP
  • Secures the web via HTTPS

– (Next lecture: DNSSEC, securing domain name lookups)

  • Goal #2: cement understanding of crypto building

blocks & how they’re used together

slide-3
SLIDE 3

Practical Defense: SYN Cookies

Client (initiator) SYN, SeqNum = x S Y N a n d A C K , S e q N u m = y , A c k = x + 1 ACK, Ack = y + 1 Server

  • Server: when SYN arrives, encode critical state

entirely within SYN-ACK’s sequence # y !

– y = encoding of necessary state, using server secret

  • When ACK of SYN-ACK arrives, server only

creates state if value of y from it agrees w/ secret

Server only creates state here if y validates

cookie y = <t, m, S> t = 5-bit 2mestamp that advances every 64 seconds m = 3 bits for encoding TCP op2ons S = boCom 24 bits of SHA-1(4-tuple, t, server secret)

slide-4
SLIDE 4

Cookies: Discussion

  • Illustrates general strategy: rather than holding

state, encode it so that it is returned when needed

  • For SYN cookies, attacker must complete

3-way handshake in order to burden server

– Can’t use spoofed source addresses

  • Note #1: strategy requires that you have

enough bits to encode all the critical state

– (This is just barely the case for SYN cookies)

  • Note #2: if it’s expensive to generate or check

the cookie, then it’s not a win

slide-5
SLIDE 5

TCP SYN Flooding, con’t

  • Approach #4: spread service across lots of

different physical servers

– This is a general defense against a wide range

  • f DoS threats (including application-layer)

– If servers are at different places around the network, protects against network-layer DoS too

  • But: costs $$
  • And: some services are not easy to divide up

– Such as when need to modify common database

  • E.g. a multi-player real-time game
slide-6
SLIDE 6

Application-Layer DoS

  • Rather than exhausting network or memory

resources, attacker can overwhelm a service’s processing capacity

  • There are many ways to do so, often at little

expense to attacker compared to target (asymmetry)

slide-7
SLIDE 7

The link sends a request to the web server that requires heavy processing by its backend database.

slide-8
SLIDE 8

Application-Layer DoS, con’t

  • Rather than exhausting network or memory resources,

attacker can overwhelm a service’s processing capacity

  • There are many ways to do so, often at little expense to

attacker compared to target (asymmetry)

  • Defenses against such attacks?
  • Approach #1: Only let legit users to issue expensive

requests

– Relies on being able to identify/authenticate them – Note: that this itself might be expensive!

  • Approach #2: Look for clusters of similar activity

– Arms race w/ attacker AND costs collateral damage

  • Approach #3: distribute service across multiple physical

servers ($$$)

slide-9
SLIDE 9

Securing Internet Communication

slide-10
SLIDE 10

Channel vs. Object Security

  • Channel security = securing a means of

communication

  • Object security = securing data values
  • CIA applies to both of them

– But with different design implications

  • TLS provides channel security
slide-11
SLIDE 11

Building Secure End-to-End Channels

  • End-to-end = communication protections

achieved all the way from originating client to intended server

– With no need to trust intermediaries

  • Dealing with threats:

– Eavesdropping?

  • Encryption (including session keys)

– Manipulation (injection, MITM)?

  • Integrity (use of a MAC); replay protection

– Impersonation?

  • Signatures

What's missing? Availability …

( )

slide-12
SLIDE 12

Building A Secure End-to-End Channel: SSL/TLS

  • SSL = Secure Sockets Layer (predecessor)
  • TLS = Transport Layer Security (standard)

– Both terms used interchangeably

  • Notion: provide means to secure any application

that uses TCP

slide-13
SLIDE 13

SSL/TLS In Network Layering

Application Transport (Inter)Network Link Physical

7 4 3 2 1

Transport (TCP) (Inter)Network Link Physical SSL / TLS

7 4 3 2 1

Application

7

slide-14
SLIDE 14

Building A Secure End-to-End Channel: SSL/TLS

  • SSL = Secure Sockets Layer (predecessor)
  • TLS = Transport Layer Security (standard)

– Both terms used interchangeably

  • Notion: provide means to secure any application

that uses TCP

– Secure = encryption/confidentiality + integrity + authentication (of server, but typ. not of client) – E.g., puts the ‘s’ in “https”

slide-15
SLIDE 15
slide-16
SLIDE 16

Regular web surfing – http: URL

slide-17
SLIDE 17

Web surfing with TLS/SSL – https: URL Note: site needs to make sure that all of its images, links, etc., are now also fetched via https: URLs. Doing so gives the web page full integrity, in keeping with end-to-end security. (Browsers do not provide this “promotion” automatically.)

slide-18
SLIDE 18

Building A Secure End-to-End Channel: SSL / TLS

  • SSL = Secure Sockets Layer (predecessor)
  • TLS = Transport Layer Security (standard)

– Both terms used interchangeably

  • Notion: provide means to secure any application

that uses TCP

– Secure = encryption/confidentiality + integrity + authentication (of server, but typ. not of client) – E.g., puts the ‘s’ in “https”

  • API similar to “socket” interface used for regular

network programming

– Fairly easy to convert an app to be secured

slide-19
SLIDE 19

HTTPS Connection (SSL / TLS)

  • Browser (client) connects via

TCP to Amazon's HTTPS server

  • Client picks 256-bit random

number RB, sends over list of crypto protocols it supports

  • Server picks 256-bit random

number RS, selects cipher suite to use for this session

  • Server sends over its certificate
  • (all of this is in the clear)
  • Client now validates cert

SYN S Y N A C K A C K

Browser Amazon Server

H e l l

  • .

M y r n d # = RB . I s u p p

  • r

t ( T L S + R S A + A E S 1 2 8 + S H A 2 5 6 )

  • r

( S S L + D H + 3 D E S + M D 5 )

  • r

… My rnd # = R

S

. Let's use TLS+RSA+AES128+SHA256 Here's my cert

~ 2

  • 3

K B

  • f

d a t a

slide-20
SLIDE 20

HTTPS Connection (SSL / TLS), con’t

  • For RSA, browser constructs long

(368 bits) “Premaster Secret” PS

  • Browser sends PS encrypted using

Amazon's public RSA key KAmazon

  • Using PS, RB, and RS, browser &

server derive symm. cipher keys (CB, CS) & MAC integrity keys (IB, IS)

– One pair to use in each direction

Browser

Here's my cert

~ 2

  • 3

K B

  • f

d a t a { P S }

KAmazon

PS PS

Amazon Server

slide-21
SLIDE 21

HTTPS Connection (SSL / TLS), con’t

  • For RSA, browser constructs long

(368 bits) “Premaster Secret” PS

  • Browser sends PS encrypted using

Amazon's public RSA key KAmazon

  • Using PS, RB, and RS, browser &

server derive symm. cipher keys (CB, CS) & MAC integrity keys (IB, IS)

– One pair to use in each direction

Browser

Here's my cert

~ 2

  • 3

K B

  • f

d a t a { P S }

KAmazon

PS PS

Amazon Server PS is used as the key for iterative HMAC invocations on RB || RS. Browser & server use the output to generate CB, CS, etc.

slide-22
SLIDE 22
  • For RSA, browser constructs long

(368 bits) “Premaster Secret” PS

  • Browser sends PS encrypted using

Amazon's public RSA key KAmazon

  • Using PS, RB, and RS, browser &

server derive symm. cipher keys (CB, CS) & MAC integrity keys (IB, IS)

– One pair to use in each direction

  • Browser & server exchange MACs

computed over entire dialog so far

  • If good MAC, Browser displays
  • All subsequent communication

encrypted w/ symmetric cipher (e.g., AES128) cipher keys, MACs

– Messages also numbered to thwart replay attacks

Browser

Here's my cert

~ 2

  • 3

K B

  • f

d a t a { P S }

KAmazon

PS PS {M1, MAC(M1,IB)}CB { M

2

, M A C ( M

2

, I

S

) }

CS

M A C ( d i a l

  • g

, I

S

) MAC(dialog,IB)

Amazon Server

HTTPS Connection (SSL / TLS), con’t

slide-23
SLIDE 23

Alternative: Key Exchange via Diffie-Hellman

  • For Diffie-Hellman, server

generates random a, sends public params and ga mod p

– Signed with server’s public key

  • Browser verifies signature
  • Browser generates random b,

computes PS = gab mod p, sends to server

  • Server also computes

PS = gab mod p

  • Remainder is as before: from

PS, RB, and RS, browser & server derive symm. cipher keys (CB, CS) and MAC integrity keys (IB, IS), etc…

Browser

Here's my cert

~ 2

  • 3

K B

  • f

d a t a g

b

m

  • d

p PS PS {M1, MAC(M1,IB)}CB M A C ( d i a l

  • g

, I

S

) MAC(dialog,IB) { g , p , g

a

m

  • d

p }

K

  • 1

Amazon

Amazon Server

slide-24
SLIDE 24

5 Minute Break

Questions Before We Proceed?

slide-25
SLIDE 25

HTTPS Connection (SSL / TLS)

  • Browser (client) connects via

TCP to Amazon's HTTPS server

  • Client picks 256-bit random

number RB, sends over list of crypto protocols it supports

  • Server picks 256-bit random

number RS, selects cipher suite use for this session

  • Server sends over its certificate
  • (all of this is in the clear)
  • Client now validates cert

SYN S Y N A C K A C K

Browser Amazon Server

H e l l

  • .

M y r n d # = RB . I s u p p

  • r

t ( T L S + R S A + A E S 1 2 8 + S H A 2 5 6 )

  • r

( S S L + D H + 3 D E S + M D 5 )

  • r

… My rnd # = R

S

. Let's use TLS+RSA+AES128+SHA256 Here's my cert

~ 2

  • 3

K B

  • f

d a t a

slide-26
SLIDE 26

Certificates

  • Cert = signed statement about someone’s public key

– Note that a cert does not say anything about the identity of who gives you the cert – It simply states a given public key KBob belongs to Bob …

  • … and backs up this statement with a digital signature made using a

different public/private key pair, say from Alice

  • Bob then can prove his identity to you by you sending

him something encrypted with KBob …

– … which he then demonstrates he can read

  • … or by signing something he demonstrably uses
  • Works provided you trust that you have a valid copy
  • f Alice’s public key …

– … and you trust Alice to use prudence when she signs

  • ther people’s keys, such as Bob’s
slide-27
SLIDE 27

What’s Inside Amazon’s Cert?

slide-28
SLIDE 28
slide-29
SLIDE 29

The CA is Symantec Corporation

slide-30
SLIDE 30

Here’s the cipher suite used for the connection

slide-31
SLIDE 31
slide-32
SLIDE 32
slide-33
SLIDE 33

PKCS #1 = “Standard RSA encryption/signing” algorithms

slide-34
SLIDE 34

It’s a 2,048-bit key

slide-35
SLIDE 35

The value of “e” to use in Me mod n is 216+1

slide-36
SLIDE 36

This cert is valid for associating with any of these DNS names

slide-37
SLIDE 37

Our browser will only honor this cert if the URL we’re accessing uses one of those domains

slide-38
SLIDE 38

The key can be used for both encryption and digital signatures

slide-39
SLIDE 39

If the browser doesn’t understand this“Certificate Key Usage” extension, it must reject the cert

slide-40
SLIDE 40

Here is where to download the CA’s certificate revocation list

slide-41
SLIDE 41

Note: it’s 1.25MB in size

slide-42
SLIDE 42

Why is it okay that we download this using http rather than requiring https?

slide-43
SLIDE 43

Because the CRL is signed using the CA’s public key, which we trust.

slide-44
SLIDE 44

Here is where to access the CA’s Online Certificate Status Protocol server to check for revocations

slide-45
SLIDE 45

The CA has signed a SHA-256 hash of this cert using RSA

slide-46
SLIDE 46

Here’s the actual signature, which our browser then needs to validate against a SHA256 hash the browser computes over the cert

slide-47
SLIDE 47

Validating Amazon’s Identity

  • Browser compares domain name in cert w/ URL

– Note: this provides an end-to-end property (as opposed to say a cert associated with an IP address)

  • Browser accesses separate cert belonging to issuer

– These are hardwired into the browser - trusted! – There could be a chain of these …

  • Browser applies issuer’s public key to verify

signature, obtaining hash of what issuer signed

– Compares with its own SHA-256 hash of Amazon’s cert

  • Assuming hashes match, now have high confidence

it’s indeed Amazon …

– assuming signatory is trustworthy

= assuming didn’t lose private key; assuming didn’t sign thoughtlessly

slide-48
SLIDE 48

End-to-End ⇒ Powerful Protections

  • Attacker runs a sniffer to capture our WiFi session?

– (maybe by buying a cup of coffee to get the password) – But: encrypted communication is unreadable

  • No problem!
  • DNS cache poisoning?

– Client goes to wrong server – But: detects impersonation since attacker lacks valid cert

  • No problem!
  • Attacker hijacks our connection, injects new traffic

– But: data receiver rejects it due to failed integrity check

  • No problem!
slide-49
SLIDE 49

Powerful Protections, con't

  • DHCP spoofing?

– Client goes to wrong server – But: detects impersonation since attacker lacks valid cert

  • No problem!
  • Attacker manipulates routing to run us by an

eavesdropper or take us to the wrong server?

– But: they can’t read; we detect impersonation

  • No problem!
  • Attacker slips in as a Man In The Middle?

– But: they can’t read, they can’t inject – They can’t even replay previous encrypted traffic – No problem!

slide-50
SLIDE 50

Validating Amazon’s Identity, con’t

  • Browser accesses separate cert belonging to issuer

– These are hardwired into the browser - trusted!

  • What if browser can’t find a cert for the issuer?
slide-51
SLIDE 51
slide-52
SLIDE 52

Validating Amazon’s Identity, con’t

  • Browser accesses separate cert belonging to issuer

– These are hardwired into the browser - trusted!

  • What if browser can’t find a cert for the issuer?
  • If it can’t find the cert, then warns the user that site

has not been verified

– Note, can still proceed, just without authentication

  • Q: Which end-to-end security properties do we lose

if we incorrectly trust that the site is whom we think?

  • A: All of them!

– Goodbye confidentiality, integrity, authentication – Attacker can read everything, modify, impersonate

slide-53
SLIDE 53

SSL / TLS Limitations

  • Properly used, SSL / TLS provides powerful end-to-

end protections

  • So why not use it for everything??
  • Issues:

– Cost of public-key crypto

  • Takes non-trivial CPU processing (but today a minor issue)
  • Note: symmetric key crypto on modern hardware is non-issue

– Hassle of buying/maintaining certs (fairly minor)

slide-54
SLIDE 54
slide-55
SLIDE 55

You prove to this CA that you’re entitled to a cert for foo.com by demonstrating your control over the domain. The CA issues a challenge, one of:

  • 1. Add an (invisible) item to the foo.com homepage
  • 2. Add an entry to the foo.com DNS zone
  • 3. Show you can receive email at the registered foo.com

email address

slide-56
SLIDE 56

SSL / TLS Limitations

  • Properly used, SSL / TLS provides powerful end-to-

end protections

  • So why not use it for everything??
  • Issues:

– Cost of public-key crypto

  • Takes non-trivial CPU processing (but today a minor issue)
  • Note: symmetric key crypto on modern hardware is non-issue

– Hassle of buying/maintaining certs (fairly minor) – DoS amplification

  • Client can force server to undertake public key operations
  • But: requires established TCP connection, and given that, there

are often other juicy targets like back-end databases

– Integrating with other sites that don’t use HTTPS – Latency: extra round trips ⇒ pages take longer to load