Скачать презентацию Secure Sockets Layer SSL and Transport layer security Скачать презентацию Secure Sockets Layer SSL and Transport layer security

bc02968ed109fffa41e4c3006a2d1096.ppt

  • Количество слайдов: 42

Secure Sockets Layer (SSL) and Transport layer security (TLS) IS 511 8 -1 Secure Sockets Layer (SSL) and Transport layer security (TLS) IS 511 8 -1

Network Security Goals: v understand principles of network security: § cryptography and its many Network Security Goals: v understand principles of network security: § cryptography and its many uses beyond “confidentiality” § authentication § message integrity v security in practice: § firewalls and intrusion detection systems § security in application, transport, network, link layers Network Security 8 -2

What is network security? confidentiality: only sender, intended receiver should “understand” message contents § What is network security? confidentiality: only sender, intended receiver should “understand” message contents § sender encrypts message § receiver decrypts message authentication: sender, receiver want to confirm identity of each other message integrity: sender, receiver want to ensure message not altered (in transit, or afterwards) without detection access and availability: services must be accessible and available to users Network Security 8 -3

Friends and enemies: Alice, Bob, Trudy v v v well-known in network security world Friends and enemies: Alice, Bob, Trudy v v v well-known in network security world Bob, Alice (lovers!) want to communicate “securely” Trudy (intruder) may intercept, delete, add messages Alice Bob channel data secure sender data, control messages secure s receiver data Trudy Network Security 8 -4

Who might Bob, Alice be? v v v … well, real-life Bobs and Alices! Who might Bob, Alice be? v v v … well, real-life Bobs and Alices! Web browser/server for electronic transactions (e. g. , on-line purchases) on-line banking client/server DNS servers routers exchanging routing table updates other examples? Network Security 8 -5

There are bad guys (and girls) out there! Q: What can a “bad guy” There are bad guys (and girls) out there! Q: What can a “bad guy” do? A: A lot! § eavesdrop: intercept messages § actively insert messages into connection § impersonation: can fake (spoof) source address in packet (or any field in packet) § hijacking: “take over” ongoing connection by removing sender or receiver, inserting himself in place § denial of service: prevent service from being used by others (e. g. , by overloading resources) Network Security 8 -6

The language of cryptography Alice’s K encryption A key plaintext encryption algorithm Bob’s K The language of cryptography Alice’s K encryption A key plaintext encryption algorithm Bob’s K decryption Bkey ciphertext decryption plaintext algorithm m plaintext message KA(m) ciphertext, encrypted with key KA m = KB(KA(m)) Network Security 8 -7

Symmetric key cryptography KS KS plaintext message, m encryption algorithm ciphertext K S (m) Symmetric key cryptography KS KS plaintext message, m encryption algorithm ciphertext K S (m) decryption plaintext algorithm m = KS(KS(m)) symmetric key crypto: Bob and Alice share same (symmetric) key: K S v e. g. , key is knowing substitution pattern in mono alphabetic substitution cipher Q: how do Bob and Alice agree on key value? Network Security 8 -8

Authentication Goal: Bob wants Alice to “prove” her identity to him Protocol ap 1. Authentication Goal: Bob wants Alice to “prove” her identity to him Protocol ap 1. 0: Alice says “I am Alice” Failure scenario? ? Network Security 8 -9

Authentication Goal: Bob wants Alice to “prove” her identity to him Protocol ap 1. Authentication Goal: Bob wants Alice to “prove” her identity to him Protocol ap 1. 0: Alice says “I am Alice” in a network, Bob can not “see” Alice, so Trudy simply declares herself to be Alice Network Security 8 -10

Authentication: another try Protocol ap 2. 0: Alice says “I am Alice” in an Authentication: another try Protocol ap 2. 0: Alice says “I am Alice” in an IP packet containing her source IP address Alice’s IP address “I am Alice” Failure scenario? ? Network Security 8 -11

Authentication: another try Protocol ap 2. 0: Alice says “I am Alice” in an Authentication: another try Protocol ap 2. 0: Alice says “I am Alice” in an IP packet containing her source IP address Alice’s IP address Trudy can create a packet “spoofing” Alice’s address “I am Alice” Network Security 8 -12

Authentication: another try Protocol ap 3. 0: Alice says “I am Alice” and sends Authentication: another try Protocol ap 3. 0: Alice says “I am Alice” and sends her secret password to “prove” it. Alice’s “I’m Alice” IP addr password Alice’s IP addr OK Failure scenario? ? Network Security 8 -13

Authentication: another try Protocol ap 3. 0: Alice says “I am Alice” and sends Authentication: another try Protocol ap 3. 0: Alice says “I am Alice” and sends her secret password to “prove” it. Alice’s “I’m Alice” IP addr password Alice’s IP addr OK playback attack: Trudy records Alice’s packet and later plays it back to Bob Alice’s “I’m Alice” IP addr password Network Security 8 -14

Authentication: yet another try Protocol ap 3. 1: Alice says “I am Alice” and Authentication: yet another try Protocol ap 3. 1: Alice says “I am Alice” and sends her encrypted secret password to “prove” it. Alice’s encrypted “I’m Alice” IP addr password Alice’s IP addr OK Failure scenario? ? Network Security 8 -15

Authentication: yet another try Protocol ap 3. 1: Alice says “I am Alice” and Authentication: yet another try Protocol ap 3. 1: Alice says “I am Alice” and sends her encrypted secret password to “prove” it. Alice’s encrypted “I’m Alice” IP addr password Alice’s IP addr OK record and playback still works! Alice’s encrypted “I’m Alice” IP addr password Network Security 8 -16

Authentication: yet another try Goal: avoid playback attack nonce: number (R) used only once-in-a-lifetime Authentication: yet another try Goal: avoid playback attack nonce: number (R) used only once-in-a-lifetime ap 4. 0: to prove Alice “live”, Bob sends Alice nonce, R. Alice must return R, encrypted with shared secret key “I am Alice” R KA-B(R) Failures, drawbacks? Alice is live, and only Alice knows key to encrypt nonce, so it must be Alice! Network Security 8 -17

Authentication: ap 5. 0 ap 4. 0 requires shared symmetric key v can we Authentication: ap 5. 0 ap 4. 0 requires shared symmetric key v can we authenticate using public key techniques? ap 5. 0: use nonce, public key cryptography “I am Alice” R Bob computes + - - K A (R) “send me your public key” + KA K A(R)) = R and knows only Alice could have the private key, that encrypted R such that + K (K (R)) = R A A Network Security 8 -18

ap 5. 0: security hole man (or woman) in the middle attack: Trudy poses ap 5. 0: security hole man (or woman) in the middle attack: Trudy poses as Alice (to Bob) and as Bob (to Alice) I am Alice R R K (R) A K (R) T Send me your public key + K T Send me your public key K - + m = K (K (m)) A A + K (m) A + A Trudy gets - + m = K (K (m)) T T sends m to Alice encrypted with Alice’s public key + K (m) T Network Security 8 -19

ap 5. 0: security hole man (or woman) in the middle attack: Trudy poses ap 5. 0: security hole man (or woman) in the middle attack: Trudy poses as Alice (to Bob) and as Bob (to Alice) difficult to detect: v v Bob receives everything that Alice sends, and vice versa. (e. g. , so Bob, Alice can meet one week later and recall conversation!) problem is that Trudy receives all messages as well! Network Security 8 -20

Public-key certification v motivation: Trudy plays pizza prank on Bob § Trudy creates e-mail Public-key certification v motivation: Trudy plays pizza prank on Bob § Trudy creates e-mail order: Dear Pizza Store, Please deliver to me four pepperoni pizzas. Thank you, Bob § Trudy signs order with her private key § Trudy sends order to Pizza Store § Trudy sends to Pizza Store her public key, but says it’s Bob’s public key § Pizza Store verifies signature; then delivers four pepperoni pizzas to Bob § Bob doesn’t even like pepperoni Network Security 8 -21

Certification authorities v certification authority (CA): binds public key to particular v entity, E. Certification authorities v certification authority (CA): binds public key to particular v entity, E. E (person, router) registers its public key with CA. § E provides “proof of identity” to CA. § CA creates certificate binding E to its public key. § certificate containing E’s public key digitally signed by CA – CA says “this is E’s public key” Bob’s public key Bob’s identifying information + KB CA private key K CA certificate for Bob’s public key, signed by CA Network Security 8 -22

Certification authorities v when Alice wants Bob’s public key: § gets Bob’s certificate (Bob Certification authorities v 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 + K B key + KB CA public key K+ CA Network Security 8 -23

SSL: Secure Sockets Layer v widely deployed security protocol § supported by almost all SSL: Secure Sockets Layer v widely deployed security protocol § supported by almost all browsers, web servers § https § billions $/year over SSL v mechanisms: [Woo 1994], implementation: Netscape v variation -TLS: transport layer security, RFC 2246 v provides § confidentiality § integrity § authentication v original goals: § Web e-commerce transactions § encryption (especially credit-card numbers) § Web-server authentication § optional client authentication § minimum hassle in doing business with new merchant v available to all TCP applications § secure socket interface Network Security 8 -24

SSL and TCP/IP Application SSL TCP IP normal application v v TCP IP application SSL and TCP/IP Application SSL TCP IP normal application v v TCP IP application with SSL provides application programming interface (API) to applications C and Java SSL libraries/classes readily available Network Security 8 -25

Toy SSL: a simple secure channel v v handshake: Alice and Bob use their Toy SSL: a simple secure channel v v handshake: Alice and Bob use their certificates, 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 series of records connection closure: special messages to securely close connection Network Security 8 -26

Toy: a simple handshake hello te rtifica ublic key ce p KB+(MS) = EMS Toy: a simple handshake hello te rtifica ublic key ce p KB+(MS) = EMS MS: master secret EMS: encrypted master secret Network Security 8 -27

Toy: key derivation v considered bad to use same key for more than one Toy: key derivation v considered bad to use same key for more than one cryptographic operation § use different keys for message authentication code (MAC) and encryption v v 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 Network Security 8 -28

Toy: data records v why not encrypt data in constant stream as we write Toy: data records v 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. § e. g. , with instant messaging, how can we do integrity check over all bytes sent before displaying? v instead, break stream in series of records § each record carries a MAC § receiver can act on each record as it arrives v issue: in record, receiver needs to distinguish MAC from data § want to use variable-length records length data MAC Network Security 8 -29

Toy: sequence numbers v v problem: attacker can capture and replay record or re-order Toy: sequence numbers v v problem: 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 v v problem: attacker could replay all records solution: use nonce Network Security 8 -30

Toy: control information v problem: truncation attack: § attacker forges TCP connection close segment Toy: control information v problem: truncation attack: § attacker forges TCP connection close segment § one or both sides thinks there is less data than there actually is. v solution: record types, with one type for closure § type 0 for data; type 1 for closure v MAC = MAC(Mx, sequence||type||data) length type data MAC Network Security 8 -31

Toy SSL: summary hello certificate, nonce KB+(MS) = EMS type 0, seq 1, data Toy SSL: summary hello certificate, nonce KB+(MS) = EMS type 0, seq 1, data encrypted type 0, seq 2, data , d e 0, seq 1 typ bob. com ata type 0, seq 3, data type 1, seq 4, close type 1, seq 2, Network Security 8 -32

Toy SSL isn’t complete v v v how long are fields? which encryption protocols? Toy SSL isn’t complete v v v how long are fields? which encryption protocols? want negotiation? § allow client and server to support different encryption algorithms § allow client and server to choose together specific algorithm before data transfer Network Security 8 -33

SSL cipher suite v cipher suite § public-key algorithm § symmetric encryption algorithm § SSL cipher suite v cipher suite § public-key algorithm § symmetric encryption algorithm § MAC algorithm v v SSL supports several cipher suites negotiation: client, server agree on cipher suite § client offers choice § server picks one common SSL symmetric ciphers § DES – Data Encryption Standard: block § 3 DES – Triple strength: block § AES § RC 2 – Rivest Cipher 2: block § RC 4 – Rivest Cipher 4: stream SSL Public key encryption § RSA Network Security 8 -34

Real SSL: handshake (1) Purpose 1. server authentication 2. negotiation: agree on crypto algorithms Real SSL: handshake (1) Purpose 1. server authentication 2. negotiation: agree on crypto algorithms 3. establish keys 4. client authentication (optional) Network Security 8 -35

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

Real SSL: handshaking (3) last 2 steps protect handshake from tampering v client typically Real SSL: handshaking (3) last 2 steps protect handshake from tampering v client typically offers range of algorithms, some strong, some weak v man-in-the middle could delete stronger algorithms from list v last 2 steps prevent this § last two messages are encrypted Network Security 8 -37

Real SSL: handshaking (4) v v v why two random nonces? suppose Trudy sniffs Real SSL: handshaking (4) v v v why two random nonces? suppose Trudy sniffs all messages between Alice & Bob next day, Trudy sets up TCP connection with Bob, sends 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 Network Security 8 -38

SSL record protocol data fragment record header data fragment MAC encrypted data and MAC SSL record protocol data fragment record header data fragment MAC encrypted data and MAC record header: content type; version; length MAC: includes sequence number, MAC key Mx fragment: each SSL fragment 214 bytes (~16 Kbytes) Network Security 8 -39

SSL record format 1 byte content type 2 bytes 3 bytes SSL version length SSL record format 1 byte content type 2 bytes 3 bytes SSL version length data MAC data and MAC encrypted (symmetric algorithm) Network Security 8 -40

Real SSL connection handshake: Client. Hello ake: Server handsh rtificate dshake: Ce han llo. Real SSL connection handshake: Client. Hello ake: Server handsh rtificate dshake: Ce han llo. Done e: Server. He handshake: Client. Key Exchange Change. Cipher. Sp ec everything henceforth is encrypted handshake: Finished r. Spec Change. Ciphe inished dshake: F han application_data application_d TCP FIN follows Alert: warning, close_no tify Network Security 8 -41

Key derivation v Step 4: Using the same key derivation function, the client and Key derivation v Step 4: Using the same key derivation function, the client and server compute the MS from the PMS and nonces. The PMS is sliced up to generate the two encryption and two MAC keys. Also, when the cipher method is CBC, it also generates two initialization vectors (one for each side). § client MAC key § § § server MAC key client encryption key server encryption key client initialization vector (IV) server initialization vector (IV) Network Security 8 -42