• No results found

SECURE SOCKETS LAYER (SSL)

N/A
N/A
Protected

Academic year: 2021

Share "SECURE SOCKETS LAYER (SSL)"

Copied!
23
0
0

Loading.... (view fulltext now)

Full text

(1)

INFS 766

Internet Security Protocols Lecture 5

SSL

Prof. Ravi Sandhu

SECURE SOCKETS LAYER (SSL)

™ layered on top of TCP

™ SSL versions 1.0, 2.0, 3.0, 3.1

™ Netscape protocol

™ later refitted as IETF standard TLS (Transport Layer Security)

™ TLS 1.0 very close to SSL 3.1

(2)

© Ravi Sandhu 2000-2004

3

SECURE SOCKETS LAYER (SSL)

™ application protocol independent

™ does not specify how application protocols add security with SSL

¾ how to initiate SSL handshaking

¾ how to interpret certificates

™ left to designers of upper layer protocols to figure out

4

SSL ARCHITECTURE

SSL Record Protocol TCP

IP

SSL Handshake

Protocol

SSL Change Cipher Spec

Protocol

SSL Alert Protocol

HTTP

Other Application

Protocols

(3)

© Ravi Sandhu 2000-2004

5

SSL ARCHITECTURE

™ Handshake protocol: complicated

¾

embodies key exchange & authentication

¾

10 message types

™ Record protocol: straightforward

¾

fragment, compress, MAC, encrypt

™ Change Cipher Spec protocol: straightforward

¾

single 1 byte message with value 1

¾

could be considered part of handshake protocol

™ Alert protocol: straightforward

¾

2 byte messages

1 byte alert level- fatal or warning; 1 byte alert code

SSL/TLS DIFFERENCES

™ TLS uses HMAC, SSL uses a precursor

™ TLS MAC covers compression version field in addition to what SSL MAC covers

™ TLS defines additional alert codes

™ other minor differences

™ TLS has a mode to fall back to SSL

(4)

© Ravi Sandhu 2000-2004

7

SSL SERVICES

™ peer entity authentication

™ data confidentiality

™ data authentication and integrity

™ compression/decompression

™ generation/distribution of session keys

¾ integrated into protocol

™ security parameter negotiation

8

SSL SESSIONS AND CONNECTIONS

™ Every connection is associated with one session

™ Session can be reused across multiple secure connections

™ Handshake protocol

¾ establishes new session and connection together

¾ uses existing session for new connection

(5)

© Ravi Sandhu 2000-2004

9

SSL SESSION

™

SSL session negotiated by handshake protocol

¾

session ID

chosen by server

¾

X.509 public-key certificate of peer

possibly null

¾

compression algorithm

¾

cipher spec

encryption algorithm

message digest algorithm

¾

master secret

48 byte shared secret

¾

is resumable flag

can be used to initiate new connections

SSL CONNECTION STATE

™

connection end: client or server

™

client and server random: 32 bytes each

™

keys generated from master secret, client/server random

¾

client_write_MAC_secret server_write_MAC_secret

¾

client_write_key server_write_key

¾

client_write_IV server_write_IV

™

compression state

™

cipher state: initially IV, subsequently next feedback block

™

sequence number: starts at 0, max 2

64

-1

(6)

© Ravi Sandhu 2000-2004

11

SSL CONNECTION STATE

™ 4 parts to state

¾ current read state

¾ current write state

¾ pending read state

¾ pending write state

™ handshake protocol

¾ initially current state is empty

¾ either pending state can be made current and reinitialized to empty

12

SSL RECORD PROTOCOL

™ 4 steps by sender (reversed by receiver)

¾ Fragmentation

¾ Compression

¾ MAC

¾ Encryption

(7)

© Ravi Sandhu 2000-2004

13

SSL RECORD PROTOCOL

™ each SSL record contains

¾ content type: 8 bits, only 4 defined

change_cipher_spec

alert

handshake

application_data

¾ protocol version number: 8 bits major, 8 bits minor

¾ length: max 16K bytes (actually 2 14 +2048)

¾ data payload: optionally compressed and encrypted

¾ message authentication code (MAC)

SSL HANDSHAKE PROTOCOL

™ initially SSL session has null

compression and cipher algorithms

™ both are set by the handshake protocol at beginning of session

™ handshake protocol may be repeated

during the session

(8)

© Ravi Sandhu 2000-2004

15

SSL HANDSHAKE PROTOCOL

™ Type: 1 byte

¾ 10 message types defined

™ length: 3 bytes

™ content

16

SSL HANDSHAKE PROTOCOL

Client Server ClientHello --->

ServerHello Certificate*

ServerKeyExchange*

CertificateRequest*

<--- ServerHelloDone Certificate*

ClientKeyExchange CertificateVerify*

[ChangeCipherSpec]

Finished --->

[ChangeCipherSpec]

<--- Finished Application Data <---> Application Data Fig. 1 - Message flow for a full handshake

* Indicates optional or situation-dependent messages that are not always sent.

(9)

© Ravi Sandhu 2000-2004

17

SSL HANDSHAKE PROTOCOL

Client Server ClientHello --->

ServerHello Certificate*

ServerKeyExchange*

CertificateRequest*

<--- ServerHelloDone Certificate*

ClientKeyExchange CertificateVerify*

[ChangeCipherSpec]

Finished --->

[ChangeCipherSpec]

<--- Finished Application Data <---> Application Data Fig. 1 - Message flow for a full handshake

* Indicates optional or situation-dependent messages that are not always sent.

Phase 1

Phase 2 Phase 3

Phase 4

Record Protocol

SSL HANDSHAKE PROTOCOL

™ Phase 1:

¾ Establish security capabilities

™ Phase 2:

¾ Server authentication and key exchange

™ Phase 3:

¾ Client authentication and key exchange

™ Phase 4:

¾ Finish

(10)

© Ravi Sandhu 2000-2004

19

SSL 1-WAY HANDSHAKE WITH RSA

Client Server ClientHello --->

ServerHello Certificate*

ServerKeyExchange*

CertificateRequest*

<--- ServerHelloDone Certificate*

ClientKeyExchange CertificateVerify*

[ChangeCipherSpec]

Finished --->

[ChangeCipherSpec]

<--- Finished Application Data <---> Application Data Fig. 1 - Message flow for a full handshake

* Indicates optional or situation-dependent messages that are not always sent.

Phase 1

Phase 2 Phase 3

Phase 4

Record Protocol

20

SSL 2-WAY HANDSHAKE WITH RSA

Client Server ClientHello --->

ServerHello Certificate*

ServerKeyExchange*

CertificateRequest*

<--- ServerHelloDone Certificate*

ClientKeyExchange CertificateVerify*

[ChangeCipherSpec]

Finished --->

[ChangeCipherSpec]

<--- Finished Application Data <---> Application Data Fig. 1 - Message flow for a full handshake

* Indicates optional or situation-dependent messages that are not always sent.

Phase 1

Phase 2 Phase 3

Phase 4

Record

Protocol

(11)

© Ravi Sandhu 2000-2004

21

SSL HANDSHAKE PROTOCOL

™ these 9 handshake messages must occur in order shown

™ optional messages can be eliminated

™ 10th message explained later

¾ hello_request message

™ change_cipher_spec is a separate 1 message protocol

¾ functionally it is just like a message in the handshake protocol

SSL HANDSHAKE PROTOCOL

Client Server ClientHello --->

ServerHello [ChangeCipherSpec]

<--- Finished [ChangeCipherSpec]

Finished --->

Application Data <---> Application Data

Fig. 2 - Message flow for an abbreviated handshake

(12)

© Ravi Sandhu 2000-2004

23

SSL HANDSHAKE PROTOCOL

™ hello_request (not shown) can be sent anytime from server to client to request client to start handshake protocol to renegotiate session when convenient

™ can be ignored by client

¾ if already negotiating a session

¾ don’t want to renegotiate a session

client may respond with a no_renegotiation alert

24

SSL HANDSHAKE PROTOCOL

Client Server ClientHello --->

ServerHello Certificate*

ServerKeyExchange*

CertificateRequest*

<--- ServerHelloDone Certificate*

ClientKeyExchange CertificateVerify*

[ChangeCipherSpec]

Finished --->

[ChangeCipherSpec]

<--- Finished Application Data <---> Application Data Fig. 1 - Message flow for a full handshake

* Indicates optional or situation-dependent messages that are not always sent.

Phase 1

Phase 2 Phase 3

Phase 4

Record

Protocol

(13)

© Ravi Sandhu 2000-2004

25

SSL HANDSHAKE: PHASE 1

ESTABLISH SECURITY CAPABILITIES

™ client hello

¾ 4 byte timestamp, 28 byte random value

¾ session ID:

non-zero for new connection on existing session

zero for new connection on new session

¾ client version: highest version

¾ cipher_suite list: ordered list

¾ compression list: ordered list

SSL HANDSHAKE: PHASE 1

ESTABLISH SECURITY CAPABILITIES

™ server hello

¾ 32 byte random value

¾ session ID:

new or reuse

¾ version

lower of client suggested and highest supported

¾ cipher_suite list: single choice

¾ compression list: single choice

(14)

© Ravi Sandhu 2000-2004

27

SSL HANDSHAKE: PHASE 1

ESTABLISH SECURITY CAPABILITIES

™ cipher suite

¾ key exchange method

RSA: requires receiver’s public-key certificates

Fixed DH: requires both sides to have public-key certificates

Ephemeral DH: signed ephemeral keys are exchanged, need signature keys and public-key certificates on both sides

Anonymous DH: no authentication of DH keys, susceptible to man-in-the-middle attack

Fortezza: Fortezza key exchange we will ignore Fortezza from here on

28

SSL HANDSHAKE: PHASE 1

ESTABLISH SECURITY CAPABILITIES

™ cipher suite

¾ cipher spec

CipherAlgorithm: RC4, RC2, DES, 3DES, DES40, IDEA, Fortezza

MACAlgorithm: MD5 or SHA-1

CipherType: stream or block

IsExportable: true or false

HashSize: 0, 16 or 20 bytes

Key Material: used to generate write keys

IV Size: size of IV for CBC

(15)

© Ravi Sandhu 2000-2004

29

SSL HANDSHAKE PROTOCOL

Client Server ClientHello --->

ServerHello Certificate*

ServerKeyExchange*

CertificateRequest*

<--- ServerHelloDone Certificate*

ClientKeyExchange CertificateVerify*

[ChangeCipherSpec]

Finished --->

[ChangeCipherSpec]

<--- Finished Application Data <---> Application Data Fig. 1 - Message flow for a full handshake

* Indicates optional or situation-dependent messages that are not always sent.

Phase 1

Phase 2 Phase 3

Phase 4

Record Protocol

SSL HANDSHAKE: PHASE 2

SERVER AUTHENTICATION & KEY EXCHANGE

™ Certificate message

¾

server’s X.509v3 certificate followed by optional chain of certificates

¾

required for RSA, Fixed DH, Ephemeral DH but not for Anonymous DH

™ Server Key Exchange message

¾

not needed for RSA, Fixed DH

¾

needed for Anonymous DH, Ephemeral DH

¾

needed for RSA where server has signature-only key

server sends temporary RSA public encryption key to client

(16)

© Ravi Sandhu 2000-2004

31

SSL HANDSHAKE: PHASE 2

SERVER AUTHENTICATION & KEY EXCHANGE

™ Server Key Exchange message

¾

signed by the server

¾

signature is on hash of

ClientHello.random, ServerHello.random

Server Key Exchange parameters

™ Certificate Request message

¾

request a certificate from client

¾

specifies Certificate Type and Certificate Authorities

certificate type specifies public-key algorithm and use

™ Server Done message

¾

ends phase 2, always required

32

SSL HANDSHAKE PROTOCOL

Client Server ClientHello --->

ServerHello Certificate*

ServerKeyExchange*

CertificateRequest*

<--- ServerHelloDone Certificate*

ClientKeyExchange CertificateVerify*

[ChangeCipherSpec]

Finished --->

[ChangeCipherSpec]

<--- Finished Application Data <---> Application Data Fig. 1 - Message flow for a full handshake

* Indicates optional or situation-dependent messages that are not always sent.

Phase 1

Phase 2 Phase 3

Phase 4

Record

Protocol

(17)

© Ravi Sandhu 2000-2004

33

SSL HANDSHAKE: PHASE 3

CLIENT AUTHENTICATION & KEY EXCHANGE

™

Certificate message

¾

send if server has requested certificate and client has appropriate certificate

otherwise send no_certificate alert

™

Client Key Exchange message

¾

content depends on type of key exchange (see next slide)

™

Certificate Verify message

¾

can be optionally sent following a client certificate with signing capability

¾

signs hash of master secret (established by key exchange) and all handshake messages so far

¾

provides evidence of possessing private key corresponding to certificate

SSL HANDSHAKE: PHASE 3

CLIENT AUTHENTICATION & KEY EXCHANGE

™ Client Key Exchange message

¾ RSA

client generates 48-byte pre-master secret, encrypts with server’s RSA public key (from server certificate or temporary key from Server Key Exchange

message)

¾

Ephemeral or Anonymous DH

client’s public DH value

¾ Fixed DH

null, public key previously sent in Certificate Message

(18)

© Ravi Sandhu 2000-2004

35

SSL HANDSHAKE: POST PHASE 3

CRYPTOGRAPHIC COMPUTATION

™ 48 byte pre master secret

¾ RSA

generated by client

sent encrypted to server

¾ DH

both sides compute the same value

each side uses its own private value and the other sides public value

36

SSL HANDSHAKE: POST PHASE 3

CRYPTOGRAPHIC COMPUTATION

master_secret = PRF(pre_master_secret, "master secret", ClientHello.random + ServerHello.random) [0..47];

pre_master_secret: 48 bytes

PRF is composed of a sequence and nesting of HMACs

(19)

© Ravi Sandhu 2000-2004

37

SSL HANDSHAKE PROTOCOL

Client Server ClientHello --->

ServerHello Certificate*

ServerKeyExchange*

CertificateRequest*

<--- ServerHelloDone Certificate*

ClientKeyExchange CertificateVerify*

[ChangeCipherSpec]

Finished --->

[ChangeCipherSpec]

<--- Finished Application Data <---> Application Data Fig. 1 - Message flow for a full handshake

* Indicates optional or situation-dependent messages that are not always sent.

Phase 1

Phase 2 Phase 3

Phase 4

Record Protocol

SSL HANDSHAKE: PHASE 4

FINISH

™ Change Cipher Spec message

¾ not considered part of handshake protocol but in some sense is part of it

™ Finished message

¾ sent under new algorithms and keys

¾ content is hash of all previous messages

and master secret

(20)

© Ravi Sandhu 2000-2004

39

SSL HANDSHAKE: PHASE 4

FINISH

™ Change Cipher Spec message

¾ 1 byte message protected by current state

¾ copies pending state to current state

sender copies write pending state to write current state

receiver copies read pending state to read current state

¾ immediately send finished message under new current state

40

SSL HANDSHAKE: PHASE 4

FINISH

verify_data

PRF(master_secret, finished_label, MD5(handshake_messages)+

SHA-1(handshake_messages)) [0..11];

finished_label

For Finished messages sent by the client, the string "client finished". For Finished messages sent by the server, the string "server finished".

handshake_messages

All of the data from all handshake messages up to but not including this message. This is only data visible at the handshake layer and does not include record layer headers.

Finished message

(21)

© Ravi Sandhu 2000-2004

41

SSL ALERT PROTOCOL

™ 2 byte alert messages

¾ 1 byte level

fatal or warning

¾ 1 byte

alert code

SSL ALERT MESSAGES

Warning or fatal

close_notify(0), unexpected_message(10), bad_record_mac(20), decryption_failed(21), record_overflow(22),

decompression_failure(30), handshake_failure(40), bad_certificate(42), unsupported_certificate(43), certificate_revoked(44), certificate_expired(45), certificate_unknown(46), illegal_parameter(47), unknown_ca(48), access_denied(49), decode_error(50), decrypt_error(51), export_restriction(60), protocol_version(70), insufficient_security(71), internal_error(80),

(22)

© Ravi Sandhu 2000-2004

43

SSL ALERT MESSAGES

™ always fatal

¾ unexpected_message

¾ bad_record_mac

¾ decompression_failure

¾ handshake_failure

¾ illegal_parameter

44

APPLICATIONS AND SSL

™ use dedicated port numbers for every application that uses SSL

¾ de facto what is happening

™ use normal application port and negotiate security options as part of application protocol

™ negotiate use of SSL during normal

TCP/IP connection establishment

(23)

© Ravi Sandhu 2000-2004

45

APPLICATION PORTS

OFFICIAL AND UNOFFICIAL

™ https 443

™ ssmtp 465

™ snntp 563

™ sldap 636

™ spop3 995

™ ftp-data 889

™ ftps 990

™ imaps 991

™ telnets 992

™ ircs 993

References

Related documents

communicate using proper framing terminology. Define and use terminology related to wall framing. Identify and collect materials and tools needed to complete the assignment.

The templates that we are going to use for planning a CLIL unit and a CLIL lesson are the ones published on the website of Conselleria d'Educacio, Servei d'ensenyament

Giám sát có thể được định nghĩa như là việc theo dõi tài nguyên và thiết bị trong hệ thống máy tính, cũng như hệ thống mạng để thu thập được các

The use of additive manufacturing techniques could provide more control towards the design of separation membrane systems and o ffers novel membrane preparation techniques that are

This public key (as part of the certificate) is send to the server and used to encrypt the communication between the client and server.. The requirement for a client-side

Server decrypts secret with private key Client sends secret to server Client encrypts using public key Client generates pre-master secret!. What’s so Special About the

– server sends a temporary RSA public key in server_key_exchange – client sends encrypted pre-master secret in client_key_exchange – client_certificate and certificate_verify are

This is the strongest conditioning factor for the omission of the genitive inflection in Older Scots, since all the examples of this context found in the corpus are uninflected,