Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 SSL: Secure Sockets Layer r Widely deployed security protocol m Supported by almost all browsers and web servers m https m Tens of billions $ spent per.

Similar presentations


Presentation on theme: "1 SSL: Secure Sockets Layer r Widely deployed security protocol m Supported by almost all browsers and web servers m https m Tens of billions $ spent per."— Presentation transcript:

1 1 SSL: Secure Sockets Layer r Widely deployed security protocol m Supported by almost all browsers and web servers m https m Tens of billions $ spent per year over SSL r Originally designed by Netscape in 1993 r Number of variations: m TLS: transport layer security, RFC 2246 r Provides m Confidentiality m Integrity m Authentication r Original goals: m Had Web e-commerce transactions in mind m Encryption (especially credit-card numbers) m Web-server authentication m Optional client authentication m Minimum hassle in doing business with new merchant r Available to all TCP applications m Secure socket interface

2 2

3 3 SSL and TCP/IP Application TCP IP Normal Application Application SSL TCP IP Application with SSL SSL provides application programming interface (API) to applications C and Java SSL libraries/classes readily available

4 4 Could do something like PGP: But want to send byte streams & interactive data Want a set of secret keys for the entire connection Want certificate exchange part of protocol: handshake phase H( ). K A ( ). - + K A (H(m)) - m KAKA - m K S ( ). K B ( ). + + K B (K S ) + KSKS KBKB + Internet KSKS

5 5 Toy SSL: a simple secure channel r Handshake: Alice and Bob use their certificates and private keys to authenticate each other and exchange shared secret r Key Derivation: Alice and Bob use shared secret to derive set of keys r Data Transfer: Data to be transferred is broken up into a series of records r Connection Closure: Special messages to securely close connection

6 6 Toy: A simple handshake r MS = master secret r EMS = encrypted master secret hello certificate K B + (MS) = EMS

7 7 RECALL: Certification Authorities r When Alice wants Bob’s public key: m gets Bob’s certificate (Bob or elsewhere). m apply CA’s public key to Bob’s certificate, get Bob’s public key Bob’s public key K B + digital signature (decrypt) CA public key K CA + K B + Bob’s Certificate

8 8 Toy: Key derivation r Considered bad to use same key for more than one cryptographic operation m Use different keys for message authentication code (MAC) and encryption r Four keys: m K c = encryption key for data sent from client to server m M c = MAC key for data sent from client to server m K s = encryption key for data sent from server to client m M s = MAC key for data sent from server to client r Keys derived from key derivation function (KDF) m Takes master secret and (possibly) some additional random data and creates the keys

9 9 Recall MAC message H( ) s message s H( ) compare s = shared secret r Recall that HMAC is a standardized MAC algorithm r SSL uses a variation of HMAC r TLS uses HMAC

10 10 Toy: Data Records r Why not encrypt data in constant stream as we write it to TCP? m Where would we put the MAC? If at end, no message integrity until all data processed. m For example, with instant messaging, how can we do integrity check over all bytes sent before displaying? r Instead, break stream in series of records m Each record carries a MAC m Receiver can act on each record as it arrives r Issue: in record, receiver needs to distinguish MAC from data m Want to use variable-length records lengthdataMAC

11 11 Toy: Sequence Numbers r Attacker can capture and replay record or re-order records r Solution: put sequence number into MAC: m MAC = MAC(M x, sequence||data) m Note: no sequence number field r Attacker could still replay all of the records m Use random nonce

12 12 Toy: Control information r Truncation attack: m attacker forges TCP connection close segment m One or both sides thinks there is less data than there actually is. r Solution: record types, with one type for closure m type 0 for data; type 1 for closure r MAC = MAC(M x, sequence||type||data) lengthtypedataMAC

13 Short Question: r In the SSL record, there is a field for SSL seq. numbers? m True or False? 13 False. Both sides maintain Seq. no independently.

14 14 Toy SSL: summary hello certificate, nonce K B + (MS) = EMS type 0, seq 1, data type 0, seq 2, data type 0, seq 1, data type 0, seq 3, data type 1, seq 4, close type 1, seq 2, close encrypted bob.com

15 Question r Suppose Seq. number is NOT used. r Question: In an SSL session, Can Trudy (woman-in-the-middle) delete a TCP segment? r Question: What effect will it have? 15

16 Question r Suppose Seq. number is USED. r In an SSL session, an attacker inserts a bogus TCP segment into a packet stream with correct TCP checksum and seq. no. r Question: Will SSL at the receiving side accept bogus packet and pass the payload to upper-level? 16 FALSE, Mx is used for MAC calculation.

17 Question. KDC r KDC (Key Distribution Center): a server that shares a unique secret symmetric key with each registered user. K A-KDC, K B-KDC r Can session key be distributed using KDC? 17 AB 1. K A-KDC (A,B) K A-KDC (S, K B-KDC (A,S)) K B-KDC (A,S) S 2. 3.

18 18 Toy SSL isn’t complete r How long are the fields? r What encryption protocols? r No negotiation m Allow client and server to support different encryption algorithms m Allow client and server to choose together specific algorithm before data transfer

19 19 Most common symmetric ciphers in SSL r DES – Data Encryption Standard: block r 3DES – Triple strength: block r RC2 – Rivest Cipher 2: block r RC4 – Rivest Cipher 4: stream Public key encryption r RSA

20 20 SSL Cipher Suite r Cipher Suite m Public-key algorithm m Symmetric encryption algorithm m MAC algorithm r SSL supports a variety of cipher suites r Negotiation: client and server must agree on cipher suite r Client offers choice; server picks one

21 21 Real SSL: Handshake (1) Purpose 1. Server authentication 2. Negotiation: agree on crypto algorithms 3. Establish keys 4. Client authentication (optional)

22 22 Real SSL: Handshake (2) 1. Client sends list of algorithms it supports, along with client nonce 2. Server chooses algorithms from list; sends back: choice + certificate + server nonce 3. Client verifies certificate, extracts server’s public key, generates pre_master_secret, encrypts with server’s public key, sends to server 4. Client and server independently compute encryption and MAC keys from pre_master_secret and nonces 5. Client sends a MAC of all the handshake messages 6. Server sends a MAC of all the handshake messages

23 23 Real SSL: Handshaking (3) Last 2 steps protect handshake from tampering r Client typically offers range of algorithms, some strong, some weak r Man-in-the middle could delete the stronger algorithms from list r Last 2 steps prevent this m Last two messages are encrypted

24 24 Real SSL: Handshaking (4) r Why the two random nonces? r Suppose Trudy sniffs all messages between Alice & Bob. r Next day, Trudy sets up TCP connection with Bob, sends the exact same sequence of records,. m Bob (Amazon) thinks Alice made two separate orders for the same thing. m Solution: Bob sends different random nonce for each connection. This causes encryption keys to be different on the two days. m Trudy’s messages will fail Bob’s integrity check.

25 25 Handshake types r All handshake messages (with SSL header) have 1 byte type field: Types m ClientHello m ServerHello m Certificate m ServerKeyExchange m CertificateRequest m ServerHelloDone m CertificateVerify m ClientKeyExchange m Finished

26 SSL Protocol Stack 26

27 27 SSL Record Protocol data fragment data fragment MAC encrypted data and MAC encrypted data and MAC record header record header record header: content type; version; length MAC: includes sequence number, MAC key M x Fragment: each SSL fragment 2 14 bytes (~16 Kbytes)

28 28 SSL Record Format content type SSL version length MAC data 1 byte 2 bytes3 bytes Data and MAC encrypted (symmetric algo)

29 29 Content types in record header r application_data (23) r alert (21) m signaling errors during handshake r handshake (22) m initial handshake messages are carried in records of type “handshake” m Hankshake messages in turn have their own “sub” types r change_cipher_spec (20) m indicates change in encryption and authentication algorithms

30 30 handshake: ClientHello handshake: ServerHello handshake: Certificate handshake: ServerHelloDone handshake: ClientKeyExchange ChangeCipherSpec handshake: Finished ChangeCipherSpec handshake: Finished application_data Alert: warning, close_notify Real Connection TCP Fin follow Everything henceforth is encrypted

31 Short Question r In which step of SSL handshake, can Alice discover that she is not talking with Bob? 31 handshake: ClientHello handshake: ServerHello Bob’s certificate Alice Trudy Bob handshake: ClientKeyExchange ChangeCipherSpec handshake: Finished ChangeCipherSpec handshake: Finished

32 32 a)Packet 112 sent by client or server? b)Server IP and port? c)What is the seq. no of the next TCP segment sent by client? P19. Client (https) 79 (seq) (len) = 283

33 33 d) Does packet 112 contain a Master Secret? e) Assume HandShake type field is 1 byte, each length field is 3 bytes, what are the values of the first / last bytes of Master Secret? P19. Yes First: bc; Last: 29

34 34 Key derivation r Client nonce, server nonce, and pre-master secret input into pseudo random-number generator. m Produces master secret r Master secret and new nonces inputed into another random-number generator: “key block” m Because of session resumption: Talk later. r Key block sliced and diced: m client MAC key m server MAC key m client encryption key m server encryption key m client initialization vector (IV) m server initialization vector (IV)

35 35 RECALL: Cipher Block Chaining (CBC) r CBC generates its own random numbers m Have encryption of current block depend on result of previous block m c(i) = K S ( m(i)  c(i-1) ) m m(i) = K S ( c(i))  c(i-1) r How do we encrypt first block? m Initialization vector (IV): random block = c(0) m IV does not have to be secret r Change IV for each message (or session) m Guarantees that even if the same message is sent repeatedly, the ciphertext will be completely different each time

36 Short Question: r Suppose an SSL session employs a block cipher with CBC (cipher block chaining). r The server sends Initialization Vector (VI) in clear-text? m True or False? 36 False. Each side can derive it.

37 Short Question: r What is the purpose of random nonces in SSL handshake? 37 Defend against Playback Attack

38 38 SSL Performance r Big-number operations in public-key crypto are CPU intensive r Server handshake m Typically over half SSL handshake CPU time goes to RSA decryption of the encrypted pre_master_secret r Client handshake m Public key encryption is less expensive m Server is handshake bottleneck r Data transfer m Symmetric encryption m MAC calculation m Neither as CPU intensive as public-key decryption

39 39 Session resumption r Full handshake is expensive: CPU time and number of RTTs r If the client and server have already communicated once, they can skip handshake and proceed directly to data transfer m For a given session, client and server store session_id, master_secret, negotiated ciphers r Client sends session_id in ClientHello r Server then agrees to resume in ServerHello m New key_block computed from master_secret and client and server random numbers

40 40 Client authentication r SSL can also authenticate client r Server sends a CertificateRequest message to client


Download ppt "1 SSL: Secure Sockets Layer r Widely deployed security protocol m Supported by almost all browsers and web servers m https m Tens of billions $ spent per."

Similar presentations


Ads by Google