Follow-up from this question. I just learned that all one needs to decrypt WPA2 traffic is the network key. So for example if I go to a coffee shop and they have the key on the wall I can listen to everything, and if people are visiting sites over HTTP I can MITM them. My question is: why??? Why can't the router and client exchange a secret using public key crypto and encrypt their connection so that other people on the network can't listen? And then each packet or whatever could have a MAC so MITM would be impossible.
From my knowledge WPA2 does this (encrypting the connection between client and router with a key different for each device)
WPA2 uses the authentification handshake to generate multiple keys. 2 of these are:
- Temporal Key (TK) – Used to encrypt/decrypt Unicast data packets
- Group Temporal Encryption Key
The first one is used to encrypt unicast connections like communication between client and router. The second one is used to encrypt multicast/broadcast messages.
In the case of the mitm attack the attacker persuades the victim to think he needs to send specific/all packets to his address. So the client encrypts the packets with a key the attacker is able to decrypt because the client thinks the attacker is the one he wants to talk to.
Think of it this way: all letterboxes in a city (wifi-network) can only be opened (decrypted) by the correct owner. You want to send secret data to your friend Joe who lives at Goodstreet 1. But you don't know that. So you ask the people of the city where he lives. Alice (also living in the city) convinces you that your friend lives at Badstreet 1. So you put your letter in the letterbox of Badstreet 1, Alice reads it/alters it and forwards it to Goodstreet 1. So even when the letterboxes are secure Alice managed a mitm-attack.
Edit: Professional routers/network equipment have countermessaures against things like ARP-poisoning to try prevent MITM-attacks.
Saying "So what's the point of encryption then? MITM renders it useless!" is not different than saying that a burglar alarm is useless in a public building or theft by a friend you invited to your house.