Top Banner
Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005
46

An Efficient Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005.

Dec 21, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: An Efficient Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005.

An Efficient Cryptographic Protocol Verifier Based on

Prolog Rules

by Bruno Blanchet

Presented by Hai Lin

04/12/2005

Page 2: An Efficient Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005.

The idea of verifying protocols formally

The design of protocols is a particularly error-prone process, many protocols have been shown to have flaws.

We need methods that can verify protocols formally.

Page 3: An Efficient Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005.

Where should we start?

Page 4: An Efficient Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005.

Is your bank account secure? (an analogy)

Assume that we decide whether or not a policy is secure by whether or not an unauthorized person can get PIN. Suppose a bank has the following (unrealistic) policy:

You can change your mail address by simply providing your name and your email address(Notice that these are both publicly known.).You can request your PIN reminder again by simply providing your name and your email address. And then the PIN will be sent to your mail address.

……

Page 5: An Efficient Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005.

Is your bank account secure? (cont.)

Of course this policy is not secure, in the sense that the attacker can easily get your PIN:

The attacker requests that your mail address is changed to an address that he has access to. (Notice that he can do this by simply providing your name and email address.)

The attacker requests your PIN reminder.

Page 6: An Efficient Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005.

Is the policy of a bank secure?This depends …

The policy of the bank(obviously)The attacker’s computational ability

reasonable computational ability: attacker(a) attacker(b)->attacker(P(a,b))∧ unreasonable computational ability: attacker(name)->attacker(PIN)

The attacker’s initial knowledge If the attacker knows PIN, then this problem is trivial.

Moreover, it is unreasonable.

Page 7: An Efficient Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005.

Similarly, whether or not a protocol has flaw depends on

The protocolThe attacker’s computational abilityThe attacker’s initial knowledge

So the first step that we should start with is to formalize them.

Page 8: An Efficient Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005.

Formalize the protocol

A protocol is represented by a set of Prolog rules.

Important terminologies: terms, facts, rules. To give an intuition:

Terms

Page 9: An Efficient Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005.

Formalize the protocol

A protocol is represented by a set of Prolog rules.

Important terminologies: terms, facts, rules. To give an intuition:

facts: predicte(terms)

Page 10: An Efficient Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005.

Formalize the protocol

A protocol is represented by a set of Prolog rules.

Important terminologies: terms, facts, rules. To give an intuition:

rules: fact1, fact2,…,factn->fact

Page 11: An Efficient Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005.

More on termsTerms represent messages that are exchanged between participants of the protocol.Terms can be constants or variables, or functions that applied to terms recursively.Functions are used to represent protocol primitives. Generally, there are two kinds of functions: constructors(e.g. encryption) and destructors(e.g. decryption).

Examples of terms: A, encrypt(x,K)

Page 12: An Efficient Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005.

More on facts

They represent facts about messages.

Facts are built by applying predicates to terms.

Examples of facts:

attacker(A)

attacker(encrypt(x,K))

Page 13: An Efficient Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005.

More on rules

Rules are of the following form:

fact1, fact2,…,factn->fact

-means if fact1,fact2,…,factn are all true, then fact is also true.

Page 14: An Efficient Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005.

Formalize the protocolThere is one set of rules for each message in the protocol. In the set corresponding to the ith message, sent by principle X, the rules are of the form:

attacker(Mj1) … attacker(M∧ ∧ jn)->attacker(Mi)

where Mj1,…,Mjn are the patterns of the message received by X before sending the ith message, and Mi is the pattern of the ith message.

Page 15: An Efficient Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005.

A simple example on how to formalize a protocol

Suppose the first two messages of a protocol are:

1. A->S: A,B

2. S->A: Kab,A,B

The corresponding rules should be:

attacker((A,B))

attacker((A,B))->attacker((Kab,A,B))

Page 16: An Efficient Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005.

Formalize the attacker’s computational ability

For each constructor f, there is a rule of the following form.

attacker(x1) … attacker(x∧ ∧ n)->attacker(f(x1,…xn)) example: attacker(m) attacker(K)->attacker(encrypt(m,K))∧

For each destructor g(M1,…,Mn)=M, there is a rule of the following form:

attacker(M1) … attacker(M∧ ∧ n)->attacker(M) example: attacker(encrypt(m,K)) attacker(K)->attacker(m)∧

Page 17: An Efficient Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005.

Formalize the attacker’s initial knowledge

We always assume that the attacker knows something at the beginning. For example, it is reasonable to believe that the attacker knows the names and public keys of participants of the protocol.

Page 18: An Efficient Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005.

What we have done so far?What we have done so far?

We have formalized the protocol, the attacker’s computational ability and the attacker’s initial knowledge.What is our goal? What’s left?

Determine some secrecy properties: for instance, can the attacker get Kab? In other words, can Kab be inferred from the rules?One possible method

Use Prolog to solve the problem directly.

Page 19: An Efficient Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005.

How does prolog work?

Prolog rules are of the form:

F1,F2,…Fn->F

A fact is a rule with no hypothesis.

A goal is a rule with no conclusion.

Prolog uses depth-first, backward chaining to prove a goal.

Page 20: An Efficient Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005.

How does Prolog work? (example)

Rules: A1->A2 (1)

A2,A3->A4 (2)

Facts: ->A1 (3)

->A3 (4)

Goal: A4-> (5)

The steps of the proof:

(2),(5): A2,A3-> (6)

(1),(6): A1,A3-> (7)

(3),(7): A3-> (8) (4),(8): □ (9)

Page 21: An Efficient Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005.

What is the problem?

Consider the following rule:

attacker(encrypt(m,K) attack(K)∧ ->attacker(m)

The above rule leads to considering more and more complex terms, with an unbounded number of encryptions.

Page 22: An Efficient Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005.

The method

Page 23: An Efficient Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005.

Overview of the method The problematic rule: attacker(pencrypt(m,pk(sk)) attack(sk)->attacker(m)∧

The problem(intuition): the above rule is not “good” enough: the premises are bigger than the conclusion. So when performing backward search, one can get bigger terms, thus termination is not guaranteed.The idea: combine pairs of rules by unification and get the “desired” rules.The solving algorithm works in two phases. The first phase transforms the rule base into a new one, that implies the same facts. The second one uses a depth-first search to determine whether a fact can be inferred or not from the rules.

Page 24: An Efficient Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005.

Overview of the first phase The first phase is actually another kind of forward

search:In the typical forward search, a fact is unified with a hypothesis of a rule to create a new rule. Or equivalently we can say:

Two rules R and R’ can be combined when: (a)The hypothesis of R belong to Φ. (b)The hypothesis F of R’ that we unify does not

satisfy F belongs to Φ.

Page 25: An Efficient Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005.

Overview of the first phase(cont.)

Here in the first phase, two rule R and R’ can be combined when:

(a)The hypothesis of R are of the form attacker(x).

(b)The hypothesis F of R’ that we unify are not of the form attacker(x).

Page 26: An Efficient Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005.

The first phase (detail)More generally…

We can define F∈rS by: there exist a renaming σ such that Fσ S. By default, S={attacker(x)}∈

Two rule R and R’ can be combined when: (a)The hypothesis of R contain only facts F which

satisfy F∈rS. (b)The hypothesis F of R’ that we unify does not

satisfy F∈rS.

Page 27: An Efficient Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005.

The first phase (detail) The first phase contains three steps:

Insert in B the initial rule representing the protocol and the attacker. And perform the normal process of simplification.Combine all rules R and R’ which satisfy the previous two conditions. And add the new rules to B.Extract from B the new rule base B’, by taking only the rules whose all hypotheses are of the form attacker(x).

Page 28: An Efficient Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005.

Some resultsGood news:

Lemma1 (Correctness of phase 1) Let F be a closed fact. F is derivable from the rules in B0 iff F is derivable from B’.

Bad news:The first phase does not always terminates, that means sometimes it will run forever! We will deal with this problem later on.

Page 29: An Efficient Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005.

Overview of the second phase

The second phase searches the fact that can be inferred from B’. The is done by a typical backward depth-first search with loop detection.

Page 30: An Efficient Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005.

The second phase (detail)

We define derivablerec(R,B’’) byderivablerec(R,B’’)=Φ if R’ B’’,∈

R’->R.derivablerec(Φ->C,B’’)={C} otherwise.derivablerec(R,B’’)=∪{derivablerec(elimdup(R’*F0R),{R}∪B’’)|R’ B’, F∈ 0 such that R’*F0R is defined} otherwise.

derivable(F) = derivablerec({F}->F,Φ)

Page 31: An Efficient Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005.

derivablerec(R,B’’)=Φ if R’ B’’,∈ R’->R.

Note: To give an intuition, consider the case in which R B’’. That means R has been ∈used in the search. So it is redundant to call the function derivablerec(R,B’’) again.

Page 32: An Efficient Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005.

derivablerec(Φ->C,B’’)={C} otherwise.

Note: It says if a rule that we want to prove has no hypothesis, then the conclusion of the rule is proved. (In other words, if we want to a fact, then the fact is trivially proved.)

Page 33: An Efficient Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005.

derivablerec(R,B’’)=∪{derivablerec(elimd-up(R’*F0R),{R}∪B’’)|R’ B’, F∈ 0 such that R’*F0R is defined} otherwise.

Note: What happens here is that we try to use R’ to prove one of the hypothesis of R, F0. We change the parameters of the function and call it recursively.

Page 34: An Efficient Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005.

Termination

Page 35: An Efficient Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005.

Termination of the first phase

The first phase does not always terminate. Consider the following rule:

attacker(f(x)->attacker(f(g(x)))

Page 36: An Efficient Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005.

Enforce termination of the first phase

Termination can be enforced by limiting the depth of terms.

Each term that starts at a depth greater than a limit is replaced by a new variable.

Note that this limit is on the depth of terms that appear in the rules, NOT the depth of terms that can be built by the attacker.

Page 37: An Efficient Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005.

Enforce termination of the first phase (cont.)

Notice that if a fact can be generated by the system without depth limitation, it can also be generated with depth limitation because we are using more “powerful” rules. The converse is not correct.The system remains correct, but some precision is lost: If the verifier does not find a flaw in a protocol, then there is no flaw. In contrast, it may give a false attack against the protocol.In practice, the algorithm terminates for many protocols without limiting the depth of terms.

Page 38: An Efficient Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005.

Termination of the second phaseThe second phase can guarantee to terminate under certain restrictions.

Proposition If F is closed and S={attacker(x)}, then derivable(F) terminates. (Otherwise, the termination of derivable(F) is not guaranteed.Proof sketch The hypotheses of the rules in B’ are smaller than the conclusions. Hence the depth-first search considers smaller and smaller terms, and thus terminates.

Page 39: An Efficient Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005.

Optimizations and extensions

Page 40: An Efficient Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005.

Tuples

The system can handle tuples with the following built-in rules:

attacker(M1) attacker(M∧ 2) … ∧ ∧attacker(Mn)->attacker((M1,M2,…,Mn))

attacker((M1,M2,…,Mn))->attacker(Mi)

i=1,2,…,n

Page 41: An Efficient Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005.

Removing useless rules and useless hypotheses

If a rule has a conclusion which is already in the hypotheses, this rule does not generate new facts. Such rules are therefore removed as soon as they are encountered by the verifier.

If a rule contains in its hypotheses attacker(x), where x is a variable that does not appear elsewhere in the rule, the hypothesis attacker(x) can be removed.

Page 42: An Efficient Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005.

Secrecy assumptions

We assume some facts will not be derived by the attacker. For example, we assume attacker(skA),attacker(skB),…are underivable.

The verifier can remove all rules which have underivable facts in their hypotheses.

Page 43: An Efficient Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005.

Experimental resultsThey have implemented the verifier, and have performed tests on a Pentium MMX 223 MHz, under Linux 2.0.32 (RedHat 5.0).

The algorithm terminates for most protocols without limiting the depth of terms.

False attacks are rare. They have been able to prove the secrecy properties of all the protocols they have considered.

Page 44: An Efficient Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005.

Experimental results (cont.)

Page 45: An Efficient Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005.

The point revisited

They separate the search into two phases. The first phase is similar to knowledge compilation. But the purpose is different: the purpose of knowledge compilation is to facilitate the reasoning process later on; The purpose of the first phase here is to guarantee the termination of the second phase.

Page 46: An Efficient Cryptographic Protocol Verifier Based on Prolog Rules by Bruno Blanchet Presented by Hai Lin 04/12/2005.

Thank you!

any questions, comments?