Docsity

SSH, SSL, and IPsec: Understanding Secure Communication Protocols, Study notes of Computer Science

Partial preview of the text

Download SSH, SSL, and IPsec: Understanding Secure Communication Protocols and more Study notes Computer Science in PDF only on Docsity!

SSH, SSL, and IPsec: wtf?

Eric Rescorla

RTFM, Inc.

[email protected]

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

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)

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

One-sided authentication with shared secrets

  • Assume Alice and Bob share a secret Sab
    • Alice needs to prove possession of Sab
    • (Assume Alice authenticates Bob some other way)
  • Simple approach:
    • Bob and Alice both store Sab
    • Alice sends Bob Sab
    • Bob does memcmp().

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?

Cryptographic hash functions

  • Basic idea: one-way function (also called message digests)
    • Take an arbitrary length bit string m and reduce it to 100- (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-

Challenge-Response

  • So, Alice just sends H(Sab), 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

oo^ Challenge H(Sab+Challenge) (^) //

  • Challenge needs to be unique for every exchange
    • Does not need to be unpredictable

Adding mutual authentication

  • We already know how to authenticate Alice
    • Now we need to authenticate Bob
    • Just reverse the procedure

Alice Bob

oo^ Challenge^1 Challenge 2 H(Sab+Challenge1+Challenge2)

oo^ H(Sab+Challenge2+Challenge1)

  • Each side needs to control its own challenges
    • Otherwise we have replay issues again

Hijacking

  • This protocol still has a hijacking problem

Alice Attacker Bob

oo^ Challenge^1 oo Challenge^1

Challenge 2 H(Sab+Challenge1+Challenge1)

/^ Challenge^2 H(Sab+Challenge1+Challenge1)

oo^ H(Sab+Challenge2+Challenge1)^ oo H(Sab+Challenge2+Challenge1)

Attack commands (^) //

  • We need to authenticate the data
    • Not just the initial handshake

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

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(Sab + Challenge1 + Challenge2)
    • But now the key is the same in both directions
    • And the same as the challenge response!
    • Allows reflection attacks
  • Second attempt
    • Ka→b = H(Sab + ”AB” + Challenge1 + Challenge2)
    • Kb→a = H(Sab + ”BA” + Challenge1 + Challenge2)

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, RC

A (mostly) complete channel security protocol

Alice Bob

oo^ Challenge^1

Challenge 2 H(Sab+Challenge1+Challenge2)

oo^ H(Sab+Challenge2+Challenge1) E(ka→b,(M essage 1 ,M AC)) (^) //

oo^ E(kb→a,(M essage^2 ,M AC))

  • Each side knows who the other is
  • All messages are authenticated
  • All messages are confidential