Top Banner
SMU CSE 5349/7349 SSL/TLS
24

SMUCSE 5349/7349 SSL/TLS. SMUCSE 5349/7349 Layers of Security.

Jan 21, 2016

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: SMUCSE 5349/7349 SSL/TLS. SMUCSE 5349/7349 Layers of Security.

SMU CSE 5349/7349

SSL/TLS

Page 2: SMUCSE 5349/7349 SSL/TLS. SMUCSE 5349/7349 Layers of Security.

SMU CSE 5349/7349

Layers of Security

Page 3: SMUCSE 5349/7349 SSL/TLS. SMUCSE 5349/7349 Layers of Security.

SMU CSE 5349/7349

SSL History

• Evolved through– Unreleased v1 (Netscape)– Flawed-but-useful v2– Version 3 from scratch– Standard TLS1.0

• SSL3.0 with minor tweaks, hence Version field is 3.1

• Defined in RFC2246, http://www.ietf.org/rfc/rfc2246.txt

• Open-source implementation at http://www.openssl.org/

Page 4: SMUCSE 5349/7349 SSL/TLS. SMUCSE 5349/7349 Layers of Security.

SMU CSE 5349/7349

Overview

• Establish a session – Agree on algorithms– Share secrets– Perform authentication

• Transfer application data– Ensure privacy and integrity

Page 5: SMUCSE 5349/7349 SSL/TLS. SMUCSE 5349/7349 Layers of Security.

SMU CSE 5349/7349

Architecture• Record Protocol to transfer

application and TLS information• A session is established using a

Handshake Protocol

TLS Record Protocol

Handshake Protocol

Alert Protocol

ChangeCipher Spec

Page 6: SMUCSE 5349/7349 SSL/TLS. SMUCSE 5349/7349 Layers of Security.

SMU CSE 5349/7349

Architecure (cont’d)

HANDLES COMMUNICATIONWITH THE APPLICATION

ProtocolsINITIALIZES COMMUNCATIONBETWEEN CLIENT & SERVER

INITIALIZES SECURECOMMUNICATION

HANDLES DATACOMPRESSION

ERROR HANDLING

Page 7: SMUCSE 5349/7349 SSL/TLS. SMUCSE 5349/7349 Layers of Security.

SMU CSE 5349/7349

Handshake

• Negotiate Cipher-Suite Algorithms– Symmetric cipher to use– Key exchange method– Message digest function

• Establish and share master secret• Optionally authenticate server

and/or client

Page 8: SMUCSE 5349/7349 SSL/TLS. SMUCSE 5349/7349 Layers of Security.

SMU CSE 5349/7349

Handshake Phases

• Hello messages• Certificate and Key Exchange

messages• Change CipherSpec and Finished

messages

Page 9: SMUCSE 5349/7349 SSL/TLS. SMUCSE 5349/7349 Layers of Security.

SMU CSE 5349/7349

SSL Messages

OFFER CIPHER SUITEMENU TO SERVER

SELECT A CIPHER SUITE

SEND CERTIFICATE ANDCHAIN TO CA ROOT

CLIENT SIDE SERVER SIDE

SEND PUBLIC KEY TOENCRYPT SYMM KEY

SERVER NEGOTIATIONFINISHED

SEND ENCRYPTEDSYMMETRIC KEY

SOURCE: THOMAS, SSL AND TLS ESSENTIALS

ACTIVATEENCRYPTION

CLIENT PORTIONDONE

( SERVER CHECKS OPTIONS )

ACTIVATESERVERENCRYPTION

SERVER PORTIONDONE

( CLIENT CHECKS OPTIONS )

NOW THE PARTIES CAN USE SYMMETRIC ENCRYPTION

Page 10: SMUCSE 5349/7349 SSL/TLS. SMUCSE 5349/7349 Layers of Security.

SMU CSE 5349/7349

Client Hello

– Protocol version• SSLv3(major=3, minor=0)• TLS (major=3, minor=1)

– Random Number • 32 bytes• First 4 bytes, time of the day in seconds, other 28

bytes random • Prevents replay attack

– Session ID• 32 bytes – indicates the use of previous

cryptographic material

– Compression algorithm

Page 11: SMUCSE 5349/7349 SSL/TLS. SMUCSE 5349/7349 Layers of Security.

SMU CSE 5349/7349

Client Hello - Cipher Suites

INITIAL (NULL) CIPHER SUITE

PUBLIC-KEYALGORITHM

SYMMETRICALGORITHM

HASHALGORITHM

CIPHER SUITE CODES USEDIN SSL MESSAGES

SSL_NULL_WITH_NULL_NULL = { 0, 0 }

SSL_RSA_WITH_NULL_MD5 = { 0, 1 }

SSL_RSA_WITH_NULL_SHA = { 0, 2 }

SSL_RSA_EXPORT_WITH_RC4_40_MD5 = { 0, 3 }

SSL_RSA_WITH_RC4_128_MD5 = { 0, 4 }

SSL_RSA_WITH_RC4_128_SHA = { 0, 5 }

SSL_RSA_EXPORT_WITH_RC2_CBC_40_MD5 = { 0, 6 }

SSL_RSA_WITH_IDEA_CBC_SHA = { 0, 7 }

SSL_RSA_EXPORT_WITH_DES40_CBC_SHA = { 0, 8 }

SSL_RSA_WITH_DES_CBC_SHA = { 0, 9 }

SSL_RSA_WITH_3DES_EDE_CBC_SHA = { 0, 10 }

Page 12: SMUCSE 5349/7349 SSL/TLS. SMUCSE 5349/7349 Layers of Security.

SMU CSE 5349/7349

Server Hello• Version• Random Number

– Protects against handshake replay

• Session ID– Provided to the client for later resumption of

the session

• Cipher suite– Usually picks client’s best preference – No

obligation

• Compression method

Page 13: SMUCSE 5349/7349 SSL/TLS. SMUCSE 5349/7349 Layers of Security.

SMU CSE 5349/7349

Certificates

• Sequence of X.509 certificates– Server’s, CA’s, …

• X.509 Certificate associates public key with identity

• Certification Authority (CA) creates certificate– Adheres to policies and verifies identity– Signs certificate

• User of Certificate must ensure it is valid

Page 14: SMUCSE 5349/7349 SSL/TLS. SMUCSE 5349/7349 Layers of Security.

SMU CSE 5349/7349

Validating a Certificate

• Must recognize accepted CA in certificate chain– One CA may issue certificate for

another CA

• Must verify that certificate has not been revoked– CA publishes Certificate Revocation

List (CRL)

Page 15: SMUCSE 5349/7349 SSL/TLS. SMUCSE 5349/7349 Layers of Security.

SMU CSE 5349/7349

Client Key Exchange

• Premaster secret– Created by client; used to “seed”

calculation of encryption parameters– 2 bytes of SSL version + 46 random

bytes– Sent encrypted to server using

server’s public keyThis is where the attack happened in SSLv2

Page 16: SMUCSE 5349/7349 SSL/TLS. SMUCSE 5349/7349 Layers of Security.

SMU CSE 5349/7349

Change Cipher Spec & Finished Messages

• Change Cipher Spec– Switch to newly negotiated algorithms and

key material

• Finished– First message encrypted with new crypto

parameters– Digest of negotiated master secret, the

ensemble of handshake messages, sender constant

– HMAC approach of nested hashing

Page 17: SMUCSE 5349/7349 SSL/TLS. SMUCSE 5349/7349 Layers of Security.

SMU CSE 5349/7349

SSL Encryption

• Master secret– Generated by both parties from

premaster secret and random values generated by both client and server

• Key material– Generated from the master secret and

shared random values• Encryption keys

– Extracted from the key material

Page 18: SMUCSE 5349/7349 SSL/TLS. SMUCSE 5349/7349 Layers of Security.

SMU CSE 5349/7349

Generating the Master Secret

SOURCE: THOMAS, SSL AND TLS ESSENTIALS

SERVER’S PUBLIC KEYIS SENT BY SERVER INServerKeyExchange

CLIENT GENERATES THEPREMASTER SECRET

ENCRYPTS WITH PUBLICKEY OF SERVER

CLIENT SENDS PREMASTERSECRET IN ClientKeyExchange

SENT BY CLIENTIN ClientHello

SENT BY SERVERIN ServerHello

MASTER SECRET IS 3 MD5HASHES CONCATENATEDTOGETHER = 384 BITS

Page 19: SMUCSE 5349/7349 SSL/TLS. SMUCSE 5349/7349 Layers of Security.

SMU CSE 5349/7349

Generation of Key Material

SOURCE: THOMAS, SSL AND TLS ESSENTIALS

JUST LIKE FORMINGTHE MASTER SECRET

EXCEPT THE MASTERSECRET IS USED HEREINSTEAD OF THEPREMASTER SECRET

. . .

Page 20: SMUCSE 5349/7349 SSL/TLS. SMUCSE 5349/7349 Layers of Security.

SMU CSE 5349/7349

Obtaining Keys from the Key Material

SOURCE: THOMAS, SSL AND TLS ESSENTIALS

SECRET VALUESINCLUDED IN MESSAGE

AUTHENTICATION CODES

INITIALIZATION VECTORSFOR DES CBC ENCRYPTION

SYMMETRIC KEYS

Page 21: SMUCSE 5349/7349 SSL/TLS. SMUCSE 5349/7349 Layers of Security.

SMU CSE 5349/7349

SSL Record Protocol

Page 22: SMUCSE 5349/7349 SSL/TLS. SMUCSE 5349/7349 Layers of Security.

SMU CSE 5349/7349

Record Header

• Three pieces of information– Content type

• Application data• Alert• Handshake• Change_cipher_spec

– Content length• Suggests when to start processing

– SSL version• Redundant check for version agreement

Page 23: SMUCSE 5349/7349 SSL/TLS. SMUCSE 5349/7349 Layers of Security.

SMU CSE 5349/7349

Protocol (cont’d)

• Max. record length 214 – 1• MAC

– Data– Headers– Sequence number

• To prevent replay and reordering attack• Not included in the record

Page 24: SMUCSE 5349/7349 SSL/TLS. SMUCSE 5349/7349 Layers of Security.

SMU CSE 5349/7349

Alerts and Closure

• Alert the other side of exceptions– Different levels– Terminate and session cannot be

resumed

• Closure notify– To prevent truncation attack (sending

a TCP FIN before the sender is finished)