src/HOL/Auth/Yahalom_Bad.thy
author paulson
Thu Sep 23 13:06:31 1999 +0200 (1999-09-23)
changeset 7584 5be4bb8e4e3f
parent 6400 1f495d4d922b
child 11185 1b737b4c2108
permissions -rw-r--r--
tidied; added lemma restrict_to_left
paulson@6400
     1
(*  Title:      HOL/Auth/Yahalom
paulson@6400
     2
    ID:         $Id$
paulson@6400
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
paulson@6400
     4
    Copyright   1996  University of Cambridge
paulson@6400
     5
paulson@6400
     6
Inductive relation "yahalom" for the Yahalom protocol.
paulson@6400
     7
paulson@6400
     8
Example of why Oops is necessary.  This protocol can be attacked because it
paulson@6400
     9
doesn't keep NB secret, but without Oops it can be "verified" anyway.
paulson@6400
    10
*)
paulson@6400
    11
paulson@6400
    12
Yahalom_Bad = Shared + 
paulson@6400
    13
paulson@6400
    14
consts  yahalom   :: event list set
paulson@6400
    15
inductive "yahalom"
paulson@6400
    16
  intrs 
paulson@6400
    17
         (*Initial trace is empty*)
paulson@6400
    18
    Nil  "[]: yahalom"
paulson@6400
    19
paulson@6400
    20
         (*The spy MAY say anything he CAN say.  We do not expect him to
paulson@6400
    21
           invent new nonces here, but he can also use NS1.  Common to
paulson@6400
    22
           all similar protocols.*)
paulson@6400
    23
    Fake "[| evs: yahalom;  X: synth (analz (knows Spy evs)) |]
paulson@6400
    24
          ==> Says Spy B X  # evs : yahalom"
paulson@6400
    25
paulson@6400
    26
         (*A message that has been sent can be received by the
paulson@6400
    27
           intended recipient.*)
paulson@6400
    28
    Reception "[| evsr: yahalom;  Says A B X : set evsr |]
paulson@6400
    29
               ==> Gets B X # evsr : yahalom"
paulson@6400
    30
paulson@6400
    31
         (*Alice initiates a protocol run*)
paulson@6400
    32
    YM1  "[| evs1: yahalom;  Nonce NA ~: used evs1 |]
paulson@6400
    33
          ==> Says A B {|Agent A, Nonce NA|} # evs1 : yahalom"
paulson@6400
    34
paulson@6400
    35
         (*Bob's response to Alice's message.*)
paulson@6400
    36
    YM2  "[| evs2: yahalom;  Nonce NB ~: used evs2;
paulson@6400
    37
             Gets B {|Agent A, Nonce NA|} : set evs2 |]
paulson@6400
    38
          ==> Says B Server 
paulson@6400
    39
                  {|Agent B, Nonce NB, Crypt (shrK B) {|Agent A, Nonce NA|}|}
paulson@6400
    40
                # evs2 : yahalom"
paulson@6400
    41
paulson@6400
    42
         (*The Server receives Bob's message.  He responds by sending a
paulson@6400
    43
            new session key to Alice, with a packet for forwarding to Bob.*)
paulson@6400
    44
    YM3  "[| evs3: yahalom;  Key KAB ~: used evs3;
paulson@6400
    45
             Gets Server 
paulson@6400
    46
                  {|Agent B, Nonce NB, Crypt (shrK B) {|Agent A, Nonce NA|}|}
paulson@6400
    47
               : set evs3 |]
paulson@6400
    48
          ==> Says Server A
paulson@6400
    49
                   {|Crypt (shrK A) {|Agent B, Key KAB, Nonce NA, Nonce NB|},
paulson@6400
    50
                     Crypt (shrK B) {|Agent A, Key KAB|}|}
paulson@6400
    51
                # evs3 : yahalom"
paulson@6400
    52
paulson@6400
    53
         (*Alice receives the Server's (?) message, checks her Nonce, and
paulson@6400
    54
           uses the new session key to send Bob his Nonce.  The premise
paulson@6400
    55
           A ~= Server is needed to prove Says_Server_not_range.*)
paulson@6400
    56
    YM4  "[| evs4: yahalom;  A ~= Server;
paulson@6400
    57
             Gets A {|Crypt(shrK A) {|Agent B, Key K, Nonce NA, Nonce NB|}, X|}
paulson@6400
    58
                : set evs4;
paulson@6400
    59
             Says A B {|Agent A, Nonce NA|} : set evs4 |]
paulson@6400
    60
          ==> Says A B {|X, Crypt K (Nonce NB)|} # evs4 : yahalom"
paulson@6400
    61
paulson@6400
    62
         (*This message models possible leaks of session keys.  The Nonces
paulson@6400
    63
           identify the protocol run.  Quoting Server here ensures they are
paulson@6400
    64
           correct.*)
paulson@6400
    65
paulson@6400
    66
end