I was trying to solve this problem:

Sometimes Alice needs to send a file to Bob, guaranteeing her identity and the file integrity (no confidentiality required); the two parties are sharing a secret w and make use of a hash function $H$ that outputs 40-bit numbers and a symmetric encryption $E$. Each time they use the following (pre-agreed) protocol.

A → B: $E_w(nA)$, where $nA$ is a nonce (Alice sends a challenge).

B → A: $E_w(nA+1)$ (Bob proves he knows the secret, providing response to challenge).

A → B: $(F, H(F),E_w(H(F)))$ (Bob, given $F$, computes $H(F)$ and $E_w(H(F))$, and then compare his results to data actually received)

**1.Show how an attacker can act in place of Alice and send a file to Bob tricking him into believing that the file is coming from Alice.

2.Fix the protocol without significantly perturbing it too.**

*My answer to 1: The attacker can do Man in the middle attack. Suppose Trudy impersonates Bob's network address. 1.Alice sends w{nA} to Trudy. 2.Trudy sends w{nA} to Bob. 3.Now Bob will send w{nA+1} to Trudy, which she will use it to send it to Alice. 4.After Trudy sends w{nA+1}, Alice will send (F, H(F),w{H(F)}) to Trudy, thinking she is Bob because she proved her that she is Bob.


  1. A → T: $E_w(nA)$

  2. T → B: $E_w(nA)$

  3. B → T: $E_w(nA+1)$

  4. T → A: $E_w(nA+1)$

  5. A → T: $(F, H(F),E_w(H(F)))$

Is my answer to question 1 correct? How do I solve the 2nd question?

Best Regards.

  • $\begingroup$ What exactly does w{nA} mean? Is it multiplication on an elliptic curve? Also your solution seems to inpersonate Bob instead of Alice. $\endgroup$ Jun 27, 2018 at 11:31
  • $\begingroup$ w is the secret shared between Alice and Bob , nA is the nonce used as a challenge by Alice. w{nA} is encryption of nonce nA by the secret key. $\endgroup$
    – Five0
    Jun 27, 2018 at 12:08

1 Answer 1


Q1 asks “Show how an attacker can act in place of Alice and send a file to Bob tricking him into believing that the file is coming from Alice.”

In your answer, Trudy simply relays the traffic to the two parties without doing anything else, thus this is not really an attack that achieves what is asked. Note that whatever Bob receives is truly coming from Alice in this session.

Hint for Q2: the problem in the protocol is that Bob cannot verify that the last message is fresh, and it can come from a previous session intercepted by Trudy (replay attack).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.