Computer Networking › Section H · Security in computer networks › Topic H.4
End-point authentication
Over a network, Bob never sees Alice; he sees only bits that claim to come from her. Designing a protocol that proves who is at the other end, even when Trudy can record and replay everything, takes several attempts, and each failure teaches something.
Proving who you are with messages alone
End-point authentication means one party proving its identity to another across a network. Face to face we recognise voices and faces; online, Bob can judge Alice only by the messages he receives, and Trudy may be watching, recording and inserting messages of her own. Authentication usually happens at the start of a session, as part of a larger protocol such as a login, a TLS handshake or joining a Wi-Fi network. The way to understand good designs is to build one in stages, letting Trudy attack each version. "Cybersecurity: encryption and authentication" covered the factors people use; this topic is about the protocol messages.
Attempts 1 and 2: a name, then an address
The simplest protocol has Alice send the message "I am Alice". Bob has no way to check it, and Trudy can send exactly the same message. A second attempt has Bob trust the source IP address: if the datagram comes from Alice's usual address, it must be Alice. But as "IPv4 datagrams and addressing" showed, the sender writes the source address into the header, and an operating system can be made to put any value there. Forging it, called IP spoofing, defeats the check. Ingress filtering by ISPs makes spoofing harder, but no address is proof of identity.
Attempt 3: a secret password
Next, Alice proves herself with something only she and Bob know, a password, sent along with her name. This is how early services such as Telnet and FTP logged users in, and it fails against a passive attacker. The password crosses the network in the clear, so anyone sniffing the link, on a shared Wi-Fi network, say, simply reads it and can log in as Alice from then on. A password is a reasonable secret; the flaw is sending it where Trudy can see it.
Attempt 4: an encrypted password, and replay
Suppose Alice and Bob share a symmetric key and Alice sends her password encrypted. Trudy can no longer read it, yet she does not need to. She records the encrypted message and later sends the identical bytes to Bob. Bob decrypts them, finds the correct password and accepts Trudy as Alice. This is a replay, or playback, attack. The weakness is that the proof never changes from one login to the next, so a recording of an old proof is as good as a new one. Bob needs evidence that Alice is present now, not merely that she was present once.
Nonces and challenge-response
The fix is a nonce, a number used only once in the lifetime of the protocol. When Alice says she is Alice, Bob replies with a fresh random nonce R, a challenge. Alice returns a value that only a holder of the shared key could compute from R, such as R encrypted with the key or an HMAC tag of R. Bob computes the expected value himself and compares. Because each login uses a new R, Trudy's recordings are useless: the old response answers an old question. This pattern, challenge-response, underlies authentication in TLS, IPsec, Wi-Fi and cellular networks.
Worked example: a challenge-response login
Alice and Bob share the key orchid and use HMAC with SHA-256, shown here as the first 8 hex digits. 1. Alice sends "I am Alice". 2. Bob picks the nonce 5f3a91c2 and sends it. 3. Alice computes the HMAC of the nonce under her key, 0ff4eafc, and returns it. 4. Bob computes the same value and accepts. 5. Later Trudy sends "I am Alice" and receives the new nonce b20e47d9. Replaying 0ff4eafc fails, because the correct answer is now c07cdd87, and computing it needs the key. Check: the key never crossed the network, and each response fits only one nonce.
Using public keys, and the man in the middle
A shared key must be set up in advance. With public keys, Bob sends a nonce and Alice signs it with her private key; Bob checks the signature with her public key. That leaves the question of how Bob gets Alice's public key. If he asks for it over the network, Trudy can intercept the request and reply with her own key. In a man-in-the-middle attack she then completes one protocol run with Bob as Alice and another with Alice as Bob, relaying messages so both believe they talk directly, while she reads everything. The protocol was sound; the key was not authenticated.
Worked example: where the protocol went wrong
Bob asks Alice for her public key, and the reply arrives unprotected. 1. Trudy swaps in her own public key, so Bob now holds Trudy's key labelled as Alice's. 2. Bob sends a nonce; Trudy signs it with her private key, and Bob's check succeeds, because it uses Trudy's public key. 3. Trudy runs a matching exchange with Alice, so both links work and she relays the traffic. 4. The failure point is step 1: nothing tied the key to Alice. 5. The fix is a certificate from a trusted CA binding Alice's name to her key, as in "Message integrity and digital signatures". Check: with a certified key, step 2's signature would fail.
Authentication in practice
Real systems combine these ideas. A website first authenticates itself with a certificate during the TLS handshake, then the user's password travels inside the encrypted connection, and the server stores only a salted, slow hash of it. One-time codes from an authenticator app act like nonces, because each code is valid for only a short time window. Passkeys, built on the FIDO2 and WebAuthn standards, go further: the device keeps a separate key pair for each website and signs the site's fresh challenge. The signature is bound to the website's real name, so a lookalike phishing site receives nothing it can reuse elsewhere.
Common mistakes to avoid
First, trusting a source IP address as proof of identity; it can be spoofed. Second, thinking encryption alone stops replay; a recorded encrypted proof works if it never changes. Third, reusing a nonce or making it predictable, which lets old or precomputed responses succeed. Fourth, sending a shared key itself as the response instead of a value computed from the nonce. Fifth, fetching a public key over an unprotected channel, inviting a man in the middle. Sixth, typing a password into a site before checking it is the genuine, certificate-authenticated server.
Key takeaways
End-point authentication must work with messages alone, against an intruder who can listen, record and insert. A claimed name or a source address proves nothing. A password sent in the clear can be sniffed, and even an encrypted one can be replayed. A nonce, used once, makes each proof fresh: in challenge-response, Bob sends a nonce and Alice returns a value that needs the shared key or her private key. Public-key versions need certified keys, or a man in the middle can relay both sides. TLS, one-time codes and passkeys apply these ideas every day.
Flashcards
Flashcard
Proving identity to the other party across a network
Test your understanding
Question 1 of 5
Alice proves her identity by sending her password encrypted with a key she shares with Bob. The encrypted value is the same at every login. What can Trudy do?
Question 2 of 5
What property must a nonce have to stop replay attacks in challenge-response authentication?
Question 3 of 5
In a challenge-response login with a shared key, which value does Alice send back after Bob's nonce?
Question 4 of 5
Bob receives Alice's public key over an unprotected connection and then checks her signature on his nonce. Why might this fail to authenticate Alice?
Question 5 of 5
Why does a passkey resist phishing better than a password typed into a login page?
