author | wenzelm |
Tue, 03 Jan 2023 17:21:24 +0100 | |
changeset 76887 | d8cdddf7b9a5 |
parent 76287 | cdc14f94c754 |
permissions | -rw-r--r-- |
37936 | 1 |
(* Title: HOL/Auth/WooLam.thy |
2274 | 2 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
3 |
Copyright 1996 University of Cambridge |
|
4 |
*) |
|
5 |
||
61830 | 6 |
section\<open>The Woo-Lam Protocol\<close> |
14207
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
paulson
parents:
13507
diff
changeset
|
7 |
|
16417 | 8 |
theory WooLam imports Public begin |
14207
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
paulson
parents:
13507
diff
changeset
|
9 |
|
61830 | 10 |
text\<open>Simplified version from page 11 of |
14207
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
paulson
parents:
13507
diff
changeset
|
11 |
Abadi and Needham (1996). |
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
paulson
parents:
13507
diff
changeset
|
12 |
Prudent Engineering Practice for Cryptographic Protocols. |
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
paulson
parents:
13507
diff
changeset
|
13 |
IEEE Trans. S.E. 22(1), pages 6-15. |
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
paulson
parents:
13507
diff
changeset
|
14 |
|
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
paulson
parents:
13507
diff
changeset
|
15 |
Note: this differs from the Woo-Lam protocol discussed by Lowe (1996): |
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
paulson
parents:
13507
diff
changeset
|
16 |
Some New Attacks upon Security Protocols. |
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
paulson
parents:
13507
diff
changeset
|
17 |
Computer Security Foundations Workshop |
61830 | 18 |
\<close> |
2274 | 19 |
|
23746 | 20 |
inductive_set woolam :: "event list set" |
21 |
where |
|
2274 | 22 |
(*Initial trace is empty*) |
11251 | 23 |
Nil: "[] \<in> woolam" |
2274 | 24 |
|
5434
9b4bed3f394c
Got rid of not_Says_to_self and most uses of ~= in definitions and theorems
paulson
parents:
3683
diff
changeset
|
25 |
(** These rules allow agents to send messages to themselves **) |
9b4bed3f394c
Got rid of not_Says_to_self and most uses of ~= in definitions and theorems
paulson
parents:
3683
diff
changeset
|
26 |
|
2274 | 27 |
(*The spy MAY say anything he CAN say. We do not expect him to |
28 |
invent new nonces here, but he can also use NS1. Common to |
|
29 |
all similar protocols.*) |
|
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
30 |
| Fake: "\<lbrakk>evsf \<in> woolam; X \<in> synth (analz (spies evsf))\<rbrakk> |
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
31 |
\<Longrightarrow> Says Spy B X # evsf \<in> woolam" |
2274 | 32 |
|
33 |
(*Alice initiates a protocol run*) |
|
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
34 |
| WL1: "evs1 \<in> woolam \<Longrightarrow> Says A B (Agent A) # evs1 \<in> woolam" |
2274 | 35 |
|
36 |
(*Bob responds to Alice's message with a challenge.*) |
|
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
37 |
| WL2: "\<lbrakk>evs2 \<in> woolam; Says A' B (Agent A) \<in> set evs2\<rbrakk> |
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
38 |
\<Longrightarrow> Says B A (Nonce NB) # evs2 \<in> woolam" |
2274 | 39 |
|
40 |
(*Alice responds to Bob's challenge by encrypting NB with her key. |
|
41 |
B is *not* properly determined -- Alice essentially broadcasts |
|
42 |
her reply.*) |
|
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
43 |
| WL3: "\<lbrakk>evs3 \<in> woolam; |
11251 | 44 |
Says A B (Agent A) \<in> set evs3; |
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
45 |
Says B' A (Nonce NB) \<in> set evs3\<rbrakk> |
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
46 |
\<Longrightarrow> Says A B (Crypt (shrK A) (Nonce NB)) # evs3 \<in> woolam" |
2274 | 47 |
|
3470 | 48 |
(*Bob forwards Alice's response to the Server. NOTE: usually |
49 |
the messages are shown in chronological order, for clarity. |
|
50 |
But here, exchanging the two events would cause the lemma |
|
3683 | 51 |
WL4_analz_spies to pick up the wrong assumption!*) |
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
52 |
| WL4: "\<lbrakk>evs4 \<in> woolam; |
11251 | 53 |
Says A' B X \<in> set evs4; |
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
54 |
Says A'' B (Agent A) \<in> set evs4\<rbrakk> |
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
55 |
\<Longrightarrow> Says B Server \<lbrace>Agent A, Agent B, X\<rbrace> # evs4 \<in> woolam" |
2274 | 56 |
|
57 |
(*Server decrypts Alice's response for Bob.*) |
|
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
58 |
| WL5: "\<lbrakk>evs5 \<in> woolam; |
61956 | 59 |
Says B' Server \<lbrace>Agent A, Agent B, Crypt (shrK A) (Nonce NB)\<rbrace> |
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
60 |
\<in> set evs5\<rbrakk> |
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
61 |
\<Longrightarrow> Says Server B (Crypt (shrK B) \<lbrace>Agent A, Nonce NB\<rbrace>) |
11251 | 62 |
# evs5 \<in> woolam" |
63 |
||
64 |
||
65 |
declare Says_imp_knows_Spy [THEN analz.Inj, dest] |
|
66 |
declare parts.Body [dest] |
|
67 |
declare analz_into_parts [dest] |
|
68 |
declare Fake_parts_insert_in_Un [dest] |
|
69 |
||
70 |
||
71 |
(*A "possibility property": there are traces that reach the end*) |
|
72 |
lemma "\<exists>NB. \<exists>evs \<in> woolam. |
|
61956 | 73 |
Says Server B (Crypt (shrK B) \<lbrace>Agent A, Nonce NB\<rbrace>) \<in> set evs" |
11251 | 74 |
apply (intro exI bexI) |
75 |
apply (rule_tac [2] woolam.Nil |
|
76 |
[THEN woolam.WL1, THEN woolam.WL2, THEN woolam.WL3, |
|
13507 | 77 |
THEN woolam.WL4, THEN woolam.WL5], possibility) |
11251 | 78 |
done |
79 |
||
80 |
(*Could prove forwarding lemmas for WL4, but we do not need them!*) |
|
81 |
||
82 |
(**** Inductive proofs about woolam ****) |
|
83 |
||
84 |
(** Theorems of the form X \<notin> parts (spies evs) imply that NOBODY |
|
85 |
sends messages containing X! **) |
|
86 |
||
87 |
(*Spy never sees a good agent's shared key!*) |
|
88 |
lemma Spy_see_shrK [simp]: |
|
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
89 |
"evs \<in> woolam \<Longrightarrow> (Key (shrK A) \<in> parts (spies evs)) = (A \<in> bad)" |
14207
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
paulson
parents:
13507
diff
changeset
|
90 |
by (erule woolam.induct, force, simp_all, blast+) |
11251 | 91 |
|
92 |
lemma Spy_analz_shrK [simp]: |
|
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
93 |
"evs \<in> woolam \<Longrightarrow> (Key (shrK A) \<in> analz (spies evs)) = (A \<in> bad)" |
11251 | 94 |
by auto |
95 |
||
96 |
lemma Spy_see_shrK_D [dest!]: |
|
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
97 |
"\<lbrakk>Key (shrK A) \<in> parts (knows Spy evs); evs \<in> woolam\<rbrakk> \<Longrightarrow> A \<in> bad" |
11251 | 98 |
by (blast dest: Spy_see_shrK) |
99 |
||
100 |
||
101 |
(**** Autheticity properties for Woo-Lam ****) |
|
102 |
||
103 |
(*** WL4 ***) |
|
104 |
||
105 |
(*If the encrypted message appears then it originated with Alice*) |
|
106 |
lemma NB_Crypt_imp_Alice_msg: |
|
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
107 |
"\<lbrakk>Crypt (shrK A) (Nonce NB) \<in> parts (spies evs); |
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
108 |
A \<notin> bad; evs \<in> woolam\<rbrakk> |
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
109 |
\<Longrightarrow> \<exists>B. Says A B (Crypt (shrK A) (Nonce NB)) \<in> set evs" |
14207
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
paulson
parents:
13507
diff
changeset
|
110 |
by (erule rev_mp, erule woolam.induct, force, simp_all, blast+) |
11251 | 111 |
|
112 |
(*Guarantee for Server: if it gets a message containing a certificate from |
|
113 |
Alice, then she originated that certificate. But we DO NOT know that B |
|
114 |
ever saw it: the Spy may have rerouted the message to the Server.*) |
|
115 |
lemma Server_trusts_WL4 [dest]: |
|
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
116 |
"\<lbrakk>Says B' Server \<lbrace>Agent A, Agent B, Crypt (shrK A) (Nonce NB)\<rbrace> |
11251 | 117 |
\<in> set evs; |
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
118 |
A \<notin> bad; evs \<in> woolam\<rbrakk> |
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
119 |
\<Longrightarrow> \<exists>B. Says A B (Crypt (shrK A) (Nonce NB)) \<in> set evs" |
11251 | 120 |
by (blast intro!: NB_Crypt_imp_Alice_msg) |
121 |
||
122 |
||
123 |
(*** WL5 ***) |
|
124 |
||
125 |
(*Server sent WL5 only if it received the right sort of message*) |
|
126 |
lemma Server_sent_WL5 [dest]: |
|
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
127 |
"\<lbrakk>Says Server B (Crypt (shrK B) \<lbrace>Agent A, NB\<rbrace>) \<in> set evs; |
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
128 |
evs \<in> woolam\<rbrakk> |
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
129 |
\<Longrightarrow> \<exists>B'. Says B' Server \<lbrace>Agent A, Agent B, Crypt (shrK A) NB\<rbrace> |
11251 | 130 |
\<in> set evs" |
14207
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
paulson
parents:
13507
diff
changeset
|
131 |
by (erule rev_mp, erule woolam.induct, force, simp_all, blast+) |
11251 | 132 |
|
133 |
(*If the encrypted message appears then it originated with the Server!*) |
|
134 |
lemma NB_Crypt_imp_Server_msg [rule_format]: |
|
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
135 |
"\<lbrakk>Crypt (shrK B) \<lbrace>Agent A, NB\<rbrace> \<in> parts (spies evs); |
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
136 |
B \<notin> bad; evs \<in> woolam\<rbrakk> |
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
137 |
\<Longrightarrow> Says Server B (Crypt (shrK B) \<lbrace>Agent A, NB\<rbrace>) \<in> set evs" |
14207
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
paulson
parents:
13507
diff
changeset
|
138 |
by (erule rev_mp, erule woolam.induct, force, simp_all, blast+) |
11251 | 139 |
|
140 |
(*Guarantee for B. If B gets the Server's certificate then A has encrypted |
|
141 |
the nonce using her key. This event can be no older than the nonce itself. |
|
142 |
But A may have sent the nonce to some other agent and it could have reached |
|
143 |
the Server via the Spy.*) |
|
144 |
lemma B_trusts_WL5: |
|
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
145 |
"\<lbrakk>Says S B (Crypt (shrK B) \<lbrace>Agent A, Nonce NB\<rbrace>) \<in> set evs; |
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
146 |
A \<notin> bad; B \<notin> bad; evs \<in> woolam\<rbrakk> |
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
147 |
\<Longrightarrow> \<exists>B. Says A B (Crypt (shrK A) (Nonce NB)) \<in> set evs" |
11251 | 148 |
by (blast dest!: NB_Crypt_imp_Server_msg) |
149 |
||
150 |
||
151 |
(*B only issues challenges in response to WL1. Not used.*) |
|
152 |
lemma B_said_WL2: |
|
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
153 |
"\<lbrakk>Says B A (Nonce NB) \<in> set evs; B \<noteq> Spy; evs \<in> woolam\<rbrakk> |
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
154 |
\<Longrightarrow> \<exists>A'. Says A' B (Agent A) \<in> set evs" |
14207
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
paulson
parents:
13507
diff
changeset
|
155 |
by (erule rev_mp, erule woolam.induct, force, simp_all, blast+) |
11251 | 156 |
|
157 |
||
158 |
(**CANNOT be proved because A doesn't know where challenges come from...*) |
|
76287
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
159 |
lemma "\<lbrakk>A \<notin> bad; B \<noteq> Spy; evs \<in> woolam\<rbrakk> |
cdc14f94c754
Elimination of the archaic ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
67613
diff
changeset
|
160 |
\<Longrightarrow> Crypt (shrK A) (Nonce NB) \<in> parts (spies evs) \<and> |
11251 | 161 |
Says B A (Nonce NB) \<in> set evs |
67613 | 162 |
\<longrightarrow> Says A B (Crypt (shrK A) (Nonce NB)) \<in> set evs" |
13507 | 163 |
apply (erule rev_mp, erule woolam.induct, force, simp_all, blast, auto) |
11251 | 164 |
oops |
2274 | 165 |
|
166 |
end |