src/HOL/Auth/OtwayRees_Bad.ML
author paulson
Fri Nov 29 18:03:21 1996 +0100 (1996-11-29)
changeset 2284 80ebd1a213fd
parent 2264 f298678bd54a
child 2375 14539397fc04
permissions -rw-r--r--
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson@2002
     1
(*  Title:      HOL/Auth/OtwayRees_Bad
paulson@2002
     2
    ID:         $Id$
paulson@2002
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
paulson@2002
     4
    Copyright   1996  University of Cambridge
paulson@2002
     5
paulson@2002
     6
Inductive relation "otway" for the Otway-Rees protocol.
paulson@2002
     7
paulson@2002
     8
The FAULTY version omitting encryption of Nonce NB, as suggested on page 247 of
paulson@2002
     9
  Burrows, Abadi and Needham.  A Logic of Authentication.
paulson@2002
    10
  Proc. Royal Soc. 426 (1989)
paulson@2002
    11
paulson@2002
    12
This file illustrates the consequences of such errors.  We can still prove
paulson@2032
    13
impressive-looking properties such as Spy_not_see_encrypted_key, yet the
paulson@2002
    14
protocol is open to a middleperson attack.  Attempting to prove some key lemmas
paulson@2002
    15
indicates the possibility of this attack.
paulson@2002
    16
*)
paulson@2002
    17
paulson@2002
    18
open OtwayRees_Bad;
paulson@2002
    19
paulson@2002
    20
proof_timing:=true;
paulson@2002
    21
HOL_quantifiers := false;
paulson@2002
    22
paulson@2002
    23
paulson@2002
    24
(*Weak liveness: there are traces that reach the end*)
paulson@2002
    25
goal thy 
paulson@2002
    26
 "!!A B. [| A ~= B; A ~= Server; B ~= Server |]   \
paulson@2002
    27
\        ==> EX K. EX NA. EX evs: otway.          \
paulson@2284
    28
\               Says B A {|Nonce NA, Crypt (shrK A) {|Nonce NA, Key K|}|} \
paulson@2002
    29
\                 : set_of_list evs";
paulson@2002
    30
by (REPEAT (resolve_tac [exI,bexI] 1));
paulson@2032
    31
by (rtac (otway.Nil RS otway.OR1 RS otway.OR2 RS otway.OR3 RS otway.OR4) 2);
paulson@2002
    32
by (ALLGOALS (simp_tac (!simpset setsolver safe_solver)));
paulson@2002
    33
by (REPEAT_FIRST (resolve_tac [refl, conjI]));
paulson@2002
    34
by (ALLGOALS (fast_tac (!claset addss (!simpset setsolver safe_solver))));
paulson@2002
    35
result();
paulson@2002
    36
paulson@2002
    37
paulson@2002
    38
(**** Inductive proofs about otway ****)
paulson@2002
    39
paulson@2032
    40
(*The Spy can see more than anybody else, except for their initial state*)
paulson@2002
    41
goal thy 
paulson@2002
    42
 "!!evs. evs : otway ==> \
paulson@2052
    43
\     sees lost A evs <= initState lost A Un sees lost Spy evs";
paulson@2032
    44
by (etac otway.induct 1);
paulson@2002
    45
by (ALLGOALS (fast_tac (!claset addDs [sees_Says_subset_insert RS subsetD] 
paulson@2032
    46
                                addss (!simpset))));
paulson@2032
    47
qed "sees_agent_subset_sees_Spy";
paulson@2002
    48
paulson@2002
    49
paulson@2002
    50
(*Nobody sends themselves messages*)
paulson@2002
    51
goal thy "!!evs. evs : otway ==> ALL A X. Says A A X ~: set_of_list evs";
paulson@2032
    52
by (etac otway.induct 1);
paulson@2002
    53
by (Auto_tac());
paulson@2002
    54
qed_spec_mp "not_Says_to_self";
paulson@2002
    55
Addsimps [not_Says_to_self];
paulson@2002
    56
AddSEs   [not_Says_to_self RSN (2, rev_notE)];
paulson@2002
    57
paulson@2002
    58
paulson@2002
    59
(** For reasoning about the encrypted portion of messages **)
paulson@2002
    60
paulson@2002
    61
goal thy "!!evs. Says A' B {|N, Agent A, Agent B, X|} : set_of_list evs ==> \
paulson@2052
    62
\                X : analz (sees lost Spy evs)";
paulson@2032
    63
by (fast_tac (!claset addSDs [Says_imp_sees_Spy RS analz.Inj]) 1);
paulson@2032
    64
qed "OR2_analz_sees_Spy";
paulson@2002
    65
paulson@2002
    66
goal thy "!!evs. Says S B {|N, X, X'|} : set_of_list evs ==> \
paulson@2052
    67
\                X : analz (sees lost Spy evs)";
paulson@2032
    68
by (fast_tac (!claset addSDs [Says_imp_sees_Spy RS analz.Inj]) 1);
paulson@2032
    69
qed "OR4_analz_sees_Spy";
paulson@2002
    70
paulson@2284
    71
goal thy "!!evs. Says Server B {|NA, X, Crypt K' {|NB,K|}|} : set_of_list evs \
paulson@2131
    72
\                 ==> K : parts (sees lost Spy evs)";
paulson@2002
    73
by (fast_tac (!claset addSEs partsEs
paulson@2032
    74
                      addSDs [Says_imp_sees_Spy RS parts.Inj]) 1);
paulson@2131
    75
qed "Oops_parts_sees_Spy";
paulson@2002
    76
paulson@2002
    77
(*OR2_analz... and OR4_analz... let us treat those cases using the same 
paulson@2002
    78
  argument as for the Fake case.  This is possible for most, but not all,
paulson@2002
    79
  proofs: Fake does not invent new nonces (as in OR2), and of course Fake
paulson@2032
    80
  messages originate from the Spy. *)
paulson@2002
    81
paulson@2052
    82
bind_thm ("OR2_parts_sees_Spy",
paulson@2052
    83
          OR2_analz_sees_Spy RS (impOfSubs analz_subset_parts));
paulson@2052
    84
bind_thm ("OR4_parts_sees_Spy",
paulson@2052
    85
          OR4_analz_sees_Spy RS (impOfSubs analz_subset_parts));
paulson@2052
    86
paulson@2002
    87
val parts_Fake_tac = 
paulson@2052
    88
    forward_tac [OR2_parts_sees_Spy] 4 THEN 
paulson@2052
    89
    forward_tac [OR4_parts_sees_Spy] 6 THEN
paulson@2131
    90
    forward_tac [Oops_parts_sees_Spy] 7;
paulson@2131
    91
paulson@2131
    92
(*For proving the easier theorems about X ~: parts (sees lost Spy evs) *)
paulson@2131
    93
fun parts_induct_tac i = SELECT_GOAL
paulson@2131
    94
    (DETERM (etac otway.induct 1 THEN parts_Fake_tac THEN
paulson@2131
    95
	     (*Fake message*)
paulson@2131
    96
	     TRY (best_tac (!claset addDs [impOfSubs analz_subset_parts,
paulson@2131
    97
					   impOfSubs Fake_parts_insert]
paulson@2131
    98
                                    addss (!simpset)) 2)) THEN
paulson@2131
    99
     (*Base case*)
paulson@2131
   100
     fast_tac (!claset addss (!simpset)) 1 THEN
paulson@2131
   101
     ALLGOALS Asm_simp_tac) i;
paulson@2002
   102
paulson@2002
   103
paulson@2052
   104
(** Theorems of the form X ~: parts (sees lost Spy evs) imply that NOBODY
paulson@2002
   105
    sends messages containing X! **)
paulson@2002
   106
paulson@2131
   107
(*Spy never sees another agent's shared key! (unless it's lost at start)*)
paulson@2002
   108
goal thy 
paulson@2131
   109
 "!!evs. evs : otway \
paulson@2131
   110
\        ==> (Key (shrK A) : parts (sees lost Spy evs)) = (A : lost)";
paulson@2131
   111
by (parts_induct_tac 1);
paulson@2002
   112
by (Auto_tac());
paulson@2131
   113
qed "Spy_see_shrK";
paulson@2131
   114
Addsimps [Spy_see_shrK];
paulson@2002
   115
paulson@2131
   116
goal thy 
paulson@2131
   117
 "!!evs. evs : otway \
paulson@2131
   118
\        ==> (Key (shrK A) : analz (sees lost Spy evs)) = (A : lost)";
paulson@2131
   119
by (auto_tac(!claset addDs [impOfSubs analz_subset_parts], !simpset));
paulson@2131
   120
qed "Spy_analz_shrK";
paulson@2131
   121
Addsimps [Spy_analz_shrK];
paulson@2002
   122
paulson@2131
   123
goal thy  "!!A. [| Key (shrK A) : parts (sees lost Spy evs);       \
paulson@2131
   124
\                  evs : otway |] ==> A:lost";
paulson@2131
   125
by (fast_tac (!claset addDs [Spy_see_shrK]) 1);
paulson@2131
   126
qed "Spy_see_shrK_D";
paulson@2002
   127
paulson@2131
   128
bind_thm ("Spy_analz_shrK_D", analz_subset_parts RS subsetD RS Spy_see_shrK_D);
paulson@2131
   129
AddSDs [Spy_see_shrK_D, Spy_analz_shrK_D];
paulson@2002
   130
paulson@2002
   131
paulson@2002
   132
(*** Future keys can't be seen or used! ***)
paulson@2002
   133
paulson@2160
   134
(*Nobody can have SEEN keys that will be generated in the future. *)
paulson@2160
   135
goal thy "!!evs. evs : otway ==>               \
paulson@2002
   136
\                length evs <= length evs' --> \
paulson@2160
   137
\                Key (newK evs') ~: parts (sees lost Spy evs)";
paulson@2131
   138
by (parts_induct_tac 1);
paulson@2264
   139
by (REPEAT_FIRST (best_tac (!claset addEs [leD RS notE]
paulson@2264
   140
				    addDs [impOfSubs analz_subset_parts,
paulson@2160
   141
					   impOfSubs parts_insert_subset_Un,
paulson@2160
   142
					   Suc_leD]
paulson@2032
   143
                                addss (!simpset))));
paulson@2160
   144
qed_spec_mp "new_keys_not_seen";
paulson@2002
   145
Addsimps [new_keys_not_seen];
paulson@2002
   146
paulson@2160
   147
(*Variant: old messages must contain old keys!*)
paulson@2002
   148
goal thy 
paulson@2002
   149
 "!!evs. [| Says A B X : set_of_list evs;  \
paulson@2002
   150
\           Key (newK evt) : parts {X};    \
paulson@2002
   151
\           evs : otway                 \
paulson@2002
   152
\        |] ==> length evt < length evs";
paulson@2032
   153
by (rtac ccontr 1);
paulson@2052
   154
by (dtac leI 1);
paulson@2032
   155
by (fast_tac (!claset addSDs [new_keys_not_seen, Says_imp_sees_Spy]
paulson@2052
   156
                      addIs  [impOfSubs parts_mono]) 1);
paulson@2002
   157
qed "Says_imp_old_keys";
paulson@2002
   158
paulson@2002
   159
paulson@2160
   160
(*** Future nonces can't be seen or used! ***)
paulson@2002
   161
paulson@2002
   162
goal thy "!!evs. evs : otway ==> \
paulson@2002
   163
\                length evs <= length evs' --> \
paulson@2160
   164
\                Nonce (newN evs') ~: parts (sees lost Spy evs)";
paulson@2160
   165
by (parts_induct_tac 1);
paulson@2160
   166
by (REPEAT_FIRST
paulson@2160
   167
    (fast_tac (!claset addSEs partsEs
paulson@2160
   168
	               addSDs  [Says_imp_sees_Spy RS parts.Inj]
paulson@2264
   169
		       addEs [leD RS notE]
paulson@2160
   170
		       addDs  [impOfSubs analz_subset_parts,
paulson@2160
   171
			       impOfSubs parts_insert_subset_Un, Suc_leD]
paulson@2160
   172
		       addss (!simpset))));
paulson@2160
   173
qed_spec_mp "new_nonces_not_seen";
paulson@2002
   174
Addsimps [new_nonces_not_seen];
paulson@2002
   175
paulson@2160
   176
(*Variant: old messages must contain old nonces!*)
paulson@2002
   177
goal thy 
paulson@2160
   178
 "!!evs. [| Says A B X : set_of_list evs;    \
paulson@2002
   179
\           Nonce (newN evt) : parts {X};    \
paulson@2002
   180
\           evs : otway                 \
paulson@2002
   181
\        |] ==> length evt < length evs";
paulson@2032
   182
by (rtac ccontr 1);
paulson@2052
   183
by (dtac leI 1);
paulson@2032
   184
by (fast_tac (!claset addSDs [new_nonces_not_seen, Says_imp_sees_Spy]
paulson@2052
   185
                      addIs  [impOfSubs parts_mono]) 1);
paulson@2002
   186
qed "Says_imp_old_nonces";
paulson@2002
   187
paulson@2002
   188
paulson@2002
   189
(*Nobody can have USED keys that will be generated in the future.
paulson@2002
   190
  ...very like new_keys_not_seen*)
paulson@2002
   191
goal thy "!!evs. evs : otway ==> \
paulson@2002
   192
\                length evs <= length evs' --> \
paulson@2160
   193
\                newK evs' ~: keysFor (parts (sees lost Spy evs))";
paulson@2131
   194
by (parts_induct_tac 1);
paulson@2002
   195
(*OR1 and OR3*)
paulson@2002
   196
by (EVERY (map (fast_tac (!claset addDs [Suc_leD] addss (!simpset))) [4,2]));
paulson@2002
   197
(*Fake, OR2, OR4: these messages send unknown (X) components*)
paulson@2107
   198
by (REPEAT
paulson@2107
   199
    (best_tac
paulson@2002
   200
      (!claset addDs [impOfSubs (analz_subset_parts RS keysFor_mono),
paulson@2032
   201
                      impOfSubs (parts_insert_subset_Un RS keysFor_mono),
paulson@2032
   202
                      Suc_leD]
paulson@2032
   203
               addEs [new_keys_not_seen RS not_parts_not_analz RSN(2,rev_notE)]
paulson@2107
   204
               addss (!simpset)) 1));
paulson@2160
   205
qed_spec_mp "new_keys_not_used";
paulson@2002
   206
paulson@2002
   207
bind_thm ("new_keys_not_analzd",
paulson@2032
   208
          [analz_subset_parts RS keysFor_mono,
paulson@2032
   209
           new_keys_not_used] MRS contra_subsetD);
paulson@2002
   210
paulson@2002
   211
Addsimps [new_keys_not_used, new_keys_not_analzd];
paulson@2002
   212
paulson@2002
   213
paulson@2131
   214
paulson@2131
   215
(*** Proofs involving analz ***)
paulson@2131
   216
paulson@2131
   217
(*Describes the form of K and NA when the Server sends this message.  Also
paulson@2131
   218
  for Oops case.*)
paulson@2131
   219
goal thy 
paulson@2131
   220
 "!!evs. [| Says Server B \
paulson@2284
   221
\            {|NA, X, Crypt (shrK B) {|NB, K|}|} : set_of_list evs;  \
paulson@2131
   222
\           evs : otway |]                                   \
paulson@2131
   223
\        ==> (EX evt: otway. K = Key(newK evt)) &            \
paulson@2131
   224
\            (EX i. NA = Nonce i) & (EX j. NB = Nonce j)";
paulson@2131
   225
by (etac rev_mp 1);
paulson@2131
   226
by (etac otway.induct 1);
paulson@2131
   227
by (ALLGOALS (fast_tac (!claset addss (!simpset))));
paulson@2131
   228
qed "Says_Server_message_form";
paulson@2131
   229
paulson@2131
   230
paulson@2131
   231
(*For proofs involving analz.*)
paulson@2131
   232
val analz_Fake_tac = 
paulson@2131
   233
    dtac OR2_analz_sees_Spy 4 THEN 
paulson@2131
   234
    dtac OR4_analz_sees_Spy 6 THEN
paulson@2131
   235
    forward_tac [Says_Server_message_form] 7 THEN
paulson@2131
   236
    assume_tac 7 THEN Full_simp_tac 7 THEN
paulson@2131
   237
    REPEAT ((eresolve_tac [bexE, exE, conjE] ORELSE' hyp_subst_tac) 7);
paulson@2002
   238
paulson@2002
   239
paulson@2002
   240
(****
paulson@2002
   241
 The following is to prove theorems of the form
paulson@2002
   242
paulson@2052
   243
          Key K : analz (insert (Key (newK evt)) (sees lost Spy evs)) ==>
paulson@2052
   244
          Key K : analz (sees lost Spy evs)
paulson@2002
   245
paulson@2002
   246
 A more general formula must be proved inductively.
paulson@2002
   247
paulson@2002
   248
****)
paulson@2002
   249
paulson@2002
   250
paulson@2002
   251
(** Session keys are not used to encrypt other session keys **)
paulson@2002
   252
paulson@2002
   253
(*Lemma for the trivial direction of the if-and-only-if*)
paulson@2002
   254
goal thy  
paulson@2002
   255
 "!!evs. (Key K : analz (Key``nE Un sEe)) --> \
paulson@2002
   256
\         (K : nE | Key K : analz sEe)  ==>     \
paulson@2002
   257
\        (Key K : analz (Key``nE Un sEe)) = (K : nE | Key K : analz sEe)";
paulson@2002
   258
by (fast_tac (!claset addSEs [impOfSubs analz_mono]) 1);
paulson@2002
   259
val lemma = result();
paulson@2002
   260
paulson@2002
   261
paulson@2002
   262
(*The equality makes the induction hypothesis easier to apply*)
paulson@2002
   263
goal thy  
paulson@2002
   264
 "!!evs. evs : otway ==> \
paulson@2052
   265
\  ALL K E. (Key K : analz (Key``(newK``E) Un (sees lost Spy evs))) = \
paulson@2052
   266
\           (K : newK``E | Key K : analz (sees lost Spy evs))";
paulson@2032
   267
by (etac otway.induct 1);
paulson@2131
   268
by analz_Fake_tac;
paulson@2002
   269
by (REPEAT_FIRST (ares_tac [allI, lemma]));
paulson@2131
   270
by (ALLGOALS
paulson@2002
   271
    (asm_simp_tac 
paulson@2002
   272
     (!simpset addsimps ([insert_Key_singleton, insert_Key_image, pushKey_newK]
paulson@2032
   273
                         @ pushes)
paulson@2002
   274
               setloop split_tac [expand_if])));
paulson@2002
   275
(** LEVEL 7 **)
paulson@2131
   276
(*OR4, OR2, Fake*) 
paulson@2131
   277
by (EVERY (map spy_analz_tac [5,3,2]));
paulson@2131
   278
(*Oops, OR3, Base*)
paulson@2131
   279
by (REPEAT (fast_tac (!claset addIs [image_eqI] addss (!simpset)) 1));
paulson@2002
   280
qed_spec_mp "analz_image_newK";
paulson@2002
   281
paulson@2002
   282
paulson@2002
   283
goal thy
paulson@2002
   284
 "!!evs. evs : otway ==>                               \
paulson@2052
   285
\        Key K : analz (insert (Key (newK evt)) (sees lost Spy evs)) = \
paulson@2052
   286
\        (K = newK evt | Key K : analz (sees lost Spy evs))";
paulson@2002
   287
by (asm_simp_tac (HOL_ss addsimps [pushKey_newK, analz_image_newK, 
paulson@2032
   288
                                   insert_Key_singleton]) 1);
paulson@2002
   289
by (Fast_tac 1);
paulson@2002
   290
qed "analz_insert_Key_newK";
paulson@2002
   291
paulson@2002
   292
paulson@2131
   293
(*** The Key K uniquely identifies the Server's  message. **)
paulson@2002
   294
paulson@2002
   295
goal thy 
paulson@2131
   296
 "!!evs. evs : otway ==>                                                 \
paulson@2131
   297
\   EX B' NA' NB' X'. ALL B NA NB X.                                          \
paulson@2284
   298
\     Says Server B {|NA, X, Crypt (shrK B) {|NB, K|}|} : set_of_list evs --> \
paulson@2131
   299
\     B=B' & NA=NA' & NB=NB' & X=X'";
paulson@2032
   300
by (etac otway.induct 1);
paulson@2002
   301
by (ALLGOALS (asm_simp_tac (!simpset addsimps [all_conj_distrib])));
paulson@2002
   302
by (Step_tac 1);
paulson@2002
   303
(*Remaining cases: OR3 and OR4*)
paulson@2002
   304
by (ex_strip_tac 2);
paulson@2002
   305
by (Fast_tac 2);
paulson@2107
   306
by (expand_case_tac "K = ?y" 1);
paulson@2107
   307
by (REPEAT (ares_tac [refl,exI,impI,conjI] 2));
paulson@2002
   308
(*...we assume X is a very new message, and handle this case by contradiction*)
paulson@2002
   309
by (fast_tac (!claset addEs [Says_imp_old_keys RS less_irrefl]
paulson@2032
   310
                      delrules [conjI]    (*prevent split-up into 4 subgoals*)
paulson@2032
   311
                      addss (!simpset addsimps [parts_insertI])) 1);
paulson@2002
   312
val lemma = result();
paulson@2002
   313
paulson@2002
   314
goal thy 
paulson@2284
   315
 "!!evs. [| Says Server B {|NA, X, Crypt (shrK B) {|NB, K|}|}      \
paulson@2002
   316
\            : set_of_list evs;                                    \ 
paulson@2284
   317
\           Says Server B' {|NA',X',Crypt (shrK B') {|NB',K|}|}    \
paulson@2002
   318
\            : set_of_list evs;                                    \
paulson@2131
   319
\           evs : otway |] ==> X=X' & B=B' & NA=NA' & NB=NB'";
paulson@2032
   320
by (dtac lemma 1);
paulson@2002
   321
by (REPEAT (etac exE 1));
paulson@2002
   322
(*Duplicate the assumption*)
paulson@2002
   323
by (forw_inst_tac [("psi", "ALL C.?P(C)")] asm_rl 1);
paulson@2002
   324
by (fast_tac (!claset addSDs [spec]) 1);
paulson@2002
   325
qed "unique_session_keys";
paulson@2002
   326
paulson@2002
   327
paulson@2131
   328
(*Crucial security property, but not itself enough to guarantee correctness!*)
paulson@2131
   329
goal thy 
paulson@2166
   330
 "!!evs. [| A ~: lost;  B ~: lost;  evs : otway |]                    \
paulson@2166
   331
\        ==> Says Server B                                            \
paulson@2284
   332
\              {|NA, Crypt (shrK A) {|NA, Key K|},                    \
paulson@2284
   333
\                Crypt (shrK B) {|NB, Key K|}|} : set_of_list evs --> \
paulson@2166
   334
\            Says B Spy {|NA, NB, Key K|} ~: set_of_list evs -->      \
paulson@2166
   335
\            Key K ~: analz (sees lost Spy evs)";
paulson@2131
   336
by (etac otway.induct 1);
paulson@2131
   337
by analz_Fake_tac;
paulson@2131
   338
by (ALLGOALS
paulson@2131
   339
    (asm_full_simp_tac 
paulson@2131
   340
     (!simpset addsimps ([analz_subset_parts RS contra_subsetD,
paulson@2131
   341
                          analz_insert_Key_newK] @ pushes)
paulson@2131
   342
               setloop split_tac [expand_if])));
paulson@2131
   343
(*OR3*)
paulson@2166
   344
by (fast_tac (!claset addEs [Says_imp_old_keys RS less_irrefl]
paulson@2131
   345
                      addss (!simpset addsimps [parts_insert2])) 3);
paulson@2131
   346
(*OR4, OR2, Fake*) 
paulson@2131
   347
by (REPEAT_FIRST (resolve_tac [conjI, impI] ORELSE' spy_analz_tac));
paulson@2131
   348
(*Oops*) (** LEVEL 5 **)
paulson@2131
   349
by (fast_tac (!claset delrules [disjE]
paulson@2131
   350
		      addDs [unique_session_keys] addss (!simpset)) 1);
paulson@2131
   351
val lemma = result() RS mp RS mp RSN(2,rev_notE);
paulson@2131
   352
paulson@2131
   353
paulson@2131
   354
goal thy 
paulson@2131
   355
 "!!evs. [| Says Server B                                         \
paulson@2284
   356
\            {|NA, Crypt (shrK A) {|NA, K|},                      \
paulson@2284
   357
\                  Crypt (shrK B) {|NB, K|}|} : set_of_list evs;  \
paulson@2131
   358
\            Says B Spy {|NA, NB, K|} ~: set_of_list evs;         \
paulson@2131
   359
\           A ~: lost;  B ~: lost;  evs : otway |]                \
paulson@2131
   360
\        ==> K ~: analz (sees lost Spy evs)";
paulson@2131
   361
by (forward_tac [Says_Server_message_form] 1 THEN assume_tac 1);
paulson@2131
   362
by (fast_tac (!claset addSEs [lemma]) 1);
paulson@2131
   363
qed "Spy_not_see_encrypted_key";
paulson@2131
   364
paulson@2131
   365
paulson@2131
   366
(*** Attempting to prove stronger properties ***)
paulson@2131
   367
paulson@2052
   368
(*Only OR1 can have caused such a part of a message to appear.
paulson@2052
   369
  I'm not sure why A ~= B premise is needed: OtwayRees.ML doesn't need it.
paulson@2052
   370
  Perhaps it's because OR2 has two similar-looking encrypted messages in
paulson@2052
   371
	this version.*)
paulson@2002
   372
goal thy 
paulson@2131
   373
 "!!evs. [| A ~: lost;  A ~= B; evs : otway |]                 \
paulson@2284
   374
\        ==> Crypt (shrK A) {|NA, Agent A, Agent B|}           \
paulson@2052
   375
\             : parts (sees lost Spy evs) -->                  \
paulson@2131
   376
\            Says A B {|NA, Agent A, Agent B,                  \
paulson@2284
   377
\                       Crypt (shrK A) {|NA, Agent A, Agent B|}|}  \
paulson@2002
   378
\             : set_of_list evs";
paulson@2131
   379
by (parts_induct_tac 1);
paulson@2131
   380
by (Fast_tac 1);
paulson@2002
   381
qed_spec_mp "Crypt_imp_OR1";
paulson@2002
   382
paulson@2002
   383
paulson@2131
   384
(*Crucial property: If the encrypted message appears, and A has used NA
paulson@2131
   385
  to start a run, then it originated with the Server!*)
paulson@2131
   386
(*Only it is FALSE.  Somebody could make a fake message to Server
paulson@2002
   387
          substituting some other nonce NA' for NB.*)
paulson@2002
   388
goal thy 
paulson@2052
   389
 "!!evs. [| A ~: lost;  A ~= Spy;  evs : otway |]                        \
paulson@2284
   390
\        ==> Crypt (shrK A) {|NA, Key K|} : parts (sees lost Spy evs) --> \
paulson@2131
   391
\            Says A B {|NA, Agent A, Agent B,                  \
paulson@2284
   392
\                       Crypt (shrK A) {|NA, Agent A, Agent B|}|}  \
paulson@2131
   393
\             : set_of_list evs -->                            \
paulson@2131
   394
\            (EX B NB. Says Server B                           \
paulson@2131
   395
\                 {|NA,                                        \
paulson@2284
   396
\                   Crypt (shrK A) {|NA, Key K|},              \
paulson@2284
   397
\                   Crypt (shrK B) {|NB, Key K|}|}             \
paulson@2002
   398
\                   : set_of_list evs)";
paulson@2131
   399
by (parts_induct_tac 1);
paulson@2002
   400
(*OR1: it cannot be a new Nonce, contradiction.*)
paulson@2002
   401
by (fast_tac (!claset addSIs [parts_insertI]
paulson@2032
   402
                      addSEs partsEs
paulson@2032
   403
                      addEs [Says_imp_old_nonces RS less_irrefl]
paulson@2032
   404
                      addss (!simpset)) 1);
paulson@2002
   405
(*OR4*)
paulson@2002
   406
by (REPEAT (Safe_step_tac 2));
paulson@2052
   407
by (REPEAT (best_tac (!claset addSDs [parts_cut]) 3));
paulson@2052
   408
by (fast_tac (!claset addSIs [Crypt_imp_OR1]
paulson@2052
   409
                      addEs  partsEs
paulson@2052
   410
                      addDs [Says_imp_sees_Spy RS parts.Inj]) 2);
paulson@2131
   411
(*OR3*)  (** LEVEL 5 **)
paulson@2002
   412
by (ALLGOALS (asm_simp_tac (!simpset addsimps [ex_disj_distrib])));
paulson@2052
   413
by (step_tac (!claset delrules [disjCI, impCE]) 1);
paulson@2002
   414
(*The hypotheses at this point suggest an attack in which nonce NA is used
paulson@2052
   415
  in two different roles:
paulson@2052
   416
          Says B' Server
paulson@2052
   417
           {|Nonce NAa, Agent Aa, Agent A,
paulson@2284
   418
             Crypt (shrK Aa) {|Nonce NAa, Agent Aa, Agent A|}, Nonce NA,
paulson@2284
   419
             Crypt (shrK A) {|Nonce NAa, Agent Aa, Agent A|}|}
paulson@2052
   420
          : set_of_list evsa;
paulson@2052
   421
          Says A B
paulson@2052
   422
           {|Nonce NA, Agent A, Agent B,
paulson@2284
   423
             Crypt (shrK A) {|Nonce NA, Agent A, Agent B|}|}
paulson@2052
   424
          : set_of_list evsa 
paulson@2052
   425
*)
paulson@2131
   426
writeln "GIVE UP! on NA_Crypt_imp_Server_msg";
paulson@2002
   427
paulson@2002
   428
paulson@2052
   429
(*Thus the key property A_can_trust probably fails too.*)