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