30
Secure sessions Karthikeyan Bhargavan Ricardo Corin Pierre-Malo Deni´ elou edric Fournet James J. Leifer 29 April 2010 Joint Institutes Workshop, Orsay Karthikeyan Bhargavan, Ricardo Corin, Pierre-Malo Deni´ edric Fournet, James J. Leifer Secure sessions 1 / 16

Karthikeyan Bhargavan Ricardo Corin Pierre-Malo Deni elou C …pauillac.inria.fr/~leifer/articles/leifer-sessions-joint... · 2010-05-01 · Karthikeyan Bhargavan, Ricardo Corin,

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Karthikeyan Bhargavan Ricardo Corin Pierre-Malo Deni elou C …pauillac.inria.fr/~leifer/articles/leifer-sessions-joint... · 2010-05-01 · Karthikeyan Bhargavan, Ricardo Corin,

Secure sessions

Karthikeyan Bhargavan Ricardo Corin Pierre-Malo Denielou

Cedric Fournet James J. Leifer

29 April 2010

Joint Institutes Workshop, Orsay

Karthikeyan Bhargavan, Ricardo Corin, Pierre-Malo Denielou [2ex], Cedric Fournet, James J. Leifer, ()Secure sessions 1 / 16

Page 2: Karthikeyan Bhargavan Ricardo Corin Pierre-Malo Deni elou C …pauillac.inria.fr/~leifer/articles/leifer-sessions-joint... · 2010-05-01 · Karthikeyan Bhargavan, Ricardo Corin,

Goal

Make it simple to write distributed programs that engage inorchestrated patterns of secure communication

between multiple peers.

Alice Bob

Charlie

Piece of cake! (Assuming we control the network and all the peers.)

Karthikeyan Bhargavan, Ricardo Corin, Pierre-Malo Denielou [2ex], Cedric Fournet, James J. Leifer, ()Secure sessions 2 / 16

Page 3: Karthikeyan Bhargavan Ricardo Corin Pierre-Malo Deni elou C …pauillac.inria.fr/~leifer/articles/leifer-sessions-joint... · 2010-05-01 · Karthikeyan Bhargavan, Ricardo Corin,

Goal

Make it simple to write distributed programs that engage inorchestrated patterns of secure communication

between multiple peers.

Alice Bob

CharliePiece of cake! (Assuming we control the network and all the peers.)

Karthikeyan Bhargavan, Ricardo Corin, Pierre-Malo Denielou [2ex], Cedric Fournet, James J. Leifer, ()Secure sessions 2 / 16

Page 4: Karthikeyan Bhargavan Ricardo Corin Pierre-Malo Deni elou C …pauillac.inria.fr/~leifer/articles/leifer-sessions-joint... · 2010-05-01 · Karthikeyan Bhargavan, Ricardo Corin,

But the network is not under our control...

(The internet circa 2005)

Karthikeyan Bhargavan, Ricardo Corin, Pierre-Malo Denielou [2ex], Cedric Fournet, James J. Leifer, ()Secure sessions 3 / 16

Page 5: Karthikeyan Bhargavan Ricardo Corin Pierre-Malo Deni elou C …pauillac.inria.fr/~leifer/articles/leifer-sessions-joint... · 2010-05-01 · Karthikeyan Bhargavan, Ricardo Corin,

...and our peers may not be trustworthy

Karthikeyan Bhargavan, Ricardo Corin, Pierre-Malo Denielou [2ex], Cedric Fournet, James J. Leifer, ()Secure sessions 4 / 16

Page 6: Karthikeyan Bhargavan Ricardo Corin Pierre-Malo Deni elou C …pauillac.inria.fr/~leifer/articles/leifer-sessions-joint... · 2010-05-01 · Karthikeyan Bhargavan, Ricardo Corin,

Secure distributed programming

Only realistic security assumption:

The network and any coalition of peers are potentially malicious.

Designing a (correct) security protocol by hand is hard:

involves low-level, error-prone coding below communication abstractions,

depends on global message choreography,

needs to protect against coalitions of compromised peers.

Therefore, we propose:

to automatically generate tailored cryptographic protocols protecting againstthe network and compromised peers;

to hide implementation details and provide mechanised proofs of correctness.

Karthikeyan Bhargavan, Ricardo Corin, Pierre-Malo Denielou [2ex], Cedric Fournet, James J. Leifer, ()Secure sessions 5 / 16

Page 7: Karthikeyan Bhargavan Ricardo Corin Pierre-Malo Deni elou C …pauillac.inria.fr/~leifer/articles/leifer-sessions-joint... · 2010-05-01 · Karthikeyan Bhargavan, Ricardo Corin,

Secure distributed programming

Only realistic security assumption:

The network and any coalition of peers are potentially malicious.

Designing a (correct) security protocol by hand is hard:

involves low-level, error-prone coding below communication abstractions,

depends on global message choreography,

needs to protect against coalitions of compromised peers.

Therefore, we propose:

to automatically generate tailored cryptographic protocols protecting againstthe network and compromised peers;

to hide implementation details and provide mechanised proofs of correctness.

Karthikeyan Bhargavan, Ricardo Corin, Pierre-Malo Denielou [2ex], Cedric Fournet, James J. Leifer, ()Secure sessions 5 / 16

Page 8: Karthikeyan Bhargavan Ricardo Corin Pierre-Malo Deni elou C …pauillac.inria.fr/~leifer/articles/leifer-sessions-joint... · 2010-05-01 · Karthikeyan Bhargavan, Ricardo Corin,

Secure distributed programming

Only realistic security assumption:

The network and any coalition of peers are potentially malicious.

Designing a (correct) security protocol by hand is hard:

involves low-level, error-prone coding below communication abstractions,

depends on global message choreography,

needs to protect against coalitions of compromised peers.

Therefore, we propose:

to automatically generate tailored cryptographic protocols protecting againstthe network and compromised peers;

to hide implementation details and provide mechanised proofs of correctness.

Karthikeyan Bhargavan, Ricardo Corin, Pierre-Malo Denielou [2ex], Cedric Fournet, James J. Leifer, ()Secure sessions 5 / 16

Page 9: Karthikeyan Bhargavan Ricardo Corin Pierre-Malo Deni elou C …pauillac.inria.fr/~leifer/articles/leifer-sessions-joint... · 2010-05-01 · Karthikeyan Bhargavan, Ricardo Corin,

Sessions (contracts, conversations, workflows, ...)

c

wc

c

()Enough()

(q)Extra(q)

(x)Reply(x)(c ,w , q)Request(c ,w , q)

Text representation:

role c = send Request{c,w,q};

loop: recv [ Reply{x} → send Extra{q};loop | Enough ]

role w = recv Request{c,w,q} →loop: send ( Reply{x}; recv Extra{q} → loop + Enough )

Karthikeyan Bhargavan, Ricardo Corin, Pierre-Malo Denielou [2ex], Cedric Fournet, James J. Leifer, ()Secure sessions 6 / 16

Page 10: Karthikeyan Bhargavan Ricardo Corin Pierre-Malo Deni elou C …pauillac.inria.fr/~leifer/articles/leifer-sessions-joint... · 2010-05-01 · Karthikeyan Bhargavan, Ricardo Corin,

Sessions (contracts, conversations, workflows, ...)

c

wc

c

()Enough()

(q)Extra(q)

(x)Reply(x)(c ,w , q)Request(c ,w , q)

ExecutionLabels:

Request-Reply-Extra-Reply-Extra-Enough

Store:c :

Alice

w :

Bob

q:x :

Karthikeyan Bhargavan, Ricardo Corin, Pierre-Malo Denielou [2ex], Cedric Fournet, James J. Leifer, ()Secure sessions 7 / 16

Page 11: Karthikeyan Bhargavan Ricardo Corin Pierre-Malo Deni elou C …pauillac.inria.fr/~leifer/articles/leifer-sessions-joint... · 2010-05-01 · Karthikeyan Bhargavan, Ricardo Corin,

Sessions (contracts, conversations, workflows, ...)

c

wc

c

()Enough()

(q)Extra(q)

(x)Reply(x)(c ,w , q)Request(c ,w , q)

ExecutionLabels: Request

-Reply-Extra-Reply-Extra-Enough

Store:c : Alicew : Bobq: “Gone with the wind”x :

Karthikeyan Bhargavan, Ricardo Corin, Pierre-Malo Denielou [2ex], Cedric Fournet, James J. Leifer, ()Secure sessions 7 / 16

Page 12: Karthikeyan Bhargavan Ricardo Corin Pierre-Malo Deni elou C …pauillac.inria.fr/~leifer/articles/leifer-sessions-joint... · 2010-05-01 · Karthikeyan Bhargavan, Ricardo Corin,

Sessions (contracts, conversations, workflows, ...)

c

wc

c

()Enough()

(q)Extra(q)

(x)Reply(x)(c ,w , q)Request(c ,w , q)

ExecutionLabels: Request-Reply

-Extra-Reply-Extra-Enough

Store:c : Alicew : Bobq: “Gone with the wind”x : “8 euros”

Karthikeyan Bhargavan, Ricardo Corin, Pierre-Malo Denielou [2ex], Cedric Fournet, James J. Leifer, ()Secure sessions 7 / 16

Page 13: Karthikeyan Bhargavan Ricardo Corin Pierre-Malo Deni elou C …pauillac.inria.fr/~leifer/articles/leifer-sessions-joint... · 2010-05-01 · Karthikeyan Bhargavan, Ricardo Corin,

Sessions (contracts, conversations, workflows, ...)

c

wc

c

()Enough()

(q)Extra(q)

(x)Reply(x)(c ,w , q)Request(c ,w , q)

ExecutionLabels: Request-Reply-Extra

-Reply-Extra-Enough

Store:c : Alicew : Bobq: “In stock?”x : “8 euros”

Karthikeyan Bhargavan, Ricardo Corin, Pierre-Malo Denielou [2ex], Cedric Fournet, James J. Leifer, ()Secure sessions 7 / 16

Page 14: Karthikeyan Bhargavan Ricardo Corin Pierre-Malo Deni elou C …pauillac.inria.fr/~leifer/articles/leifer-sessions-joint... · 2010-05-01 · Karthikeyan Bhargavan, Ricardo Corin,

Sessions (contracts, conversations, workflows, ...)

c

wc

c

()Enough()

(q)Extra(q)

(x)Reply(x)(c ,w , q)Request(c ,w , q)

ExecutionLabels: Request-Reply-Extra-Reply

-Extra-Enough

Store:c : Alicew : Bobq: “In stock?”x : “yes”

Karthikeyan Bhargavan, Ricardo Corin, Pierre-Malo Denielou [2ex], Cedric Fournet, James J. Leifer, ()Secure sessions 7 / 16

Page 15: Karthikeyan Bhargavan Ricardo Corin Pierre-Malo Deni elou C …pauillac.inria.fr/~leifer/articles/leifer-sessions-joint... · 2010-05-01 · Karthikeyan Bhargavan, Ricardo Corin,

Sessions (contracts, conversations, workflows, ...)

c

wc

c

()Enough()

(q)Extra(q)

(x)Reply(x)(c ,w , q)Request(c ,w , q)

ExecutionLabels: Request-Reply-Extra-Reply-Extra

-Enough

Store:c : Alicew : Bobq: “Delivery date?”x : “yes”

Karthikeyan Bhargavan, Ricardo Corin, Pierre-Malo Denielou [2ex], Cedric Fournet, James J. Leifer, ()Secure sessions 7 / 16

Page 16: Karthikeyan Bhargavan Ricardo Corin Pierre-Malo Deni elou C …pauillac.inria.fr/~leifer/articles/leifer-sessions-joint... · 2010-05-01 · Karthikeyan Bhargavan, Ricardo Corin,

Sessions (contracts, conversations, workflows, ...)

c

wc

c

()Enough()

(q)Extra(q)

(x)Reply(x)(c ,w , q)Request(c ,w , q)

ExecutionLabels: Request-Reply-Extra-Reply-Extra-EnoughStore:

c : Alicew : Bobq: “Delivery date?”x : “yes”

Karthikeyan Bhargavan, Ricardo Corin, Pierre-Malo Denielou [2ex], Cedric Fournet, James J. Leifer, ()Secure sessions 7 / 16

Page 17: Karthikeyan Bhargavan Ricardo Corin Pierre-Malo Deni elou C …pauillac.inria.fr/~leifer/articles/leifer-sessions-joint... · 2010-05-01 · Karthikeyan Bhargavan, Ricardo Corin,

Expressivity

Loops, branching, value passing, and value rebinding (as we alreadysaw)

Committment “coin flips by telephone” (c commits to x without priorknowledge of y ; likewise, w chooses y without knowledge of x)

c w() Reveal (x)w (y) Flip (y)c (c,w,x) Commit (c,w)

Dynamic principal binding (the proxy p gets to choose the web serverw based on the client c and her login credentials q)

w c(x) Reply (x)

c() Forward (c,p,w,q)

p(w) Server (w)

c(c,p,q) Query (c,p,q)

Karthikeyan Bhargavan, Ricardo Corin, Pierre-Malo Denielou [2ex], Cedric Fournet, James J. Leifer, ()Secure sessions 8 / 16

Page 18: Karthikeyan Bhargavan Ricardo Corin Pierre-Malo Deni elou C …pauillac.inria.fr/~leifer/articles/leifer-sessions-joint... · 2010-05-01 · Karthikeyan Bhargavan, Ricardo Corin,

Threats against session integrity

Powerful Attacker model

can spy on transmitted messages

can join a session as any role

can initiate sessions

can access the libraries (networking,crypto)

cannot forge signatures

c oAbort

w

Reject

c

Offer

w oConfirm

ChangeAccept

o Contractc Request

Attacks against an insecure implementation

(Integrity) Rewrite Offer by Reject

(Replay) Intercept Reject and replay old Offer, triggering a new iteration

(Sender authentication) send Confirm to o without having received an Accept

... and many more against the store

Karthikeyan Bhargavan, Ricardo Corin, Pierre-Malo Denielou [2ex], Cedric Fournet, James J. Leifer, ()Secure sessions 9 / 16

Page 19: Karthikeyan Bhargavan Ricardo Corin Pierre-Malo Deni elou C …pauillac.inria.fr/~leifer/articles/leifer-sessions-joint... · 2010-05-01 · Karthikeyan Bhargavan, Ricardo Corin,

Protocol outline

Principles of ourprotocol generation

1 Each edge is implemented by a unique concrete message.

2 We want static message handling for efficiency.

Against replay attacks

between session executions: session nonces

between loop iterations: time stamps

at session initialisations: anti-replay caches

w cReplyp Forwardc Request

Against session flow attacks

Signatures of the entire message history (optimisations possible ...)

Karthikeyan Bhargavan, Ricardo Corin, Pierre-Malo Denielou [2ex], Cedric Fournet, James J. Leifer, ()Secure sessions 10 / 16

Page 20: Karthikeyan Bhargavan Ricardo Corin Pierre-Malo Deni elou C …pauillac.inria.fr/~leifer/articles/leifer-sessions-joint... · 2010-05-01 · Karthikeyan Bhargavan, Ricardo Corin,

Optimisation: visibility

Do we really need to include a complete signed history in every message?

c oAbort

w

Reject

c

Offer

w oConfirm

ChangeAccept

o Contractc Request

Execution paths: which signatures to convince the receiver?

Request-Contract-Reject

Request-Contract-Offer-Change-Offer-Change

Request-Contract-(Offer-Change)n-Reject-Abort

Visibility: at most one signature from each of the previous roles is enough.

Karthikeyan Bhargavan, Ricardo Corin, Pierre-Malo Denielou [2ex], Cedric Fournet, James J. Leifer, ()Secure sessions 11 / 16

Page 21: Karthikeyan Bhargavan Ricardo Corin Pierre-Malo Deni elou C …pauillac.inria.fr/~leifer/articles/leifer-sessions-joint... · 2010-05-01 · Karthikeyan Bhargavan, Ricardo Corin,

Message format

MessageHeaderSession IdSession code Nonce

Time stamp

Content… Payload

MACs

...

x y

MACHeader

… Hashes hx hy

Hashes

sid ts st hx hy

Karthikeyan Bhargavan, Ricardo Corin, Pierre-Malo Denielou [2ex], Cedric Fournet, James J. Leifer, ()Secure sessions 12 / 16

Page 22: Karthikeyan Bhargavan Ricardo Corin Pierre-Malo Deni elou C …pauillac.inria.fr/~leifer/articles/leifer-sessions-joint... · 2010-05-01 · Karthikeyan Bhargavan, Ricardo Corin,

Architecture

MLApplication

codeConcreteModel

F+S

Networking &Cryptography

ML compiler

MLApplication

code

Sessiondeclarations

An extension of MLwith sessions

S2ml,A secure session compiler

Concrete

Executable

Sessionimplementation

Karthikeyan Bhargavan, Ricardo Corin, Pierre-Malo Denielou [2ex], Cedric Fournet, James J. Leifer, ()Secure sessions 13 / 16

Page 23: Karthikeyan Bhargavan Ricardo Corin Pierre-Malo Deni elou C …pauillac.inria.fr/~leifer/articles/leifer-sessions-joint... · 2010-05-01 · Karthikeyan Bhargavan, Ricardo Corin,

Architecture

MLApplication

code

F+S

Networking &Cryptography

Sessionimplementation

ML compiler

SymbolicModel

Symbolic

formallyverified code

MLApplication

code

Sessiondeclarations

An extension of MLwith sessions

S2ml,A secure session compiler

Karthikeyan Bhargavan, Ricardo Corin, Pierre-Malo Denielou [2ex], Cedric Fournet, James J. Leifer, ()Secure sessions 13 / 16

Page 24: Karthikeyan Bhargavan Ricardo Corin Pierre-Malo Deni elou C …pauillac.inria.fr/~leifer/articles/leifer-sessions-joint... · 2010-05-01 · Karthikeyan Bhargavan, Ricardo Corin,

Architecture

MLApplication

codeConcreteModel

F+S

Networking &Cryptography

Sessionimplementation

ML compiler

SymbolicModel

Symbolic

formallyverified code

MLApplication

code

Sessiondeclarations

An extension of MLwith sessions

S2ml,A secure session compiler

Concrete

Executable

Karthikeyan Bhargavan, Ricardo Corin, Pierre-Malo Denielou [2ex], Cedric Fournet, James J. Leifer, ()Secure sessions 13 / 16

Page 25: Karthikeyan Bhargavan Ricardo Corin Pierre-Malo Deni elou C …pauillac.inria.fr/~leifer/articles/leifer-sessions-joint... · 2010-05-01 · Karthikeyan Bhargavan, Ricardo Corin,

Security result

Theorem (Session Integrity)

For any run of a S1....Sn-system, there is a partition of the compliantevents such that each equivalence class coincides with a compliantsubtrace of a session Si from from S1...Sn.

All events: ������������

Compliant events: ������������

...corresponding to S1 events: ������������

...and S2 events: ������������

Karthikeyan Bhargavan, Ricardo Corin, Pierre-Malo Denielou [2ex], Cedric Fournet, James J. Leifer, ()Secure sessions 14 / 16

Page 26: Karthikeyan Bhargavan Ricardo Corin Pierre-Malo Deni elou C …pauillac.inria.fr/~leifer/articles/leifer-sessions-joint... · 2010-05-01 · Karthikeyan Bhargavan, Ricardo Corin,

Security result

Theorem (Session Integrity)

For any run of a S1....Sn-system, there is a partition of the compliantevents such that each equivalence class coincides with a compliantsubtrace of a session Si from from S1...Sn.

All events: ������������

Compliant events: ������������

...corresponding to S1 events: ������������

...and S2 events: ������������

Karthikeyan Bhargavan, Ricardo Corin, Pierre-Malo Denielou [2ex], Cedric Fournet, James J. Leifer, ()Secure sessions 14 / 16

Page 27: Karthikeyan Bhargavan Ricardo Corin Pierre-Malo Deni elou C …pauillac.inria.fr/~leifer/articles/leifer-sessions-joint... · 2010-05-01 · Karthikeyan Bhargavan, Ricardo Corin,

Performance evaluationPerformance of the code generation

File Appli- Graph Compi-Session S Roles .session cation Local graph S.mli S.ml lation

(loc) (loc) (loc) (loc) (loc) (loc) (s)Single 2 5 21 8 12 19 247 1.26Rpc 2 7 25 10 18 23 377 1.35Forward 3 10 33 12 25 34 632 1.66Auth 4 15 45 16 38 49 1 070 1.86Ws 2 7 33 12 24 25 481 1.36Wsn 2 15 44 13 42 29 782 1.50Wsne 2 19 45 15 48 31 881 1.90Shopping 3 29 70 21 85 49 1 780 2.43Conf 3 48 86 37 181 78 3 451 3.32Loi 6 101 189 57 310 141 7 267 6.29

Performance of the generated code for Conf (10 000 messages)

Time OverheadUnprotected (no key establishment) 1.31 s 0 %Don’t sign but do cache checking 1.43 s 9 %

Sign but don’t verify 1.66 s 27 %Fully protected 1.77 s 35 %

Karthikeyan Bhargavan, Ricardo Corin, Pierre-Malo Denielou [2ex], Cedric Fournet, James J. Leifer, ()Secure sessions 15 / 16

Page 28: Karthikeyan Bhargavan Ricardo Corin Pierre-Malo Deni elou C …pauillac.inria.fr/~leifer/articles/leifer-sessions-joint... · 2010-05-01 · Karthikeyan Bhargavan, Ricardo Corin,

Conclusion

Security protocols are hard to write by hand. They arelong, complicated, difficult to verify, and fragile in the face ofspecification change.

Automatic generation with mechanised verification is the future!

We have:

designed a high-level session language,

built a compiler for generating secure implementations from sessionspecifications,

mechanised the verification of the resulting security protocols(executable code not just models!)

http://www.msr-inria.inria.fr/projects/sec/sessions/

Thank you and bon appetit!

Karthikeyan Bhargavan, Ricardo Corin, Pierre-Malo Denielou [2ex], Cedric Fournet, James J. Leifer, ()Secure sessions 16 / 16

Page 29: Karthikeyan Bhargavan Ricardo Corin Pierre-Malo Deni elou C …pauillac.inria.fr/~leifer/articles/leifer-sessions-joint... · 2010-05-01 · Karthikeyan Bhargavan, Ricardo Corin,

Conclusion

Security protocols are hard to write by hand. They arelong, complicated, difficult to verify, and fragile in the face ofspecification change.

Automatic generation with mechanised verification is the future!

We have:

designed a high-level session language,

built a compiler for generating secure implementations from sessionspecifications,

mechanised the verification of the resulting security protocols(executable code not just models!)

http://www.msr-inria.inria.fr/projects/sec/sessions/

Thank you and bon appetit!

Karthikeyan Bhargavan, Ricardo Corin, Pierre-Malo Denielou [2ex], Cedric Fournet, James J. Leifer, ()Secure sessions 16 / 16

Page 30: Karthikeyan Bhargavan Ricardo Corin Pierre-Malo Deni elou C …pauillac.inria.fr/~leifer/articles/leifer-sessions-joint... · 2010-05-01 · Karthikeyan Bhargavan, Ricardo Corin,

Conclusion

Security protocols are hard to write by hand. They arelong, complicated, difficult to verify, and fragile in the face ofspecification change.

Automatic generation with mechanised verification is the future!

We have:

designed a high-level session language,

built a compiler for generating secure implementations from sessionspecifications,

mechanised the verification of the resulting security protocols(executable code not just models!)

http://www.msr-inria.inria.fr/projects/sec/sessions/

Thank you and bon appetit!

Karthikeyan Bhargavan, Ricardo Corin, Pierre-Malo Denielou [2ex], Cedric Fournet, James J. Leifer, ()Secure sessions 16 / 16