SSH, SSL, and IPsec: wtf?



Similar documents
Security. Contents. S Wireless Personal, Local, Metropolitan, and Wide Area Networks 1

Chapter 7 Transport-Level Security

Secure Sockets Layer (SSL ) / Transport Layer Security (TLS) Network Security Products S31213

Real-Time Communication Security: SSL/TLS. Guevara Noubir CSU610

Transport Level Security

Secure Socket Layer (SSL) and Transport Layer Security (TLS)

Network Security Essentials Chapter 5

3.2: Transport Layer: SSL/TLS Secure Socket Layer (SSL) Transport Layer Security (TLS) Protocol

Chapter 17. Transport-Level Security

Security Protocols HTTPS/ DNSSEC TLS. Internet (IPSEC) Network (802.1x) Application (HTTP,DNS) Transport (TCP/UDP) Transport (TCP/UDP) Internet (IP)

Client Server Registration Protocol

Network Security Fundamentals

Overview of CSS SSL. SSL Cryptography Overview CHAPTER

APNIC elearning: Network Security Fundamentals. 20 March :30 pm Brisbane Time (GMT+10)

Chapter 10. Network Security

7 Network Security. 7.1 Introduction 7.2 Improving the Security 7.3 Internet Security Framework. 7.5 Absolute Security?

Using etoken for SSL Web Authentication. SSL V3.0 Overview

Authenticity of Public Keys

Lecture 9 - Network Security TDTS (ht1)

CPS Computer Security Lecture 9: Introduction to Network Security. Xiaowei Yang

Topics in Network Security

Managing and Securing Computer Networks. Guy Leduc. Chapter 4: Securing TCP. connections. connections. Chapter goals: security in practice:

Network Security. Gaurav Naik Gus Anderson. College of Engineering. Drexel University, Philadelphia, PA. Drexel University. College of Engineering

SBClient SSL. Ehab AbuShmais

Network Security [2] Plain text Encryption algorithm Public and private key pair Cipher text Decryption algorithm. See next slide

Overview. SSL Cryptography Overview CHAPTER 1

Is Your SSL Website and Mobile App Really Secure?

Security vulnerabilities in the Internet and possible solutions

INF3510 Information Security University of Oslo Spring Lecture 9 Communication Security. Audun Jøsang

Network Security. Marcus Bendtsen Institutionen för Datavetenskap (IDA) Avdelningen för Databas- och Informationsteknik (ADIT)

Using BroadSAFE TM Technology 07/18/05

Security Protocols/Standards

Chapter 8 Security. IC322 Fall Computer Networking: A Top Down Approach. 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012

mod_ssl Cryptographic Techniques

Network Security. Lecture 3

Authentication Types. Password-based Authentication. Off-Line Password Guessing

APNIC elearning: IPSec Basics. Contact: esec03_v1.0

Web Payment Security. A discussion of methods providing secure communication on the Internet. Zhao Huang Shahid Kahn

Outline. INF3510 Information Security. Lecture 10: Communications Security. Communication Security Analogy. Network Security Concepts

SSL/TLS: The Ugly Truth

CRYPTOGRAPHY IN NETWORK SECURITY

Secure Socket Layer. Carlo U. Nicola, SGI FHNW With extracts from publications of : William Stallings.

Lecture 10: Communications Security

Module 8. Network Security. Version 2 CSE IIT, Kharagpur

Network Security Web Security and SSL/TLS. Angelos Keromytis Columbia University

Lecture 9: Application of Cryptography

CSE/EE 461 Lecture 23

2.4: Authentication Authentication types Authentication schemes: RSA, Lamport s Hash Mutual Authentication Session Keys Trusted Intermediaries

Computer Networks. Secure Systems

12/8/2015. Review. Final Exam. Network Basics. Network Basics. Network Basics. Network Basics. 12/10/2015 Thursday 5:30~6:30pm Science S-3-028

Network Security. Computer Networking Lecture 08. March 19, HKU SPACE Community College. HKU SPACE CC CN Lecture 08 1/23

EXAM questions for the course TTM Information Security May Part 1

Q: Why security protocols?

Network Security. Abusayeed Saifullah. CS 5600 Computer Networks. These slides are adapted from Kurose and Ross 8-1

Security Engineering Part III Network Security. Security Protocols (I): SSL/TLS

Communication Security for Applications

Implementing and Managing Security for Network Communications

Chapter 3. Network Domain Security

Part 2 D(E(M, K),K ) E(M, K) E(M, K) Plaintext M. Plaintext M. Decrypt with private key. Encrypt with public key. Ciphertext

Web Security Considerations

Network Security Protocols

BlackBerry Enterprise Service 10. Secure Work Space for ios and Android Version: Security Note

Secure Shell SSH provides support for secure remote login, secure file transfer, and secure TCP/IP and X11 forwarding. It can automatically encrypt,

CS 356 Lecture 27 Internet Security Protocols. Spring 2013

ERserver. iseries. Securing applications with SSL

Security agility solution independent of the underlaying protocol architecture

How To Understand And Understand The Ssl Protocol ( And Its Security Features (Protocol)

SSL: Secure Socket Layer

Secure Socket Layer. Introduction Overview of SSL What SSL is Useful For

, ) I Transport Layer Security

Transport Layer Security Protocols

Using IKEv2 on Juniper Networks Junos Pulse Secure Access Appliance

Three attacks in SSL protocol and their solutions

Insecure network services. Firewalls. Two separable topics. Packet filtering. Example: blocking forgeries. Example: blocking outgoing mail

Network Security. Abusayeed Saifullah. CS 5600 Computer Networks. These slides are adapted from Kurose and Ross 8-1

Securing IP Networks with Implementation of IPv6

Secure Sockets Layer

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.

Security: Focus of Control. Authentication

Secure Sockets Layer (SSL) / Transport Layer Security (TLS)

Communication Systems 16 th lecture. Chair of Communication Systems Department of Applied Sciences University of Freiburg 2009

SY system so that an unauthorized individual can take over an authorized session, or to disrupt service to authorized users.

Chapter 32 Internet Security

CIS 6930 Emerging Topics in Network Security. Topic 2. Network Security Primitives

As enterprises conduct more and more

Cryptography and Network Security

SSL/TLS. What Layer? History. SSL vs. IPsec. SSL Architecture. SSL Architecture. IT443 Network Security Administration Instructor: Bo Sheng

Part III-b. Universität Klagenfurt - IWAS Multimedia Kommunikation (VK) M. Euchner; Mai Siemens AG 2001, ICN M NT

Message authentication and. digital signatures

Is your data safe out there? -A white Paper on Online Security

WEB Security & SET. Outline. Web Security Considerations. Web Security Considerations. Secure Socket Layer (SSL) and Transport Layer Security (TLS)

Authentication applications Kerberos X.509 Authentication services E mail security IP security Web security

Secure Socket Layer (TLS) Carlo U. Nicola, SGI FHNW With extracts from publications of : William Stallings.

Introduction to Cryptography

Forward Secrecy: How to Secure SSL from Attacks by Government Agencies

Chapter 8. Cryptography Symmetric-Key Algorithms. Digital Signatures Management of Public Keys Communication Security Authentication Protocols

Outline. Transport Layer Security (TLS) Security Protocols (bmevihim132)

IT Networks & Security CERT Luncheon Series: Cryptography

Transcription:

SSH, SSL, and IPsec: wtf? Eric Rescorla RTFM, Inc. ekr@rtfm.com Eric Rescorla SSH, SSL, and IPsec 1

What are we trying to accomplish? Alice, Bob want to talk to each other But they re worried about attack How do you know you re talking to the right person? How do you know people can t listen to your conversation How do you know people can t change your conversation? We want to build a system that protects against these attacks Eric Rescorla SSH, SSL, and IPsec 2

Terminology Dump 1: Attacker Capabilities Passive Attacker doesn t send anything. Active Attacker is allowed to send traffic. On-path Attacker is on the communications path between A and B. Sees all traffic Can seamlessly impersonate either side Off-path Attacker is not on communications path between A and B Can t see traffic between A and B. Can sometimes send traffic as either (subject to address filtering). Eric Rescorla SSH, SSL, and IPsec 3

Terminology Dump 2: Security Properties Confidentiality Information being transmitted is kept secret from attackers Data Origin Authentication Receivers can determine the origin of traffic. Message Integrity Tampering of traffic can be detected. Third-party Verifiability A party not involved in the initial communication can verify what happened. (Often misleadingly called non-repudiation) Eric Rescorla SSH, SSL, and IPsec 4

A simple problem: remote authentication You re a Web server X connects to you claiming to be Alice How can you tell? Assumptions: All you have is the network traffic Can send messages to X Receive X s response Attackers can forge but not view, intercept, or modify traffic You have some prior relationship with Alice Eric Rescorla SSH, SSL, and IPsec 5

Remote authentication: basic ideas Alice needs to be able to do something others can t do Generally, compute some function But why can t X do that? How do we break the symmetry? Give Alice more resources Give Alice some secret Eric Rescorla SSH, SSL, and IPsec 6

One-sided authentication with shared secrets Assume Alice and Bob share a secret S ab Alice needs to prove possession of S ab (Assume Alice authenticates Bob some other way) Simple approach: Bob and Alice both store S ab Alice sends Bob S ab Bob does memcmp(). Eric Rescorla SSH, SSL, and IPsec 7

Problems with the previous scheme Snooping. an attacker who is on-path can capture the password and replay it Hijacking. an attacker can wait for you to exchange the password and then take over the connection One-way authentication. how does Alice authenticate Bob? Eric Rescorla SSH, SSL, and IPsec 8

Fixing snooping Alice doesn t send S ab over the wire Instead she computes some function f And sends f(s ab ) What properties does f need? 1st Preimage Resistant hard to compute S ab from f(s ab ) 2nd Preimage Resistant hard to find S st f(s ) = f(s ab ) Luckily, we have such functions Eric Rescorla SSH, SSL, and IPsec 9

Cryptographic hash functions Basic idea: one-way function (also called message digests) Take an arbitrary length bit string m and reduce it to 100-200 (b) bits H(m) = h Hash functions are preimage resistant Takes approximately 2 b operations to find m given h Hash functions are collision resistant Takes approximately 2 b/2 operations to find m, m st. H(m) = H(m ) Popular algorithms: MD5, SHA-1, SHA-256 Eric Rescorla SSH, SSL, and IPsec 10

Challenge-Response So, Alice just sends H(S ab ), right? Wrong This becomes the new secret So we still have a replay attack problem Bob needs to force Alice to compute a new function each time Alice Bob Challenge H(S ab +Challenge) Challenge needs to be unique for every exchange Does not need to be unpredictable Eric Rescorla SSH, SSL, and IPsec 11

Why mutual authentication? We assumed that Alice was talking to Bob But how does Alice know that? She can t trust the network What if she s connecting to the attacker Alice Attacker Bob Challenge Challenge H(S ab +Challenge) H(S ab +Challenge) Alice has just logged in for the attacker He can issue any commands he wants (oops!) Attack Commands Eric Rescorla SSH, SSL, and IPsec 12

Adding mutual authentication We already know how to authenticate Alice Now we need to authenticate Bob Just reverse the procedure Alice Bob Challenge1 Challenge2 H(S ab +Challenge1+Challenge2) H(S ab +Challenge2+Challenge1) Each side needs to control its own challenges Otherwise we have replay issues again Eric Rescorla SSH, SSL, and IPsec 13

Hijacking This protocol still has a hijacking problem Alice Attacker Bob Challenge1 Challenge1 Challenge2 H(S ab +Challenge1+Challenge1) H(S ab +Challenge2+Challenge1) Challenge2 H(S ab +Challenge1+Challenge1) H(S ab +Challenge2+Challenge1) We need to authenticate the data Not just the initial handshake Attack commands Eric Rescorla SSH, SSL, and IPsec 14

Authenticating data Break the data into records Attach a message authentication code (MAC) to each record Receiver verifies MACs on record Length Data MAC Eric Rescorla SSH, SSL, and IPsec 15

A message authentication code? Dude, wait, what? What s a MAC? A one-way function of the key and some data F (k, data) = x x is short (80-200 bits) Hard to compute x without k Hard to compute data even with k, x This sounds kinda like a hash MACs are usually built from hashes World s simplest MAC: H(k + data) (this has problems) Popular MACs: HMAC Eric Rescorla SSH, SSL, and IPsec 16

Where does the key come from? We want a key that s unique to this connection And tied to both sides Get it from the challenge-response handshake First attempt: K = H(S ab + Challenge1 + Challenge2) But now the key is the same in both directions And the same as the challenge response! Allows reflection attacks Second attempt K a b = H(S ab + AB + Challenge1 + Challenge2) K b a = H(S ab + BA + Challenge1 + Challenge2) Eric Rescorla SSH, SSL, and IPsec 17

World s simplest security protocol Alice Bob Challenge1 Challenge2 H(S ab +Challenge1+Challenge2) H(S ab +Challenge2+Challenge1) M essage1,m AC M essage2,m AC Each side knows who the other is All messages are authenticated But they re not confidential So don t send any secret information Eric Rescorla SSH, SSL, and IPsec 18

Symmetric Encryption We have two functions E, D st. E(k, P laintext) = Ciphertext D(k, Ciphertext) = P laintext These are easy to compute Either function is hard to compute without k Popular encryption algorithms: DES, 3DES, AES, RC4 Eric Rescorla SSH, SSL, and IPsec 19

A (mostly) complete channel security protocol Alice Bob Challenge1 Challenge2 H(S ab +Challenge1+Challenge2) H(S ab +Challenge2+Challenge1) E(k a b,(message1,mac)) E(k b a,(message2,mac)) Each side knows who the other is All messages are authenticated All messages are confidential Eric Rescorla SSH, SSL, and IPsec 20

So, we re done, right? How do Alice and Bob get S ab? Some out of band channel Send a letter do you trust USPS? Meet in person airplane tickets are expensive Guys with briefcases handcuffed to their wrists? All of these are pretty inconvenient We can do better Eric Rescorla SSH, SSL, and IPsec 21

Diffie-Hellman Key Agreement Each side has two keys ( public and private ) You publish the public key but the private key is secret F (K a pub, Kb priv ) = F (Kb pub, Ka pub ) = ZZ You need at least one private key to compute ZZ This is crypto rocket science but you don t need to understand how it works Eric Rescorla SSH, SSL, and IPsec 22

Using Diffie-Hellman Alice Bob Random1,K a pub Random2,K b pub E(k a b,(message1,mac)) E(k b a,(message2,mac)) Each side sends its public key The other side combines its private key with the other side s public key to compute ZZ The traffic keys are generated from ZZ Eric Rescorla SSH, SSL, and IPsec 23

Man-in-the-middle attack Alice Attacker Bob Random1,K a pub Random1,K A pub Random2,K A pub Random2,K b pub E(k a A,(Message1,MAC)) E(k A b,(message1,mac)) E(k A a,(message2,mac)) Each side thinks it s talking to the other E(k b A,(Message2,MAC)) This is what happens when you don t authenticate Alice and Bob need some way to authenticate each other s public keys Eric Rescorla SSH, SSL, and IPsec 24

Digital Signatures Remember MACs? There s a public key version of this Sign with K priv Verify with K pub A signed message can only be generated by someone who has the private key Popular algorithms: RSA, DSA, ECDSA Eric Rescorla SSH, SSL, and IPsec 25

Public key distribution Public key cryptography is one piece of the puzzle But only one piece I can verify a signature came from a given key But where do I get that key from? We could have a global directory Obvious scaling problems here What if I could give you a credential vouching for your public key? Eric Rescorla SSH, SSL, and IPsec 26

Certificates Digital signatures let us do exactly that Create a central certificate authority (CA) Alice proves her identity to the CA The CA gives her a signed message Alice s public key is X (a certificate) Anyone can verify this certificate As long as they have the public key of the CA This key is compiled into the software Popular CAs: VeriSign, Thawte, GoDaddy Eric Rescorla SSH, SSL, and IPsec 27

Diffie-Hellman with certificates Alice Bob Random1,Cert a Random2,Cert b E(k a b,(message1,mac)) E(k b a,(message2,mac)) Certificates contain DH public keys Each side can authenticate the other This is actually a bug Certificates are too inconvenient for users to get And the user doesn t always need to be authenticated Or is authenticated some other way Eric Rescorla SSH, SSL, and IPsec 28

One-way authentication with PKC One side (server) has a certificate The other side (client) makes up a random key pair Client Server Random1,Cert s Random2,K c pub E(k c s,(credit card #,MAC)) E(k s c,(ok,mac)) This authenticates the server but not the client We can do a similar trick with RSA Encrypt with public key, decrypt with private key This is the main operational mode for SSL/TLS Eric Rescorla SSH, SSL, and IPsec 29

Perfect Forward Secrecy What happens if one side s computer is compromised? Attacker gets private key Can decode all communications by that side Fix: have certificates with signature keys (RSA, DSA) Generate a random DH key for each handshake Sign it with your signature key Compromise of private key doesn t affect past traffic But you can MITM future connections This is the main operational mode for IPsec Eric Rescorla SSH, SSL, and IPsec 30

Algorithm negotiation There are a lot of choices here Who authenticates, Public key algorithm Digest algorithm Encryption algorithm Each make sense in some scenarios A good protocol is adaptable This means some kind of negotiation This needs to be protected to prevent downgrade attacks Eric Rescorla SSH, SSL, and IPsec 31

A complete channel security protocol Alice Bob Random1,Algorithms Random2,Algorithm,Cert b Cert a,mac(zz,handshakemsgs) M AC(ZZ,HandshakeM sgs) E(k a b,(message1,mac)) E(k b a,(message2,mac)) Eric Rescorla SSH, SSL, and IPsec 32

Secure Sockets Layer (SSL) Originally a Netscape proprietary protocol Target application: e-commerce What people thought the Web was for in 1994 Objective: send my credit card to Amazon securely Basic principles (ca. 1994) The server is authenticated (via certificate) The client is unauthenticated This should be easy to plug in to both sides Eric Rescorla SSH, SSL, and IPsec 33

SSL/TLS History (1) SSLv1 (never released) Designed by Kipp Hickman Severe security flaws (immediately obvious to anyone who knew crypto) SSLv2 Hickman again (after being beaten up by others) Modest security flaws (truncation attacks, downgrade) Very widely deployed SSLv3 Freier, Karlton, Kocher Fixes the above problems Eric Rescorla SSH, SSL, and IPsec 34

SSL/TLS History (2) Transport Layer Security (TLS) 1.0 (RFC 2246) First standardized version of SSL Modest improvements to key derivation TLS 1.1 (RFC 4346) Fixes for modest security flaws TLS 1.2 (RFC 5246) Flexibility for hash functions (thanks Dr. Wang!) As you can see, this is in maintenance mode Eric Rescorla SSH, SSL, and IPsec 35

Client HTTP over SSL (HTTPS) T CP SY N T CP SY N ACK T CP ACK Server SSL Handshake HT T P Request HT T P Response The client knows that the server expects HTTPS It s in the URL https://www.example.com/ It s on a separate port The server s certificate has its domain name (www.example.com) Eric Rescorla SSH, SSL, and IPsec 36

SSL Session Resumption Asymmetric (private key) operations are expensive And HTTPS tends to involve a lot of SSL/TCP connections Caching pays off here Each handshake establishes a session Clients can resume the session with the same keying material Thus skipping the key exchange Eric Rescorla SSH, SSL, and IPsec 37

Upward Negotiation What if the client and server don t know each other s capabilities Would be nice to discover them And automatically upgrade to TLS Example: SMTP Client Server HELO + T LS OK do T LS SSL Handshake SMT P transaction Of course, this allows downgrade attacks Eric Rescorla SSH, SSL, and IPsec 38

DoS Attacks on SSL/TLS Resource consumption Public key operations are expensive Client can force the server to do a lot of them But not blindly (TCP handshake) State on the server side SSL/TLS connection runs over TCP TCP connections are easy to DoS SSL/TLS can t protect you from this Needs to be at a lower layer Eric Rescorla SSH, SSL, and IPsec 39

Datagram TLS (RFC 4347) TLS requires a reliable channel The handshake is in sequence The data records depend on each other In practice this means TCP What about unreliable channels? DTLS is a slight modification of TLS Reliability for the handshake Record independence More DoS resistance (more on this later) Eric Rescorla SSH, SSL, and IPsec 40

Secure Shell (SSH) Originally designed by Tatu Ylonen Replacement for rsh Now the standard tool for secure remote login A lot of authentication mechanisms Other features Remote X File transfer Port forwarding Original version was seriously broken Later standardized versions are better Transport protocol looks a lot like TLS Eric Rescorla SSH, SSL, and IPsec 41

SSH leap of faith authentication No certificates server just has a raw public key The server provides the key when the client connects The client stores the server s key on first connection Any changes in the key are an error The key can be authenticated out of band The server operator tells the client the key fingerprint (hash) over the phone But only the most paranoid people do this This was considered insanity at the time Now it s considered clever Eric Rescorla SSH, SSL, and IPsec 42

SSL Key Exchange Protocol Client Server P rotocol=ssh 2.0... P rotocol=ssl 2.0... KeyExInit(algorithms...) KeyExInit(algorithms...) DH(group size) p,g DH c pub DH s pub,sign(ks priv,dhs pub ) Eric Rescorla SSH, SSL, and IPsec 43

SSH Client Authentication Server is authenticated first Client is then authenticated Raw password Challenge-response Public key GSS-API Kerberos Mechanisms are negotiated Eric Rescorla SSH, SSL, and IPsec 44

SSL Client Authentication Protocol Client Server Auth: None Auth: publickey,password,... publickey=xxx No publickey=y Y Y No signature OK Eric Rescorla SSH, SSL, and IPsec 45

Port Forwarding SSH provides a port forwarding feature Example: X11 remote X Server X Client localhost:6000 localhost:xxxx SSH Client SSH Server SSH server does setenv DISPLAY localhost:xxxx Apps just automatically work Eric Rescorla SSH, SSL, and IPsec 46

Secure Remote Shell SSH is backward compatible with rsh So other applications can be securely remoted Even without port forwarding Examples CVS rsync dump/restore Apps don t need security, just remote access Eric Rescorla SSH, SSL, and IPsec 47

IPsec: IP Security Basic idea: secure IP datagrams Instead of at application layer like TLS or SSH Why was this considered a good idea? Secure all traffic, not just TCP/UDP Automatically secure applications Without any change to the application Built-in-firewalling/access control Eric Rescorla SSH, SSL, and IPsec 48

IPsec history Work started in 1992-1993 General agreement on packet formats early on Though confusion about integrity vs. authentication Key agreement was very controversial Design issues IPR issues First proposed standards published in 1998 Mishmash of IKE, ISAKMP, OAKLEY Complaints about clarity and complexity IKEv2 approved in 2005 Eric Rescorla SSH, SSL, and IPsec 49

IPsec architecture User Space Kernel Space HTTP SMTP... IKE Transport TCP/UDP IP SPD IPsec SAD Eric Rescorla SSH, SSL, and IPsec 50

IPsec Packet Formats IP Hdr IPsec Hdr TCP Hdr Data Transport Mode IP Hdr IPsec Hdr IP Hdr TCP Hdr Data Tunnel Mode Eric Rescorla SSH, SSL, and IPsec 51

IKE Anonymity The handshakes we ve seen leak your identity to passive attackers Arguably this is bad IKE tries to stop this Initiator Responder DH i pub DH r pub {CERT i } {CERT r } An active attacker can get the initiator s identity Eric Rescorla SSH, SSL, and IPsec 52

IKE DoS prevention Objective: prevent blind DoS attacks Initiator Responder DH i pub T icket DH i pub,t icket DH r pub {CERT i } Ticket has to be stateless {CERT r } Eric Rescorla SSH, SSL, and IPsec 53

IPsec Status Many implementations Windows, OS/X, Linux, FreeBSD, IOS... Nearly all deployments are in VPN settings And peopel are cutting over to SSL/VPN Semi-manual configuration This is not what was intended Widely regarded as a semi-failure Eric Rescorla SSH, SSL, and IPsec 54

What was wrong with IPsec? Complexity Time to market Wrong design goals Hard to use Eric Rescorla SSH, SSL, and IPsec 55

Final thoughts All of these protocols look strikingly alike To some extent they were designed by the same people But also there appear to only be so many ways to do this All have gone through multiple revisions This is really hard to get right Even when you ave experienced people Don t invent your own Usage models matter SSL/TLS and SSH got this right IPsec did not Eric Rescorla SSH, SSL, and IPsec 56