T riple Handshake: can cryptography, formal methods, and applied - - PowerPoint PPT Presentation

t riple handshake
SMART_READER_LITE
LIVE PREVIEW

T riple Handshake: can cryptography, formal methods, and applied - - PowerPoint PPT Presentation

T riple Handshake: can cryptography, formal methods, and applied security be friends? http://miTLS.org Karthik Bhargavan Markulf Kohlweiss with Antoine Delignat-Lavaud, Cdric Fournet, Alfredo Pironti, Pierre-Yves Strub, Santiago Zanella


slide-1
SLIDE 1

T riple Handshake:

can cryptography, formal methods, and applied security be friends?

Karthik Bhargavan Markulf Kohlweiss

with Antoine Delignat-Lavaud, Cédric Fournet, Alfredo Pironti, Pierre-Yves Strub, Santiago Zanella Beguelin

http://miTLS.org

slide-2
SLIDE 2

2015 TLS1.3? OpenSSL, SecureTransport, NSS, SChannel, GnuTLS, JSSE, PolarSSL, … many bugs, attacks, patches every year Well-understood, detailed specs many security theorems… mostly for small simplified models of TLS

slide-3
SLIDE 3

Threat model Security Goal authenticity confidentiality

connect(server,port); send(d1); send(d2); send(d3); … accept(port); d1’ = recv(); d2’ = recv(); d3’ = recv(); …

authentication infrastructure

slide-4
SLIDE 4

Security Goal

X.509 public-key infrastructure

connect(server,port); send(d1); send(d2); send(d3); … accept(port); d1’ = recv(); d2’ = recv(); d3’ = recv(); …

slide-5
SLIDE 5

Client Server

slide-6
SLIDE 6

Client Server

slide-7
SLIDE 7

Client Server

slide-8
SLIDE 8

Client Server

slide-9
SLIDE 9

Many obsolete crypto constructions

  • Countermeasures
  • Disable these features:

SSL3, compression, RC4

  • Implement ad-hoc mitigations

very very carefully:

  • empty fragment to

initialize IV for TLS 1.0 AES-CBC

  • constant time mitigation

for Bleichenbacher attacks

  • constant-time plaintext

length-hiding HMAC to prevent Lucky 13

slide-10
SLIDE 10

Memory safety Buffer overruns leak secrets Missing checks Forgetting to verify signature/MAC/certificate bypasses crypto guarantees Certificate validation ASN.1 parsing, wildcard certificates State machine bugs Most TLS implementations don’t conform to spec Unexpected transitions break protocol (badly) (EarlyCCS, OpenSSL, …)

slide-11
SLIDE 11

Use formal methods!

  • Use a type-safe programming language
  • OCaml, F#, Java, C#,…
  • (No buffer overruns, no Heartbleed)
  • Verify the logical correctness of your code
  • Use a software verifier: Why3, F7/F*, Boogie, Frama-C,…
  • Link software invariants to cryptographic guarantees
  • Use a crypto verifier: EasyCrypt, CryptoVerif, ProVerif
  • Hire a cryptographer!
slide-12
SLIDE 12
slide-13
SLIDE 13
slide-14
SLIDE 14
slide-15
SLIDE 15

Security for TLS-DHE + authenticated encryption in the standard model Security for TLS- DHE + TLS-RSA + authenticated encryption Comprehensive modular treatment of a TLS handshake implementation

slide-16
SLIDE 16
slide-17
SLIDE 17
slide-18
SLIDE 18

completes a cert ms, k tag

slide-19
SLIDE 19

KEM

DHGroup DH

KEF

KDF/ MAC RSA Cert Sig SessionDB StAE LHAE Enc MAC Record Dispatch

TCP

Untyped Adversary Encode LHAEPlain StPlain TLSFragment Alert Datastream Handshake (and CCS) TLSInfo TLSConstants

Handshake/CCS TLS Record

AppData

Base

Bytes Untyped API

Adversary

RPC RPCPlain

Application TLS API Alert Protocol AppData Protocol

Nonce TLS CoreCrypto RSAKey Auth AuthPlain Extensions

1 2 3 4 5 6 7

Range

8 9

Error

slide-20
SLIDE 20

security specification

  • type Connection // for each local instance of the protocol

type (;c:Connection) AppData // creating new client and server instances val connect: TcpStream -> Params -> Connection val accept: TcpStream -> Params -> Connection // reading data type (;c:Connection) IOResult_i = | Read of c':Connection * data:(;c) AppData | CertQuery of c':Connection | Complete of c':Connection { Agreement(c’) } | Close of TcpStream | Warning of c':Connection * a:AlertDescription | Fatal of a:AlertDescription val read : c:Connection -> (;c) IOResult_i // writing data type (;c:Connection,data:(;c) AppData) IOResult_o = | WriteComplete of c':Connection | WritePartial

  • f c':Connection * rest:(;c') AppData

| MustRead

  • f c':Connection

val write: c:Connection -> data:(;c) AppData -> (;c,data) IOResult_o // triggering new handshakes, and closing connections val rehandshake: c:Connection -> Connection Result val request: c:Connection -> Connection Result val shutdown: c:Connection TcpStream Result

slide-21
SLIDE 21

KEM

DHGroup DH

KEF

KDF/ MAC RSA Cert Sig SessionDB StAE LHAE Enc MAC Record Dispatch

TCP

Untyped Adversary Encode LHAEPlain StPlain TLSFragment Alert Datastream Handshake (and CCS) TLSInfo TLSConstants

Handshake/CCS TLS Record

AppData

Base

Bytes Untyped API

Adversary

RPC RPCPlain

Application TLS API Alert Protocol AppData Protocol

Nonce TLS CoreCrypto RSAKey Auth AuthPlain Extensions

1 2 3 4 5 6 7

Range

8 9

Error

slide-22
SLIDE 22
slide-23
SLIDE 23
slide-24
SLIDE 24
slide-25
SLIDE 25
slide-26
SLIDE 26
slide-27
SLIDE 27

concrete TLS & ideal TLS are computationally indistinguishable using standard program verification (typing)

miTLS LS implementa lementation tion

miTL TLS typed API

Bytes tes, Netw etwor

  • rk

lib.fs Crypto yptograph graphic ic Prov

  • vid

ider er

cryptogra graph phic assu sumpt ption

  • ns

any program representing the adversary application data stream miTLS LS ideal al implementa lementation tion

miTL TLS typed API

application

Safe, e, except pt for a neglig igib ible le probabil abilit ity Safe e by typin ing (info-theo eore retica ically lly)

slide-28
SLIDE 28

7,000 lines of F# checked against 3,000 lines of F7 type annotations + 3,000 lines of EasyCrypt for the core key exchange Ongoing work ECDHE, GCM, Certificates, Side-channels

miTLS LS implementa lementation tion

miTL TLS typed API

Bytes tes, Netw etwor

  • rk

lib.fs Crypto yptograph graphic ic Prov

  • vid

ider er

cryptogra graph phic assu sumpt ption

  • ns

any program representing the adversary application data stream miTLS LS ideal al implementa lementation tion

miTL TLS typed API

application

slide-29
SLIDE 29
slide-30
SLIDE 30

Client Server

slide-31
SLIDE 31

Client Server

Efficiency: One round-trip before client sends data Security?

slide-32
SLIDE 32

completes Agreement there must be a unique server that agrees on the variables in both the abbreviated handshake and the

  • riginal handshake

Authenticity and Confidentiality: (as usual)

C C S S

slide-33
SLIDE 33
slide-34
SLIDE 34
  • M can log in as

u at S!

slide-35
SLIDE 35

S appends Data,Data’

  • S concatenates

data sent by M to data sent by u!

slide-36
SLIDE 36

cid

Extract TLS-level channel identifier cid

cid’

Does not work if M can ensure that cid = cid’ Computing a channel identifier (cid):

  • f(master secret) (EAP)
  • f(handshake log) (Renegotiation Indication,SASL)

Bind cid to User authentication

slide-37
SLIDE 37

If an endpoint completes renegotiation with an honest peer and (all) strong algorithms, then Agreement there must be a peer endpoint that agrees on all variables in the new and the old handshake (even if the peer in the old handshake was compromised or unauthenticated) More generally, in a sequence of handshakes, the last handshake guarantees agreement on all previous ones

C S

slide-38
SLIDE 38

Details, demos at: http://secure-resumption.com

slide-39
SLIDE 39

Key Synchronization Attack

RSA Key Synchronization DHE Key Synchronization Does not break Markulf’s theorem “ honest server Breaks EAP compound authentication (reenables 2002 attack)

slide-40
SLIDE 40

Transcript Synchronization Attack

Abbreviated agreement Does not break Markulf’s theorem

“ honest

Breaks transcript-based channel identifiers

After resumption, handshake log is not a good channel identifier Breaks tls-unique (SASL), renegotiation indication

slide-41
SLIDE 41

User Impersonation Attack

Surely this must break Markulf’s multi-handshake theorem?

Renegotiation with honest peer implies agreement on abbreviated handshake, but not on original handshake Theorem needs honest peer in original handshake for agreement on all three

Impact

A malicious website can impersonate any user who uses client certificates on any other website that requires client certificate auth, and supports resumption and renegotiation

slide-42
SLIDE 42

Disallow server certificate change during renegotiation Preferred fix for web browsers (same origin policy) Use only well-known DH groups and validate DH keys Preferred fix for TLS libraries (good idea anyway) Disallow client authentication after resumption How else can we fix SASL, EAP? Root problem: master secret is not context bound

slide-43
SLIDE 43
slide-44
SLIDE 44
slide-45
SLIDE 45

http://secure-resumption.com http://mitls.org

slide-46
SLIDE 46