author  paulson 
Mon, 14 Jul 1997 12:47:21 +0200  
changeset 3519  ab0a9fbed4c0 
parent 3466  30791e5a69c4 
child 3674  65ec38fbb265 
permissions  rwrr 
2002  1 
(* Title: HOL/Auth/OtwayRees_Bad 
2 
ID: $Id$ 

3 
Author: Lawrence C Paulson, Cambridge University Computer Laboratory 

4 
Copyright 1996 University of Cambridge 

5 

6 
Inductive relation "otway" for the OtwayRees protocol. 

7 

8 
The FAULTY version omitting encryption of Nonce NB, as suggested on page 247 of 

9 
Burrows, Abadi and Needham. A Logic of Authentication. 

10 
Proc. Royal Soc. 426 (1989) 

11 

12 
This file illustrates the consequences of such errors. We can still prove 

2032  13 
impressivelooking properties such as Spy_not_see_encrypted_key, yet the 
2002  14 
protocol is open to a middleperson attack. Attempting to prove some key lemmas 
15 
indicates the possibility of this attack. 

16 
*) 

17 

18 
open OtwayRees_Bad; 

19 

20 
proof_timing:=true; 

21 
HOL_quantifiers := false; 

22 

23 

3121
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
paulson
parents:
3102
diff
changeset

24 
(*A "possibility property": there are traces that reach the end*) 
2002  25 
goal thy 
26 
"!!A B. [ A ~= B; A ~= Server; B ~= Server ] \ 

27 
\ ==> EX K. EX NA. EX evs: otway. \ 

2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset

28 
\ Says B A {Nonce NA, Crypt (shrK A) {Nonce NA, Key K}} \ 
3465  29 
\ : set evs"; 
2002  30 
by (REPEAT (resolve_tac [exI,bexI] 1)); 
2032  31 
by (rtac (otway.Nil RS otway.OR1 RS otway.OR2 RS otway.OR3 RS otway.OR4) 2); 
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset

32 
by possibility_tac; 
2002  33 
result(); 
34 

35 

36 
(**** Inductive proofs about otway ****) 

37 

38 
(*Nobody sends themselves messages*) 

3465  39 
goal thy "!!evs. evs : otway ==> ALL A X. Says A A X ~: set evs"; 
2032  40 
by (etac otway.induct 1); 
2002  41 
by (Auto_tac()); 
42 
qed_spec_mp "not_Says_to_self"; 

43 
Addsimps [not_Says_to_self]; 

44 
AddSEs [not_Says_to_self RSN (2, rev_notE)]; 

45 

46 

47 
(** For reasoning about the encrypted portion of messages **) 

48 

3465  49 
goal thy "!!evs. Says A' B {N, Agent A, Agent B, X} : set evs ==> \ 
3519
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3466
diff
changeset

50 
\ X : analz (sees Spy evs)"; 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3466
diff
changeset

51 
by (blast_tac (!claset addSDs [Says_imp_sees_Spy RS analz.Inj]) 1); 
2032  52 
qed "OR2_analz_sees_Spy"; 
2002  53 

3465  54 
goal thy "!!evs. Says S' B {N, X, Crypt (shrK B) X'} : set evs ==> \ 
3519
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3466
diff
changeset

55 
\ X : analz (sees Spy evs)"; 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3466
diff
changeset

56 
by (blast_tac (!claset addSDs [Says_imp_sees_Spy RS analz.Inj]) 1); 
2032  57 
qed "OR4_analz_sees_Spy"; 
2002  58 

3465  59 
goal thy "!!evs. Says Server B {NA, X, Crypt K' {NB,K}} : set evs \ 
3519
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3466
diff
changeset

60 
\ ==> K : parts (sees Spy evs)"; 
3102  61 
by (blast_tac (!claset addSEs sees_Spy_partsEs) 1); 
2131  62 
qed "Oops_parts_sees_Spy"; 
2002  63 

64 
(*OR2_analz... and OR4_analz... let us treat those cases using the same 

65 
argument as for the Fake case. This is possible for most, but not all, 

66 
proofs: Fake does not invent new nonces (as in OR2), and of course Fake 

2032  67 
messages originate from the Spy. *) 
2002  68 

2052  69 
bind_thm ("OR2_parts_sees_Spy", 
70 
OR2_analz_sees_Spy RS (impOfSubs analz_subset_parts)); 

71 
bind_thm ("OR4_parts_sees_Spy", 

72 
OR4_analz_sees_Spy RS (impOfSubs analz_subset_parts)); 

73 

3519
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3466
diff
changeset

74 
(*For proving the easier theorems about X ~: parts (sees Spy evs).*) 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3466
diff
changeset

75 
fun parts_induct_tac i = 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3466
diff
changeset

76 
etac otway.induct i THEN 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3466
diff
changeset

77 
forward_tac [Oops_parts_sees_Spy] (i+6) THEN 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3466
diff
changeset

78 
forward_tac [OR4_parts_sees_Spy] (i+5) THEN 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3466
diff
changeset

79 
forward_tac [OR2_parts_sees_Spy] (i+3) THEN 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3466
diff
changeset

80 
prove_simple_subgoals_tac i; 
2002  81 

82 

3519
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3466
diff
changeset

83 
(** Theorems of the form X ~: parts (sees Spy evs) imply that NOBODY 
2002  84 
sends messages containing X! **) 
85 

2131  86 
(*Spy never sees another agent's shared key! (unless it's lost at start)*) 
2002  87 
goal thy 
3519
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3466
diff
changeset

88 
"!!evs. evs : otway ==> (Key (shrK A) : parts (sees Spy evs)) = (A : lost)"; 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3466
diff
changeset

89 
by (parts_induct_tac 1); 
3121
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
paulson
parents:
3102
diff
changeset

90 
by (Fake_parts_insert_tac 1); 
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
paulson
parents:
3102
diff
changeset

91 
by (Blast_tac 1); 
2131  92 
qed "Spy_see_shrK"; 
93 
Addsimps [Spy_see_shrK]; 

2002  94 

2131  95 
goal thy 
3519
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3466
diff
changeset

96 
"!!evs. evs : otway ==> (Key (shrK A) : analz (sees Spy evs)) = (A : lost)"; 
2131  97 
by (auto_tac(!claset addDs [impOfSubs analz_subset_parts], !simpset)); 
98 
qed "Spy_analz_shrK"; 

99 
Addsimps [Spy_analz_shrK]; 

2002  100 

3519
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3466
diff
changeset

101 
goal thy "!!A. [ Key (shrK A) : parts (sees Spy evs); \ 
2131  102 
\ evs : otway ] ==> A:lost"; 
3102  103 
by (blast_tac (!claset addDs [Spy_see_shrK]) 1); 
2131  104 
qed "Spy_see_shrK_D"; 
2002  105 

2131  106 
bind_thm ("Spy_analz_shrK_D", analz_subset_parts RS subsetD RS Spy_see_shrK_D); 
107 
AddSDs [Spy_see_shrK_D, Spy_analz_shrK_D]; 

2002  108 

109 

2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset

110 
(*Nobody can have used nonexistent keys!*) 
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset

111 
goal thy "!!evs. evs : otway ==> \ 
3519
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3466
diff
changeset

112 
\ Key K ~: used evs > K ~: keysFor (parts (sees Spy evs))"; 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3466
diff
changeset

113 
by (parts_induct_tac 1); 
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset

114 
(*Fake*) 
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset

115 
by (best_tac 
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset

116 
(!claset addIs [impOfSubs analz_subset_parts] 
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset

117 
addDs [impOfSubs (analz_subset_parts RS keysFor_mono), 
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset

118 
impOfSubs (parts_insert_subset_Un RS keysFor_mono)] 
3207  119 
addss (!simpset)) 1); 
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset

120 
(*OR13*) 
3121
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
paulson
parents:
3102
diff
changeset

121 
by (ALLGOALS Blast_tac); 
2160  122 
qed_spec_mp "new_keys_not_used"; 
2002  123 

124 
bind_thm ("new_keys_not_analzd", 

2032  125 
[analz_subset_parts RS keysFor_mono, 
126 
new_keys_not_used] MRS contra_subsetD); 

2002  127 

128 
Addsimps [new_keys_not_used, new_keys_not_analzd]; 

129 

130 

2131  131 

132 
(*** Proofs involving analz ***) 

133 

134 
(*Describes the form of K and NA when the Server sends this message. Also 

135 
for Oops case.*) 

136 
goal thy 

2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset

137 
"!!evs. [ Says Server B \ 
3466
30791e5a69c4
Corrected indentations and margins after the renaming of "set_of_list"
paulson
parents:
3465
diff
changeset

138 
\ {NA, X, Crypt (shrK B) {NB, Key K}} : set evs; \ 
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset

139 
\ evs : otway ] \ 
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset

140 
\ ==> K ~: range shrK & (EX i. NA = Nonce i) & (EX j. NB = Nonce j)"; 
2131  141 
by (etac rev_mp 1); 
142 
by (etac otway.induct 1); 

3121
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
paulson
parents:
3102
diff
changeset

143 
by (prove_simple_subgoals_tac 1); 
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
paulson
parents:
3102
diff
changeset

144 
by (Blast_tac 1); 
2131  145 
qed "Says_Server_message_form"; 
146 

147 

148 
(*For proofs involving analz.*) 

3121
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
paulson
parents:
3102
diff
changeset

149 
val analz_sees_tac = 
2131  150 
dtac OR2_analz_sees_Spy 4 THEN 
151 
dtac OR4_analz_sees_Spy 6 THEN 

2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset

152 
forward_tac [Says_Server_message_form] 7 THEN assume_tac 7 THEN 
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2417
diff
changeset

153 
REPEAT ((eresolve_tac [exE, conjE] ORELSE' hyp_subst_tac) 7); 
2002  154 

155 

156 
(**** 

157 
The following is to prove theorems of the form 

158 

3519
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3466
diff
changeset

159 
Key K : analz (insert (Key KAB) (sees Spy evs)) ==> 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3466
diff
changeset

160 
Key K : analz (sees Spy evs) 
2002  161 

162 
A more general formula must be proved inductively. 

163 
****) 

164 

165 

166 
(** Session keys are not used to encrypt other session keys **) 

167 

168 
(*The equality makes the induction hypothesis easier to apply*) 

169 
goal thy 

3519
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3466
diff
changeset

170 
"!!evs. evs : otway ==> \ 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3466
diff
changeset

171 
\ ALL K KK. KK <= Compl (range shrK) > \ 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3466
diff
changeset

172 
\ (Key K : analz (Key``KK Un (sees Spy evs))) = \ 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3466
diff
changeset

173 
\ (K : KK  Key K : analz (sees Spy evs))"; 
2032  174 
by (etac otway.induct 1); 
3121
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
paulson
parents:
3102
diff
changeset

175 
by analz_sees_tac; 
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset

176 
by (REPEAT_FIRST (resolve_tac [allI, impI])); 
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset

177 
by (REPEAT_FIRST (rtac analz_image_freshK_lemma )); 
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset

178 
by (ALLGOALS (asm_simp_tac analz_image_freshK_ss)); 
3451
d10f100676d8
Made proofs more concise by replacing calls to spy_analz_tac by uses of
paulson
parents:
3207
diff
changeset

179 
(*Fake*) 
d10f100676d8
Made proofs more concise by replacing calls to spy_analz_tac by uses of
paulson
parents:
3207
diff
changeset

180 
by (spy_analz_tac 2); 
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset

181 
(*Base*) 
3121
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
paulson
parents:
3102
diff
changeset

182 
by (Blast_tac 1); 
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset

183 
qed_spec_mp "analz_image_freshK"; 
2002  184 

185 

186 
goal thy 

3519
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3466
diff
changeset

187 
"!!evs. [ evs : otway; KAB ~: range shrK ] ==> \ 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3466
diff
changeset

188 
\ Key K : analz (insert (Key KAB) (sees Spy evs)) = \ 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3466
diff
changeset

189 
\ (K = KAB  Key K : analz (sees Spy evs))"; 
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset

190 
by (asm_simp_tac (analz_image_freshK_ss addsimps [analz_image_freshK]) 1); 
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset

191 
qed "analz_insert_freshK"; 
2002  192 

193 

2131  194 
(*** The Key K uniquely identifies the Server's message. **) 
2002  195 

196 
goal thy 

3466
30791e5a69c4
Corrected indentations and margins after the renaming of "set_of_list"
paulson
parents:
3465
diff
changeset

197 
"!!evs. evs : otway ==> \ 
30791e5a69c4
Corrected indentations and margins after the renaming of "set_of_list"
paulson
parents:
3465
diff
changeset

198 
\ EX B' NA' NB' X'. ALL B NA NB X. \ 
30791e5a69c4
Corrected indentations and margins after the renaming of "set_of_list"
paulson
parents:
3465
diff
changeset

199 
\ Says Server B {NA, X, Crypt (shrK B) {NB, K}} : set evs > \ 
2131  200 
\ B=B' & NA=NA' & NB=NB' & X=X'"; 
2032  201 
by (etac otway.induct 1); 
2002  202 
by (ALLGOALS (asm_simp_tac (!simpset addsimps [all_conj_distrib]))); 
203 
by (Step_tac 1); 

204 
(*Remaining cases: OR3 and OR4*) 

205 
by (ex_strip_tac 2); 

3102  206 
by (Blast_tac 2); 
2107
23e8f15ec95f
The new proof of the lemma for new_nonces_not_seen is faster
paulson
parents:
2052
diff
changeset

207 
by (expand_case_tac "K = ?y" 1); 
23e8f15ec95f
The new proof of the lemma for new_nonces_not_seen is faster
paulson
parents:
2052
diff
changeset

208 
by (REPEAT (ares_tac [refl,exI,impI,conjI] 2)); 
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset

209 
(*...we assume X is a recent message, and handle this case by contradiction*) 
3102  210 
by (blast_tac (!claset addSEs sees_Spy_partsEs 
3121
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
paulson
parents:
3102
diff
changeset

211 
delrules [conjI] (*no splitup to 4 subgoals*)) 1); 
2002  212 
val lemma = result(); 
213 

214 
goal thy 

3466
30791e5a69c4
Corrected indentations and margins after the renaming of "set_of_list"
paulson
parents:
3465
diff
changeset

215 
"!!evs. [ Says Server B {NA, X, Crypt (shrK B) {NB, K}} : set evs; \ 
30791e5a69c4
Corrected indentations and margins after the renaming of "set_of_list"
paulson
parents:
3465
diff
changeset

216 
\ Says Server B' {NA',X',Crypt (shrK B') {NB',K}} : set evs; \ 
2131  217 
\ evs : otway ] ==> X=X' & B=B' & NA=NA' & NB=NB'"; 
2417  218 
by (prove_unique_tac lemma 1); 
2002  219 
qed "unique_session_keys"; 
220 

221 

2131  222 
(*Crucial security property, but not itself enough to guarantee correctness!*) 
223 
goal thy 

2166  224 
"!!evs. [ A ~: lost; B ~: lost; evs : otway ] \ 
225 
\ ==> Says Server B \ 

2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset

226 
\ {NA, Crypt (shrK A) {NA, Key K}, \ 
3466
30791e5a69c4
Corrected indentations and margins after the renaming of "set_of_list"
paulson
parents:
3465
diff
changeset

227 
\ Crypt (shrK B) {NB, Key K}} : set evs > \ 
30791e5a69c4
Corrected indentations and margins after the renaming of "set_of_list"
paulson
parents:
3465
diff
changeset

228 
\ Says B Spy {NA, NB, Key K} ~: set evs > \ 
3519
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3466
diff
changeset

229 
\ Key K ~: analz (sees Spy evs)"; 
2131  230 
by (etac otway.induct 1); 
3121
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
paulson
parents:
3102
diff
changeset

231 
by analz_sees_tac; 
2131  232 
by (ALLGOALS 
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset

233 
(asm_simp_tac (!simpset addcongs [conj_cong] 
3451
d10f100676d8
Made proofs more concise by replacing calls to spy_analz_tac by uses of
paulson
parents:
3207
diff
changeset

234 
addsimps [analz_insert_eq, not_parts_not_analz, 
d10f100676d8
Made proofs more concise by replacing calls to spy_analz_tac by uses of
paulson
parents:
3207
diff
changeset

235 
analz_insert_freshK] 
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset

236 
setloop split_tac [expand_if]))); 
3451
d10f100676d8
Made proofs more concise by replacing calls to spy_analz_tac by uses of
paulson
parents:
3207
diff
changeset

237 
(*Oops*) 
d10f100676d8
Made proofs more concise by replacing calls to spy_analz_tac by uses of
paulson
parents:
3207
diff
changeset

238 
by (blast_tac (!claset addSDs [unique_session_keys]) 4); 
d10f100676d8
Made proofs more concise by replacing calls to spy_analz_tac by uses of
paulson
parents:
3207
diff
changeset

239 
(*OR4*) 
d10f100676d8
Made proofs more concise by replacing calls to spy_analz_tac by uses of
paulson
parents:
3207
diff
changeset

240 
by (Blast_tac 3); 
2131  241 
(*OR3*) 
3451
d10f100676d8
Made proofs more concise by replacing calls to spy_analz_tac by uses of
paulson
parents:
3207
diff
changeset

242 
by (blast_tac (!claset addSEs sees_Spy_partsEs 
d10f100676d8
Made proofs more concise by replacing calls to spy_analz_tac by uses of
paulson
parents:
3207
diff
changeset

243 
addIs [impOfSubs analz_subset_parts]) 2); 
d10f100676d8
Made proofs more concise by replacing calls to spy_analz_tac by uses of
paulson
parents:
3207
diff
changeset

244 
(*Fake*) 
d10f100676d8
Made proofs more concise by replacing calls to spy_analz_tac by uses of
paulson
parents:
3207
diff
changeset

245 
by (spy_analz_tac 1); 
2131  246 
val lemma = result() RS mp RS mp RSN(2,rev_notE); 
247 

248 
goal thy 

3466
30791e5a69c4
Corrected indentations and margins after the renaming of "set_of_list"
paulson
parents:
3465
diff
changeset

249 
"!!evs. [ Says Server B \ 
30791e5a69c4
Corrected indentations and margins after the renaming of "set_of_list"
paulson
parents:
3465
diff
changeset

250 
\ {NA, Crypt (shrK A) {NA, Key K}, \ 
30791e5a69c4
Corrected indentations and margins after the renaming of "set_of_list"
paulson
parents:
3465
diff
changeset

251 
\ Crypt (shrK B) {NB, Key K}} : set evs; \ 
30791e5a69c4
Corrected indentations and margins after the renaming of "set_of_list"
paulson
parents:
3465
diff
changeset

252 
\ Says B Spy {NA, NB, Key K} ~: set evs; \ 
2131  253 
\ A ~: lost; B ~: lost; evs : otway ] \ 
3519
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3466
diff
changeset

254 
\ ==> Key K ~: analz (sees Spy evs)"; 
2131  255 
by (forward_tac [Says_Server_message_form] 1 THEN assume_tac 1); 
3102  256 
by (blast_tac (!claset addSEs [lemma]) 1); 
2131  257 
qed "Spy_not_see_encrypted_key"; 
258 

259 

260 
(*** Attempting to prove stronger properties ***) 

261 

2052  262 
(*Only OR1 can have caused such a part of a message to appear. 
263 
I'm not sure why A ~= B premise is needed: OtwayRees.ML doesn't need it. 

264 
Perhaps it's because OR2 has two similarlooking encrypted messages in 

2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset

265 
this version.*) 
2002  266 
goal thy 
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset

267 
"!!evs. [ A ~: lost; A ~= B; evs : otway ] \ 
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset

268 
\ ==> Crypt (shrK A) {NA, Agent A, Agent B} \ 
3519
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3466
diff
changeset

269 
\ : parts (sees Spy evs) > \ 
2131  270 
\ Says A B {NA, Agent A, Agent B, \ 
3466
30791e5a69c4
Corrected indentations and margins after the renaming of "set_of_list"
paulson
parents:
3465
diff
changeset

271 
\ Crypt (shrK A) {NA, Agent A, Agent B}} : set evs"; 
3519
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3466
diff
changeset

272 
by (parts_induct_tac 1); 
3121
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
paulson
parents:
3102
diff
changeset

273 
by (Fake_parts_insert_tac 1); 
3102  274 
by (Blast_tac 1); 
2002  275 
qed_spec_mp "Crypt_imp_OR1"; 
276 

277 

2131  278 
(*Crucial property: If the encrypted message appears, and A has used NA 
279 
to start a run, then it originated with the Server!*) 

280 
(*Only it is FALSE. Somebody could make a fake message to Server 

2002  281 
substituting some other nonce NA' for NB.*) 
282 
goal thy 

3519
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3466
diff
changeset

283 
"!!evs. [ A ~: lost; A ~= Spy; evs : otway ] \ 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3466
diff
changeset

284 
\ ==> Crypt (shrK A) {NA, Key K} : parts (sees Spy evs) > \ 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3466
diff
changeset

285 
\ Says A B {NA, Agent A, Agent B, \ 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3466
diff
changeset

286 
\ Crypt (shrK A) {NA, Agent A, Agent B}} \ 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3466
diff
changeset

287 
\ : set evs > \ 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3466
diff
changeset

288 
\ (EX B NB. Says Server B \ 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3466
diff
changeset

289 
\ {NA, \ 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3466
diff
changeset

290 
\ Crypt (shrK A) {NA, Key K}, \ 
3466
30791e5a69c4
Corrected indentations and margins after the renaming of "set_of_list"
paulson
parents:
3465
diff
changeset

291 
\ Crypt (shrK B) {NB, Key K}} : set evs)"; 
3519
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3466
diff
changeset

292 
by (parts_induct_tac 1); 
3121
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
paulson
parents:
3102
diff
changeset

293 
by (Fake_parts_insert_tac 1); 
2002  294 
(*OR1: it cannot be a new Nonce, contradiction.*) 
3102  295 
by (blast_tac (!claset addSIs [parts_insertI] 
296 
addSEs sees_Spy_partsEs) 1); 

2002  297 
(*OR4*) 
298 
by (REPEAT (Safe_step_tac 2)); 

3102  299 
by (REPEAT (blast_tac (!claset addSDs [parts_cut]) 3)); 
300 
by (blast_tac (!claset addSIs [Crypt_imp_OR1] 

301 
addEs sees_Spy_partsEs) 2); 

2131  302 
(*OR3*) (** LEVEL 5 **) 
2002  303 
by (ALLGOALS (asm_simp_tac (!simpset addsimps [ex_disj_distrib]))); 
2052  304 
by (step_tac (!claset delrules [disjCI, impCE]) 1); 
2002  305 
(*The hypotheses at this point suggest an attack in which nonce NA is used 
2052  306 
in two different roles: 
307 
Says B' Server 

308 
{Nonce NAa, Agent Aa, Agent A, 

2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset

309 
Crypt (shrK Aa) {Nonce NAa, Agent Aa, Agent A}, Nonce NA, 
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset

310 
Crypt (shrK A) {Nonce NAa, Agent Aa, Agent A}} 
3465  311 
: set evsa; 
2052  312 
Says A B 
313 
{Nonce NA, Agent A, Agent B, 

2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset

314 
Crypt (shrK A) {Nonce NA, Agent A, Agent B}} 
3465  315 
: set evsa 
2052  316 
*) 
2131  317 
writeln "GIVE UP! on NA_Crypt_imp_Server_msg"; 
2002  318 

319 

2052  320 
(*Thus the key property A_can_trust probably fails too.*) 