I am working through the
initial example. I tried modifying it to allow a MitM attack. Tamarin found a counterexample trace but the counterexample trace seems to use the Reveal_ltk which should've been forbidden.
To allow the MitM attack, I modified the Register_pk rule to send the public key into the insecure channel so the attacker can forge this message. The client reads the public key from the channel too.
```
rule Register_pk:
[ Fr(~ltk) ]
-->
[ !Ltk($A, ~ltk), Out(<$A, pk(~ltk)>) ]
rule Client_1:
[ Fr(~k) // choose fresh key
, In(<$S, pkS>) // lookup public-key of server
]
-->
[ Client_1( $S, ~k ) // Store server and key for next step of thread
, Out( aenc(~k, pkS) ) // Send the encrypted session key to the server
]
```
I wanted to falsify the security property:
```
lemma Client_session_key_secrecy:
" /* It cannot be that a */
not(
Ex S k #i #j.
/* client has set up a session key 'k' with a server'S' */
SessKeyC(S, k) @ #i
/* and the adversary knows 'k' */
& K(k) @ #j
/* without having performed a long-term key reveal on 'S'. */
& not(Ex #r. LtkReveal(S) @ r)
)
"
```
This is the counterexample trace autoprove found. It doesn't use the MitM attack and instead calls Reveal_ltk on the server which I thought was disallowed by the `not(Ex #r. LtkReveal(S) @ r)`.

If I instead simplify the reveal Ltk to not know about the device name, then Tamarin gives me the counterexample I expected to find where the attacker deceives the client by giving it a wrong public key.
```
rule Reveal_ltk:
[ !Ltk(A, ltk) ]
--[ LtkReveal() ]->
[ Out(ltk) ]
...
& not(Ex #r. LtkReveal() @ r)
```

I've attached the .spthy files for the two pictures. They can be generated by running autoprove in the webui.
Having no experience with Tamarin, I thought I might be misinterpreting the counterexample trace. Any help in clarifying what's going on would be greatly appreciated!