Monday 12 March 2018

WPA3: Technical Details and Discussion

Update 26 June 2018: The Wi-Fi Alliance released the specification of WPA3. For an up-to-date discussion of WPA3, see my new blog post. Summarized, only section "A More Secure Handshake" is a mandatory part of WPA3. Section "Increased Session Key Sizes" is optional, and only required when using WPA3-Enterprise. The other features discussed in this post are not part of WPA3.

Update 20 May 2018: A short description of the DPP protocol was added, and more information is provided about increased key sizes of WPA3.

The Wi-Fi Alliance made a press release where it announced WPA3. Unfortunately, this did not include many technical details. Nevertheless, we'll interpret the press release from a technical perspective. In particular, it mentions WPA3 will include four major new security features:

1. A More Secure Handshake

They explain that WPA3 will "deliver robust protections even when users choose passwords that fall short of typical complexity recommendations". This means that personal networks, in other words ordinary home networks that are protected with a single password, will be required to use the Simultaneous Authentication of Equals (SAE) handshake. Most importantly, this handshake is resistant against offline dictionary attacks. In contrast, personal WPA2 networks that use a weak password are vulnerable to offline dictionary attacks. Since in practice many networks use weak passwords, resistance against this attack is a major improvement.

On top of that, there is a security proof that indicates the design of the new SAE handshake is secure. The proof also confirms that the handshake provides forward secrecy: if an attacker ever learns the password of a network, they cannot use it to decrypt old captured traffic. This is again in contrast to WPA2, where learning the password allows an attacker to decrypt old traffic. So again the SAE handshake of WPA3 offers a major improvement.

Nevertheless, some caution is warranted. If the handshake is not carefully implemented, it is vulnerable to side-channel attacks. Additionally, because the handshake was designed to be a balanced PAKE, the access point (AP) must store the password in plaintext. Put differently, the AP cannot store some derivation of the password, meaning if someone gains access to the AP they can read out the plaintext password. Finally, just because there is a security proof, does not guarantee it is indeed secure. After all, WPA2 also had a security proof, but could still be attacked. Therefore it remains important to verify that the security proof is correct, makes valid assumptions, proves the correct properties, models real implementations, etc.

On a more technical level, the SAE handshake is a variant of the Dragonfly handshake defined in RFC 7664, which in turn is based on the SPEKE handshake. In a Wi-Fi network, the SAE handshake negotiates a fresh Pairwise Master Key (PMK). The resulting PMK is then used in a traditional 4-way handshake to generate session keys. This means the SAE handshake is always followed by a 4-way handshake. Although it may be surprising to learn that the 4-way handshake is still being used, this construction does avoid the weaknesses of the 4-way handshake. That's because the 32-byte PMK that the SAE handshake negotiates cannot be guessed using a dictionary attack, even though it's used in the 4-way handshake. Additionally, forward secrecy is indeed provided because the SAE handshake assures the PMK cannot be recovered if the password becomes known.

You can view the pcap of an example SAE handshake online on cloudshark.

2. Replacement of Wi-Fi Protected Setup (WPS)

The second improvement that WPA3 brings is "simplified, secure configuration and onboarding for devices with limited or no display interface". This refers to the replacement of Wi-Fi Protected Setup (WPS). Note that WPS is considered insecure. More precisely, the replacement of WPS will be the Wi-Fi Device Provisioning Protocol (DPP). This protocol allows you to securely add new devices to a network using a QR code or a password. It also defines methods to add devices using NFC, and using Bluetooth. At its core, DPP relies on public keys to identify and authenticate devices.

The DPP protocol itself consists of three main phases. In the first phase, called bootstrapping, the public key of the new device (i.e. the device being added to the network) is obtained. This can be accomplished by scanning a QR code that encodes the public key, or by exchanging and encrypting the public key wirelessly using the PKEX protocol. As previously suggested, it is also possible to transfer the public key using NFC or Bluetooth. Each method provides different levels of guarantees as to whether the obtained public key indeed belongs to the new device.

In the second phase, called authentication and provisioning, the now trusted public keys are used to establish a (temporary) authenticated connection, over which credentials can be exchanged. The exchanged credentials are not yet the final credentials to connect to the network. Instead, the exchanged credential is a so-called connector. This connector is used in the final phase of the DPP protocol, called the network access phase, to establish the actual networks keys. More precisely, the connect is used to perform a Diffie-Hellman exchange to establish a Pairwise Master Key (PMK). This PMK can then be used to access the network in a normal fashion.

3. Unauthenticated Encryption

The third feature of WPA3 "strengthens user privacy in open networks through individualized data encryption". This refers to unauthenticated encryption for open networks (i.e. for public hotspots). More precisely, I believe WPA3 will require support for Opportunistic Wireless Encryption (OWE). In practice this would mean a passive adversary, which can only sniff/monitor traffic, will not be able to read traffic of clients. Unfortunately, an active adversary can still create a fake AP, trick victims into connecting to this fake AP, and then read all traffic of connected clients.

Remark that the common practice of setting up a WPA2 network, and then publicly sharing the password to customers, does not prevent a passive adversary from decrypting all traffic. That's because an adversary only needs to capture the handshake the client executes when connecting to a WPA2 network, and then combine it with the public password to decrypt all frames between the client and AP. Active attacks against this setup are equally trivial: an adversary can set up a WPA2 network with the same name and password. Clients (e.g. customers) will then connect to the AP of the adversary, again allowing the adversary to intercept and read all traffic.

The advantage of OWE is that passive attacks are prevented. Unfortunately, active attacks still enable an adversary to intercept traffic. Nevertheless, under the motto of RFC 7435 "Some Protection Most of the Time" this still increases security. One shortcoming of OWE is that there is no mechanism to trust an AP on first use. Contrast this with, for example, SSH: the first time you connect to a SSH server, you can trust the public key of the server. This prevents an adversary from intercepting traffic in the future. However, with OWE there is no option to trust a particular AP on first use. So even if you connected to a particular AP previously, an adversary can still set up a fake AP and make you connect to it in the future.

On a technical level, the OWE handshake negotiates a new PMK using a Diffie-Hellman key exchange. This handshake is encapsulated in Information Elements (IEs) in the (re)association request and response frames. The resulting PMK is used in a 4-way handshake, which will negotiate and install frame encryption keys.

4. Increased Session Key Sizes

Finally, the fourth improvement that WPA3 offers is increased key sizes. More specifically, they refer to the Commercial National Security Algorithms (CNSA) suite. This means WPA3 will support AES-GCM with 256-bit keys for encryption, and elliptic curve cryptography based 384-bit curves. Additionally, SHA384 of the SHA2 family will be used, and any employed RSA keys must be at least 3072 bits in size. All combined, this results in 192-bit security, because that's roughly the effective strength of 384-bit elliptic curves and SHA384.

Improvements to WPA2

It's also interesting to note that the Wi-Fi Alliance now mandates support of Protected Management Frames (PMF) as part of its WPA2 certification. This means new WPA2-certified devices are now required to support PMF. This prevents deauthentication attacks where an adversary can forcibly disconnect clients from a Wi-Fi network. On top of that, it seems they will fuzz implementations of WPA2. Or to put it in their words, they will perform "Enhanced validation of vendor security implementations". In particular devices are tested to assure they validate server certificates properly, and that they are patched against the KRACK attack against WPA2.