Network Security: TLS/SSL Tuomas Aura T-110.5241 Network security Aalto University, Autumn 2015.

Slides:



Advertisements
Similar presentations
Web security: SSL and TLS
Advertisements

Spring 2012: CS419 Computer Security Vinod Ganapathy SSL, etc.
1 Lecture 17: SSL/TLS history, architecture basic handshake session initiation/resumption key computation negotiating cipher suites application: SET.
1 Lecture 12 SSL/TLS (Secure Sockets Layer / Transport Layer Security) CIS CIS 5357 Network Security.
TLS Introduction 14.2 TLS Record Protocol 14.3 TLS Handshake Protocol 14.4 Summary.
Cryptography and Network Security
Secure Socket Layer.
SSL CS772 Fall Secure Socket layer Design Goals: SSLv2) SSL should work well with the main web protocols such as HTTP. Confidentiality is the top.
Lecture 7: Transport Level Security – SSL/TLS CS 336/536: Computer Network Security Fall 2013 Nitesh Saxena Adopted from previous lecture by Tony Barnard.
17.1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 17 Security at the Transport Layer: SSL and TLS.
Transport Layer Security (TLS) Bill Burr November 2, 2001.
Socket Layer Security. In this Presentation: need for web security SSL/TLS transport layer security protocols HTTPS secure shell (SSH)
Working Connection Computer and Network Security - SSL, IPsec, Firewalls – (Chapter 17, 18, 19, and 23)
7-1 Chapter 7 – Web Security Use your mentality Wake up to reality —From the song, "I've Got You under My Skin“ by Cole Porter.
An Introduction to Secure Sockets Layer (SSL). Overview Types of encryption SSL History Design Goals Protocol Problems Competing Technologies.
Slide 1 Vitaly Shmatikov CS 378 SSL/TLS. slide 2 What is SSL / TLS? uTransport Layer Security protocol, version 1.0 De facto standard for Internet security.
1 SSL/TLS 2 Web security Security requirements Secrecy to prevent eavesdroppers to learn sensitive information Entity authentication Message authentication.
Transport Layer Security (TLS) Protocol Introduction to networks and communications(CS555) Prof : Dr Kurt maly Student:Abhinav y.
December 2006Prof. Reuven Aviv, SSL1 Web Security with SSL Prof. Reuven Aviv Dept. of Computer Science Tel Hai Academic College.
BASIC CRYPTOGRAPHY CONCEPT. Secure Socket Layer (SSL)  SSL was first used by Netscape.  To ensure security of data sent through HTTP, LDAP or POP3.
Mar 19, 2002Mårten Trolin1 This lecture On the assignment Certificates and key management SSL/TLS –Introduction –Phases –Commands.
Apr 2, 2002Mårten Trolin1 Previous lecture On the assignment Certificates and key management –Obtaining a certificate –Verifying a certificate –Certificate.
CS470, A.SelcukReal-Time Communication Issues1 Real-Time Communication Security IPsec & SSL Issues CS 470 Introduction to Applied Cryptography Instructor:
Cryptography and Network Security Chapter 17
0 SSL3.0 / TLS1.0 Secure Communication over Insecure Line.
Chapter 8 Web Security.
Announcement Final exam: Wed, June 9, 9:30-11:18 Scope: materials after RSA (but you need to know RSA) Open books, open notes. Calculators allowed. 1.
11 Secure Sockets Layer (SSL) Protocol (SSL) Protocol Saturday, University of Palestine Applied and Urban Engineering College Information Security.
Secure Socket Layer (SSL)
SSL / TLS in ITDS Arun Vishwanathan 23 rd Dec 2003.
1 Lecture 14: Real-Time Communication Security real-time communication – two parties interact in real time (as opposed to delayed communication like )
Behzad Akbari Spring 2012 (These slides are based on lecture slides by Lawrie Brown)
Cosc 4765 SSL/TLS and VPN. SSL and TLS We can apply this generally, but also from a prospective of web services. Multi-layered: –S-http (secure http),
CSCE 715: Network Systems Security Chin-Tser Huang University of South Carolina.
Network Security Essentials Chapter 5
Cryptography and Network Security (CS435) Part Fourteen (Web Security)
Web Security : Secure Socket Layer Secure Electronic Transaction.
December 2008Prof. Reuven Aviv, SSL1 Web Security with SSL Network Security Prof. Reuven Aviv King Mongkut’s University of Technology Faculty of information.
Tunneling and Securing TCP Services Nathan Green.
SARVAJANIK COLLEGE OF ENGINEERING & TECHNOLOGY. Secure Sockets Layer (SSL) Protocol Presented By Shivangi Modi Presented By Shivangi ModiCo-M(Shift-1)En.No
SMUCSE 5349/7349 SSL/TLS. SMUCSE 5349/7349 Layers of Security.
IPSec and TLS Lesson Introduction ●IPSec and the Internet key exchange protocol ●Transport layer security protocol.
Secure Sockets Layer (SSL) Protocol by Steven Giovenco.
1 SSL/TLS. 2 Web security Security requirements Secrecy to prevent eavesdroppers to learn sensitive information Entity authentication Message authentication.
Encryption protocols Monil Adhikari. What is SSL / TLS? Transport Layer Security protocol, ver 1.0 De facto standard for Internet security “The primary.
CSCE 715: Network Systems Security Chin-Tser Huang University of South Carolina.
8-1 CSE 4707/5850 Network Security (2) SSL/TLS. 8-2 Think about Google or YouTube  Desired properties  Indeed the other side is Google or YouTube server.
@Yuan Xue CS 285 Network Security Secure Socket Layer Yuan Xue Fall 2013.
Cryptography CSS 329 Lecture 13:SSL.
Page 1 of 17 M. Ufuk Caglayan, CmpE 476 Spring 2000, SSL and SET Notes, March 29, 2000 CmpE 476 Spring 2000 Notes on SSL and SET Dr. M. Ufuk Caglayan Department.
Secure Sockets Layer (SSL)
CSCE 715: Network Systems Security
CSE 4095 Transport Layer Security TLS, Part II
CSE 4095 Transport Layer Security TLS
Network Security: TLS/SSL
Cryptography and Network Security
SSL (Secure Socket Layer)
Transport Layer Security (TLS)
Cryptography and Network Security
Presentation transcript:

Network Security: TLS/SSL Tuomas Aura T Network security Aalto University, Autumn 2015

2 Outline 1.Diffie-Hellman key exchange (recall from earlier) 2.Key exchange using public-key encryption 3.Goals of authenticated key exchange 4.TLS/SSL architecture 5.TLS handshake (!) 6.TLS record protocol 7.TLS trust model

Diffie-Hellman key exchange Recall from previous lecture 3

4 Signed DH with nonces and key confirmation Signed Diffie-Hellman with nonces and key confirmation: 1. A → B: A, B, N A, g x, S A (“Msg1”, A, B, N A, g x ), Cert A 2. B → A: A, B, N B, g y, S B (“Msg2”, A, B, N B, g y ), Cert B, MAC SK (A, B, “Responder done.”) 3. A → B: A, B, MAC SK (A, B, “Initiator done.”) SK = h(N A, N B, g xy ) Ok to reuse the exponents x and y Somewhat realistic protocol (compare with TLS_DHE_DSS)

5 Ephemeral Diffie-Hellman Perfect forward secrecy (PFS): session keys and data from past sessions is safe even if the long-term secrets, such as private keys, are later compromised Even participants themselves cannot recover old session keys Called “perfect” for some historical reason; the word means nothing specific General principle of implementing PFS: create a new temporary public key pair for each key exchange and afterwards discard the private key Common way to implement PFS is ephemeral DH (DHE): both sides generate a new random DH exponents for every key exchange and forget the exponent values afterwards Cost of ephemeral Diffie-Hellman: random-number generation for new x and y, exponentiation for the DH public keys g x and g y, and cannot cache and reuse previously computed g xy for communicating again with the same peer Typical trade-off: replace DH exponents periodically, e.g. once in a day or an hour, and use nonces to create a fresh session key: SK = h(g xy, N A, N B )

Key exchange using public-key encryption

7 PK encryption of session key Public-key encryption of the session key: 1. A → B: A, PK A 2. B → A: B, E A (SK) SK = session key E A (…) = encryption with A’s public key Note: This protocol is not secure like this. Please read further.

8 Impersonation and MitM attacks The protocol again: 1. A → B: A,B, PK A 2. B → A: A,B, E A (SK) SK = session key E A (…) = encryption with A’s public key Same impersonation and man-in-the-middle attacks as in unauthenticated Diffie-Hellman: A → T(B): A, PK A // Trent intercepts the message T(B) → A: B, E A (SK)// Trent spoofs the message

9 Authenticated key exchange Authenticated key exchange with public-key encryption: 1. A → B: A,B, N A, Cert A 2. B → A: A,B, N B, E A (KM), S B (“Msg2”,A,B,N A,N B,E A (KM)), Cert B, MAC SK (A, B, “Responder done.”) 3. A → B: A,B, MAC SK (A, B, “Initiator done.”) SK = h(N A, N B, KM) // why nonces and not SK = KM? KM = random key material (random bits) generated by B Cert A = certificate for A’s public encryption key E A (…) = encryption with A’s public key Cert B = certificate for B’s public signature key S B (…) = B’s signature MAC SK (…) = MAC with the session key Typically RSA encryption and signatures because the same RSA keys can be used for both Somewhat realistic protocol (compare with TLS_RSA)

Goals of authenticated key exchange – more detail

Basic security goals Create a good session key: Secret i.e. known only to the intended participants Fresh i.e. never used before Separation of long-term and short-term secrets: long-term secrets such as private keys or master keys are not compromised even if session keys are Authentication: Mutual i.e. bidirectional authentication: each party knows with whom it shares the session key Sometimes only one-way i.e. unidirectional authentication Optional properties: Entity authentication: each or one participant knows that the other is online and participated in the protocol Key confirmation: each or one participant knows that the other knows the session key (implies entity authentication) Perfect forward secrecy: compromise of current secrets should not compromise past session keys Contributory key exchange: both parties contribute to the session key; neither can decide the key alone (the opposite is key distribution)

Advanced security goals Non-repudiation A party cannot later deny taking part (usually not an explicit goal) Plausible deniability No evidence left of taking part (usually not an explicit goal either) Integrity check for version and algorithm negotiation Increases difficulty of version roll-back attacks Identity protection: Passive sniffers cannot learn the identities of the protocol participants Usually only one side can be protected against active attacks: one side must reveal its identity first, making it vulnerable to active attacks Denial-of-service resistance: The protocol cannot be used to exhaust memory or CPU of the participants It is not easy to spoof packets that prevent others from completing a key exchange The protocol cannot be used to flood third parties with data

TLS/SSL

14 TLS/SSL Originally Secure Sockets Layer (SSLv3) by Netscape in 1995 Originally created to facilitate web commerce: Encrypting credit card numbers and passwords on the web Fast adoption because built into web browsers Historical controversy: First, there was resistance against SSL, especially in the IETF. IPsec was seen as the real solution, and SSL just as a stop-gap measure. SSL was considered hazardous because it slowed down the adoption of IPsec Now SSL/TLS is the dominant Internet encryption standard Standardized as Transport-Layer Security (TLS) by IETF [RFC 5246, RFC 6066] Minimal changes to SSLv3 implementations but not interoperable with it

15 TLS/SSL architecture (1) Encryption and authentication layer added to the protocol stack between TCP and applications End-to-end security between client and server, usually web browser and web server

16 TLS/SSL architecture (2) TLS Handshake Protocol — authenticated key exchange TLS Record Protocol — block data delivery General architecture of security protocols: authenticated key exchange + session protocol TSL specifies separate minor “protocols”: Alert — error messages Change Cipher Spec — turn on encryption or update keys

Cryptography in TLS Key-exchange mechanisms and algorithms organized in cipher suites Negotiated in the beginning of the handshake Example: TLS_RSA_WITH_3DES_EDE_CBC_SHA RSA = handshake: RSA-based key exchange Key-exchange uses its own MAC composed of SHA-1 and MD5 3DES_EDE_CBC = data encryption with 3DES block cipher in EDE and CBC mode SHA = data authentication with HMAC-SHA-1 TLS mandatory cipher suites: TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA (TLS 1.0) DHE_DSS = handshake: ephemeral Diffie-Hellman key exchange authenticated with DSS* signatures* TLS_RSA_WITH_3DES_EDE_CBC_SHA (TLS 1.1) TLS_RSA_WITH_AES_128_CBC_SHA (TLS 1.2) SHA-1 and MD5 in the handshake replaced with a negotiable MAC algorithm in TLS 1.2 Obviously insecure cipher suites: TLS_NULL_WITH_NULL_NULL (used for testing) TLS_RSA_EXPORT_WITH_DES40_CBC_SHA (used in the 90s)

TLS handshake 18

19 TLS handshake protocol Runs on top of TLS record protocol Negotiates protocol version and cipher suite (i.e. cryptographic algorithms) Protocol versions: 3.0 = SSLv3, 3.1 = TLSv1 Cipher suite e.g. DHE_RSA_WITH_3DES_EDE_CBC_SHA Performs authenticated key exchange Several different key exchange mechanisms supported (typically RSA and DHE) Often only the server is authenticated Session keys created in the handshake will then be used for encryption and integrity protection of data

ClientServer ClientHello ServerHello Certificate* ServerKeyExchange* CertificateRequest* ServerHelloDone Certificate* ClientKeyExchange CertificateVerify* ChangeCipherSpec Finished ChangeCipherSpec Finished Application data 20 TLS Handshake (DH) Optional, client typically unauthenticated. Client D-H key etc. Server D-H key and signature etc. 1. Negotiation 2. Authentication 3. Key exchange 4. Key confirmation 5. Start session Protocol version, server nonce, cipher suite Protocol versions, client nonce, cipher suites Server certificate Optional signature Key confirmation Encrypted and MAC’ed session data Copied from the RFC

21 TLS handshake 1. C → S: ClientHello 2. S → C: ServerHello, Certificate, [ ServerKeyExchange ], [ CertificateRequest ], ServerHelloDone 3. C → S: [ Certificate ], ClientKeyExchange, [ CertificateVerify ], ChangeCipherSpec, Finished 4. S → C: ChangeCipherSpec, Finished [Brackets] indicate fields not needed in one-directional authentication Reformatted

22 TLS_DHE_DSS handshake 1. C → S: Versions, N C, SessionId, CipherSuites 2. S → C:Version, N S, SessionId, CipherSuite CertChain S g, n, g y, Sign S (N C, N S, g, n, g y ) [ Root CAs ] 3. C → S: [ CertChain C ] g x [ Sign C (all previous messages including N C, N S, g, n, g y, g x ) ] ChangeCipherSpec MAC SK (“client finished”, all previous messages) 4. S → C: ChangeCipherSpec MAC SK ("server finished“, all previous messages) pre_master_secret = g xy master_secret = SK = h(pre_master_secret, “master secret”, N C, N S ) The Finished messages are already protected by the new session keys 1. Negotiation 2. Ephemeral Diffie-Hellman 3. Nonces 4. Signature 5. Certificates 6. Key confirmation and negotiation integrity check Message contents shown

ClientServer ClientHello ServerHello Certificate* ServerKeyExchange* CertificateRequest* ServerHelloDone Certificate* ClientKeyExchange CertificateVerify* ChangeCipherSpec Finished ChangeCipherSpec Finished Application data 23 TLS Handshake (RSA) Optional, client typically unauthenticated. Key material encrypted to server Not needed 1. Negotiation 2. Authentication 3. Key exchange 4. Key confirmation 5. Start session Protocol version, server nonce, cipher suite Protocol versions, client nonce, cipher suites Server certificate (RSA) Optional signature Key confirmation Encrypted and MAC’ed session data Copied from the RFC

24 TLS_RSA handshake 1. C → S: Versions, N C, SessionId, CipherSuites 2. S → C:Version, N S, SessionId, CipherSuite CertChain S [ Root CAs ] 3. C → S: [ CertChain C ] E S (pre_master_secret), [ Sign C (all previous messages including N C, N S, E S (…)) ] ChangeCipherSpec MAC SK (“client finished”, all previous messages) 4. S → C: ChangeCipherSpec MAC SK ("server finished“, all previous messages) E S = RSA encryption (PKCS #1 v1.5) with S’s public key from CertChain S pre_master_secret = random number chosen by C master_secret = SK = h(pre_master_secret, “master secret”, N C, N S ) Finished messages are already protected by the new session keys 1. Negotiation 2. RSA 3. Nonces 4. Signature 5. Certificates 6. Key confirmation and negotiation integrity check Reformatted and message contents shown

25 Nonces in TLS Client and Server Random are nonces Concatenation of a real-time clock value and random number: struct { uint32 gmt_unix_time; opaque random_bytes[28]; } Random;

26 Session vs. connection TLS session can span multiple connections Client and server may cache the session state and master_secret Client sends the SessionId of a cached session in Client Hello; otherwise zero Server responds with the same SessionId if session found in server cache; otherwise with a fresh value → session resumed if both sides remember it When session is reused, new session keys are derived from old master_secret and new nonces Change of IP address does not invalidate cached sessions Session tickets [RFC 5077]: Server can store the client’s session state data (ticket) in the client Client sends the ticket back to the server when reconnecting Ticket is encrypted and authenticated with a secret key know only to the server  client cannot modify data Not implemented by all browsers

27 TLS renegotiation attack TLS client or server can initiate “renegotiation handshake” i.e. new handshake to refresh session keys In 2009, a protocol flaw was found: 1.MitM attacker intercepts a TLS connection from honest client; lets the honest client wait in the beginning of the handshake 2.Attacker executes another TLS handshake with the honest server and sends some data to the server over this TLS connection 3.Attacker forwards the (still unauthenticated) connection from the client to the server over its own TLS connection 4.Honest client completes the TLS handshake with the server; server thinks it is renegotiation; attacker loses ability to decrypt the data after ChangeCipherSpec, but continues to forward the connection What did the attacker achieve? Attacker inserted its own data to the beginning of the connection E.g. consider applications where the client sends commands first and finally authorizes them by entering its password Surprising because TLS/SSL is one of the most analyzed protocols and no major protocol-level flaws have been found since 1995 Solved by RFC 5746 Renegotiation includes the MACs (verify_data) from the previous Finished messages Complexity arises from backward compatibility and avoiding version roll-back attacks

TLS record protocol

29 TLS record protocol For write (sending): 1.Take arbitrary-length data blocks from upper layer 2.Fragment to blocks of ≤ 4096 bytes 3.Compress the data (optional) 4.Apply a MAC for data integrity 5.Encrypt for data confidentiality 6.Add fragment header (serial number SN, content type, length) 7.Transmit over TCP server port 443 (https) For read (receiving): Receive, decrypt, verify MAC, decompress, defragment, deliver to upper layer

30 TLS record protocol - abstraction Abstract view: E K1 (data, HMAC K2 (SN, content type, length, data)) Different encryption and MAC keys in each direction All keys and IVs are derived from the master_secret TLS record protocol uses 64-bit unsigned integers starting from zero as message sequence numbers for each connection TLS works over TCP, which is reliable and preserves order. Thus, sequence numbers must be received in exact order

31 TLS 1.3 Draft currently under development in IETF Reducing web latency: 1-RTT (one round trip time) handshake: DH keys sent already with Hello Client sends application data in the third message Experimental 0-RTT handshake: Client may send application data already in the first Handshake message, with less security Server scalability: Session tickets as the only way to resume a session General updating and cleanup: (EC)DHE as the key exchange method Old algorithms and unused features removed

32 TLS Applications Originally designed for web browsing (HTTPS) Client typically unauthenticated New applications: Any TCP connection can be protected with TLS The SOAP remote procedure call (SOAP RPC) protocol uses HTTP as its transport protocol. Thus, SOAP can be protected with TLS TLS-based VPNs, e.g. OpenVPN EAP-TLS and PEAP authentication and key exchange in wireless LANs and elsewhere Many of the new applications require mutual authentication

33 Notes on protocol engineering Network is a distributed system with many participants Computer networking is about protocols Protocol = distributed algorithm Algorithm = stepwise instructions to achieve something Security is just one requirement for network protocols Cost, complexity, performance, deployability, code reuse, time to market etc. may override some security properties Like the design of cryptographic algorithms, security engineering requires experienced experts and peer scrutiny Reuse well-understood solutions such as TLS; avoid designing your own protocols If you cannot afford strong, standard cryptographic algorithms (e.g. constraints on battery, latency, gate count etc.), better do without crypto The most difficult part is understanding the problem Must understand both security and the application domain When the problem is understood, potential solutions often become obvious

34 Related reading William Stallings. Network security essentials: applications and standards, 3rd ed. chapters ; 4th ed. chapter 5; 5th ed. chapter 6 William Stallings. Cryptography and Network Security, 4th ed.: chapters Kaufmann, Perlman, Speciner. Network security, 2nd ed.: chapters 11, 19 Dieter Gollmann. Computer Security, 2nd ed. chapter 13.4; 3rd ed. chapter 16.5

35 Exercises Use a network sniffer (e.g. Netmon, Ethereal) to look at TLS handshakes. Can you spot a full handshake and session reuse? Can you see the lack of identity protection? Why is the lack of identity protection in TLS usually not a big issue? How would you modify the TLS handshake to improve identity protection? Remember that the certificates are sent as plaintext and SessionId is also a traceable identifier. Why do most web servers prefer the RSA handshake? Consider removing message fields from the TLS DHE and RSA key exchanges. How does each message field contribute to security? How would you implement perfect forward secrecy with RSA? Why have the mandatory-to-implement cipher suites in TLS changed over time? How many round trips between client and server do the TLS DHE and RSA key exchanges require? Consider also the TCP handshake and that certificates may not fit into one IP packet. Why is the front page of a web site often insecure (HTTP) even if the password entry and/or later data access are secure (HTTPS)? What security problems can this cause? What problems arise if you want to set up multiple secure (HTTPS) web sites behind a NAT or on virtual servers that share only one IP address? How does the server name extension (RFC 6066) help?RFC 6066 If an online service (e.g. webmail) uses TLS with server-only authentication to protect passwords, is the system vulnerable to offline password cracking?