src/HOL/Auth/OtwayRees_Bad.ML
author paulson
Thu, 06 Aug 1998 15:48:13 +0200
changeset 5278 a903b66822e2
parent 5223 4cb05273f764
child 5421 01fc8d6a40f2
permissions -rw-r--r--
even more tidying of Goal commands
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
4537
4e835bd9fada Expressed most Oops rules using Notes instead of Says, and other tidying
paulson
parents: 4509
diff changeset
    18
AddEs spies_partsEs;
4e835bd9fada Expressed most Oops rules using Notes instead of Says, and other tidying
paulson
parents: 4509
diff changeset
    19
AddDs [impOfSubs analz_subset_parts];
4e835bd9fada Expressed most Oops rules using Notes instead of Says, and other tidying
paulson
parents: 4509
diff changeset
    20
AddDs [impOfSubs Fake_parts_insert];
4e835bd9fada Expressed most Oops rules using Notes instead of Says, and other tidying
paulson
parents: 4509
diff changeset
    21
2002
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
    22
3121
cbb6c0c1c58a Conversion to use blast_tac (with other improvements)
paulson
parents: 3102
diff changeset
    23
(*A "possibility property": there are traces that reach the end*)
5278
a903b66822e2 even more tidying of Goal commands
paulson
parents: 5223
diff changeset
    24
Goal "[| A ~= B; A ~= Server; B ~= Server |]   \
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
    25
\  ==> EX K. EX NA. EX evs: otway.          \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
    26
\         Says B A {|Nonce NA, Crypt (shrK A) {|Nonce NA, Key K|}|} \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
    27
\           : set evs";
2002
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
    28
by (REPEAT (resolve_tac [exI,bexI] 1));
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2002
diff changeset
    29
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
    30
by possibility_tac;
2002
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
    31
result();
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
    32
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
    33
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
    34
(**** Inductive proofs about otway ****)
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
    35
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
    36
(*Nobody sends themselves messages*)
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
    37
Goal "evs : otway ==> ALL A X. Says A A X ~: set evs";
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2002
diff changeset
    38
by (etac otway.induct 1);
4477
b3e5857d8d99 New Auto_tac (by Oheimb), and new syntax (without parens), and expandshort
paulson
parents: 4471
diff changeset
    39
by Auto_tac;
2002
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
    40
qed_spec_mp "not_Says_to_self";
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
    41
Addsimps [not_Says_to_self];
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
    42
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
    43
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
    44
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
    45
(** For reasoning about the encrypted portion of messages **)
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
    46
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
    47
Goal "Says A' B {|N, Agent A, Agent B, X|} : set evs \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
    48
\          ==> X : analz (spies evs)";
4537
4e835bd9fada Expressed most Oops rules using Notes instead of Says, and other tidying
paulson
parents: 4509
diff changeset
    49
by (dtac (Says_imp_spies RS analz.Inj) 1);
4e835bd9fada Expressed most Oops rules using Notes instead of Says, and other tidying
paulson
parents: 4509
diff changeset
    50
by (Blast_tac 1);
3683
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3674
diff changeset
    51
qed "OR2_analz_spies";
2002
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
    52
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
    53
Goal "Says S' B {|N, X, Crypt (shrK B) X'|} : set evs \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
    54
\          ==> X : analz (spies evs)";
4537
4e835bd9fada Expressed most Oops rules using Notes instead of Says, and other tidying
paulson
parents: 4509
diff changeset
    55
by (dtac (Says_imp_spies RS analz.Inj) 1);
4e835bd9fada Expressed most Oops rules using Notes instead of Says, and other tidying
paulson
parents: 4509
diff changeset
    56
by (Blast_tac 1);
3683
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3674
diff changeset
    57
qed "OR4_analz_spies";
2002
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
    58
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
    59
Goal "Says Server B {|NA, X, Crypt K' {|NB,K|}|} : set evs \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
    60
\          ==> K : parts (spies evs)";
4537
4e835bd9fada Expressed most Oops rules using Notes instead of Says, and other tidying
paulson
parents: 4509
diff changeset
    61
by (Blast_tac 1);
3683
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3674
diff changeset
    62
qed "Oops_parts_spies";
2002
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
    63
3683
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3674
diff changeset
    64
bind_thm ("OR2_parts_spies",
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3674
diff changeset
    65
          OR2_analz_spies RS (impOfSubs analz_subset_parts));
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3674
diff changeset
    66
bind_thm ("OR4_parts_spies",
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3674
diff changeset
    67
          OR4_analz_spies RS (impOfSubs analz_subset_parts));
2052
d9f7f4b2613e Working again with new theory Shared
paulson
parents: 2032
diff changeset
    68
3683
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3674
diff changeset
    69
(*For proving the easier theorems about X ~: parts (spies evs).*)
3519
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3466
diff changeset
    70
fun parts_induct_tac i = 
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3466
diff changeset
    71
    etac otway.induct i			THEN 
3683
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3674
diff changeset
    72
    forward_tac [Oops_parts_spies] (i+6) THEN
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3674
diff changeset
    73
    forward_tac [OR4_parts_spies]  (i+5) THEN
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3674
diff changeset
    74
    forward_tac [OR2_parts_spies]  (i+3) THEN 
3519
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3466
diff changeset
    75
    prove_simple_subgoals_tac  i;
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
3683
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3674
diff changeset
    78
(** Theorems of the form X ~: parts (spies evs) imply that NOBODY
2002
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
    79
    sends messages containing X! **)
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
    80
4537
4e835bd9fada Expressed most Oops rules using Notes instead of Says, and other tidying
paulson
parents: 4509
diff changeset
    81
(*Spy never sees a good agent's shared key!*)
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
    82
Goal "evs : otway ==> (Key (shrK A) : parts (spies evs)) = (A : bad)";
3519
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3466
diff changeset
    83
by (parts_induct_tac 1);
3961
6a8996fb7d99 Many minor speedups:
paulson
parents: 3919
diff changeset
    84
by (ALLGOALS Blast_tac);
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2107
diff changeset
    85
qed "Spy_see_shrK";
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2107
diff changeset
    86
Addsimps [Spy_see_shrK];
2002
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
    87
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
    88
Goal "evs : otway ==> (Key (shrK A) : analz (spies evs)) = (A : bad)";
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3961
diff changeset
    89
by (auto_tac(claset() addDs [impOfSubs analz_subset_parts], simpset()));
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2107
diff changeset
    90
qed "Spy_analz_shrK";
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2107
diff changeset
    91
Addsimps [Spy_analz_shrK];
2002
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
    92
4471
0abf9d3f4391 Tidied using rev_iffD1
paulson
parents: 4449
diff changeset
    93
AddSDs [Spy_see_shrK RSN (2, rev_iffD1), 
0abf9d3f4391 Tidied using rev_iffD1
paulson
parents: 4449
diff changeset
    94
	Spy_analz_shrK RSN (2, rev_iffD1)];
2002
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
    95
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
    96
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
    97
(*Nobody can have used non-existent keys!*)
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
    98
Goal "evs : otway ==> Key K ~: used evs --> K ~: keysFor (parts (spies evs))";
3519
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3466
diff changeset
    99
by (parts_induct_tac 1);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   100
(*Fake*)
4509
828148415197 Making proofs faster, especially using keysFor_parts_insert
paulson
parents: 4477
diff changeset
   101
by (blast_tac (claset() addSDs [keysFor_parts_insert]) 1);
4537
4e835bd9fada Expressed most Oops rules using Notes instead of Says, and other tidying
paulson
parents: 4509
diff changeset
   102
(*OR2, OR3*)
3121
cbb6c0c1c58a Conversion to use blast_tac (with other improvements)
paulson
parents: 3102
diff changeset
   103
by (ALLGOALS Blast_tac);
2160
ad4382e546fc Simplified new_keys_not_seen, etc.: replaced the
paulson
parents: 2131
diff changeset
   104
qed_spec_mp "new_keys_not_used";
2002
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
   105
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
   106
bind_thm ("new_keys_not_analzd",
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2002
diff changeset
   107
          [analz_subset_parts RS keysFor_mono,
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2002
diff changeset
   108
           new_keys_not_used] MRS contra_subsetD);
2002
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
   109
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
   110
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
   111
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
   112
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2107
diff changeset
   113
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2107
diff changeset
   114
(*** Proofs involving analz ***)
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2107
diff changeset
   115
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2107
diff changeset
   116
(*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
   117
  for Oops case.*)
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   118
Goal "[| Says Server B {|NA, X, Crypt (shrK B) {|NB, Key K|}|} : set evs; \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   119
\        evs : otway |]                                           \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   120
\  ==> K ~: range shrK & (EX i. NA = Nonce i) & (EX j. NB = Nonce j)";
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2107
diff changeset
   121
by (etac rev_mp 1);
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2107
diff changeset
   122
by (etac otway.induct 1);
4537
4e835bd9fada Expressed most Oops rules using Notes instead of Says, and other tidying
paulson
parents: 4509
diff changeset
   123
by (ALLGOALS Simp_tac);
4e835bd9fada Expressed most Oops rules using Notes instead of Says, and other tidying
paulson
parents: 4509
diff changeset
   124
by (ALLGOALS Blast_tac);
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2107
diff changeset
   125
qed "Says_Server_message_form";
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2107
diff changeset
   126
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2107
diff changeset
   127
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2107
diff changeset
   128
(*For proofs involving analz.*)
3683
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3674
diff changeset
   129
val analz_spies_tac = 
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3674
diff changeset
   130
    dtac OR2_analz_spies 4 THEN 
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3674
diff changeset
   131
    dtac OR4_analz_spies 6 THEN
4537
4e835bd9fada Expressed most Oops rules using Notes instead of Says, and other tidying
paulson
parents: 4509
diff changeset
   132
    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
   133
    REPEAT ((eresolve_tac [exE, conjE] ORELSE' hyp_subst_tac) 7);
2002
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
   134
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
   135
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
   136
(****
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
   137
 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
   138
3683
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3674
diff changeset
   139
  Key K : analz (insert (Key KAB) (spies evs)) ==>
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3674
diff changeset
   140
  Key K : analz (spies evs)
2002
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
   141
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
   142
 A more general formula must be proved inductively.
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
   143
****)
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
   144
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
   145
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
   146
(** 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
   147
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
   148
(*The equality makes the induction hypothesis easier to apply*)
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   149
Goal "evs : otway ==>                                 \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   150
\  ALL K KK. KK <= Compl (range shrK) -->             \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   151
\         (Key K : analz (Key``KK Un (spies evs))) =  \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   152
\         (K : KK | Key K : analz (spies evs))";
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2002
diff changeset
   153
by (etac otway.induct 1);
3683
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3674
diff changeset
   154
by analz_spies_tac;
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   155
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
   156
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
   157
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
   158
(*Fake*) 
4422
21238c9d363e Simplified proofs using rewrites for f``A where f is injective
paulson
parents: 4091
diff changeset
   159
by (spy_analz_tac 1);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   160
qed_spec_mp "analz_image_freshK";
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
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   163
Goal "[| evs : otway;  KAB ~: range shrK |] ==>       \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   164
\     Key K : analz (insert (Key KAB) (spies evs)) =  \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   165
\     (K = KAB | Key K : analz (spies evs))";
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   166
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
   167
qed "analz_insert_freshK";
2002
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
   168
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
   169
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2107
diff changeset
   170
(*** 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
   171
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   172
Goal "evs : otway ==>                                                  \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   173
\     EX B' NA' NB' X'. ALL B NA NB X.                                    \
3466
30791e5a69c4 Corrected indentations and margins after the renaming of "set_of_list"
paulson
parents: 3465
diff changeset
   174
\     Says Server B {|NA, X, Crypt (shrK B) {|NB, K|}|} : set evs -->     \
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2107
diff changeset
   175
\     B=B' & NA=NA' & NB=NB' & X=X'";
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2002
diff changeset
   176
by (etac otway.induct 1);
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3961
diff changeset
   177
by (ALLGOALS (asm_simp_tac (simpset() addsimps [all_conj_distrib])));
3730
6933d20f335f Step_tac -> Safe_tac
paulson
parents: 3683
diff changeset
   178
by (ALLGOALS Clarify_tac);
2002
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
   179
(*Remaining cases: OR3 and OR4*)
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
   180
by (ex_strip_tac 2);
4537
4e835bd9fada Expressed most Oops rules using Notes instead of Says, and other tidying
paulson
parents: 4509
diff changeset
   181
by (Best_tac 2);	(*Blast_tac's too slow (in reconstruction)*)
2107
23e8f15ec95f The new proof of the lemma for new_nonces_not_seen is faster
paulson
parents: 2052
diff changeset
   182
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
   183
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
   184
(*...we assume X is a recent message, and handle this case by contradiction*)
4537
4e835bd9fada Expressed most Oops rules using Notes instead of Says, and other tidying
paulson
parents: 4509
diff changeset
   185
by (blast_tac (claset() addSEs spies_partsEs) 1);
2002
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
   186
val lemma = result();
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
   187
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   188
Goal "[| Says Server B {|NA, X, Crypt (shrK B) {|NB, K|}|}   : set evs; \ 
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   189
\        Says Server B' {|NA',X',Crypt (shrK B') {|NB',K|}|} : set evs; \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   190
\        evs : otway |] ==> X=X' & B=B' & NA=NA' & NB=NB'";
2417
95f275c8476e New tactic: prove_unique_tac
paulson
parents: 2375
diff changeset
   191
by (prove_unique_tac lemma 1);
2002
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
   192
qed "unique_session_keys";
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
   193
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
   194
4537
4e835bd9fada Expressed most Oops rules using Notes instead of Says, and other tidying
paulson
parents: 4509
diff changeset
   195
(** Crucial secrecy property: Spy does not see the keys sent in msg OR3
4e835bd9fada Expressed most Oops rules using Notes instead of Says, and other tidying
paulson
parents: 4509
diff changeset
   196
    Does not in itself guarantee security: an attack could violate 
4e835bd9fada Expressed most Oops rules using Notes instead of Says, and other tidying
paulson
parents: 4509
diff changeset
   197
    the premises, e.g. by having A=Spy **)
4e835bd9fada Expressed most Oops rules using Notes instead of Says, and other tidying
paulson
parents: 4509
diff changeset
   198
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   199
Goal "[| A ~: bad;  B ~: bad;  evs : otway |]                      \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   200
\     ==> Says Server B                                            \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   201
\           {|NA, Crypt (shrK A) {|NA, Key K|},                    \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   202
\             Crypt (shrK B) {|NB, Key K|}|} : set evs -->         \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   203
\         Notes Spy {|NA, NB, Key K|} ~: set evs -->               \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   204
\         Key K ~: analz (spies evs)";
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2107
diff changeset
   205
by (etac otway.induct 1);
3683
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3674
diff changeset
   206
by analz_spies_tac;
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2107
diff changeset
   207
by (ALLGOALS
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3961
diff changeset
   208
    (asm_simp_tac (simpset() addcongs [conj_cong] 
4537
4e835bd9fada Expressed most Oops rules using Notes instead of Says, and other tidying
paulson
parents: 4509
diff changeset
   209
                             addsimps [analz_insert_eq, analz_insert_freshK]
4831
dae4d63a1318 Renamed expand_const -> split_const.
nipkow
parents: 4598
diff changeset
   210
                             addsimps (pushes@split_ifs))));
3451
d10f100676d8 Made proofs more concise by replacing calls to spy_analz_tac by uses of
paulson
parents: 3207
diff changeset
   211
(*Oops*)
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3961
diff changeset
   212
by (blast_tac (claset() addSDs [unique_session_keys]) 4);
3451
d10f100676d8 Made proofs more concise by replacing calls to spy_analz_tac by uses of
paulson
parents: 3207
diff changeset
   213
(*OR4*) 
d10f100676d8 Made proofs more concise by replacing calls to spy_analz_tac by uses of
paulson
parents: 3207
diff changeset
   214
by (Blast_tac 3);
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2107
diff changeset
   215
(*OR3*)
4537
4e835bd9fada Expressed most Oops rules using Notes instead of Says, and other tidying
paulson
parents: 4509
diff changeset
   216
by (Blast_tac 2);
3451
d10f100676d8 Made proofs more concise by replacing calls to spy_analz_tac by uses of
paulson
parents: 3207
diff changeset
   217
(*Fake*) 
d10f100676d8 Made proofs more concise by replacing calls to spy_analz_tac by uses of
paulson
parents: 3207
diff changeset
   218
by (spy_analz_tac 1);
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2107
diff changeset
   219
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
   220
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   221
Goal "[| Says Server B                                           \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   222
\         {|NA, Crypt (shrK A) {|NA, Key K|},                    \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   223
\               Crypt (shrK B) {|NB, Key K|}|} : set evs;        \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   224
\        Notes Spy {|NA, NB, Key K|} ~: set evs;                 \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   225
\        A ~: bad;  B ~: bad;  evs : otway |]                    \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   226
\     ==> Key K ~: analz (spies evs)";
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2107
diff changeset
   227
by (forward_tac [Says_Server_message_form] 1 THEN assume_tac 1);
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3961
diff changeset
   228
by (blast_tac (claset() addSEs [lemma]) 1);
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2107
diff changeset
   229
qed "Spy_not_see_encrypted_key";
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
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2107
diff changeset
   232
(*** Attempting to prove stronger properties ***)
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2107
diff changeset
   233
2052
d9f7f4b2613e Working again with new theory Shared
paulson
parents: 2032
diff changeset
   234
(*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
   235
  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
   236
  Perhaps it's because OR2 has two similar-looking encrypted messages in
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   237
        this version.*)
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   238
Goal "[| A ~: bad;  A ~= B;  evs : otway |]                \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   239
\     ==> Crypt (shrK A) {|NA, Agent A, Agent B|} : parts (spies evs) --> \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   240
\         Says A B {|NA, Agent A, Agent B,                  \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   241
\                    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
   242
by (parts_induct_tac 1);
4537
4e835bd9fada Expressed most Oops rules using Notes instead of Says, and other tidying
paulson
parents: 4509
diff changeset
   243
by (ALLGOALS Blast_tac);
2002
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
   244
qed_spec_mp "Crypt_imp_OR1";
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
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2107
diff changeset
   247
(*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
   248
  to start a run, then it originated with the Server!*)
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2107
diff changeset
   249
(*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
   250
          substituting some other nonce NA' for NB.*)
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   251
Goal "[| A ~: bad;  evs : otway |]                                \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   252
\     ==> Crypt (shrK A) {|NA, Key K|} : parts (spies evs) -->    \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   253
\         Says A B {|NA, Agent A, Agent B,                        \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   254
\                    Crypt (shrK A) {|NA, Agent A, Agent B|}|}    \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   255
\          : set evs -->                                          \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   256
\         (EX B NB. Says Server B                                 \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   257
\              {|NA,                                              \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   258
\                Crypt (shrK A) {|NA, Key K|},                    \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   259
\                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
   260
by (parts_induct_tac 1);
4537
4e835bd9fada Expressed most Oops rules using Notes instead of Says, and other tidying
paulson
parents: 4509
diff changeset
   261
(*Fake*)
4e835bd9fada Expressed most Oops rules using Notes instead of Says, and other tidying
paulson
parents: 4509
diff changeset
   262
by (Blast_tac 1);
2002
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
   263
(*OR1: it cannot be a new Nonce, contradiction.*)
4537
4e835bd9fada Expressed most Oops rules using Notes instead of Says, and other tidying
paulson
parents: 4509
diff changeset
   264
by (Blast_tac 1);
3730
6933d20f335f Step_tac -> Safe_tac
paulson
parents: 3683
diff changeset
   265
(*OR3 and OR4*)
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3961
diff changeset
   266
by (ALLGOALS (asm_simp_tac (simpset() addsimps [ex_disj_distrib])));
3730
6933d20f335f Step_tac -> Safe_tac
paulson
parents: 3683
diff changeset
   267
by (ALLGOALS Clarify_tac);
2002
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
   268
(*OR4*)
4537
4e835bd9fada Expressed most Oops rules using Notes instead of Says, and other tidying
paulson
parents: 4509
diff changeset
   269
by (blast_tac (claset() addSIs [Crypt_imp_OR1]) 2);
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2107
diff changeset
   270
(*OR3*)  (** LEVEL 5 **)
3730
6933d20f335f Step_tac -> Safe_tac
paulson
parents: 3683
diff changeset
   271
(*The hypotheses at this point suggest an attack in which nonce NB is used
2052
d9f7f4b2613e Working again with new theory Shared
paulson
parents: 2032
diff changeset
   272
  in two different roles:
d9f7f4b2613e Working again with new theory Shared
paulson
parents: 2032
diff changeset
   273
          Says B' Server
3730
6933d20f335f Step_tac -> Safe_tac
paulson
parents: 3683
diff changeset
   274
           {|Nonce NA, Agent Aa, Agent A,
6933d20f335f Step_tac -> Safe_tac
paulson
parents: 3683
diff changeset
   275
             Crypt (shrK Aa) {|Nonce NA, Agent Aa, Agent A|}, Nonce NB,
6933d20f335f Step_tac -> Safe_tac
paulson
parents: 3683
diff changeset
   276
             Crypt (shrK A) {|Nonce NA, Agent Aa, Agent A|}|}
6933d20f335f Step_tac -> Safe_tac
paulson
parents: 3683
diff changeset
   277
          : set evs3;
2052
d9f7f4b2613e Working again with new theory Shared
paulson
parents: 2032
diff changeset
   278
          Says A B
3730
6933d20f335f Step_tac -> Safe_tac
paulson
parents: 3683
diff changeset
   279
           {|Nonce NB, Agent A, Agent B,
6933d20f335f Step_tac -> Safe_tac
paulson
parents: 3683
diff changeset
   280
             Crypt (shrK A) {|Nonce NB, Agent A, Agent B|}|}
6933d20f335f Step_tac -> Safe_tac
paulson
parents: 3683
diff changeset
   281
          : set evs3;
2052
d9f7f4b2613e Working again with new theory Shared
paulson
parents: 2032
diff changeset
   282
*)
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2107
diff changeset
   283
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
   284
ed423882c6a9 Bad version of Otway-Rees and the new attack on it
paulson
parents:
diff changeset
   285
2052
d9f7f4b2613e Working again with new theory Shared
paulson
parents: 2032
diff changeset
   286
(*Thus the key property A_can_trust probably fails too.*)