34
Computer-Aided Security Proofs, Aarhus, Oct 9—13 2017 Security Verification with F* Cédric Fournet Catalin Hritcu Aseem Rastogi

Cédric Fournet Catalin Hritcu Aseem Rastogi...HTTP, reverse proxy, mail,… We replace OpenSSL with miTLS & its crypto: the modified server supports TLS 1.3 with tickets and 0-RTT

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Cédric Fournet Catalin Hritcu Aseem Rastogi...HTTP, reverse proxy, mail,… We replace OpenSSL with miTLS & its crypto: the modified server supports TLS 1.3 with tickets and 0-RTT

Computer-Aided Security Proofs, Aarhus, Oct 9—13 2017

Security Verification with F*Cédric FournetCatalin HritcuAseem Rastogi

Page 2: Cédric Fournet Catalin Hritcu Aseem Rastogi...HTTP, reverse proxy, mail,… We replace OpenSSL with miTLS & its crypto: the modified server supports TLS 1.3 with tickets and 0-RTT

Everest*: Verified Drop-in Replacements for TLS/HTTPS

*th

e E

vere

st V

ER

ifie

dEn

d-t

o-e

nd

Secu

re T

ran

spo

rt

Page 3: Cédric Fournet Catalin Hritcu Aseem Rastogi...HTTP, reverse proxy, mail,… We replace OpenSSL with miTLS & its crypto: the modified server supports TLS 1.3 with tickets and 0-RTT

Services & Applications

ServersClients

cURL WebKit IIS ApacheSkype NginxEdge

HTTPS Ecosystem

Page 4: Cédric Fournet Catalin Hritcu Aseem Rastogi...HTTP, reverse proxy, mail,… We replace OpenSSL with miTLS & its crypto: the modified server supports TLS 1.3 with tickets and 0-RTT

4

***

TLS

X.509

HTTPS

RSA SHA

ECDH

Network buffers

Untrusted network (TCP, UDP, …)

Crypto Algorithms

4Q

Services & Applications

ASN.1Certification

Authority

ServersClients

cURL WebKit IIS ApacheSkype NginxEdge

Page 5: Cédric Fournet Catalin Hritcu Aseem Rastogi...HTTP, reverse proxy, mail,… We replace OpenSSL with miTLS & its crypto: the modified server supports TLS 1.3 with tickets and 0-RTT

Buffer overflowsIncorrect state machinesLax certificate parsingWeak or poorly implemented cryptoSide channels

Implicit security goalsDangerous APIsFlawed standards

OpenSSL, SChannel, NSS, …Monthly security patches

5

***

TLS

X.509

HTTPS

RSA SHA

ECDH

Network buffers

Untrusted network (TCP, UDP, …)

Crypto Algorithms

4Q

Services & Applications

ASN.1Certification

Authority

ServersClients

cURL WebKit IIS ApacheSkype NginxEdge

Page 6: Cédric Fournet Catalin Hritcu Aseem Rastogi...HTTP, reverse proxy, mail,… We replace OpenSSL with miTLS & its crypto: the modified server supports TLS 1.3 with tickets and 0-RTT

***

TLS

X.509

HTTPS

RSA SHA

ECDH

Network buffers

Untrusted network (TCP, UDP, …)

Crypto Algorithms

AES

Services & Applications

ASN.1Certification

Authority

ServersClients

cURL WebKit IIS ApacheSkype NginxEdge

Verified Components for the HTTPS Ecosystem

Page 7: Cédric Fournet Catalin Hritcu Aseem Rastogi...HTTP, reverse proxy, mail,… We replace OpenSSL with miTLS & its crypto: the modified server supports TLS 1.3 with tickets and 0-RTT

Redmond

Paris (INRIA)

Cambridge

Chris

Hawblitzel

Cédric

Fournet

Antoine

Delignat-Lavaud

Karthik

Bhargavan

Bryan Parno

Markulf

Kohlweiss

Jean Karim

Zinzindohoue

Santiago

Zanella-Beguelin

Nik Swamy

Jonathan

Protzenko

Aseem

Rastogi

Bangalore

Leonardo

de Moura

Catalin Hritcu

Nadim

Kobeissi

Tahina

Ramanandro

Barry Bond

Pittsburgh (CMU)

Kenji

Maillard

Benjamin

Beurdouche

Christoph

Wintersteiger

Patrice

Godefroid

Danel Ahman

Victor Dumitrescu

Page 8: Cédric Fournet Catalin Hritcu Aseem Rastogi...HTTP, reverse proxy, mail,… We replace OpenSSL with miTLS & its crypto: the modified server supports TLS 1.3 with tickets and 0-RTT
Page 9: Cédric Fournet Catalin Hritcu Aseem Rastogi...HTTP, reverse proxy, mail,… We replace OpenSSL with miTLS & its crypto: the modified server supports TLS 1.3 with tickets and 0-RTT

By implementing standardized components and proving them secure,we validate both their design and our code.

kreMLin

source code, specs, security definitions,

crypto games & constructions, proofs…

interop with rest of TLS/HTTPS ecosystem

verify all properties

(using automated provers)

then erase all proofs

extract low-level code,

with good performance &

(some) side-channel protection

production code

C/C++

Page 10: Cédric Fournet Catalin Hritcu Aseem Rastogi...HTTP, reverse proxy, mail,… We replace OpenSSL with miTLS & its crypto: the modified server supports TLS 1.3 with tickets and 0-RTT

The TLS/HTTPS ecosystem

***

TLS

X.509

HTTPS

RSA SHA

ECDH

Network buffers

Crypto Algorithms

4Q

ASN.1

Page 11: Cédric Fournet Catalin Hritcu Aseem Rastogi...HTTP, reverse proxy, mail,… We replace OpenSSL with miTLS & its crypto: the modified server supports TLS 1.3 with tickets and 0-RTT

2008 TLS 1.22017? TLS 1.3

OpenSSL SChannel NSS SecureTransport PolarSSL JSSE GnuTLS miTLS

https://github.com/openssl/openssl

https://openssl.org/news/vulnerabilities.html

Page 12: Cédric Fournet Catalin Hritcu Aseem Rastogi...HTTP, reverse proxy, mail,… We replace OpenSSL with miTLS & its crypto: the modified server supports TLS 1.3 with tickets and 0-RTT

Threat modelSecurity Goal

connect(server,port);

send “GET…”;

data = recv();

send “POST…”;

accept(port);

request = recv();

send “<html>…”;

order = recv();

Public Key

Infrastructure

Page 13: Cédric Fournet Catalin Hritcu Aseem Rastogi...HTTP, reverse proxy, mail,… We replace OpenSSL with miTLS & its crypto: the modified server supports TLS 1.3 with tickets and 0-RTT

Client Server

Page 14: Cédric Fournet Catalin Hritcu Aseem Rastogi...HTTP, reverse proxy, mail,… We replace OpenSSL with miTLS & its crypto: the modified server supports TLS 1.3 with tickets and 0-RTT

(some of them broken)Client Server

Page 15: Cédric Fournet Catalin Hritcu Aseem Rastogi...HTTP, reverse proxy, mail,… We replace OpenSSL with miTLS & its crypto: the modified server supports TLS 1.3 with tickets and 0-RTT

Excluding crypto algorithms, X.509, …

Not fully mechanized(paper proofs too)

Not production code(poor performance)

1. Internet Standard compliance & interoperability

2. Verified security

3. Experimental platform

Page 16: Cédric Fournet Catalin Hritcu Aseem Rastogi...HTTP, reverse proxy, mail,… We replace OpenSSL with miTLS & its crypto: the modified server supports TLS 1.3 with tickets and 0-RTT

https://www.secure-resumption.com/

flaw in the standard

now patched in TLS

Page 17: Cédric Fournet Catalin Hritcu Aseem Rastogi...HTTP, reverse proxy, mail,… We replace OpenSSL with miTLS & its crypto: the modified server supports TLS 1.3 with tickets and 0-RTT

deviant traces

new attacks against all mainstream implementations

Test results

for OpenSSL:

each colored

arrow is a bug

Page 18: Cédric Fournet Catalin Hritcu Aseem Rastogi...HTTP, reverse proxy, mail,… We replace OpenSSL with miTLS & its crypto: the modified server supports TLS 1.3 with tickets and 0-RTT

deviant traces

Many many exploitable bugs

new attacks against all mainstream implementations

An attack

against TLS

Java Library

(open for

10 years)

Page 19: Cédric Fournet Catalin Hritcu Aseem Rastogi...HTTP, reverse proxy, mail,… We replace OpenSSL with miTLS & its crypto: the modified server supports TLS 1.3 with tickets and 0-RTT

Man-in-the-middle attack against:

• servers that support RSA_EXPORT (512bit keys obsoleted in 2000) from 40% to 8.5%

• clients that accept ServerKeyExchange in RSA (state machine bug) almost all browsers have been patched

Factoring

in 7-10h

Page 20: Cédric Fournet Catalin Hritcu Aseem Rastogi...HTTP, reverse proxy, mail,… We replace OpenSSL with miTLS & its crypto: the modified server supports TLS 1.3 with tickets and 0-RTT

Crypto

failures

2007 2008 2009 2010 2011 2012 2013 2014 2015

2016

Protocol

weaknesses

Implementation

bugs

EarlyCCS

Heartbleed

POODLE

Triple

Handshake

SKIP

FREAK

Logjam

SLOTH DROWN

Renegotiation

Attack

ECDHE Cross-

protocol AttackBEAST

(Rogaway 02)

Lucky13

RC4MD5

OpenSSL entropy

CRIME

RSA 512 bit SHA1

Page 21: Cédric Fournet Catalin Hritcu Aseem Rastogi...HTTP, reverse proxy, mail,… We replace OpenSSL with miTLS & its crypto: the modified server supports TLS 1.3 with tickets and 0-RTT

Much discussionsIETF, Google, Mozilla, Microsoft, CDNs, cryptographers, network engineers, …

Much improvements• Modern design

• Fewer roundtrips

• Stronger security

New implementationsrequired for all

• Be first & verified too!

• Find & fix flaws before it’s too late

Page 22: Cédric Fournet Catalin Hritcu Aseem Rastogi...HTTP, reverse proxy, mail,… We replace OpenSSL with miTLS & its crypto: the modified server supports TLS 1.3 with tickets and 0-RTT

Client has no guaranteethe server is present or unique.

Server has no guarantee the client agrees on the connection

Trading performancefor security

Page 23: Cédric Fournet Catalin Hritcu Aseem Rastogi...HTTP, reverse proxy, mail,… We replace OpenSSL with miTLS & its crypto: the modified server supports TLS 1.3 with tickets and 0-RTT

https://www.secure-resumption.com/

IETF WG9599

1321st draft including some of our proposals

RFC finalized this month?

Page 24: Cédric Fournet Catalin Hritcu Aseem Rastogi...HTTP, reverse proxy, mail,… We replace OpenSSL with miTLS & its crypto: the modified server supports TLS 1.3 with tickets and 0-RTT

***

TLS

X.509

HTTPS

RSA SHA

ECDH

Network buffers

Crypto Algorithms

4Q

ASN.1

Page 25: Cédric Fournet Catalin Hritcu Aseem Rastogi...HTTP, reverse proxy, mail,… We replace OpenSSL with miTLS & its crypto: the modified server supports TLS 1.3 with tickets and 0-RTT
Page 26: Cédric Fournet Catalin Hritcu Aseem Rastogi...HTTP, reverse proxy, mail,… We replace OpenSSL with miTLS & its crypto: the modified server supports TLS 1.3 with tickets and 0-RTT

Example: tracing https://www.visualstudio.com/

• Trust is transitive

• Trust is implicit

• Trust is a matter of state

***

TLS

X.509

HTTPS

RSA SHA

ECDH

Network buffers

Crypto Algorithms

4Q

ASN.1

Page 27: Cédric Fournet Catalin Hritcu Aseem Rastogi...HTTP, reverse proxy, mail,… We replace OpenSSL with miTLS & its crypto: the modified server supports TLS 1.3 with tickets and 0-RTT

Unsolved issues with HTTPS

2006 2007 2008 2009 2010 2011 2012 2013 2014

2015

SSL Stripping

(Marlinspike)

Cookie-based Attacks

(various variants)

CRIME / BREACH

(Rizzo, Duong et al.)

Virtual Host Confusion

(Delignat-Lavaud)

TLS is optional in HTTP and

can be disabled by an

active attacker

Shared cookie database for

HTTP and HTTPS can be

used to mount various

session fixation and login

CSRF attacks.

Attackers can easily mount

adaptive chosen-plaintext

attacks. Encryption after

compression can leak

secrets through length.

HTTPS servers do not

correlate transport-layer

and HTTP identities,

leading to origin confusion

Mitigated by correct use of

HTTP Strict Transport

Security (HSTS)

Mitigated by new binding

proposals (ChannelID,

Token Binding). Mitigation

is not widely implemented.

Mitigated by refreshing

secrets (e.g. CSRF tokens).

Some protocol-specific

mitigations (QUICK, HTTP2)

Mitigated by configuration

of HTTPS servers with strict

host rules

Mitigation not widely used.

and vulnerability is still

widespread in practice.

Difficult to mitigate in

browsers with current

technologies. Can be used

to attack many websites.

Ad-hoc mitigation; attack is

still widespread in practice

as HTTP compression

remains popular.

Ad-hoc mitigation.

Attack still widespread in

practice.

Page 28: Cédric Fournet Catalin Hritcu Aseem Rastogi...HTTP, reverse proxy, mail,… We replace OpenSSL with miTLS & its crypto: the modified server supports TLS 1.3 with tickets and 0-RTT

https://letsencrypt.org/ ***

TLS

X.509

HTTPS

RSA SHA

ECDH

Network buffers

Crypto Algorithms

4Q

ASN.1

Page 29: Cédric Fournet Catalin Hritcu Aseem Rastogi...HTTP, reverse proxy, mail,… We replace OpenSSL with miTLS & its crypto: the modified server supports TLS 1.3 with tickets and 0-RTT

Crypto failuresA Timeline of Recent PKI Failures

2006 2007 2008 2009 2010 2011 2012 2013 2014

2015

HashClash rogue CA

(MD5 collision)

Stevens et al.

Flame malware

NSA/GCHQ attack

against Windows CA Bleichenbacher’s

e=3 attack on

PKCS#1 signatures

512 bit Korean

School CAs

TÜRKTRUST

BERSerk

(MSR—Inria)

DigiNotar hack

Usage-unrestricted

VeriSign certificates

ANSSIComodo hack TrustwaveVeriSign

NetDiscovery

Debian OpenSSL entropy bug

Basic constraints not enforced (recurring catastrophic bug)

OpenSSL

null prefix

The SHAppening

DROWN

KeyUsage

Name constraints failures

VeriSign hack

OpenSSL CVE-

2015-1793

GnuTLS X509v1

Formatting & semantics

CA failures

Page 30: Cédric Fournet Catalin Hritcu Aseem Rastogi...HTTP, reverse proxy, mail,… We replace OpenSSL with miTLS & its crypto: the modified server supports TLS 1.3 with tickets and 0-RTT

Side Channel Challenge (Attacks)

2000 … 2006 2007 2008 2009 2010 2011 2012 2013 2014

Protocol-levelside channels

Traffic analysis Timing attacks against cryptographic primitives

Memory & Cache

TLS messages may reveal information about the internal protocol state or the application data

Combined analysis of the time and length distributions of packets leaks information about the application

A remote attacker may learn information about crypto secrets by timing execution time for various inputs

Memory access patterns may expose secrets, in particular because caching may expose sensitive data (e.g. by timing)

• Hello message contents (e.g. time in nonces, SNI)

• Alerts (e.g. decryption vs. padding alerts)

• Record headers

• CRIME/BREACH (adaptive chosen plaintext attack)

• User tracking• Auto-complete input theft

• Bleichenbacher attacks against PKCS#1 decryption and signatures

• Timing attacks against RC4 (Lucky 13)

• OpenSSL key recovery in virtual machines

• Cache timing attacks against AES

AES cache timing

Bleichenbacher

CRIME Lucky13 DROWN ->

Remote timing attacks are practical

BREACH

Tag size

Side-channel leaks in Web applications

ECDSA timing

Vaudenay

Page 31: Cédric Fournet Catalin Hritcu Aseem Rastogi...HTTP, reverse proxy, mail,… We replace OpenSSL with miTLS & its crypto: the modified server supports TLS 1.3 with tickets and 0-RTT

Demo

Page 32: Cédric Fournet Catalin Hritcu Aseem Rastogi...HTTP, reverse proxy, mail,… We replace OpenSSL with miTLS & its crypto: the modified server supports TLS 1.3 with tickets and 0-RTT

miTLS, protocol layer:

16K lines of code and proofs

Compiled to Ocaml.

Partially verified.

AEAD record-layer crypto

14K lines of code and proofs

Verified & compiled to C

Page 33: Cédric Fournet Catalin Hritcu Aseem Rastogi...HTTP, reverse proxy, mail,… We replace OpenSSL with miTLS & its crypto: the modified server supports TLS 1.3 with tickets and 0-RTT

A high performance server for

HTTP, reverse proxy, mail,…

We replace OpenSSL with miTLS & its crypto:

the modified server supports TLS 1.3

with tickets and 0-RTT requests.

We integrate miTLS & its verified crypto

with Internet Explorer.

We run TLS 1.3 sessions with 0RTT

without changing their application code.

Page 34: Cédric Fournet Catalin Hritcu Aseem Rastogi...HTTP, reverse proxy, mail,… We replace OpenSSL with miTLS & its crypto: the modified server supports TLS 1.3 with tickets and 0-RTT

Wo

rker

Thre

ad

Master Process

.

.

.

(IP1, Port1)

(IP2, Port2)

(IPk, Portk)

VirtualServer

VirtualServer

VirtualServer

Certificate

TLS

Certificate

TLS

Certificate

TLS

Wo

rer

Thre

ad

Wo

rker

Thre

ad

Backends

Application serversMemory Caches

Local Files

HTTP

FastCGI

Sendfile

mmap

AIO

Unix sockets

Nginx Architecture