2318
|
1 |
(* Title: HOL/Auth/NS_Public_Bad
|
|
2 |
ID: $Id$
|
|
3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory
|
|
4 |
Copyright 1996 University of Cambridge
|
|
5 |
|
|
6 |
Inductive relation "ns_public" for the Needham-Schroeder Public-Key protocol.
|
|
7 |
Flawed version, vulnerable to Lowe's attack.
|
|
8 |
|
|
9 |
From page 260 of
|
|
10 |
Burrows, Abadi and Needham. A Logic of Authentication.
|
|
11 |
Proc. Royal Soc. 426 (1989)
|
|
12 |
*)
|
|
13 |
|
|
14 |
open NS_Public_Bad;
|
|
15 |
|
|
16 |
proof_timing:=true;
|
|
17 |
HOL_quantifiers := false;
|
|
18 |
Pretty.setdepth 20;
|
|
19 |
|
|
20 |
AddIffs [Spy_in_lost];
|
|
21 |
|
|
22 |
(*Replacing the variable by a constant improves search speed by 50%!*)
|
|
23 |
val Says_imp_sees_Spy' =
|
|
24 |
read_instantiate_sg (sign_of thy) [("lost","lost")] Says_imp_sees_Spy;
|
|
25 |
|
|
26 |
|
|
27 |
(*A "possibility property": there are traces that reach the end*)
|
|
28 |
goal thy
|
|
29 |
"!!A B. [| A ~= B |] \
|
|
30 |
\ ==> EX NB. EX evs: ns_public. \
|
|
31 |
\ Says A B (Crypt (pubK B) (Nonce NB)) : set_of_list evs";
|
|
32 |
by (REPEAT (resolve_tac [exI,bexI] 1));
|
|
33 |
by (rtac (ns_public.Nil RS ns_public.NS1 RS ns_public.NS2 RS ns_public.NS3) 2);
|
|
34 |
by (ALLGOALS (simp_tac (!simpset setsolver safe_solver)));
|
|
35 |
by (REPEAT_FIRST (resolve_tac [refl, conjI]));
|
|
36 |
by (REPEAT_FIRST (fast_tac (!claset addss (!simpset setsolver safe_solver))));
|
|
37 |
result();
|
|
38 |
|
|
39 |
|
|
40 |
(**** Inductive proofs about ns_public ****)
|
|
41 |
|
|
42 |
(*Nobody sends themselves messages*)
|
|
43 |
goal thy "!!evs. evs : ns_public ==> ALL A X. Says A A X ~: set_of_list evs";
|
|
44 |
by (etac ns_public.induct 1);
|
|
45 |
by (Auto_tac());
|
|
46 |
qed_spec_mp "not_Says_to_self";
|
|
47 |
Addsimps [not_Says_to_self];
|
|
48 |
AddSEs [not_Says_to_self RSN (2, rev_notE)];
|
|
49 |
|
|
50 |
|
|
51 |
(*For proving the easier theorems about X ~: parts (sees lost Spy evs) *)
|
|
52 |
fun parts_induct_tac i = SELECT_GOAL
|
|
53 |
(DETERM (etac ns_public.induct 1 THEN
|
|
54 |
(*Fake message*)
|
|
55 |
TRY (best_tac (!claset addDs [impOfSubs analz_subset_parts,
|
|
56 |
impOfSubs Fake_parts_insert]
|
|
57 |
addss (!simpset)) 2)) THEN
|
|
58 |
(*Base case*)
|
|
59 |
fast_tac (!claset addss (!simpset)) 1 THEN
|
|
60 |
ALLGOALS Asm_simp_tac) i;
|
|
61 |
|
|
62 |
(** Theorems of the form X ~: parts (sees lost Spy evs) imply that NOBODY
|
|
63 |
sends messages containing X! **)
|
|
64 |
|
|
65 |
(*Spy never sees another agent's private key! (unless it's lost at start)*)
|
|
66 |
goal thy
|
|
67 |
"!!evs. evs : ns_public \
|
|
68 |
\ ==> (Key (priK A) : parts (sees lost Spy evs)) = (A : lost)";
|
|
69 |
by (parts_induct_tac 1);
|
|
70 |
by (Auto_tac());
|
|
71 |
qed "Spy_see_priK";
|
|
72 |
Addsimps [Spy_see_priK];
|
|
73 |
|
|
74 |
goal thy
|
|
75 |
"!!evs. evs : ns_public \
|
|
76 |
\ ==> (Key (priK A) : analz (sees lost Spy evs)) = (A : lost)";
|
|
77 |
by (auto_tac(!claset addDs [impOfSubs analz_subset_parts], !simpset));
|
|
78 |
qed "Spy_analz_priK";
|
|
79 |
Addsimps [Spy_analz_priK];
|
|
80 |
|
|
81 |
goal thy "!!A. [| Key (priK A) : parts (sees lost Spy evs); \
|
|
82 |
\ evs : ns_public |] ==> A:lost";
|
|
83 |
by (fast_tac (!claset addDs [Spy_see_priK]) 1);
|
|
84 |
qed "Spy_see_priK_D";
|
|
85 |
|
|
86 |
bind_thm ("Spy_analz_priK_D", analz_subset_parts RS subsetD RS Spy_see_priK_D);
|
|
87 |
AddSDs [Spy_see_priK_D, Spy_analz_priK_D];
|
|
88 |
|
|
89 |
|
|
90 |
(*** Future nonces can't be seen or used! ***)
|
|
91 |
|
|
92 |
goal thy "!!evs. evs : ns_public ==> \
|
|
93 |
\ length evs <= length evt --> \
|
|
94 |
\ Nonce (newN evt) ~: parts (sees lost Spy evs)";
|
|
95 |
by (parts_induct_tac 1);
|
|
96 |
by (REPEAT_FIRST (fast_tac (!claset
|
|
97 |
addSEs partsEs
|
|
98 |
addSDs [Says_imp_sees_Spy' RS parts.Inj]
|
|
99 |
addEs [leD RS notE]
|
|
100 |
addDs [impOfSubs analz_subset_parts,
|
|
101 |
impOfSubs parts_insert_subset_Un,
|
|
102 |
Suc_leD]
|
|
103 |
addss (!simpset))));
|
|
104 |
qed_spec_mp "new_nonces_not_seen";
|
|
105 |
Addsimps [new_nonces_not_seen];
|
|
106 |
|
|
107 |
val nonce_not_seen_now = le_refl RSN (2, new_nonces_not_seen) RSN (2,rev_notE);
|
|
108 |
|
|
109 |
|
|
110 |
(**** Authenticity properties obtained from NS2 ****)
|
|
111 |
|
|
112 |
(*It is impossible to re-use a nonce in both NS1 and NS2, provided the nonce
|
|
113 |
is secret. (Honest users generate fresh nonces.)*)
|
|
114 |
goal thy
|
|
115 |
"!!evs. evs : ns_public \
|
|
116 |
\ ==> Nonce NA ~: analz (sees lost Spy evs) --> \
|
|
117 |
\ Crypt (pubK B) {|Nonce NA, Agent A|} : parts (sees lost Spy evs) --> \
|
|
118 |
\ Crypt (pubK C) {|NA', Nonce NA|} ~: parts (sees lost Spy evs)";
|
|
119 |
by (etac ns_public.induct 1);
|
|
120 |
by (ALLGOALS
|
|
121 |
(asm_simp_tac
|
2374
|
122 |
(!simpset addsimps ([not_parts_not_analz] @ pushes)
|
2318
|
123 |
setloop split_tac [expand_if])));
|
|
124 |
(*NS3*)
|
|
125 |
by (fast_tac (!claset addSEs partsEs
|
|
126 |
addEs [nonce_not_seen_now]) 4);
|
|
127 |
(*NS2*)
|
|
128 |
by (fast_tac (!claset addSEs partsEs
|
|
129 |
addEs [nonce_not_seen_now]) 3);
|
|
130 |
(*Fake*)
|
2374
|
131 |
by (best_tac (!claset addIs [analz_insertI]
|
2318
|
132 |
addDs [impOfSubs analz_subset_parts,
|
|
133 |
impOfSubs Fake_parts_insert]
|
|
134 |
addss (!simpset)) 2);
|
|
135 |
(*Base*)
|
2374
|
136 |
by (fast_tac (!claset addss (!simpset)) 1);
|
2318
|
137 |
bind_thm ("no_nonce_NS1_NS2", result() RSN (2, rev_mp) RSN (2, rev_mp));
|
|
138 |
|
|
139 |
|
|
140 |
(*Uniqueness for NS1: nonce NA identifies agents A and B*)
|
|
141 |
goal thy
|
|
142 |
"!!evs. evs : ns_public \
|
|
143 |
\ ==> Nonce NA ~: analz (sees lost Spy evs) --> \
|
|
144 |
\ (EX A' B'. ALL A B. \
|
|
145 |
\ Crypt (pubK B) {|Nonce NA, Agent A|} : parts (sees lost Spy evs) --> \
|
|
146 |
\ A=A' & B=B')";
|
|
147 |
by (etac ns_public.induct 1);
|
|
148 |
by (ALLGOALS
|
|
149 |
(asm_simp_tac
|
2374
|
150 |
(!simpset addsimps ([not_parts_not_analz] @ pushes)
|
2318
|
151 |
setloop split_tac [expand_if])));
|
|
152 |
(*NS1*)
|
|
153 |
by (expand_case_tac "NA = ?y" 3 THEN
|
|
154 |
REPEAT (fast_tac (!claset addSEs (nonce_not_seen_now::partsEs)) 3));
|
|
155 |
(*Base*)
|
|
156 |
by (fast_tac (!claset addss (!simpset)) 1);
|
|
157 |
(*Fake*)
|
|
158 |
by (simp_tac (!simpset addsimps [all_conj_distrib,parts_insert_sees]) 1);
|
2374
|
159 |
by (step_tac (!claset addSIs [analz_insertI]) 1);
|
2318
|
160 |
by (ex_strip_tac 1);
|
|
161 |
by (best_tac (!claset delrules [conjI]
|
2324
|
162 |
addSDs [impOfSubs Fake_parts_insert]
|
|
163 |
addDs [impOfSubs analz_subset_parts]
|
2318
|
164 |
addss (!simpset)) 1);
|
|
165 |
val lemma = result();
|
|
166 |
|
|
167 |
goal thy
|
|
168 |
"!!evs. [| Crypt(pubK B) {|Nonce NA, Agent A|} : parts(sees lost Spy evs); \
|
|
169 |
\ Crypt(pubK B') {|Nonce NA, Agent A'|} : parts(sees lost Spy evs); \
|
|
170 |
\ Nonce NA ~: analz (sees lost Spy evs); \
|
|
171 |
\ evs : ns_public |] \
|
|
172 |
\ ==> A=A' & B=B'";
|
|
173 |
by (dtac lemma 1);
|
|
174 |
by (mp_tac 1);
|
|
175 |
by (REPEAT (etac exE 1));
|
|
176 |
(*Duplicate the assumption*)
|
|
177 |
by (forw_inst_tac [("psi", "ALL C.?P(C)")] asm_rl 1);
|
|
178 |
by (fast_tac (!claset addSDs [spec]) 1);
|
|
179 |
qed "unique_NA";
|
|
180 |
|
|
181 |
|
|
182 |
(*Secrecy: Spy does not see the nonce sent in msg NS1 if A and B are secure*)
|
|
183 |
goal thy
|
|
184 |
"!!evs. [| A ~: lost; B ~: lost; evs : ns_public |] \
|
|
185 |
\ ==> Says A B (Crypt (pubK B) {|Nonce NA, Agent A|}) : set_of_list evs \
|
|
186 |
\ --> Nonce NA ~: analz (sees lost Spy evs)";
|
|
187 |
by (etac ns_public.induct 1);
|
|
188 |
by (ALLGOALS
|
|
189 |
(asm_simp_tac
|
2374
|
190 |
(!simpset addsimps ([not_parts_not_analz] @ pushes)
|
2318
|
191 |
setloop split_tac [expand_if])));
|
|
192 |
(*NS3*)
|
|
193 |
by (fast_tac (!claset addSDs [Says_imp_sees_Spy' RS parts.Inj]
|
|
194 |
addEs [no_nonce_NS1_NS2 RSN (2, rev_notE)]) 4);
|
|
195 |
(*NS1*)
|
|
196 |
by (fast_tac (!claset addSEs partsEs
|
|
197 |
addSDs [new_nonces_not_seen,
|
|
198 |
Says_imp_sees_Spy' RS parts.Inj]) 2);
|
|
199 |
(*Fake*)
|
2374
|
200 |
by (REPEAT_FIRST spy_analz_tac);
|
2318
|
201 |
(*NS2*)
|
|
202 |
by (Step_tac 1);
|
|
203 |
by (fast_tac (!claset addSEs partsEs
|
|
204 |
addSDs [new_nonces_not_seen,
|
|
205 |
Says_imp_sees_Spy' RS parts.Inj]) 2);
|
|
206 |
by (fast_tac (!claset addSDs [Says_imp_sees_Spy' RS parts.Inj]
|
|
207 |
addDs [unique_NA]) 1);
|
|
208 |
bind_thm ("Spy_not_see_NA", result() RSN (2, rev_mp));
|
|
209 |
|
|
210 |
|
|
211 |
(*Authentication for A: if she receives message 2 and has used NA
|
|
212 |
to start a run, then B has sent message 2.*)
|
|
213 |
goal thy
|
|
214 |
"!!evs. [| A ~: lost; B ~: lost; evs : ns_public |] \
|
|
215 |
\ ==> Crypt (pubK A) {|Nonce NA, Nonce NB|} : parts (sees lost Spy evs) \
|
|
216 |
\ --> Says A B (Crypt (pubK B) {|Nonce NA, Agent A|}) : set_of_list evs \
|
|
217 |
\ --> Says B A (Crypt (pubK A) {|Nonce NA, Nonce NB|}) : set_of_list evs";
|
|
218 |
by (etac ns_public.induct 1);
|
|
219 |
by (ALLGOALS Asm_simp_tac);
|
|
220 |
(*NS1*)
|
|
221 |
by (fast_tac (!claset addSEs partsEs
|
|
222 |
addSDs [new_nonces_not_seen,
|
|
223 |
Says_imp_sees_Spy' RS parts.Inj]) 2);
|
|
224 |
(*Fake*)
|
|
225 |
by (REPEAT_FIRST (resolve_tac [impI, conjI]));
|
|
226 |
by (fast_tac (!claset addss (!simpset)) 1);
|
|
227 |
by (forward_tac [Spy_not_see_NA] 1 THEN REPEAT (assume_tac 1));
|
2324
|
228 |
by (best_tac (!claset addSIs [disjI2]
|
|
229 |
addSDs [impOfSubs Fake_parts_insert]
|
|
230 |
addDs [impOfSubs analz_subset_parts]
|
2318
|
231 |
addss (!simpset)) 1);
|
|
232 |
(*NS2*)
|
|
233 |
by (Step_tac 1);
|
|
234 |
by (forward_tac [Spy_not_see_NA] 1 THEN REPEAT (assume_tac 1));
|
|
235 |
by (fast_tac (!claset addSDs [Says_imp_sees_Spy' RS parts.Inj]
|
|
236 |
addDs [unique_NA]) 1);
|
|
237 |
qed_spec_mp "NA_decrypt_imp_B_msg";
|
|
238 |
|
|
239 |
(*Corollary: if A receives B's message NS2 and the nonce NA agrees
|
|
240 |
then that message really originated with B.*)
|
|
241 |
goal thy
|
|
242 |
"!!evs. [| Says B' A (Crypt(pubK A) {|Nonce NA, Nonce NB|}): set_of_list evs;\
|
|
243 |
\ Says A B (Crypt (pubK B) {|Nonce NA, Agent A|}) : set_of_list evs;\
|
|
244 |
\ A ~: lost; B ~: lost; evs : ns_public |] \
|
|
245 |
\ ==> Says B A (Crypt(pubK A) {|Nonce NA, Nonce NB|}): set_of_list evs";
|
|
246 |
by (fast_tac (!claset addSIs [NA_decrypt_imp_B_msg]
|
|
247 |
addEs partsEs
|
|
248 |
addDs [Says_imp_sees_Spy' RS parts.Inj]) 1);
|
|
249 |
qed "A_trusts_NS2";
|
|
250 |
|
|
251 |
(*If the encrypted message appears then it originated with Alice in NS1*)
|
|
252 |
goal thy
|
|
253 |
"!!evs. evs : ns_public \
|
|
254 |
\ ==> Nonce NA ~: analz (sees lost Spy evs) --> \
|
|
255 |
\ Crypt (pubK B) {|Nonce NA, Agent A|} : parts (sees lost Spy evs) --> \
|
|
256 |
\ Says A B (Crypt (pubK B) {|Nonce NA, Agent A|}) : set_of_list evs";
|
|
257 |
by (etac ns_public.induct 1);
|
|
258 |
by (ALLGOALS
|
|
259 |
(asm_simp_tac
|
2374
|
260 |
(!simpset addsimps ([not_parts_not_analz] @ pushes)
|
2318
|
261 |
setloop split_tac [expand_if])));
|
|
262 |
(*Fake*)
|
|
263 |
by (best_tac (!claset addSIs [disjI2]
|
2324
|
264 |
addSDs [impOfSubs Fake_parts_insert]
|
2374
|
265 |
addIs [analz_insertI]
|
2324
|
266 |
addDs [impOfSubs analz_subset_parts]
|
2318
|
267 |
addss (!simpset)) 2);
|
|
268 |
(*Base*)
|
|
269 |
by (fast_tac (!claset addss (!simpset)) 1);
|
|
270 |
qed_spec_mp "B_trusts_NS1";
|
|
271 |
|
|
272 |
|
|
273 |
|
|
274 |
(**** Authenticity properties obtained from NS2 ****)
|
|
275 |
|
|
276 |
(*Uniqueness for NS2: nonce NB identifies agent A and nonce NA
|
|
277 |
[proof closely follows that for unique_NA] *)
|
|
278 |
goal thy
|
|
279 |
"!!evs. evs : ns_public \
|
|
280 |
\ ==> Nonce NB ~: analz (sees lost Spy evs) --> \
|
2324
|
281 |
\ (EX A' NA'. ALL A NA. \
|
2318
|
282 |
\ Crypt (pubK A) {|Nonce NA, Nonce NB|} : parts (sees lost Spy evs) --> \
|
|
283 |
\ A=A' & NA=NA')";
|
|
284 |
by (etac ns_public.induct 1);
|
|
285 |
by (ALLGOALS
|
|
286 |
(asm_simp_tac
|
2374
|
287 |
(!simpset addsimps ([not_parts_not_analz] @ pushes)
|
2318
|
288 |
setloop split_tac [expand_if])));
|
|
289 |
(*NS2*)
|
|
290 |
by (expand_case_tac "NB = ?y" 3 THEN
|
|
291 |
REPEAT (fast_tac (!claset addSEs (nonce_not_seen_now::partsEs)) 3));
|
|
292 |
(*Base*)
|
|
293 |
by (fast_tac (!claset addss (!simpset)) 1);
|
|
294 |
(*Fake*)
|
|
295 |
by (simp_tac (!simpset addsimps [all_conj_distrib,parts_insert_sees]) 1);
|
2374
|
296 |
by (step_tac (!claset addSIs [analz_insertI]) 1);
|
2318
|
297 |
by (ex_strip_tac 1);
|
|
298 |
by (best_tac (!claset delrules [conjI]
|
2324
|
299 |
addSDs [impOfSubs Fake_parts_insert]
|
|
300 |
addDs [impOfSubs analz_subset_parts]
|
|
301 |
addss (!simpset)) 1);
|
2318
|
302 |
val lemma = result();
|
|
303 |
|
|
304 |
goal thy
|
|
305 |
"!!evs. [| Crypt(pubK A) {|Nonce NA, Nonce NB|} : parts(sees lost Spy evs); \
|
|
306 |
\ Crypt(pubK A'){|Nonce NA', Nonce NB|} : parts(sees lost Spy evs); \
|
|
307 |
\ Nonce NB ~: analz (sees lost Spy evs); \
|
|
308 |
\ evs : ns_public |] \
|
|
309 |
\ ==> A=A' & NA=NA'";
|
|
310 |
by (dtac lemma 1);
|
|
311 |
by (mp_tac 1);
|
|
312 |
by (REPEAT (etac exE 1));
|
|
313 |
(*Duplicate the assumption*)
|
|
314 |
by (forw_inst_tac [("psi", "ALL C.?P(C)")] asm_rl 1);
|
|
315 |
by (fast_tac (!claset addSDs [spec]) 1);
|
|
316 |
qed "unique_NB";
|
|
317 |
|
|
318 |
|
|
319 |
(*NB remains secret PROVIDED Alice never responds with round 3*)
|
|
320 |
goal thy
|
|
321 |
"!!evs. [| A ~: lost; B ~: lost; evs : ns_public |] \
|
|
322 |
\ ==> Says B A (Crypt (pubK A) {|Nonce NA, Nonce NB|}) : set_of_list evs --> \
|
|
323 |
\ (ALL C. Says A C (Crypt (pubK C) (Nonce NB)) ~: set_of_list evs) --> \
|
|
324 |
\ Nonce NB ~: analz (sees lost Spy evs)";
|
|
325 |
by (etac ns_public.induct 1);
|
|
326 |
by (ALLGOALS
|
|
327 |
(asm_simp_tac
|
2374
|
328 |
(!simpset addsimps ([not_parts_not_analz] @ pushes)
|
2318
|
329 |
setloop split_tac [expand_if])));
|
|
330 |
(*NS1*)
|
|
331 |
by (fast_tac (!claset addSEs partsEs
|
|
332 |
addSDs [new_nonces_not_seen,
|
|
333 |
Says_imp_sees_Spy' RS parts.Inj]) 2);
|
|
334 |
(*Fake*)
|
2374
|
335 |
by (REPEAT_FIRST spy_analz_tac);
|
2318
|
336 |
(*NS2 and NS3*)
|
|
337 |
by (Step_tac 1);
|
|
338 |
(*NS2*)
|
|
339 |
by (fast_tac (!claset addSDs [Says_imp_sees_Spy' RS parts.Inj]
|
|
340 |
addEs [no_nonce_NS1_NS2 RSN (2, rev_notE)]) 3);
|
|
341 |
by (fast_tac (!claset addSEs partsEs
|
|
342 |
addSDs [new_nonces_not_seen,
|
|
343 |
Says_imp_sees_Spy' RS parts.Inj]) 2);
|
|
344 |
by (Fast_tac 1);
|
|
345 |
(*NS3*)
|
|
346 |
by (Fast_tac 2);
|
|
347 |
by (fast_tac (!claset addSEs partsEs
|
|
348 |
addSDs [Says_imp_sees_Spy' RS parts.Inj,
|
|
349 |
new_nonces_not_seen,
|
|
350 |
impOfSubs analz_subset_parts]) 1);
|
|
351 |
|
|
352 |
by (forw_inst_tac [("A'","A")] (Says_imp_sees_Spy' RS parts.Inj RS unique_NB) 1
|
|
353 |
THEN REPEAT (eresolve_tac [asm_rl, Says_imp_sees_Spy' RS parts.Inj] 1));
|
|
354 |
by (Fast_tac 1);
|
|
355 |
bind_thm ("Spy_not_see_NB", result() RSN (2, rev_mp) RS mp);
|
|
356 |
|
|
357 |
|
|
358 |
|
|
359 |
(*Authentication for B: if he receives message 3 and has used NB
|
|
360 |
in message 2, then A has sent message 3.*)
|
|
361 |
goal thy
|
|
362 |
"!!evs. [| A ~: lost; B ~: lost; evs : ns_public |] \
|
|
363 |
\ ==> Crypt (pubK B) (Nonce NB) : parts (sees lost Spy evs) \
|
|
364 |
\ --> Says B A (Crypt (pubK A) {|Nonce NA, Nonce NB|}) : set_of_list evs \
|
|
365 |
\ --> (EX C. Says A C (Crypt (pubK C) (Nonce NB)) : set_of_list evs)";
|
|
366 |
by (etac ns_public.induct 1);
|
|
367 |
by (ALLGOALS (asm_simp_tac (!simpset addsimps [ex_disj_distrib])));
|
|
368 |
by (ALLGOALS Asm_simp_tac);
|
|
369 |
(*NS1*)
|
|
370 |
by (fast_tac (!claset addSEs partsEs
|
|
371 |
addSDs [new_nonces_not_seen,
|
|
372 |
Says_imp_sees_Spy' RS parts.Inj]) 2);
|
|
373 |
(*Fake*)
|
|
374 |
by (REPEAT_FIRST (resolve_tac [impI, conjI]));
|
|
375 |
by (fast_tac (!claset addss (!simpset)) 1);
|
|
376 |
br (ccontr RS disjI2) 1;
|
|
377 |
by (forward_tac [Spy_not_see_NB] 1 THEN REPEAT (assume_tac 1));
|
|
378 |
by (Fast_tac 1);
|
|
379 |
by (best_tac (!claset addSDs [impOfSubs Fake_parts_insert]
|
|
380 |
addDs [impOfSubs analz_subset_parts]
|
|
381 |
addss (!simpset)) 1);
|
|
382 |
(*NS3*)
|
|
383 |
by (Step_tac 1);
|
|
384 |
by (forward_tac [Spy_not_see_NB] 1 THEN REPEAT1 (assume_tac 1));
|
|
385 |
by (Fast_tac 1);
|
|
386 |
by (best_tac (!claset addSDs [Says_imp_sees_Spy' RS parts.Inj]
|
|
387 |
addDs [unique_NB]) 1);
|
|
388 |
qed_spec_mp "NB_decrypt_imp_A_msg";
|
|
389 |
|
|
390 |
|
|
391 |
(*Corollary: if B receives message NS3 and the nonce NB agrees
|
|
392 |
then A sent NB to somebody....*)
|
|
393 |
goal thy
|
|
394 |
"!!evs. [| Says A' B (Crypt (pubK B) (Nonce NB)): set_of_list evs; \
|
|
395 |
\ Says B A (Crypt (pubK A) {|Nonce NA, Nonce NB|}) \
|
|
396 |
\ : set_of_list evs; \
|
|
397 |
\ A ~: lost; B ~: lost; evs : ns_public |] \
|
|
398 |
\ ==> EX C. Says A C (Crypt (pubK C) (Nonce NB)) : set_of_list evs";
|
|
399 |
by (fast_tac (!claset addSIs [NB_decrypt_imp_A_msg]
|
|
400 |
addEs partsEs
|
|
401 |
addDs [Says_imp_sees_Spy' RS parts.Inj]) 1);
|
|
402 |
qed "B_trusts_NS3";
|
|
403 |
|
|
404 |
|
|
405 |
(*Can we strengthen the secrecy theorem? NO*)
|
|
406 |
goal thy
|
|
407 |
"!!evs. [| A ~: lost; B ~: lost; evs : ns_public |] \
|
|
408 |
\ ==> Says B A (Crypt (pubK A) {|Nonce NA, Nonce NB|}) : set_of_list evs \
|
|
409 |
\ --> Nonce NB ~: analz (sees lost Spy evs)";
|
|
410 |
by (etac ns_public.induct 1);
|
|
411 |
by (ALLGOALS
|
|
412 |
(asm_simp_tac
|
2374
|
413 |
(!simpset addsimps ([not_parts_not_analz] @ pushes)
|
2318
|
414 |
setloop split_tac [expand_if])));
|
|
415 |
(*NS1*)
|
|
416 |
by (fast_tac (!claset addSEs partsEs
|
|
417 |
addSDs [new_nonces_not_seen,
|
|
418 |
Says_imp_sees_Spy' RS parts.Inj]) 2);
|
|
419 |
(*Fake*)
|
2374
|
420 |
by (REPEAT_FIRST spy_analz_tac);
|
2318
|
421 |
(*NS2 and NS3*)
|
|
422 |
by (Step_tac 1);
|
|
423 |
(*NS2*)
|
|
424 |
by (fast_tac (!claset addSEs partsEs
|
|
425 |
addSDs [new_nonces_not_seen,
|
|
426 |
Says_imp_sees_Spy' RS parts.Inj]) 2);
|
|
427 |
by (fast_tac (!claset addSDs [Says_imp_sees_Spy' RS parts.Inj]
|
|
428 |
addEs [no_nonce_NS1_NS2 RSN (2, rev_notE)]) 1);
|
|
429 |
(*NS3*)
|
|
430 |
by (forw_inst_tac [("A'","A")] (Says_imp_sees_Spy' RS parts.Inj RS unique_NB) 1
|
|
431 |
THEN REPEAT (eresolve_tac [asm_rl, Says_imp_sees_Spy' RS parts.Inj] 1));
|
|
432 |
by (Step_tac 1);
|
|
433 |
|
|
434 |
(*
|
|
435 |
THIS IS THE ATTACK!
|
|
436 |
Level 9
|
|
437 |
!!evs. [| A ~: lost; B ~: lost; evs : ns_public |]
|
|
438 |
==> Says B A (Crypt (pubK A) {|Nonce NA, Nonce NB|})
|
|
439 |
: set_of_list evs -->
|
|
440 |
Nonce NB ~: analz (sees lost Spy evs)
|
|
441 |
1. !!evs Aa Ba B' NAa NBa evsa.
|
|
442 |
[| A ~: lost; B ~: lost; evsa : ns_public; A ~= Ba;
|
|
443 |
Says B' A (Crypt (pubK A) {|Nonce NA, Nonce NB|}) : set_of_list evsa;
|
|
444 |
Says A Ba (Crypt (pubK Ba) {|Nonce NA, Agent A|}) : set_of_list evsa;
|
|
445 |
Ba : lost;
|
|
446 |
Says B A (Crypt (pubK A) {|Nonce NA, Nonce NB|}) : set_of_list evsa;
|
|
447 |
Nonce NB ~: analz (sees lost Spy evsa) |]
|
|
448 |
==> False
|
|
449 |
*)
|
|
450 |
|
|
451 |
|
|
452 |
|