| author | wenzelm | 
| Sun, 19 Aug 2012 17:45:07 +0200 | |
| changeset 48932 | c6e679443adc | 
| parent 45605 | a89b4bc311a5 | 
| child 58889 | 5b7a9633cfa8 | 
| permissions | -rw-r--r-- | 
| 37936 | 1 | (* Title: HOL/Auth/Yahalom_Bad.thy | 
| 6400 | 2 | Author: Lawrence C Paulson, Cambridge University Computer Laboratory | 
| 3 | Copyright 1996 University of Cambridge | |
| 4 | *) | |
| 5 | ||
| 13956 | 6 | header{*The Yahalom Protocol: A Flawed Version*}
 | 
| 7 | ||
| 16417 | 8 | theory Yahalom_Bad imports Public begin | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 9 | |
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 10 | text{*
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 11 | Demonstrates of why Oops is necessary. This protocol can be attacked because | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 12 | it doesn't keep NB secret, but without Oops it can be "verified" anyway. | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 13 | The issues are discussed in lcp's LICS 2000 invited lecture. | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 14 | *} | 
| 6400 | 15 | |
| 23746 | 16 | inductive_set yahalom :: "event list set" | 
| 17 | where | |
| 6400 | 18 | (*Initial trace is empty*) | 
| 11251 | 19 | Nil: "[] \<in> yahalom" | 
| 6400 | 20 | |
| 21 | (*The spy MAY say anything he CAN say. We do not expect him to | |
| 22 | invent new nonces here, but he can also use NS1. Common to | |
| 23 | all similar protocols.*) | |
| 23746 | 24 | | Fake: "[| evsf \<in> yahalom; X \<in> synth (analz (knows Spy evsf)) |] | 
| 11251 | 25 | ==> Says Spy B X # evsf \<in> yahalom" | 
| 6400 | 26 | |
| 27 | (*A message that has been sent can be received by the | |
| 28 | intended recipient.*) | |
| 23746 | 29 | | Reception: "[| evsr \<in> yahalom; Says A B X \<in> set evsr |] | 
| 11251 | 30 | ==> Gets B X # evsr \<in> yahalom" | 
| 6400 | 31 | |
| 32 | (*Alice initiates a protocol run*) | |
| 23746 | 33 | | YM1: "[| evs1 \<in> yahalom; Nonce NA \<notin> used evs1 |] | 
| 11251 | 34 |           ==> Says A B {|Agent A, Nonce NA|} # evs1 \<in> yahalom"
 | 
| 6400 | 35 | |
| 36 | (*Bob's response to Alice's message.*) | |
| 23746 | 37 | | YM2: "[| evs2 \<in> yahalom; Nonce NB \<notin> used evs2; | 
| 11251 | 38 |              Gets B {|Agent A, Nonce NA|} \<in> set evs2 |]
 | 
| 39 | ==> Says B Server | |
| 6400 | 40 |                   {|Agent B, Nonce NB, Crypt (shrK B) {|Agent A, Nonce NA|}|}
 | 
| 11251 | 41 | # evs2 \<in> yahalom" | 
| 6400 | 42 | |
| 43 | (*The Server receives Bob's message. He responds by sending a | |
| 44 | new session key to Alice, with a packet for forwarding to Bob.*) | |
| 23746 | 45 | | YM3: "[| evs3 \<in> yahalom; Key KAB \<notin> used evs3; KAB \<in> symKeys; | 
| 11251 | 46 | Gets Server | 
| 6400 | 47 |                   {|Agent B, Nonce NB, Crypt (shrK B) {|Agent A, Nonce NA|}|}
 | 
| 11251 | 48 | \<in> set evs3 |] | 
| 6400 | 49 | ==> Says Server A | 
| 50 |                    {|Crypt (shrK A) {|Agent B, Key KAB, Nonce NA, Nonce NB|},
 | |
| 51 |                      Crypt (shrK B) {|Agent A, Key KAB|}|}
 | |
| 11251 | 52 | # evs3 \<in> yahalom" | 
| 6400 | 53 | |
| 54 | (*Alice receives the Server's (?) message, checks her Nonce, and | |
| 55 | uses the new session key to send Bob his Nonce. The premise | |
| 11251 | 56 | A \<noteq> Server is needed to prove Says_Server_not_range.*) | 
| 23746 | 57 | | YM4: "[| evs4 \<in> yahalom; A \<noteq> Server; K \<in> symKeys; | 
| 6400 | 58 |              Gets A {|Crypt(shrK A) {|Agent B, Key K, Nonce NA, Nonce NB|}, X|}
 | 
| 11251 | 59 | \<in> set evs4; | 
| 60 |              Says A B {|Agent A, Nonce NA|} \<in> set evs4 |]
 | |
| 61 |           ==> Says A B {|X, Crypt K (Nonce NB)|} # evs4 \<in> yahalom"
 | |
| 62 | ||
| 63 | ||
| 64 | declare Says_imp_knows_Spy [THEN analz.Inj, dest] | |
| 65 | declare parts.Body [dest] | |
| 66 | declare Fake_parts_insert_in_Un [dest] | |
| 67 | declare analz_into_parts [dest] | |
| 68 | ||
| 69 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 70 | text{*A "possibility property": there are traces that reach the end*}
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 71 | lemma "[| A \<noteq> Server; Key K \<notin> used []; K \<in> symKeys |] | 
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
13956diff
changeset | 72 | ==> \<exists>X NB. \<exists>evs \<in> yahalom. | 
| 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
13956diff
changeset | 73 |               Says A B {|X, Crypt K (Nonce NB)|} \<in> set evs"
 | 
| 11251 | 74 | apply (intro exI bexI) | 
| 75 | apply (rule_tac [2] yahalom.Nil | |
| 76 | [THEN yahalom.YM1, THEN yahalom.Reception, | |
| 77 | THEN yahalom.YM2, THEN yahalom.Reception, | |
| 78 | THEN yahalom.YM3, THEN yahalom.Reception, | |
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
13956diff
changeset | 79 | THEN yahalom.YM4]) | 
| 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
13956diff
changeset | 80 | apply (possibility, simp add: used_Cons) | 
| 11251 | 81 | done | 
| 82 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 83 | subsection{*Regularity Lemmas for Yahalom*}
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 84 | |
| 11251 | 85 | lemma Gets_imp_Says: | 
| 86 | "[| Gets B X \<in> set evs; evs \<in> yahalom |] ==> \<exists>A. Says A B X \<in> set evs" | |
| 87 | by (erule rev_mp, erule yahalom.induct, auto) | |
| 88 | ||
| 89 | (*Must be proved separately for each protocol*) | |
| 90 | lemma Gets_imp_knows_Spy: | |
| 91 | "[| Gets B X \<in> set evs; evs \<in> yahalom |] ==> X \<in> knows Spy evs" | |
| 92 | by (blast dest!: Gets_imp_Says Says_imp_knows_Spy) | |
| 93 | ||
| 94 | declare Gets_imp_knows_Spy [THEN analz.Inj, dest] | |
| 95 | ||
| 96 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 97 | subsection{* For reasoning about the encrypted portion of messages *}
 | 
| 11251 | 98 | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 99 | text{*Lets us treat YM4 using a similar argument as for the Fake case.*}
 | 
| 11251 | 100 | lemma YM4_analz_knows_Spy: | 
| 101 |      "[| Gets A {|Crypt (shrK A) Y, X|} \<in> set evs;  evs \<in> yahalom |]
 | |
| 102 | ==> X \<in> analz (knows Spy evs)" | |
| 103 | by blast | |
| 104 | ||
| 105 | lemmas YM4_parts_knows_Spy = | |
| 45605 | 106 | YM4_analz_knows_Spy [THEN analz_into_parts] | 
| 11251 | 107 | |
| 108 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 109 | text{*Theorems of the form @{term "X \<notin> parts (knows Spy evs)"} imply 
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 110 | that NOBODY sends messages containing X!*} | 
| 11251 | 111 | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 112 | text{*Spy never sees a good agent's shared key!*}
 | 
| 11251 | 113 | lemma Spy_see_shrK [simp]: | 
| 114 | "evs \<in> yahalom ==> (Key (shrK A) \<in> parts (knows Spy evs)) = (A \<in> bad)" | |
| 115 | apply (erule yahalom.induct, force, | |
| 13507 | 116 | drule_tac [6] YM4_parts_knows_Spy, simp_all, blast+) | 
| 11251 | 117 | done | 
| 118 | ||
| 119 | lemma Spy_analz_shrK [simp]: | |
| 120 | "evs \<in> yahalom ==> (Key (shrK A) \<in> analz (knows Spy evs)) = (A \<in> bad)" | |
| 121 | by auto | |
| 122 | ||
| 123 | lemma Spy_see_shrK_D [dest!]: | |
| 124 | "[|Key (shrK A) \<in> parts (knows Spy evs); evs \<in> yahalom|] ==> A \<in> bad" | |
| 125 | by (blast dest: Spy_see_shrK) | |
| 126 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 127 | text{*Nobody can have used non-existent keys!
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 128 |     Needed to apply @{text analz_insert_Key}*}
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 129 | lemma new_keys_not_used [simp]: | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 130 | "[|Key K \<notin> used evs; K \<in> symKeys; evs \<in> yahalom|] | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 131 | ==> K \<notin> keysFor (parts (spies evs))" | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 132 | apply (erule rev_mp) | 
| 11251 | 133 | apply (erule yahalom.induct, force, | 
| 134 | frule_tac [6] YM4_parts_knows_Spy, simp_all) | |
| 13926 | 135 | txt{*Fake*}
 | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 136 | apply (force dest!: keysFor_parts_insert, auto) | 
| 11251 | 137 | done | 
| 138 | ||
| 139 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 140 | subsection{*Secrecy Theorems*}
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 141 | |
| 11251 | 142 | (**** | 
| 143 | The following is to prove theorems of the form | |
| 144 | ||
| 145 | Key K \<in> analz (insert (Key KAB) (knows Spy evs)) ==> | |
| 146 | Key K \<in> analz (knows Spy evs) | |
| 147 | ||
| 148 | A more general formula must be proved inductively. | |
| 149 | ****) | |
| 150 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 151 | subsection{* Session keys are not used to encrypt other session keys *}
 | 
| 11251 | 152 | |
| 153 | lemma analz_image_freshK [rule_format]: | |
| 154 | "evs \<in> yahalom ==> | |
| 155 | \<forall>K KK. KK <= - (range shrK) --> | |
| 156 | (Key K \<in> analz (Key`KK Un (knows Spy evs))) = | |
| 157 | (K \<in> KK | Key K \<in> analz (knows Spy evs))" | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 158 | by (erule yahalom.induct, | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 159 | drule_tac [7] YM4_analz_knows_Spy, analz_freshK, spy_analz, blast) | 
| 11251 | 160 | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 161 | lemma analz_insert_freshK: | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 162 | "[| evs \<in> yahalom; KAB \<notin> range shrK |] ==> | 
| 11655 | 163 | (Key K \<in> analz (insert (Key KAB) (knows Spy evs))) = | 
| 11251 | 164 | (K = KAB | Key K \<in> analz (knows Spy evs))" | 
| 165 | by (simp only: analz_image_freshK analz_image_freshK_simps) | |
| 166 | ||
| 167 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 168 | text{*The Key K uniquely identifies the Server's  message.*}
 | 
| 11251 | 169 | lemma unique_session_keys: | 
| 170 | "[| Says Server A | |
| 171 |           {|Crypt (shrK A) {|Agent B, Key K, na, nb|}, X|} \<in> set evs;
 | |
| 172 | Says Server A' | |
| 173 |           {|Crypt (shrK A') {|Agent B', Key K, na', nb'|}, X'|} \<in> set evs;
 | |
| 174 | evs \<in> yahalom |] | |
| 175 | ==> A=A' & B=B' & na=na' & nb=nb'" | |
| 176 | apply (erule rev_mp, erule rev_mp) | |
| 177 | apply (erule yahalom.induct, simp_all) | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 178 | txt{*YM3, by freshness, and YM4*}
 | 
| 11251 | 179 | apply blast+ | 
| 180 | done | |
| 181 | ||
| 182 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 183 | text{* Crucial secrecy property: Spy does not see the keys sent in msg YM3 *}
 | 
| 11251 | 184 | lemma secrecy_lemma: | 
| 185 | "[| A \<notin> bad; B \<notin> bad; evs \<in> yahalom |] | |
| 186 | ==> Says Server A | |
| 187 |             {|Crypt (shrK A) {|Agent B, Key K, na, nb|},
 | |
| 188 |               Crypt (shrK B) {|Agent A, Key K|}|}
 | |
| 189 | \<in> set evs --> | |
| 190 | Key K \<notin> analz (knows Spy evs)" | |
| 191 | apply (erule yahalom.induct, force, drule_tac [6] YM4_analz_knows_Spy) | |
| 13507 | 192 | apply (simp_all add: pushes analz_insert_eq analz_insert_freshK, spy_analz) (*Fake*) | 
| 11251 | 193 | apply (blast dest: unique_session_keys) (*YM3*) | 
| 194 | done | |
| 195 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 196 | text{*Final version*}
 | 
| 11251 | 197 | lemma Spy_not_see_encrypted_key: | 
| 198 | "[| Says Server A | |
| 199 |             {|Crypt (shrK A) {|Agent B, Key K, na, nb|},
 | |
| 200 |               Crypt (shrK B) {|Agent A, Key K|}|}
 | |
| 201 | \<in> set evs; | |
| 202 | A \<notin> bad; B \<notin> bad; evs \<in> yahalom |] | |
| 203 | ==> Key K \<notin> analz (knows Spy evs)" | |
| 204 | by (blast dest: secrecy_lemma) | |
| 205 | ||
| 6400 | 206 | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 207 | subsection{* Security Guarantee for A upon receiving YM3 *}
 | 
| 11251 | 208 | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 209 | text{*If the encrypted message appears then it originated with the Server*}
 | 
| 11251 | 210 | lemma A_trusts_YM3: | 
| 211 |      "[| Crypt (shrK A) {|Agent B, Key K, na, nb|} \<in> parts (knows Spy evs);
 | |
| 212 | A \<notin> bad; evs \<in> yahalom |] | |
| 213 | ==> Says Server A | |
| 214 |             {|Crypt (shrK A) {|Agent B, Key K, na, nb|},
 | |
| 215 |               Crypt (shrK B) {|Agent A, Key K|}|}
 | |
| 216 | \<in> set evs" | |
| 217 | apply (erule rev_mp) | |
| 218 | apply (erule yahalom.induct, force, | |
| 219 | frule_tac [6] YM4_parts_knows_Spy, simp_all) | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 220 | txt{*Fake, YM3*}
 | 
| 11251 | 221 | apply blast+ | 
| 222 | done | |
| 223 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 224 | text{*The obvious combination of @{text A_trusts_YM3} with
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 225 |   @{text Spy_not_see_encrypted_key}*}
 | 
| 11251 | 226 | lemma A_gets_good_key: | 
| 227 |      "[| Crypt (shrK A) {|Agent B, Key K, na, nb|} \<in> parts (knows Spy evs);
 | |
| 228 | A \<notin> bad; B \<notin> bad; evs \<in> yahalom |] | |
| 229 | ==> Key K \<notin> analz (knows Spy evs)" | |
| 230 | by (blast dest!: A_trusts_YM3 Spy_not_see_encrypted_key) | |
| 231 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 232 | subsection{* Security Guarantees for B upon receiving YM4 *}
 | 
| 11251 | 233 | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 234 | text{*B knows, by the first part of A's message, that the Server distributed
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 235 | the key for A and B. But this part says nothing about nonces.*} | 
| 11251 | 236 | lemma B_trusts_YM4_shrK: | 
| 237 |      "[| Crypt (shrK B) {|Agent A, Key K|} \<in> parts (knows Spy evs);
 | |
| 238 | B \<notin> bad; evs \<in> yahalom |] | |
| 239 | ==> \<exists>NA NB. Says Server A | |
| 240 |                       {|Crypt (shrK A) {|Agent B, Key K, Nonce NA, Nonce NB|},
 | |
| 241 |                         Crypt (shrK B) {|Agent A, Key K|}|}
 | |
| 242 | \<in> set evs" | |
| 243 | apply (erule rev_mp) | |
| 244 | apply (erule yahalom.induct, force, | |
| 245 | frule_tac [6] YM4_parts_knows_Spy, simp_all) | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 246 | txt{*Fake, YM3*}
 | 
| 11251 | 247 | apply blast+ | 
| 248 | done | |
| 249 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 250 | subsection{*The Flaw in the Model*}
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 251 | |
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 252 | text{* Up to now, the reasoning is similar to standard Yahalom.  Now the
 | 
| 11251 | 253 | doubtful reasoning occurs. We should not be assuming that an unknown | 
| 254 | key is secure, but the model allows us to: there is no Oops rule to | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 255 | let session keys become compromised.*} | 
| 11251 | 256 | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 257 | text{*B knows, by the second part of A's message, that the Server distributed
 | 
| 11251 | 258 | the key quoting nonce NB. This part says nothing about agent names. | 
| 259 | Secrecy of K is assumed; the valid Yahalom proof uses (and later proves) | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 260 | the secrecy of NB.*} | 
| 11251 | 261 | lemma B_trusts_YM4_newK [rule_format]: | 
| 262 | "[|Key K \<notin> analz (knows Spy evs); evs \<in> yahalom|] | |
| 263 | ==> Crypt K (Nonce NB) \<in> parts (knows Spy evs) --> | |
| 264 | (\<exists>A B NA. Says Server A | |
| 265 |                       {|Crypt (shrK A) {|Agent B, Key K,
 | |
| 266 | Nonce NA, Nonce NB|}, | |
| 267 |                         Crypt (shrK B) {|Agent A, Key K|}|}
 | |
| 268 | \<in> set evs)" | |
| 269 | apply (erule rev_mp) | |
| 270 | apply (erule yahalom.induct, force, | |
| 271 | frule_tac [6] YM4_parts_knows_Spy) | |
| 272 | apply (analz_mono_contra, simp_all) | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 273 | txt{*Fake*}
 | 
| 11251 | 274 | apply blast | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 275 | txt{*YM3*}
 | 
| 11251 | 276 | apply blast | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 277 | txt{*A is uncompromised because NB is secure
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 278 | A's certificate guarantees the existence of the Server message*} | 
| 11251 | 279 | apply (blast dest!: Gets_imp_Says Crypt_Spy_analz_bad | 
| 280 | dest: Says_imp_spies | |
| 281 | parts.Inj [THEN parts.Fst, THEN A_trusts_YM3]) | |
| 282 | done | |
| 283 | ||
| 284 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 285 | text{*B's session key guarantee from YM4.  The two certificates contribute to a
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 286 | single conclusion about the Server's message. *} | 
| 11251 | 287 | lemma B_trusts_YM4: | 
| 288 |      "[| Gets B {|Crypt (shrK B) {|Agent A, Key K|},
 | |
| 289 | Crypt K (Nonce NB)|} \<in> set evs; | |
| 290 | Says B Server | |
| 291 |            {|Agent B, Nonce NB, Crypt (shrK B) {|Agent A, Nonce NA|}|}
 | |
| 292 | \<in> set evs; | |
| 293 | A \<notin> bad; B \<notin> bad; evs \<in> yahalom |] | |
| 294 | ==> \<exists>na nb. Says Server A | |
| 295 |                    {|Crypt (shrK A) {|Agent B, Key K, na, nb|},
 | |
| 296 |                      Crypt (shrK B) {|Agent A, Key K|}|}
 | |
| 297 | \<in> set evs" | |
| 298 | by (blast dest: B_trusts_YM4_newK B_trusts_YM4_shrK Spy_not_see_encrypted_key | |
| 299 | unique_session_keys) | |
| 300 | ||
| 301 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 302 | text{*The obvious combination of @{text B_trusts_YM4} with 
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 303 |   @{text Spy_not_see_encrypted_key}*}
 | 
| 11251 | 304 | lemma B_gets_good_key: | 
| 305 |      "[| Gets B {|Crypt (shrK B) {|Agent A, Key K|},
 | |
| 306 | Crypt K (Nonce NB)|} \<in> set evs; | |
| 307 | Says B Server | |
| 308 |            {|Agent B, Nonce NB, Crypt (shrK B) {|Agent A, Nonce NA|}|}
 | |
| 309 | \<in> set evs; | |
| 310 | A \<notin> bad; B \<notin> bad; evs \<in> yahalom |] | |
| 311 | ==> Key K \<notin> analz (knows Spy evs)" | |
| 312 | by (blast dest!: B_trusts_YM4 Spy_not_see_encrypted_key) | |
| 313 | ||
| 314 | ||
| 315 | (*** Authenticating B to A: these proofs are not considered. | |
| 316 | They are irrelevant to showing the need for Oops. ***) | |
| 317 | ||
| 318 | ||
| 319 | (*** Authenticating A to B using the certificate Crypt K (Nonce NB) ***) | |
| 320 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 321 | text{*Assuming the session key is secure, if both certificates are present then
 | 
| 11251 | 322 | A has said NB. We can't be sure about the rest of A's message, but only | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 323 | NB matters for freshness.*} | 
| 11251 | 324 | lemma A_Said_YM3_lemma [rule_format]: | 
| 325 | "evs \<in> yahalom | |
| 326 | ==> Key K \<notin> analz (knows Spy evs) --> | |
| 327 | Crypt K (Nonce NB) \<in> parts (knows Spy evs) --> | |
| 328 |           Crypt (shrK B) {|Agent A, Key K|} \<in> parts (knows Spy evs) -->
 | |
| 329 | B \<notin> bad --> | |
| 330 |           (\<exists>X. Says A B {|X, Crypt K (Nonce NB)|} \<in> set evs)"
 | |
| 331 | apply (erule yahalom.induct, force, | |
| 332 | frule_tac [6] YM4_parts_knows_Spy) | |
| 333 | apply (analz_mono_contra, simp_all) | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 334 | txt{*Fake*}
 | 
| 11251 | 335 | apply blast | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 336 | txt{*YM3: by @{text new_keys_not_used}, the message
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 337 |    @{term "Crypt K (Nonce NB)"} could not exist*}
 | 
| 11251 | 338 | apply (force dest!: Crypt_imp_keysFor) | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 339 | txt{*YM4: was @{term "Crypt K (Nonce NB)"} the very last message?
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 340 | If not, use the induction hypothesis*} | 
| 11251 | 341 | apply (simp add: ex_disj_distrib) | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 342 | txt{*yes: apply unicity of session keys*}
 | 
| 11251 | 343 | apply (blast dest!: Gets_imp_Says A_trusts_YM3 B_trusts_YM4_shrK | 
| 344 | Crypt_Spy_analz_bad | |
| 345 | dest: Says_imp_knows_Spy [THEN parts.Inj] unique_session_keys) | |
| 346 | done | |
| 347 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 348 | text{*If B receives YM4 then A has used nonce NB (and therefore is alive).
 | 
| 11251 | 349 | Moreover, A associates K with NB (thus is talking about the same run). | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 350 | Other premises guarantee secrecy of K.*} | 
| 11251 | 351 | lemma YM4_imp_A_Said_YM3 [rule_format]: | 
| 352 |      "[| Gets B {|Crypt (shrK B) {|Agent A, Key K|},
 | |
| 353 | Crypt K (Nonce NB)|} \<in> set evs; | |
| 354 | Says B Server | |
| 355 |            {|Agent B, Nonce NB, Crypt (shrK B) {|Agent A, Nonce NA|}|}
 | |
| 356 | \<in> set evs; | |
| 357 | A \<notin> bad; B \<notin> bad; evs \<in> yahalom |] | |
| 358 |       ==> \<exists>X. Says A B {|X, Crypt K (Nonce NB)|} \<in> set evs"
 | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 359 | by (blast intro!: A_Said_YM3_lemma | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 360 | dest: Spy_not_see_encrypted_key B_trusts_YM4 Gets_imp_Says) | 
| 6400 | 361 | |
| 362 | end |