51
1 Secure Socket Layer Secure Socket Layer Yu Yang Yu Yang Lilly Lilly Wang Wang

1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

Embed Size (px)

Citation preview

Page 1: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

1

Secure Socket LayerSecure Socket Layer

•Yu YangYu Yang•Lilly Lilly WangWang

Page 2: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

2

AgendaAgenda

• SSL BasicsSSL Basics• WTLSWTLS• Security for Web ServiceSecurity for Web Service

Page 3: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

3

SSL FactsSSL Facts

• SSL was first developed by SSL was first developed by Netscape in 1994 and became an Netscape in 1994 and became an internet standard in 1996 ( RFC internet standard in 1996 ( RFC 2246 – TLS V1.0)2246 – TLS V1.0)

• SSL is a cryptographic protocol to SSL is a cryptographic protocol to secure network across a secure network across a connection-orientedconnection-oriented layer layer

• Any program using TCP can be Any program using TCP can be modified to use SSL connectionmodified to use SSL connection

Page 4: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

4

SSL FactsSSL Facts

• SSL connection uses a dedicated SSL connection uses a dedicated TCP/IP socket(e.g. port 443 for https)TCP/IP socket(e.g. port 443 for https)

• SSL is flexible in choice of which SSL is flexible in choice of which symmetric encryption, message symmetric encryption, message digest, and authentication can be useddigest, and authentication can be used

• SSL provides built in data SSL provides built in data compressioncompression

Page 5: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

5

SSL UsageSSL Usage• Authenticate the server to the clientAuthenticate the server to the client

• Allow the client and server to select Allow the client and server to select cryptographic algorithms, or ciphers, cryptographic algorithms, or ciphers, that they both supportthat they both support

• Optionally authenticate the client to the Optionally authenticate the client to the serverserver

• Use public key encryption techniques to Use public key encryption techniques to generate shared secretgenerate shared secret

• Establish an encrypted SSL connection Establish an encrypted SSL connection

Page 6: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

6

Secure Socket LayerSecure Socket LayerSSL is a secure protocol which runs SSL is a secure protocol which runs above TCP/IP and allows users to encrypt above TCP/IP and allows users to encrypt data and authenticate servers/vendors data and authenticate servers/vendors identity securelyidentity securely

Application layer

Transport layerTCP/IP layer

SMTPSFTPSHTTPS

SECURE SOCKET LAYER

Page 7: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

7

SSL StackSSL Stack

Page 8: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

8

SSL Record Protocol SSL Record Protocol OperationOperation

Page 9: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

9

SSL Record FormatSSL Record Format

Page 10: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

10

SSL HandshakeSSL Handshake

SSL handshake verifies the server SSL handshake verifies the server and allows client and server to and allows client and server to agree on an encryption set agree on an encryption set before before any data is sent outany data is sent out

Page 11: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

11

SSL HandshakeSSL Handshake

Page 12: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

12

SSL HandshakeSSL Handshake

Server

Client

Public key

Private key

Client request

Public key

Page 13: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

13

SSL Session KeySSL Session Key

Server

Client

Public key

Private key

Public key Pre-Master

Pre-Master

Pre-Master

Session key

Session key

Page 14: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

14

Secure Data on Secure Data on NetworkNetwork

Server

Client

Public key

Private key

Session key

Data Session key Data

Data

Data Session key Data

Page 15: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

15

Man-in-the-Middle Man-in-the-Middle AttackAttack

Server

Client

Public key

Private key

HackerPublic

keyPrivate

keyPre-

master

Public key

Public key

Public key

Session key

Pre-master

Public key

Pre-master

Pre-master

Session key

Page 16: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

16

Key exchange and Key exchange and certificatecertificate

SSL version number client supported (v2, v3)

Ciphers supported client (DES, RC2, RC4)

Client Random Number

SSL version number server picked (v2, v3)

Ciphers server picked (DES, RC2, RC4)

Server Random Number

Server

Client

Public key

Private key

Public key

Certificate

Page 17: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

17

Verify CertificateVerify Certificate

Checking

Server

Client

Public key

Private key

Client request

Certificate

Certificate

Valid

Public key

Certificate is Good and Valid

Server/vendor has been verified and authenticated

Client has vendor’s public key and Client has vendor’s public key and can now encrypt pre-master to send can now encrypt pre-master to send to server/vendorto server/vendor

Page 18: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

18

Not-recognizable Not-recognizable CertificateCertificate

Page 19: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

19

Review the Certificate Review the Certificate In IEIn IE

Page 20: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

20

SSL HandshakeSSL HandshakeClient hello

Server hello

Present Server Certificate*Request Client Certificate

Server Key Exchange

Client Finish

*Present Client CertificateClient Key Exchange

*Certificate VerifyChange Cipher Spec

Server Finish

Change Cipher Spec

Client

Server

Application Data

Page 21: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

21

Server Hello RequestServer Hello Request

• Notifies the client that they should send a Notifies the client that they should send a client hello message to begin the client hello message to begin the negotiation processnegotiation process

• Sent by the server at any timeSent by the server at any time• After the server sends a request, it does After the server sends a request, it does

not send another one until a handshake not send another one until a handshake has been completedhas been completed

• Client can choose to ignore them or send Client can choose to ignore them or send a Client Helloa Client Hello

Page 22: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

22

Client HelloClient Hello• Sent by the client Sent by the client

–When first connecting to a When first connecting to a serverserver

–In response to a hello request or In response to a hello request or on its ownon its own

• ContainsContains–32 bytes random number 32 bytes random number created by a secure random created by a secure random number generatornumber generator

–Protocol versionProtocol version–Session IDSession ID–A list of supported ciphersA list of supported ciphers–A list of compression methodsA list of compression methods

Page 23: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

23

Server HelloServer Hello• Sent as response if client hello is Sent as response if client hello is acceptedaccepted

– If not, a handshake failure alert is sent If not, a handshake failure alert is sent

• ContainsContains– 32 bytes random number created by a 32 bytes random number created by a

secure random number generatorsecure random number generator– Protocol versionProtocol version– Session IDSession ID– Cipher suite chosenCipher suite chosen– Compression method selectedCompression method selected

Page 24: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

24

Server CertificatesServer Certificates

• Immediately following the server Immediately following the server hello, the server sends its hello, the server sends its certificatecertificate– Generally an X.509.v3 certificateGenerally an X.509.v3 certificate

• Server sends server hello done Server sends server hello done messagemessage

Page 25: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

25

Verify Server CertificateVerify Server Certificate

Page 26: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

26

Client Certificate Client Certificate ((optional)optional)

Client only sends a certificate upon Client only sends a certificate upon the receipt of a certificate requestthe receipt of a certificate request

– Sends after receiving server hello Sends after receiving server hello donedone

– If the client does not have a If the client does not have a suitable certificate, it sends a no suitable certificate, it sends a no certificate alertcertificate alert•Server will respond with a fatal Server will respond with a fatal handshake failure if a client handshake failure if a client certificate is necessarycertificate is necessary

Page 27: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

27

Verify Client CertificateVerify Client Certificate

Page 28: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

28

Key ExchangeKey Exchange

• Client sends 48-bytes pre-master, Client sends 48-bytes pre-master, encrypted using server’s public encrypted using server’s public key, to the serverkey, to the server

• Both server and client use the Both server and client use the pre-master to generate the pre-master to generate the master secretmaster secret

• A same session key is generated A same session key is generated on both client and server side on both client and server side using the master secretusing the master secret

Page 29: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

29

Final StepsFinal Steps

• Client sends Client sends change_cipher_specchange_cipher_spec• Client sends finished Client sends finished messagemessage• Server sends Server sends change_cipher_specchange_cipher_spec• Server sends finished Server sends finished messagemessage

Page 30: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

30

SSL ArchitectureSSL Architecture

Page 31: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

31

Record LayerRecord Layer

• Compression and decompressionCompression and decompression

• A MAC is applied to each record A MAC is applied to each record using the MAC algorithm defined in using the MAC algorithm defined in the current cipher specthe current cipher spec

• Encryption occurs Encryption occurs afterafter compression compression• May need fragmentationMay need fragmentation

Page 32: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

32

SSL ArchitectureSSL Architecture

Page 33: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

33

Alert LayerAlert Layer

• Explain severity of the message and a Explain severity of the message and a descriptiondescription–fatalfatal

•Immediate terminationImmediate termination•Other connections in session may continueOther connections in session may continue•Session ID invalidated to prevent failed session Session ID invalidated to prevent failed session to open new sessionsto open new sessions

• Alerts are compressed same as other Alerts are compressed same as other datadata

Page 34: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

34

SSL ArchitectureSSL Architecture

Page 35: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

35

Change Cipher Spec Change Cipher Spec ProtocolProtocol

• Notify the other party to use Notify the other party to use the new cipher suitethe new cipher suite

• Before the Finished messageBefore the Finished message

Page 36: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

36

Comparison of SSL V2.0 Comparison of SSL V2.0 and V3.0and V3.0

• SSL 2.0 is vulnerable to “man-SSL 2.0 is vulnerable to “man-in-the-middle” attack.in-the-middle” attack. The The hello messagehello message can be can be modified to use 40 bits modified to use 40 bits encryption. encryption. SSL 3.0 defends SSL 3.0 defends against this attack by having against this attack by having the last handshake message the last handshake message include a hash of all the include a hash of all the previous handshake messageprevious handshake message

Page 37: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

37

Comparison of SSL V2.0 Comparison of SSL V2.0 and V3.0and V3.0

• SSL 2.0 uses a weak MAC SSL 2.0 uses a weak MAC constructionconstruction

• In SSL 3.0, the Message In SSL 3.0, the Message Authentication Hash uses a Authentication Hash uses a full 128 bits of key material for full 128 bits of key material for Export cipher, while SSL 2.0 Export cipher, while SSL 2.0 uses only 40 bitsuses only 40 bits

Page 38: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

38

Comparison of SSL V2.0 Comparison of SSL V2.0 and V3.0 and V3.0

• SSL 2.0 only allows a handshake at the SSL 2.0 only allows a handshake at the beginning of the connection. In 3.0, the beginning of the connection. In 3.0, the client can initiate a handshake routine client can initiate a handshake routine any timeany time

• SSL 3.0 allows server and client to send SSL 3.0 allows server and client to send chains of certificatechains of certificate

• SSL 3.0 has a generalized key exchange SSL 3.0 has a generalized key exchange protocol. It allows Diffie-Hellman and protocol. It allows Diffie-Hellman and Fortezza key exchangeFortezza key exchange

• SSL 3.0 allows for record compression SSL 3.0 allows for record compression and decompressionand decompression

Page 39: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

39

Problem Free?Problem Free?• Side channel attack – discovered by Swiss Side channel attack – discovered by Swiss

Federal Institute of Technology in LausanneFederal Institute of Technology in Lausannehttp://www.newsfactor.com/perl/story/20843.htmlhttp://www.newsfactor.com/perl/story/20843.html

• Information leak in encrypted connections. Information leak in encrypted connections. Vulnerable openssl versions do not perform Vulnerable openssl versions do not perform a MAC computation if an incorrect block a MAC computation if an incorrect block cipher padding is used. An active attacker cipher padding is used. An active attacker who can insert data into an existing who can insert data into an existing encrypted connection is then able to encrypted connection is then able to measure time differences between the error measure time differences between the error messages the server sends. This messages the server sends. This information can make it easier to launch information can make it easier to launch cryptographic attacks that rely on cryptographic attacks that rely on distinguishing between padding and MAC distinguishing between padding and MAC verification errors, possibly leading to verification errors, possibly leading to extraction of the original plaintext.extraction of the original plaintext.

Page 40: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

40

Wireless Transport Layer Wireless Transport Layer SecuritySecurity

Page 41: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

41

WTLS OverviewWTLS Overview

Page 42: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

42

WTLS FactsWTLS Facts

•Mainly used to secure data Mainly used to secure data transport between wireless device transport between wireless device and gatewayand gateway

•Built on top of datagram (UDP) Built on top of datagram (UDP) instead of TCPinstead of TCP

•WTLS provides full, optimized and WTLS provides full, optimized and abbreviated handshake to reduce abbreviated handshake to reduce roundtrips in high-latency networksroundtrips in high-latency networks

Page 43: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

43

WTLS FactsWTLS Facts

• WTLS uses different format of WTLS uses different format of certificates, mainly WTLS certificate, certificates, mainly WTLS certificate, X509v1 and 968. It also supports X509v1 and 968. It also supports additional cipher suites, such as RC5, additional cipher suites, such as RC5, short hashes, ECC, etc;short hashes, ECC, etc;

• WTLS provides built-in key-refresh WTLS provides built-in key-refresh mechanism for renegotiation;mechanism for renegotiation;

• WTLS can also set session resumable WTLS can also set session resumable to continue on a previous session.to continue on a previous session.

Page 44: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

44

Web Service SecurityWeb Service Security

Page 45: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

45

Comparison of Traditional Comparison of Traditional Web Application and Web Web Application and Web

ServiceService

• Client-server system vs multi-Client-server system vs multi-partyparty

• Simple protocol sets vs Simple protocol sets vs complicated protocol setscomplicated protocol sets

Page 46: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

46

Point-to-Point

End-to-End

Page 47: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

47

Initial SpecificationsInitial Specifications•WS-SecurityWS-Security•WS-PolicyWS-Policy•WS-TrustWS-Trust•WS-PrivacyWS-Privacy

Follow-on Follow-on SpecificationsSpecifications•WS-WS-SecureConversationSecureConversation•WS-FederationWS-Federation•WS-AuthorizationWS-Authorization

Proposed Security Proposed Security SpecificationSpecification

Page 48: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

48

WS-SecurityWS-Security

• A“ what” not “how”A“ what” not “how”• Security token is embedded Security token is embedded

inside SOAP headersinside SOAP headers

• Message integrity is provided Message integrity is provided by XML Signature and by XML Signature and security tokenssecurity tokens

• Message confidentiality is Message confidentiality is provided by XML Encryption provided by XML Encryption with security tokenswith security tokens

Page 49: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

49

WS-SecurityWS-Security

Page 50: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

50

Web Service SecurityWeb Service Security

Page 51: 1 Secure Socket Layer Yu YangYu Yang Lilly WangLilly Wang

51

ReferenceReference

[1[1] http://www.faqs.org/faqs/computer-security/ssl-talk faq/

[2] [2]

http://www.pcwebopedia.com/TERM/S/SSL.htmhttp://www.pcwebopedia.com/TERM/S/SSL.htm

[3][3]http://developer.netscape.com/docs/manuals/http://developer.netscape.com/docs/manuals/security/sslin/contents.htmsecurity/sslin/contents.htm

[4] [4] http://www.ece.wpi.edu/~sunar/ee578/SSL.ppt http://www.ece.wpi.edu/~sunar/ee578/SSL.ppt [5] [5]

http://nas.cl.uh.edu/yang/teaching/csci5931webhttp://nas.cl.uh.edu/yang/teaching/csci5931webSecurity/Security/

ThesisProWS_Rajiv.docThesisProWS_Rajiv.doc