
result (truncated to 16 bits) would be used [25]. These older
Windows versions are out of scope for this paper.
The source code of the algorithm that is used for gener-
ating IP ID values in Windows is not public. However, we
recovered the exact algorithm using reverse engineering, and
verified its correctness by comparing its output to IP ID val-
ues generated by live Windows systems.
Technical details The algorithm was obtained by reverse-
engineering parts of the tcpip.sys driver of 64-bit Win-
dows 10 RedStone 4 (April 2018 Update, Build 1803). Ap-
parently this algorithm is in use starting with Windows 8 and
Windows Server 2012. Notice that the code is not specific
to IPv4, and can be used with IPv6, which is why the key K
is defined as 320 bits - more than required to support IPv4.7
For IPv4 pre RedStone 5, only 106 key bits are used.
Toeplitz hash The IP ID generation is based on the
Toeplitz hash function defined in [10]. Let us first define
the Toeplitz hash,T(K,I), which is a bilinear transformation
from a binary vector Kin GF(2)320 , and an input which is a
binary string I(where |I|≤289) to the output space GF(2)32.
For a binary vector V, denote by Vithe i-th bit in the vector,
with bit numbering starting from 0. The i-th bit of T(K,I)
(0 ≤i≤31) is defined as the inner product between Iand a
substring of Kstarting in location i. Namely
T(K,I)i=|I|−1
M
j=0
Ij·Ki+j(1)
IP ID generation The IP ID generation algorithm itself
uses keys K(tcpip!TcpToeplitzHashKey) which is a 320
bit vector, and K1 and K2 which are 32 bits each. All these
keys are generated once during Windows kernel initialization
(using SystemPrng and BCryptGenRandom).
In addition to these constant keys, the algorithm uses a
dynamic array of Mcounters, denoted β[0],...,β[M−1],
where Mis a power of 2, and is specifically set to M=8192.
Algorithm 1describes how Windows 8 (and later) gener-
ates an IP ID for a packet delivered from IPSRC to IPDST ,
while updating a counter in β.
The algorithm uses the keys, and the source and destina-
tion IP addresses, to pick a random index ifor a counter in β,
and an offset. The algorithm outputs the sum of the counter
β[i]and the offset, and increments the counter.
Notation We use the notation Num(a0,a1,...,a31)for the
number represented in binary by the bits ai, namely the num-
ber ∑31
i=0ai·231−i. (Network byte order is used throughout
the paper for representing IP addresses as bit vectors, e.g.
127.0.0.1 is 01111111.00000000.00000000.00000001.)
Properties of the Toeplitz hash Our attack uses the fol-
lowing properties of T, which follow from the linearity of
this transformation:
T(K,I||(0,0,...,0)) = T(K,I)(2)
7Our tracking technique can be probably adapted to IPv6, but since IPv6
is out of scope for this paper, we did not test this.
Therefore the trailing zeros in the input of Tin the compu-
tation of von line 3 of Algorithm 1, have no effect on the
output. Also,
T(K,I1||I2) = T(K,I1)⊕T(K,0|I1|||I2)(3)
Therefore it is possible to decompose the second input of T
to two parts, and rephrase the computation as the XOR of
two separate expressions.
4.2 Reconstructing the Key K
To reconstruct the key, the device needs to be measured. The
measurements only take a few seconds, and are thus assumed
to take place from the same network. I.e., the device’s source
IP address, IPSRC, is fixed (though possibly unknown). A
first set of measurements directs the client device to JIP ad-
dresses from the same class B network. A second set of mea-
surements directs the client device to G pairs of IP addresses,
each pair in the same class B network, with Gdifferent class
B network pairs in the set.
Once the device is measured, the attack proceeds in two
phases. The first phase of the attack recovers 30 bits of the
key using the first set of measurements. The second phase
of the attack reveals additional 15 bits of the key using the
second set of measurements. Overall, the measurements re-
veal 45 bits of the key, which suffices to uniquely identify
machines from a large population, with high probability.
Section 4.5 describes how to optimally choose the param-
eters Jand Ggiven limits on the number of IP addresses that
are available (L) and the processing time that is allowed (T).
For L=30 IP addresses (typical low budget limit), and attack
run time limit of T=1 seconds on a single Azure B1s ma-
chine (α=0.001 from Section 5.2), the optimal parameter
values are J=6,G=12.
4.3 Extracting Bits of K- Phase 1
Denote by IPg,j,IPIDg,jand β[ig]g,jthe values of the des-
tination IP address, the IP ID and β[i](prior to increment)
respectively, with respect to the j-th packet in the g-th class
B network that is used in the attack ( jand gare counted
0-based). The first phase of the attack uses only a single
class B network, and therefore gis set to 0 in this phase.
We thus use the following shorthand notation: IP j=IP0,j,
IPIDj=IPID0,jand βg=β[ig]g,0.
A major observation is that only the first half of IPDST is
used to calculate iin Algorithm 1. Therefore packets that are
sent to different IP addresses in the same class B network,
have an identical index iinto the counter table, and use the
same counter β[i]. Denote the value of ifor the g-th class B
network as ig.
If these packets are sent in rapid succession (i.e. when no
other packet is sent in-between with i=ig), then β[ig]g,j=
βg+jmod 232, and therefore the output in line 5 of the
USENIX Association 28th USENIX Security Symposium 1067