A leader should be selected by randomly choosing one of three parties A, B and C. The parties use the following protocol:
$A → B: N_A$ (where $N_A$ is a nonce)
$B → C:$ $N_{AB}$ $= N_A$ ^ $N_B$ (where $N_B$ is a nonce, and ^ is the ex-or operation}
$C → A:$ $N_{ABC}$ $= N_{AB}$ ^ $N_C$ (where $N_C$ is a nonce) ( Now both A and C know $N_{ABC}$)
$A → B$: $N_{ABC}$ (Now B knows $N_{ABC}$, too)
( Each of the three parties can now compute $p = N_{ABC} mod 3$, where $p = 0$ denotes A, $p = 1$ denotes B, and $p = 2$ denotes C ).
Discuss the security of the protocol and establish if and how is it possible for some of the parties to deterministically choose the leader, being the others not aware of the fraud.
Then fix the protocol too.
I am training with security exercises, but I don't know how to approach to this. Can you give me some help?