The basis of the FMS attack lies in the use of weak
initialization vectors (IVs) used with RC4. RC4 encrypts one byte at a time with a
keystream output from
prga(); RC4 uses the key to initialize a
state machine via
ksa(), and then continuously modifies the state and generates a new byte of the keystream from the new state. Theoretically, the key stream functions as a random
one-time pad, as a
pseudo-random number generator controls the output at each step. With certain IVs, an
attacker knowing the first byte of the keystream and the first
m bytes of the key can derive the (
m + 1)th byte of the key due to a weakness in the KSA. Because the first byte of the plaintext comes from the WEP
SNAP header, an attacker can assume they can derive the first byte of the keystream from
B ⊕ 0x
AA (the SNAP header is almost always 0xAA). From there, they only need an IV in the form (
a + 3,
n − 1,
x) for key index
a equal to 0, element value space
n equal to 256 (since 8 bits make a byte), and any
x. To start, the attacker needs IVs of (3, 255,
x). WEP uses 24-bit IVs, making each value one byte long. To start, the attacker utilizes the IV as the first 3 elements in K[ ]. They fill the S-box S[ ] with sequential values from 0 to
n as RC4 does when initializing the S-box from a known K[ ]. They then perform the first 3 iterations of ksa() to begin initializing the S-box. After the third step, the attacker can possibly, but not definitely, derive the fourth byte of the key using the keystream output
O by computing (O −
j −
S[
i]) mod
n =
K[
i], with the value
i = 3 at this step. At this point, the attacker does not yet have the fourth byte of the key. This algorithm does not regenerate the next byte of the key; it generates a possible value of the key. By collecting multiple messages—for example WEP packets—and repeating these steps, the attacker will generate a number of different possible values. The correct value appears significantly more frequently than any other; the attacker can determine the value of the key by recognizing this value and selecting it as the next byte. At this point, they can start the attack over again on the fifth byte of the key. Although the attacker cannot attack words of the key out of order, they can store messages for later sequential attack on later words once they know earlier words. Again, they only need messages with weak IVs, and can discard others. Through this process, they can gather a large number of messages for attack on the entire key; in fact, they can store only a short portion of the beginning of those messages, just enough to carry the attack out as far as the word of the key the IV will allow them to attack. == References ==