1 SSL: Secure Sockets Layer r Widely deployed security protocol m Supported by almost all browsers...
-
Upload
molly-wiley -
Category
Documents
-
view
214 -
download
2
Transcript of 1 SSL: Secure Sockets Layer r Widely deployed security protocol m Supported by almost all browsers...
![Page 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.](https://reader038.fdocuments.us/reader038/viewer/2022110320/56649ca45503460f94965371/html5/thumbnails/1.jpg)
1
SSL: Secure Sockets Layer
Widely deployed security protocol Supported by almost all browsers and web servers https Tens of billions $ spent per year over SSL
Originally designed by Netscape in 1993 Number of variations:
TLS: transport layer security, RFC 2246 Provides
Confidentiality Integrity Authentication
Original goals: Had Web e-commerce transactions in mind Encryption (especially credit-card numbers) Web-server authentication Optional client authentication Minimum hassle in doing business with new merchant
Available to all TCP applications Secure socket interface
![Page 2: 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.](https://reader038.fdocuments.us/reader038/viewer/2022110320/56649ca45503460f94965371/html5/thumbnails/2.jpg)
2
![Page 3: 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.](https://reader038.fdocuments.us/reader038/viewer/2022110320/56649ca45503460f94965371/html5/thumbnails/3.jpg)
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
![Page 4: 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.](https://reader038.fdocuments.us/reader038/viewer/2022110320/56649ca45503460f94965371/html5/thumbnails/4.jpg)
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( ). KA( ).-
+
KA(H(m))-
m
KA-
m
KS( ).
KB( ).+
+
KB(KS )+
KS
KB+
Internet
KS
![Page 5: 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.](https://reader038.fdocuments.us/reader038/viewer/2022110320/56649ca45503460f94965371/html5/thumbnails/5.jpg)
5
Toy SSL: a simple secure channel
Handshake: Alice and Bob use their certificates and private keys to authenticate each other and exchange shared secret
Key Derivation: Alice and Bob use shared secret to derive set of keys
Data Transfer: Data to be transferred is broken up into a series of records
Connection Closure: Special messages to securely close connection
![Page 6: 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.](https://reader038.fdocuments.us/reader038/viewer/2022110320/56649ca45503460f94965371/html5/thumbnails/6.jpg)
6
Toy: A simple handshake
MS = master secret EMS = encrypted master secret
hello
certificate
KB+(MS) = EMS
![Page 7: 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.](https://reader038.fdocuments.us/reader038/viewer/2022110320/56649ca45503460f94965371/html5/thumbnails/7.jpg)
7
RECALL: Certification Authorities When Alice wants Bob’s public key:
gets Bob’s certificate (Bob or elsewhere). apply CA’s public key to Bob’s certificate,
get Bob’s public key
Bob’s public
key K B+
digitalsignature(decrypt)
CA public
key K CA+
K B+
Bob’s Certificate
![Page 8: 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.](https://reader038.fdocuments.us/reader038/viewer/2022110320/56649ca45503460f94965371/html5/thumbnails/8.jpg)
8
Toy: Key derivation
Considered bad to use same key for more than one cryptographic operation Use different keys for message authentication code
(MAC) and encryption Four keys:
Kc = encryption key for data sent from client to server
Mc = MAC key for data sent from client to server Ks = encryption key for data sent from server to
client Ms = MAC key for data sent from server to client
Keys derived from key derivation function (KDF) Takes master secret and (possibly) some additional
random data and creates the keys
![Page 9: 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.](https://reader038.fdocuments.us/reader038/viewer/2022110320/56649ca45503460f94965371/html5/thumbnails/9.jpg)
9
Recall MACm
ess
ag
e
H( )
s
mess
ag
e
mess
ag
e
s
H( )
compare
s = shared secret
Recall that HMAC is a standardized MAC algorithm SSL uses a variation of HMAC TLS uses HMAC
![Page 10: 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.](https://reader038.fdocuments.us/reader038/viewer/2022110320/56649ca45503460f94965371/html5/thumbnails/10.jpg)
10
Toy: Data Records Why not encrypt data in constant stream as
we write it to TCP? Where would we put the MAC? If at end, no message
integrity until all data processed. For example, with instant messaging, how can we do
integrity check over all bytes sent before displaying? Instead, break stream in series of records
Each record carries a MAC Receiver can act on each record as it arrives
Issue: in record, receiver needs to distinguish MAC from data Want to use variable-length records
length data MAC
![Page 11: 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.](https://reader038.fdocuments.us/reader038/viewer/2022110320/56649ca45503460f94965371/html5/thumbnails/11.jpg)
11
Toy: Sequence Numbers
Attacker can capture and replay record or re-order records
Solution: put sequence number into MAC: MAC = MAC(Mx, sequence||data) Note: no sequence number field
Attacker could still replay all of the records Use random nonce
![Page 12: 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.](https://reader038.fdocuments.us/reader038/viewer/2022110320/56649ca45503460f94965371/html5/thumbnails/12.jpg)
12
Toy: Control information
Truncation attack: attacker forges TCP connection close
segment One or both sides thinks there is less data
than there actually is. Solution: record types, with one type for
closure type 0 for data; type 1 for closure
MAC = MAC(Mx, sequence||type||data)length type data MAC
![Page 13: 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.](https://reader038.fdocuments.us/reader038/viewer/2022110320/56649ca45503460f94965371/html5/thumbnails/13.jpg)
Short Question: In the SSL record, there is a field for SSL
seq. numbers? True or False?
13
False. Both sides maintain Seq. no independently.
![Page 14: 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.](https://reader038.fdocuments.us/reader038/viewer/2022110320/56649ca45503460f94965371/html5/thumbnails/14.jpg)
14
Toy SSL: summary
hello
certificate, nonce
KB+(MS) = EMS
type 0, seq 1, datatype 0, seq 2, data
type 0, seq 1, data
type 0, seq 3, data
type 1, seq 4, close
type 1, seq 2, close
en
cryp
ted
bob.com
![Page 15: 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.](https://reader038.fdocuments.us/reader038/viewer/2022110320/56649ca45503460f94965371/html5/thumbnails/15.jpg)
Question
Suppose Seq. number is NOT used.
Question: In an SSL session, Can Trudy (woman-in-the-middle) delete a TCP segment?
Question: What effect will it have?
15
![Page 16: 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.](https://reader038.fdocuments.us/reader038/viewer/2022110320/56649ca45503460f94965371/html5/thumbnails/16.jpg)
Question
Suppose Seq. number is USED.
In an SSL session, an attacker inserts a bogus TCP segment into a packet stream with correct TCP checksum and seq. no.
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.
![Page 17: 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.](https://reader038.fdocuments.us/reader038/viewer/2022110320/56649ca45503460f94965371/html5/thumbnails/17.jpg)
Question. KDC
KDC (Key Distribution Center): a server that shares a unique secret symmetric key with each registered user. KA-KDC, KB-KDC
Can session key be distributed using KDC?
17A B
1. KA-KDC(A,B)
KA-KDC(S, KB-KDC(A,S))
KB-KDC(A,S)
S
2.
3.
![Page 18: 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.](https://reader038.fdocuments.us/reader038/viewer/2022110320/56649ca45503460f94965371/html5/thumbnails/18.jpg)
18
Toy SSL isn’t complete
How long are the fields? What encryption protocols? No negotiation
Allow client and server to support different encryption algorithms
Allow client and server to choose together specific algorithm before data transfer
![Page 19: 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.](https://reader038.fdocuments.us/reader038/viewer/2022110320/56649ca45503460f94965371/html5/thumbnails/19.jpg)
19
Most common symmetric ciphers in SSL
DES – Data Encryption Standard: block 3DES – Triple strength: block RC2 – Rivest Cipher 2: block RC4 – Rivest Cipher 4: stream
Public key encryption RSA
![Page 20: 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.](https://reader038.fdocuments.us/reader038/viewer/2022110320/56649ca45503460f94965371/html5/thumbnails/20.jpg)
20
SSL Cipher Suite
Cipher Suite Public-key algorithm Symmetric encryption algorithm MAC algorithm
SSL supports a variety of cipher suites Negotiation: client and server must
agree on cipher suite Client offers choice; server picks one
![Page 21: 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.](https://reader038.fdocuments.us/reader038/viewer/2022110320/56649ca45503460f94965371/html5/thumbnails/21.jpg)
21
Real SSL: Handshake (1)
Purpose1. Server authentication2. Negotiation: agree on crypto
algorithms3. Establish keys4. Client authentication (optional)
![Page 22: 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.](https://reader038.fdocuments.us/reader038/viewer/2022110320/56649ca45503460f94965371/html5/thumbnails/22.jpg)
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
![Page 23: 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.](https://reader038.fdocuments.us/reader038/viewer/2022110320/56649ca45503460f94965371/html5/thumbnails/23.jpg)
23
Real SSL: Handshaking (3)
Last 2 steps protect handshake from tampering
Client typically offers range of algorithms, some strong, some weak
Man-in-the middle could delete the stronger algorithms from list
Last 2 steps prevent this Last two messages are encrypted
![Page 24: 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.](https://reader038.fdocuments.us/reader038/viewer/2022110320/56649ca45503460f94965371/html5/thumbnails/24.jpg)
24
Real SSL: Handshaking (4)
Why the two random nonces? Suppose Trudy sniffs all messages
between Alice & Bob. Next day, Trudy sets up TCP connection
with Bob, sends the exact same sequence of records,. Bob (Amazon) thinks Alice made two
separate orders for the same thing. Solution: Bob sends different random nonce
for each connection. This causes encryption keys to be different on the two days.
Trudy’s messages will fail Bob’s integrity check.
![Page 25: 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.](https://reader038.fdocuments.us/reader038/viewer/2022110320/56649ca45503460f94965371/html5/thumbnails/25.jpg)
25
Handshake types
All handshake messages (with SSL header) have 1 byte type field: Types ClientHello ServerHello Certificate ServerKeyExchange CertificateRequest ServerHelloDone CertificateVerify ClientKeyExchange Finished
![Page 26: 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.](https://reader038.fdocuments.us/reader038/viewer/2022110320/56649ca45503460f94965371/html5/thumbnails/26.jpg)
SSL Protocol Stack
26
![Page 27: 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.](https://reader038.fdocuments.us/reader038/viewer/2022110320/56649ca45503460f94965371/html5/thumbnails/27.jpg)
27
SSL Record Protocol
data
data fragment
data fragment
MAC MAC
encrypteddata and MAC
encrypteddata and MAC
recordheader
recordheader
record header: content type; version; length
MAC: includes sequence number, MAC key Mx
Fragment: each SSL fragment 214 bytes (~16 Kbytes)
![Page 28: 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.](https://reader038.fdocuments.us/reader038/viewer/2022110320/56649ca45503460f94965371/html5/thumbnails/28.jpg)
28
SSL Record Format
contenttype
SSL version length
MAC
data
1 byte 2 bytes 3 bytes
Data and MAC encrypted (symmetric algo)
![Page 29: 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.](https://reader038.fdocuments.us/reader038/viewer/2022110320/56649ca45503460f94965371/html5/thumbnails/29.jpg)
29
Content types in record header application_data (23) alert (21)
signaling errors during handshake handshake (22)
initial handshake messages are carried in records of type “handshake”
Hankshake messages in turn have their own “sub” types
change_cipher_spec (20) indicates change in encryption and
authentication algorithms
![Page 30: 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.](https://reader038.fdocuments.us/reader038/viewer/2022110320/56649ca45503460f94965371/html5/thumbnails/30.jpg)
30
handshake: ClientHello
handshake: ServerHello
handshake: Certificate
handshake: ServerHelloDone
handshake: ClientKeyExchangeChangeCipherSpec
handshake: Finished
ChangeCipherSpec
handshake: Finished
application_data
application_data
Alert: warning, close_notify
Real Connection
TCP Fin follow
Everythinghenceforthis encrypted
![Page 31: 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.](https://reader038.fdocuments.us/reader038/viewer/2022110320/56649ca45503460f94965371/html5/thumbnails/31.jpg)
Short Question
In which step of SSL handshake, can Alice discover that she is not talking with Bob?
31
handshake: ClientHello
handshake: ServerHello
Bob’s certificateAliceTrudy
Bobhandshake: ClientKeyExchangeChangeCipherSpec
handshake: Finished
ChangeCipherSpec
handshake: Finished
![Page 32: 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.](https://reader038.fdocuments.us/reader038/viewer/2022110320/56649ca45503460f94965371/html5/thumbnails/32.jpg)
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.
Client216.75.194.220 443(https)
79 (seq) + 204 (len) = 283
![Page 33: 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.](https://reader038.fdocuments.us/reader038/viewer/2022110320/56649ca45503460f94965371/html5/thumbnails/33.jpg)
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
![Page 34: 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.](https://reader038.fdocuments.us/reader038/viewer/2022110320/56649ca45503460f94965371/html5/thumbnails/34.jpg)
34
Key derivation
Client nonce, server nonce, and pre-master secret input into pseudo random-number generator. Produces master secret
Master secret and new nonces inputed into another random-number generator: “key block” Because of session resumption: Talk later.
Key block sliced and diced: client MAC key server MAC key client encryption key server encryption key client initialization vector (IV) server initialization vector (IV)
![Page 35: 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.](https://reader038.fdocuments.us/reader038/viewer/2022110320/56649ca45503460f94965371/html5/thumbnails/35.jpg)
35
RECALL: Cipher Block Chaining (CBC) CBC generates its own random numbers
Have encryption of current block depend on result of previous block
c(i) = KS( m(i) c(i-1) ) m(i) = KS( c(i)) c(i-1)
How do we encrypt first block? Initialization vector (IV): random block = c(0) IV does not have to be secret
Change IV for each message (or session) Guarantees that even if the same message is sent
repeatedly, the ciphertext will be completely different each time
![Page 36: 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.](https://reader038.fdocuments.us/reader038/viewer/2022110320/56649ca45503460f94965371/html5/thumbnails/36.jpg)
Short Question: Suppose an SSL session employs a
block cipher with CBC (cipher block chaining).
The server sends Initialization Vector (VI) in clear-text? True or False?
36
False. Each side can derive it.
![Page 37: 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.](https://reader038.fdocuments.us/reader038/viewer/2022110320/56649ca45503460f94965371/html5/thumbnails/37.jpg)
Short Question:
What is the purpose of random nonces in SSL handshake?
37
Defend against Playback Attack
![Page 38: 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.](https://reader038.fdocuments.us/reader038/viewer/2022110320/56649ca45503460f94965371/html5/thumbnails/38.jpg)
38
SSL Performance
Big-number operations in public-key crypto are CPU intensive
Server handshake Typically over half SSL handshake CPU time goes to
RSA decryption of the encrypted pre_master_secret Client handshake
Public key encryption is less expensive Server is handshake bottleneck
Data transfer Symmetric encryption MAC calculation Neither as CPU intensive as public-key decryption
![Page 39: 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.](https://reader038.fdocuments.us/reader038/viewer/2022110320/56649ca45503460f94965371/html5/thumbnails/39.jpg)
39
Session resumption
Full handshake is expensive: CPU time and number of RTTs
If the client and server have already communicated once, they can skip handshake and proceed directly to data transfer For a given session, client and server store
session_id, master_secret, negotiated ciphers Client sends session_id in ClientHello Server then agrees to resume in ServerHello
New key_block computed from master_secret and client and server random numbers
![Page 40: 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.](https://reader038.fdocuments.us/reader038/viewer/2022110320/56649ca45503460f94965371/html5/thumbnails/40.jpg)
40
Client authentication
SSL can also authenticate client Server sends a CertificateRequest
message to client