CNS - 04 - User Authentication (802.11 WEP)


Lecture Info

  • Date: [2020-09-28 lun 14:00]

  • Slides: CNS 03 - User Authentication (802.11 WEP)

  • Introduction: In the last lecture we have talked about the problems with the IVgenerations. We also talked about the fact that the crypto function \(\text{RC4}()\) itself was found to be vulnerable. Today we will talk about user authentication in WEP, and how badly it was managed.

1 Vulnerabilities and Exploits

In cybersecurity there is a huge distinction between a vulnerability, which is something that is weak and could potentially be exploited, and the actual exploitation, which is an actual attack carried out on top of one or more vulnerabilities of a system.

Not all vulnerabilities manage to get exploited, but it also not surprising to find a new exploit that uses a very old vulnerability which did not get patched. There is a big different in saying "A system is vulnerable" and "A system can be exploited".

Example: In WEP we saw that the IV generation was both vulnerable and exploitable. The vulnerabilities consisted in the fact that the IVs repeated, while the attack consisted of a dictionary attack in which couples \((\text{IV}, \text{RC4}(\text{IV}, k))\) were stored.

In this course we study protocols and we stop at the level of the vulnerability: if there is at least a vulnerability, we say that the system is vulnerable. The main purpose of security management is asses which vulnerabilities are the most critical one in order to properly distribute the (limited) resources needed to fix them.

2 User Authentication

User authentication is one of the essential service that security offers, and it allows you to prove you are really the one you claim to be. Its important to remember the difference between these two related processes:

  • Identification: in which you show the data that uniquely identifies.

  • Authentication: in which you prove your digial identity is controlled by you.

In reality defining authentication properly is not such an easy task, because, for example, sometimes web sites use the email as a means to authenticate the user. In this case we could mean "Successful authentication" by saying that we are reasonably assured that the subject accessing the service today is the smae as the one which accessed the service in the past. For more information regarding how to properly talk about authentication look at the NIST SP 800-63-3.


2.1 Authentication Means

There are various ways to authenticate, such as:

  • Using something you (and only you) know.

    • passwords, PIN, secret keys, ...

    • smart card, physical devices (tokens), PUF (physical unclonable function), ...

  • Using something you are (static biometrics)

    • retina, fingerprint, face, ... (movie Gattaca)

  • Something you do (dynamic biometrics, behavioral authentication)

    • voice recognition, hand writing, typing characteristics, mouse movements...

Observation: The team of Bianchi analyzed the way people move the mouse and found that each one of us has a slightly different pattern of mouse movement. The same was done for keyboard typing by another research team.

3 Warm-Up Example 2: 802.11 WEP (part 2)

In WEP authentication was very basic, because WEP does not care about authenticating individual users; it splits the world into two groups: one formed by the user that can enter the network, and the other formed by the users that cant enter the network. Within the authenticated group everyone can see everything, but a user in the other group cannot see what happens within the authentication group.

This idea was implemented as follows: we grant network access only to users who know a pre-shared secret. Notice that this is a goal different from confidentiality, confidentiality has to come later after we enter the network.

To implement this basic idea we have to solve the following problem: how can we "prove" that we know a secret? We can't simply revealing it while accessing the network, because at this stage we still don't have encryption, and therefore anyone listening on the network would sniff the password.


3.1 Challenge-Handshake with Symmetric Cipher

The WEP guys solved this problem with the following approach: instead of showing the password, we first do some operation based on the password value, and then we show the result of such operation.

\[\text{Result} = \text{Operation}(\text{Password})\]

For this scheme to work the operation has to be defined in such a way as to make sure the final result, which is computed starting from the password, cannot be used to gain any information regarding the original password.


Technically speaking the WEP guys did the following: lets start by noting that we already know the secret \(k\). When I want to connect to the Access Point (AP), the AP sends me a challenge as a plaintext string. I, the user who wants to connect to the network, respond to such challenge by sending the result of encrypting the challenge with the secret key \(k\).

Also, everytime a new connection starts, the challenge must be different, for otherwise a replay attack could take place in which someone simply sniff the previous correct encrypted value and "replays" it to the API whenever it asks for the same challenge.

When the AP gets back the encrypted challenge from the user who wants to authenticate, the AP can decrypt it and can check if the result of the decryption is the same as the original challenge. Grahpically,

Observation: Suppose I want to test if you know arabic. To do this I send you a word in italian and I expect you to give me the arabic translated version. The requirement here is that I would never ever give you the same word.


3.1.1 Is this valid?

To check if this approach is valid we can check the menezes book, and in particular to chapter 10, page 16 which takes care of the identification and user authentication. Since in that chapter we see the protocol, as long as the challenge is random and never repats, then the protocol is valid.

Things however turned out pretty bad: indeed, even if the protocol itself was secure, in the specific way it was designed in WEP it allowed the creation of two big vulnerabilities.



3.1.2 WEP Auth helps in Breaking Crypto

In the previous lecture we saw that to break WEP encryption you needed to build a dictionary with \((\text{IV}, \text{RC4}(\text{IV}, k))\) couples. Well, the user authentication helps in this.

Thats because anytime a user connects, he receives a challenge from the AP, and he replies with that challenge with the encrypted version of that challenge using the secret key as well as an initalization vector. This means that considering the challenge as a plaintext, we have a known plaintext attack thanks to which we can simply extract the \(\text{RC4}(\text{IV}, k)\) that can be used to build our dictionary and break the system.

IMPORTANT: This vulnerability comes from the fact that user authentication uses the same cryptographic key which is then used later in encryption. The menezes book only tells you about specific algorithmis, not in how to build a system. Whenever you build a system, you should never ever use the same key for different services.

This gives us a good way to attack the crypto: simply use a fake AP that sends multiple challenges to each client it encounters in order to gather IV pairs. This works because the authentication is unilateral, i.e. the client does not check if the AP is a valid one or a fake one.



3.1.3 WEP Auth is Broken

WEP Authentication is actually broken. Just by watching a valid user authenticate, a potential attacker can sniff the two packets and can compute \(\text{RC4}(\text{IV}, k)\) and \(\text{IV}\) which can be use to authenticate itself whathever challenge is given by the AP.

The vulnerability here comes from the fact that its the user who can select the \(\text{IV}\), which means that the attack can first snoop on another authentication and can then select the \(\text{IV}\) used by the other user.

This means that WEP is completely broken.

Observation: What the standardizers forgot to notice is that there are two critical aspects which had to be taken care of: who selects the challenges (which was rightly choosen), and who selects the initialization vectors (which was badly choosen). The fix would've been to let the AP choose both the challenges and the IVs.

IMPORTANT: In general in a challenge/response situation you have to make sure that the client is only able to respond and does not have any degree of freedom to select things.



3.2 WEP Goals (Revisited)

Let us revisit the goals of WEP with what we've seen so far.

  • Authentication:

    • It helps in attacking the cipher.

    • It is broken badly.

  • Confidentiality:

    • IV too small.

    • RC4 weak.

The only thing that's left to attack is integrity. And even in this case the WEP guys failed miserably.


3.3 What About Integrity?

As far as the integrity goes, the WEP guys had the terrific idea of using the native CRC-32 bits as the integrity check value. They though that the external encryption wrapping should have prevented any attacker to perform valid alterations.

A common (and wrong) belief, is that encryption guarantess protection. This is false. Encryption is a service that only guarantess confidentiality. An encyption mechanism does not guarantee integrity.

Now, the WEP guys knew that. What what they did not realize however was that CRC-32 is linear with respect to the XOR operation, meaning that

\[c(A) \mathbin{\oplus} c(B) = c(A \mathbin{\oplus} B)\]

since WEP uses XOR to encrypt the messages, this is deadly in terms of integrity. The consequences of this fact are, in fact, terrible: I can do any (meaningful) message modification of my choice as well as any message injection of my choice.


3.3.1 Message modification

Suppose I have a plaintext in which I want to flip certain bits.

To do this we generate our \(\text{IV}\) and we encrypt our message as well as the CRC bits with the relative keystream.

Consider now a different message, in which you have all \(0\) bits and \(1\) bits in the positions of interest of the original message (those I want to flip) and once again I generate the CRC value of such message. Then, I take the previously obtained ciphertext, and I XOR it together with the newly created message

Notice that like this I'm able to obtain a new message \(M \mathbin{\oplus} \delta\) encrypted with a correct CRC value.


Formally, let

\[\text{IV}, C = [M \,\, | \,\, C(M)] \mathbin{\oplus} \text{RC4}(\text{IV}, k)\]

be the encrypted message sent by the valid user to the AP. Then an attacker by doing a man in the middle attack (MITM) can choose a new message \(\delta\) as long as message \(M\), can compute \(c(\delta)\) and finally can compute

\[\begin{split} C' &= C \mathbin{\oplus} \{\delta, c(\delta)\} \\ &= \Big[\text{RC4}(\text{IV}, k) \mathbin{\oplus} \{M, c(M)\} \Big] \mathbin{\oplus} \{\delta, c(\delta)\} \\ &= \text{RC4}(\text{IV}, k) \mathbin{\oplus} \{M \mathbin{\oplus} \delta, c(M) \mathbin{\oplus} c(\delta)\} \\ &= \text{RC4}(\text{IV}, k) \mathbin{\oplus} \{M', c(M \mathbin{\oplus} \delta)\} \\ &= \text{RC4}(\text{IV}, k) \mathbin{\oplus} \{M', c(M')\} \\ \end{split}\]

at the end \(C'\) is an encrypted message with a valid CRC32 value. Since \(\delta\) can be choosen so as to flip specific bits, integrity is completely broken.



3.3.2 Message Injection

As long as I have one pair \((\text{IV}, \text{RC4}(\text{IV}, k)\) I can inject any message \(M\) so that it is authenticated and encrypted by simply computing \(c(M)\) and by injecting the pair to obtain

\[\text{IV}, \text{RC4}(\text{IV}, k) \mathbin{\oplus} \Big[M | c(M) \Big]\]



3.3.3 Takeways

The takeways as far as integrity goes are:

  1. Integrity checks must always be non linear.

  2. Integrity checks must explictly include a key, since external encryption may not provide any guarantee.

4 Aftermath of 802.11

After being ridiculed over for the blunders they have made in the original version of the WEP protocol, the WEP guys decided to open a new standardization (802.11i), which produced two specifications which this time involved crypto guys:

  • WPA: The basic idea was to use the same hardware, but with a firmware patch that added protection:

    • Longer IV (48 bit)

    • Protection of IV

    • Epehemeral key derivation

    • ...

  • WPA2: As above but using AES (new hardware).

Observation: "Do it Yourself" in security is definitely a bad approach. The best guys are the ones that know their limits.