Security proofs in the symbolic model the applied pi calculus - - PowerPoint PPT Presentation

security proofs in the symbolic model
SMART_READER_LITE
LIVE PREVIEW

Security proofs in the symbolic model the applied pi calculus - - PowerPoint PPT Presentation

Security proofs in the symbolic model the applied pi calculus Karthikeyan Bhargavan INRIA karthikeyan.bhargavan@inria.fr http://prosecco.inria.fr/personal/karthik September 2013 Karthikeyan Bhargavan (INRIA) Security proofs in the symbolic


slide-1
SLIDE 1

Security proofs in the symbolic model

the applied pi calculus Karthikeyan Bhargavan

INRIA karthikeyan.bhargavan@inria.fr http://prosecco.inria.fr/personal/karthik

September 2013

Karthikeyan Bhargavan (INRIA) Security proofs in the symbolic model September 2013 1 / 29

slide-2
SLIDE 2

Recap: Cryptographic protocols

Cryptographic protocol

A set of rules for the exchange of data between multiple principals that uses cryptography to achieve security goals against a threat model. Principal: a protocol participant, typically human or computer Security Goal: the confidentiality or integrity of a data item, or the authentication of a principal Threat Model: the capabilities of the attacker

Examples

Communications protocols: TLS, IPsec, SSH, WPA Tamper-proof hardware: Smartcard, Navigo, SIM card Privacy preserving applications: BitCoin, Electronic Voting

Karthikeyan Bhargavan (INRIA) Security proofs in the symbolic model September 2013 2 / 29

slide-3
SLIDE 3

Informal Notation

Principals: A (alice), B (bob), C (charlie), . . . Messages: m,n,o,. . .

Constructors: m, n (pairing), {m}k, sig{m}k, pk(m) Destructors: proj1(m), proj2(m),dec(m, k), verify(m, s, k)

proj1(m, n) = m, proj2(m, n) = n

A protocol is informally specified as a sequence of messages exchanged between principals:

  • 1. A −

→ B: m1

  • 2. B −

→ C: m2

  • 3. C −

→ A: m3 . . .

Denotes the expected behaviour of a single run of the protocol The goal of the attacker is to disrupt this behaviour!

Karthikeyan Bhargavan (INRIA) Security proofs in the symbolic model September 2013 3 / 29

slide-4
SLIDE 4

Recap: Writing protocols, finding attacks

Alice (A) wishes to perform an online transaction with her bank (B): A − → B : request B − → A : response

Karthikeyan Bhargavan (INRIA) Security proofs in the symbolic model September 2013 4 / 29

slide-5
SLIDE 5

Recap: Writing protocols, finding attacks

Alice (A) wishes to perform an online transaction with her bank (B): A − → B : request B − → A : response Encryption for confidentiality A − → B : {request}pk(B) B − → A : {response}pk(A)

Karthikeyan Bhargavan (INRIA) Security proofs in the symbolic model September 2013 4 / 29

slide-6
SLIDE 6

Recap: Writing protocols, finding attacks

Alice (A) wishes to perform an online transaction with her bank (B): A − → B : request B − → A : response Encryption for confidentiality A − → B : {request}pk(B) B − → A : {response}pk(A) Signature for integrity and authenticity A − → B : {request}pk(B), sig{{request}pk(B)}sk(A) B − → A : {response}pk(A), sig{{response}pk(A)}sk(B)

Karthikeyan Bhargavan (INRIA) Security proofs in the symbolic model September 2013 4 / 29

slide-7
SLIDE 7

Recap: Writing protocols, finding attacks

Alice (A) wishes to perform an online transaction with her bank (B): A − → B : request B − → A : response Encryption for confidentiality A − → B : {request}pk(B) B − → A : {response}pk(A) Signature for integrity and authenticity A − → B : {request}pk(B), sig{{request}pk(B)}sk(A) B − → A : {response}pk(A), sig{{response}pk(A)}sk(B) Nonces to prevent replays B − → A : {N}pk(A) A − → B : {N, request}pk(B), sig{{N, request}pk(B)}sk(A) B − → A : {N, response}pk(A), sig{{N, response}pk(A)}sk(B)

Karthikeyan Bhargavan (INRIA) Security proofs in the symbolic model September 2013 4 / 29

slide-8
SLIDE 8

Recap: From attacks to proofs

Our informal notation is adequate for finding and explaining attacks

replay, man-in-the-middle, guessing attacks, . . . that compromise confidentiality and authenticity

To precisely state and prove security theorems about cryptographic protocols, we need to move to a more formal setting.

Precisely state what actions each principal must do Formalize security goals and threat model Prove that these goals are met in all executions

Karthikeyan Bhargavan (INRIA) Security proofs in the symbolic model September 2013 5 / 29

slide-9
SLIDE 9

Recap: A small process calculus

Simplified version of the applied pi calculus [Abadi, Fournet, 2000] Names: a, b, c, . . . (used for keys, nonces, channels) Messages: M, N, . . .

Constructors: m, n (pairing), {m}k, sig{m}k, pk(m) Destructors: proj1(m), proj2(m), dec(m, k), verify(m, s, k)

Processes: P, Q, R, . . . P, Q, R ::= Processes null process new a.P fresh name generation in(c, x).P message input (continue as P)

  • ut(c, M).P

message output (continue as P) let x = g(M1, . . . , Mn) in P else Q destructor application if M = N then P else Q conditional P|Q parallel composition !P replication

Karthikeyan Bhargavan (INRIA) Security proofs in the symbolic model September 2013 6 / 29

slide-10
SLIDE 10

Today: The Applied Pi Calculus

Introduction and syntax: communication, concurrency, crypto Term semantics: equational theories, term reduction systems Process semantics: structural congruence, internal reduction Attacker knowledge: frames, deduction, labeled reduction Security goals: syntactic secrecy, authenticity Proof technique: invariants

Karthikeyan Bhargavan (INRIA) Security proofs in the symbolic model September 2013 7 / 29

slide-11
SLIDE 11

References

Books:

Communicating and Mobile Systems: The Pi Calculus, R. Milner The Pi-Calculus: A Theory of Mobile Processes, D. Sangiorgi

Papers:

Mobile values, new names, and secure communication, M. Abadi and

  • C. Fournet (POPL’01, ).

Applied pi calculus, M.D. Ryan, B. Smyth (Tutorial, 2011)

Karthikeyan Bhargavan (INRIA) Security proofs in the symbolic model September 2013 8 / 29

slide-12
SLIDE 12

Process Calculi

Process calculi have been proposed as models for distributed systems

CCS [Milner, ’80], CSP [Hoare, ’85], . . . pi calculus, join calculus, ambient calculus, . . .

Concurrency: P Q

Interleaving semantics: The actions in P and Q can happen in any

  • rder

Communication: out(c, M).P in(c, x).Q

Both synchronous and asynchronous variants Synchronous: instant communication, both processes evolve

  • ut(c, M).P in(c, x).Q −

→ P Q{M/x} Asynchronous: output first, input may happen later

  • ut(c, M).P −

→ P out c(M)

  • ut(c, M) in(c, x).Q −

→ Q{M/x}

Karthikeyan Bhargavan (INRIA) Security proofs in the symbolic model September 2013 9 / 29

slide-13
SLIDE 13

Pi Calculus

Proposed by Robin Milner in 1990s Dynamic creation of channels, capabilities

useful to model mobile code,replicated servers,. . . recently used to model security protocols, memory models, . . .

Names: a, b, c Fresh name generation: new a.P

create a fresh (secret) communication channel create a new memory location (channel) create a fresh random nonce, key, . . .

Replication: !P

create as many copies of P as necessary P P · · · P

Karthikeyan Bhargavan (INRIA) Security proofs in the symbolic model September 2013 10 / 29

slide-14
SLIDE 14

Adding Crypto: Applied Pi Calculus

Spi calculus [Abadi, Gordon ’99] adds cryptography to pi calculus

specific primitives are hard-coded (symmetric and asymmetric encryption)

Applied pi calculus [Abadi, Fournet ’00] generalizes spi calculus

an algebra of terms (constructors, destructors) equational theory to encode arbitrary cryptographic primitives can also encode complex message formats

Messages: m,n,o,. . .

Karthikeyan Bhargavan (INRIA) Security proofs in the symbolic model September 2013 11 / 29

slide-15
SLIDE 15

Adding Crypto: Applied Pi Calculus

Spi calculus [Abadi, Gordon ’99] adds cryptography to pi calculus

specific primitives are hard-coded (symmetric and asymmetric encryption)

Applied pi calculus [Abadi, Fournet ’00] generalizes spi calculus

an algebra of terms (constructors, destructors) equational theory to encode arbitrary cryptographic primitives can also encode complex message formats

Messages: m,n,o,. . .

Constructors: m, n (pairing), {m}k, sig{m}k, pk(m) Destructors: proj1(m), proj2(m),dec(m, k), verify(m, s, k)

proj1(m, n) = m, proj2(m, n) = n

Karthikeyan Bhargavan (INRIA) Security proofs in the symbolic model September 2013 11 / 29

slide-16
SLIDE 16

Term Syntax

N: an infinite (countable) set of names a, b, c, . . . X: an infinite (countable) set of variables x, y, z, . . . F: a finite signature of function symbols f , g, h, . . .

Includes constructors and destructors F = FC ∪ FD

Terms represent messages that may be sent between processes M, N, O, . . . ::= Terms a name x variable f (M1, . . . , Mn) function application T (Σ): terms constructed from the symbols in Σ

Σ contains names, variables, and functions

Karthikeyan Bhargavan (INRIA) Security proofs in the symbolic model September 2013 12 / 29

slide-17
SLIDE 17

Process Syntax

Processes: P, Q, R, . . . P, Q, R ::= Processes null process new a.P fresh name generation in(c, x).P message input (continue as P)

  • ut(c, M).P

message output (continue as P) if M = N then P else Q conditional P Q parallel composition !P replication

Karthikeyan Bhargavan (INRIA) Security proofs in the symbolic model September 2013 13 / 29

slide-18
SLIDE 18

Term Semantics: Equational Theories

A set of rules that define equality on terms M = N Example: encoding symmetric encryption

Functions: F = {senc, sdec} Equations: ∀M, N.sdec(senc(M, N), N) = M

= is the smallest equivalence on terms that includes these equations

senc(a, b) = senc(a, b) (reflexivity) senc(a, k) = senc(c, k) sdec(senc(a, k), k) = a (equation) sdec(senc(a, k), k′) = a senc(sdec(senc(a, k), k), k′) = senc(a, k′) (transitivity)

Karthikeyan Bhargavan (INRIA) Security proofs in the symbolic model September 2013 14 / 29

slide-19
SLIDE 19

Term Semantics: Term Rewriting System

A convenient way of expressing some equational theories R: a set of rules of the form: l → r

where l ∈ T (F ∪ X) (can use any function or variable, but no names) and r ∈ T (F ∪ X) (can use any function and any variable in l)

S →R T: term S rewrites to T if

S = St[M]: S has a subterm M M = lσ: M matches the left of some rewriting rule T = St[rσ] Note: S ∈ T (F ∪ X ∪ N): S can contain any symbol Assume: for each x ∈ dom(σ), xσ uses only constructor functions, no destructors

Example: encoding symmetric encryption

Rewrite rule: sdec(senc(x, y), y) → x Instance: sdec(senc(a, k), k) → a (M = S, σ = {a/x, k/y}) Instance: senc(sdec(senc(a, k), k), k′) → senc(a, k′) (M =?, σ =?)

Karthikeyan Bhargavan (INRIA) Security proofs in the symbolic model September 2013 15 / 29

slide-20
SLIDE 20

Term Semantics: Term Rewriting System

→∗

R: the reflexive, transitive closure of →R

=R: the symmetric, reflexive, transitive closure of →R Convergence: A term rewriting system R is convergent if it is:

Terminating: there is no infinite chain T1 →R T2 →R · · · Confluent: if S =R T, then there exists U such that S →∗

R U and T →∗ R U

Karthikeyan Bhargavan (INRIA) Security proofs in the symbolic model September 2013 16 / 29

slide-21
SLIDE 21

Term Semantics: Term Rewriting System

→∗

R: the reflexive, transitive closure of →R

=R: the symmetric, reflexive, transitive closure of →R Convergence: A term rewriting system R is convergent if it is:

Terminating: there is no infinite chain T1 →R T2 →R · · · Confluent: if S =R T, then there exists U such that S →∗

R U and T →∗ R U

M ↓R: the R-reduced form of M

S = M ↓R if M →∗

R S and S →R

M ↓R is defined (is unique) only if →R is convergent

Karthikeyan Bhargavan (INRIA) Security proofs in the symbolic model September 2013 16 / 29

slide-22
SLIDE 22

Term Semantics: Term Rewriting System

→∗

R: the reflexive, transitive closure of →R

=R: the symmetric, reflexive, transitive closure of →R Convergence: A term rewriting system R is convergent if it is:

Terminating: there is no infinite chain T1 →R T2 →R · · · Confluent: if S =R T, then there exists U such that S →∗

R U and T →∗ R U

M ↓R: the R-reduced form of M

S = M ↓R if M →∗

R S and S →R

M ↓R is defined (is unique) only if →R is convergent

For convergent R, M =R N if and only if M ↓R= N ↓R

Karthikeyan Bhargavan (INRIA) Security proofs in the symbolic model September 2013 16 / 29

slide-23
SLIDE 23

Process Semantics: Structural Congruence

≡: a structural congruence relation between processes P 0 ≡ P P Q ≡ Q P P (Q R) ≡ (P Q) R

Karthikeyan Bhargavan (INRIA) Security proofs in the symbolic model September 2013 17 / 29

slide-24
SLIDE 24

Process Semantics: Structural Congruence

≡: a structural congruence relation between processes P 0 ≡ P P Q ≡ Q P P (Q R) ≡ (P Q) R !P ≡ P !P

Karthikeyan Bhargavan (INRIA) Security proofs in the symbolic model September 2013 17 / 29

slide-25
SLIDE 25

Process Semantics: Structural Congruence

≡: a structural congruence relation between processes P 0 ≡ P P Q ≡ Q P P (Q R) ≡ (P Q) R !P ≡ P !P new a.0 ≡ 0 new a.new b.P ≡ new b.new a.P (new a.P) Q ≡ new a.(P Q) if a ∈ fn(Q)

Karthikeyan Bhargavan (INRIA) Security proofs in the symbolic model September 2013 17 / 29

slide-26
SLIDE 26

Process Semantics: Internal Reduction

τ

→: computation within a closed process

  • ut(c, M).P in(c, x).Q

τ

→ P Q{M/x}

More general form expects a pattern at the input and unifies it with M

if M = M then P else Q

τ

→ P if M = N then P else Q

τ

→ Q, if M = N

relies on =R defined by the term rewriting semantics

P

τ

→ Q if P ≡ P′ and Q ≡ Q′ and P′

τ

→ Q′

Karthikeyan Bhargavan (INRIA) Security proofs in the symbolic model September 2013 18 / 29

slide-27
SLIDE 27

Exercises

Write processes for the one-message protocol: A − → B : {request}pk(B), sig{{request}pk(B)}sk(A) Define the term rewriting system for public key encryption Describe the internal reduction sequence of these processes

Karthikeyan Bhargavan (INRIA) Security proofs in the symbolic model September 2013 19 / 29

slide-28
SLIDE 28

Modeling attacker knowledge: Frames

Frames: φ = new a.σ where σ is a substitution of the form: σ = {M1/x1, M2/x2, . . . , Mn/xn}

  • a are bound and may be renamed as necessary

Mi may not contain destructor symbols

We use frames to represent the terms that may become known to the adversary Example: new k.{senc(a, k)/x1, senc(b, k)/x2} As a process evolves, we collect all the information given to the adversary in a frame The adversary can use a frame to deduce additional terms

Karthikeyan Bhargavan (INRIA) Security proofs in the symbolic model September 2013 20 / 29

slide-29
SLIDE 29

Attacker knowledge: Deduction

Assume that the functions in F are divided into private and public functions: F = Fpub ∪ Fpriv The attacker can use public function symbols and fresh names to deduce terms from a frame φ ⊢ M: M can be deduced from φ

new a.{ M/ x} ⊢ Mi new a.{ M/ x} ⊢ b, if b ∈ N \ a new a.{ M/ x} ⊢ f (M1, . . . , Mn) if φ ⊢ Mi for each i ∈ [1..n] new a.{ M/ x} ⊢ N if new a.{ M/ x} ⊢ N and M =R N Exercise: Show how to deduce a from new a, k.{senc(a, k)/x1, k/x2}

Karthikeyan Bhargavan (INRIA) Security proofs in the symbolic model September 2013 21 / 29

slide-30
SLIDE 30

Extended Processes

Extend processes to record frames: A, B, C ::= Extended processes P process new a.A fresh name generation A B parallel composition {M/x} active substitution

Each active substitution assigns to a unique (free) variable Bound variables and names are renamed to be unique

φ(A): the frame of A, replace every plain process P in A by 0

Example: φ(new a.(P {M/x} Q)) ≡ new a.{M/x}

Karthikeyan Bhargavan (INRIA) Security proofs in the symbolic model September 2013 22 / 29

slide-31
SLIDE 31

Extended Process Semantics

≡: we extend ≡ to operate over extended processes

τ

→: we extend internal reductions over extended processes

l

→: a new labelled semantics for interacting with the environment

in(c, x).P

in(c,M)

→ P{M/x}

  • ut(c, M).P
  • ut(c,M↓)

→ P {M ↓ /x}, where x is a fresh variable

Karthikeyan Bhargavan (INRIA) Security proofs in the symbolic model September 2013 23 / 29

slide-32
SLIDE 32

Extended Process Semantics

≡: we extend ≡ to operate over extended processes

τ

→: we extend internal reductions over extended processes

l

→: a new labelled semantics for interacting with the environment

in(c, x).P

in(c,M)

→ P{M/x}

  • ut(c, M).P
  • ut(c,M↓)

→ P {M ↓ /x}, where x is a fresh variable A

l

→ B if A ≡ A′ and B ≡ B′ and A′

l

→ B′

Karthikeyan Bhargavan (INRIA) Security proofs in the symbolic model September 2013 23 / 29

slide-33
SLIDE 33

Extended Process Semantics

≡: we extend ≡ to operate over extended processes

τ

→: we extend internal reductions over extended processes

l

→: a new labelled semantics for interacting with the environment

in(c, x).P

in(c,M)

→ P{M/x}

  • ut(c, M).P
  • ut(c,M↓)

→ P {M ↓ /x}, where x is a fresh variable A

l

→ B if A ≡ A′ and B ≡ B′ and A′

l

→ B′ C[A]

l

→ C[B] if

A

l

→ B, and C is an evaluation context (extended process with a hole) if l = in(c, M) then φ(C[A]) ⊢ M

Every output on a public channel goes to the attacker’s frame Every input on a public channel must be deducible from the frame

Karthikeyan Bhargavan (INRIA) Security proofs in the symbolic model September 2013 23 / 29

slide-34
SLIDE 34

Exercises

Write extended processes for the one-message protocol: A − → B : {request}pk(B), sig{{request}pk(B)}sk(A) Describe the labeled reduction sequence of these processes as it interacts with an unknown environment over the net channel.

Karthikeyan Bhargavan (INRIA) Security proofs in the symbolic model September 2013 24 / 29

slide-35
SLIDE 35

Properties and Security Goals

Functional Adequacy: Is there a valid reduction sequence that reaches the end of each process (no deadlock)

Note that the attacker can still block network messages, so there may well be valid reduction sequences that do not complete the protocol

Syntactic Secrecy: Is there a reduction sequence that ends in a frame where the attacker can deduce a secret name a?

In our protocol, can the attacker deduce request or sk(a)?

Authentication: If one principal completes the protocol, can we guarantee that the other principal has a consistent state?

In our protocol, can A and B have different values for A, B, request at the end of the protocol?

Karthikeyan Bhargavan (INRIA) Security proofs in the symbolic model September 2013 25 / 29

slide-36
SLIDE 36

Proving Security Goals

To show functional adequacy or an attack on secrecy/authentication, all we need is to display one trace (easy.) To prove secrecy/authentication, we need to show that all reduction sequences preserve this property (hard) This is hard because the number of reduction sequences is not finite

In fact, the problem is undecidable (next lecture) If however, we restrict processes to finite number of sessions and names, it is decidable but PSPACE-complete (next lecture) In any case, it can be hard to prove both by hand and by computer This explains why we have so many attacks on well-studied protocols

We will explore one symbolic proof technique today

We will see wo more in this course.

Karthikeyan Bhargavan (INRIA) Security proofs in the symbolic model September 2013 26 / 29

slide-37
SLIDE 37

Finding Invariants

A method to prove syntactic secrecy Find an invariant on the shape of the extended process as it evolves

For all B such that A

l

→∗B, B must have the shape I Example: B ≡ new a.{senc(M, ai)/x} P for some M, i, P such that M, P do not mention ai

Show that the frame of this invariant establishes your secrecy goal

The attacker cannot deduce a secret from the frame of I φ(I) = new a.{senc(M, ai)/x} The attacker cannot deduce the secrets ak or M from this frame

Karthikeyan Bhargavan (INRIA) Security proofs in the symbolic model September 2013 27 / 29

slide-38
SLIDE 38

Exercise

Start from the extended processes for the one-message protocol: A − → B : {request}pk(B), sig{{request}pk(B)}sk(A) The processes are of the form: S = new sA, sB, request.(PA PB) where PA can use sA, pk(sB), and request and PB can use sB, pk(sa) and both of them communicate over a free channel net. Assume that the attacker knows net, pk(sa), and pk(sb) Find an invariant I that captures all B such that S

l

→∗ B Show that the attacker cannot deduce request from φ(I)

Every deduced term that mentions request has a subterm of the form senc(request, pk(sb)) Corollary: sa, sb, and request are kept secret

Karthikeyan Bhargavan (INRIA) Security proofs in the symbolic model September 2013 28 / 29

slide-39
SLIDE 39

Static Equivalence

What can an attacker learn from a frame? For syntactic secrecy, we ask whether he can derive a secret name a. For weak secrecy, we ask whether he can distinguish between frames. Static Equivalence

(M =R N)φ: if φ = new a.σ and Mσ ↓R= Nσ ↓R φ1 ˜ φ2: if dom(φ1) = dom(φ2) and for all M that use public functions, Mφ1 is a constructor terms iff Mφ2 is a constructor term and for all M, N that use public functions, (M =R N)φ1 iff (M =R N)φ2

Captures guessing attacks: Is {aenc(a, pk(s))/x, a/y}˜ {aenc(b, pk(s)), a/y}?

Karthikeyan Bhargavan (INRIA) Security proofs in the symbolic model September 2013 29 / 29