Are all challenge-response (or other authentication) protocols vulnerable to on-line main-in-the-middle attacks?
Let's say Alice wants to setup a connection with Bob (e.g. she wants to login on a server). Bob sends her a random number, r. Alice then replies with a MAC of the random number, using her password. Bob knows that only Alice can do this and logs her into the server.
But what if, during all this time, there was an on-line adversary between Alice and Bob. He can intercept r and sent it to Alice himself. He could spoof the IP of the server so Alice thinks it's coming from Bob. Alice then sends her response and again the adversary intercepts it and sends it to the server. The adversary just forwarded the message so Bob still accepts it as correct and logs-in the adversary. He now has setup a connection with Bob, in the name of Alice.
Is my reasoning correct? I assume that, because of this, you will never use challenge-response protocols to login a user or start a session. If I'm not mistaking, using session keys protects against this attack and allows a safe connection.