Off-Path TCP Hijacking Attacks Via The Side Channel of Downgraded IPID
Off-Path TCP Hijacking Attacks Via The Side Channel of Downgraded IPID
Off-Path TCP Hijacking Attacks Via The Side Channel of Downgraded IPID
flag in packet header [14] to choose between the two poli- within 215 seconds on average and the success rate is
cies, since only socket protocols can set this flag to TRUE over 88%.
to perform the path MTU discovery (PMTUD) mechanism Note that the attacks in IPv4 networks require that the off-
[23], [24]. In other words, if the DF flag is set to TRUE, path attackers control 1,837 IPv4 addresses on average to
it uses the per-socket-based policy; otherwise, it chooses the construct hash collisions and build the side channel. However,
hash-based policy. However, our study shows that the mixed this requirement may not be easily fulfilled in the IPv4 net-
IPID assignment in Linux implementations has vulnerabilities works for individuals. We resolve this limitation by exploiting
that can be exploited to launch a new off-path TCP hijacking IPv4/IPv6 dual-stack networks that hold adequate IP addresses
attack. to build the side channel. Particularly, for Linux systems
Since Linux uses the more secure per-socket-based IPID running IPv4/IPv6 dual-stack, we show that attackers can more
assignment by default for TCP connections, an off-path easily construct hash collisions by leveraging the adequate
attacker first tricks the victim into assigning IPID for its TCP IPv6 addresses. Since the globally shared 2048 hash counters
packets using the less secure hash-based IPID assignment. This on the victim are also used by IPv6 addresses [22], an off-path
goal can be achieved by pretending to be a router and sending attacker can misuse its adequate IPv6 addresses to construct
a forged ICMP “Fragmentation Needed” error message [25] hash collisions and identify the target hash counter used in a
to a victim. Since the ICMP error message informs the victim victim TCP connection. Hence, in IPv4/IPv6 dual-stack net-
that the packets issued from the victim need to be fragmented works, the off-path attacker can more easily hijack victim TCP
and the DF flag is set, the victim will be tricked into cleaning connections between the vulnerable server’s IPv4 interface and
the DF flag of TCP packets and thus uses the hash-based IPID an arbitrary IPv4 client.
assignment. Next, the victim chooses one IPID counter from Finally, we propose countermeasures that aim to eliminate
the 2048 hash counters to assign IPID for its TCP packets. the root cause of the newly discovered off-path TCP attack.
Among the 2048 globally shared hash counters, the target We fix the mixed IPID assignment in Linux kernels by
counter is decided by the hash value of four components, determining if a packet is originated from TCP protocol
i.e., three fields of the packet (source IP address, destination on the Protocol field in IP header, instead of the DF
IP address, protocol number) and a random value generated flag. We implement a prototype of our countermeasure in
on system boot. Due to the small-sized hash counter pool, Linux 4.18 and confirm its effectiveness through experimental
the attacker may identify the target hash counter used in a evaluation on the Internet.
victim TCP connection via hash collisions, namely, alternating Contributions: Our main contributions are the following:
IP addresses to collide with the target counter. • We uncover that the new mixed IPID assignment method
Once the shared IPID counter is known, attackers can use can still be exploited to hijack TCP connections.
the challenge ACK mechanism [6] as trigger conditions to • We uncover a new side channel in IPID assignment in the
change the shared IPID counter, facilitating the next two attack latest Linux kernels. We demonstrate that the side channel
steps, i.e., to detect the presence of the victim TCP connection can be exploited to learn the presence of victim TCP
and infer the sequence and acknowledgment numbers. The connections and infer the sequence and acknowledgment
attacker sends forged TCP packets to the victim, and the numbers of the connections.
triggered challenge ACK packets will alter the shared IPID • We discover that more than 20% of Alexa top 100k websites
counter under different situations. It helps the attacker to are vulnerable to our off-path attack. We also perform case
determine if the specified values in the forged TCP packets studies on a wide range of applications and confirm the
are correct. Note that our attack only leverages the challenge effectiveness of the attack.
ACK mechanism as trigger conditions to assist the inference • We analyze the root cause of the new attack and develop
of a victim TCP connection, instead of directly exploiting countermeasures that use new IPID assignment methods
vulnerabilities in the challenge ACK mechanism to hijack TCP for TCP packets. Our prototype in Linux 4.18 validates its
connections [8], [9]. effectiveness.
Our attack does not suffer from traditional noise challenges
that other works have to address [16], [17], [26], [27]. Since, II. BACKGROUND
in our attack, irrelevant TCP traffic using per-socket-based
counters, instead of the hash-based counters, will not interfere A. IPID Assignment in Linux
with the attack traffic. Moreover, we measure that non-TCP There are two basic IPID assignment policies in current
traffic also rarely interferes with the attack. We evaluate the Linux, i.e., IPID based on 2048 hash counters or IPID
impacts of the new off-path TCP vulnerability on the Internet. based on per-socket counters, where the latter is specific to
We find that more than 20% of the Alexa (www.alexa.com) socket related protocols such as TCP. Figure 1 illustrates
top 100k websites are vulnerable to our off-path attack. the procedure of IPID assignment in Linux version 4.18 and
Those websites can be tricked into cleaning the DF flag and beyond. When a packet is generated, the IP protocol first
downgrading the IPID assignment from the per-socket-based checks whether the packet is a TCP RST packet. If yes, then
policy to the hash-based policy for their TCP packets after the IPID of the packet is set to 0 directly. This assignment
receiving forged ICMP “Fragmentation Needed” messages. is due to Geoffrey et al.’s disclosure of a side channel in
We implement a PoC and perform case studies on a wide range previous assignment methods, i.e., IPID of the RST packet
of applications, e.g., HTTP, SSH and BGP, to validate the was assigned based on one of the 2048 hash counters before
effectiveness of the attack in the real world. The experimental version 4.18, which can be exploited to detect the presence of
results show that our off-path TCP attack can be constructed TCP connections [21].
FENG et al.: OFF-PATH TCP HIJACKING ATTACKS VIA SIDE CHANNEL OF DOWNGRADED IPID 411
between the server and the detected client. Our attack uses the
ICMP protocol to detect hash collisions due to its simplicity
and observability.
The procedure of detecting victim clients by constructing
hash collisions is shown in Figure 4. First, the attacker pre-
tends to be a router and sends a forged ICMP “Fragmentation
Needed” message to the server, who will be tricked into
clearing the DF flag and downgrading the IPID assignment
of packets to the client whose IP address is specified in the
forged ICMP message. Second, the attacker initiates ICMP
echo requests to the server and observes the IPID of the reply
packets. Then the attacker impersonates the client and sends
a spoofed SYN packet to the server’s listening port (e.g., 80).
Following the three-way handshake process of TCP, the server
will respond an SYN/ACK packet to the client. Here, the key
difference is that if the attacker’s IP address collides with the
Fig. 3. Structure of the forged ICMP error message.
client (i.e., the attacker and the client share the same hash-
based IPID counter at the server side), the IPID assignment for
message and clears the DF flag of subsequent packets sent to the SYN/ACK packet will incur an additional increment to the
the client whose IP address is specified in the embedded echo shared IPID counter, which can be observed by the attacker.2
reply. Even if the server checks on the embedded echo reply Otherwise, if there is no collision, the IPID observed by the
data, it is easy for attackers to circumvent this checking. For attacker will be continuous distribution, i.e., without additional
example, the attacker can impersonate the client and initiate increment. Using this method, the attacker can identify victim
an ICMP echo request to the server, triggering the server clients who collide with its IP address and share the same
to send an echo reply message. Then, the attacker pretends IPID counter.
to be a router and sends an ICMP “Fragmentation Needed”
message embedded with the known echo reply data to the hash(server_IP, client_IP, T CP, Boot_key)
server, tricking the server into accepting the forged message. = hash(server_IP, attacker_IP, ICM P, Boot_key) (1)
Note the next-hop MTU value specified in the forged ICMP
“Fragmentation Needed” message should be smaller than the The hash-based IPID counter does not increase linearly.
server’s acceptable minimum PMTU min_pmtu, as described Instead, the increment is a random value in a uniform distrib-
in Section II-B. Actually, the value can be set to 68 octets, ution between 1 and the number of system ticks since the last
which is always smaller than the system variable of min_pmtu packet transmission that used the same counter. Hence, if the
in various IP implementations. Besides, we find that a forged attacker wants to force the counter to increase linearly and
ICMP error message embedded with a GRE data [31] can also facilitate the observation, it needs to restrict the increment of
be used to trick the server into clearing the DF flag. system ticks related to the IPID counter. Usually, if more than
In a nutshell, it is difficult to verify the legitimacy of ICMP 3 packets are sent to the server under 10 ms, the random value
error messages on the Internet. Therefore, an attacker can forge added to the IPID counter will never be larger than one [21].
an ICMP message and trick the server into accepting it. The We send ICMP request packets to the server in parallel and
forged ICMP error messages can force the server to clear the restrict the increment of system ticks. Our experiments show
DF flag of packets sent to the victim client. Thus, the IPID that if the round-trip time (RTT) from the attacker to the server
assignment can be easily downgraded by attackers. is within 200 ms, the attacker only needs to send less than
300 packets per second to force the hash-based IPID counter
increasing linearly.
B. Constructing Hash Collisions There are totally 2048 hash-based IPID counters in Linux,
The server will assign IPID to the packets by using and the probability of hash collisions between the attacker
one of 2048 hash counters once the TCP packet’s DF flag and the client is a geometric distribution. When the protocol
is cleared. The counter is selected based on four factors, is specified as ICMP (see Eq. 1), if the attacker has k IP
i.e., source IP address, destination IP address, protocol num- addresses, the probability of collisions between the attacker
ber (e.g., 1 represents ICMP protocol, 6 represents TCP and the target client is 1 − (1 − p)k , where p equals 1/2048.
protocol) of the packet, and a random value generated on To construct an attack in practice, the attacker has two strate-
system boot. A hash index computed from the four factors is gies to detect victim clients by leveraging hash collisions.
used to select one counter from the 2048 hash IPID counters. Attacking Potential Targets: If the attacker has only one or
Hence, if the TCP packets sent to the victim client have the a few IP addresses, the attacker can detect potential victim
same hash value as the packets sent to the attacker, the server clients who collide with the attacker. In theory, if the attacker
will use the same IPID counter to assign IPID for those has only one IP address, on a target server, the number of
packets to different destinations. Therefore, by constructing
2 A special case is that the source port in a spoofed SYN packet happens to
hash collisions using Equation 1, the attacker can detect the
victim clients who share the same IPID counter on the server match the source port of a TCP connection from the client to the server. In this
case, the spoofed SYN packet will trigger a challenge ACK packet, instead of
side. In other words, the shared IPID counter forms a side a SYN/ACK packet. However, the attacker can still observe an additional
channel, which can be exploited to infer TCP connections increment to the shared IPID counter.
414 IEEE/ACM TRANSACTIONS ON NETWORKING, VOL. 30, NO. 1, FEBRUARY 2022
clients conflicting with the attacker is 232 /2048 = 221 . Since V. D ETECTING TCP C ONNECTIONS
the detection only depends on the server side, the attacker
can create a list of IP addresses and select one from the list Once a victim client is identified, the attacker can learn
as the client’s IP address each time. Following the procedure the presence of TCP connections between the client and
in Figure 4, the attacker can determine if the selected one is the server. A TCP connection is identified by a four-tuple,
a victim. In this way, the attacker can identify and enumerate i.e., [source IP address, source port number, destination IP
all the potential victim clients who are vulnerable to its address, destination port number]. Usually, the destination IP
IP address. In our test, an attacker can detect more than address, and port number are public known, so an attacker
20 victim clients within 6 minutes using one IP address only needs to infer the source IP address and source port
(see Section VII-A). number. In our attack, since the victim client can be detected
Attacking Arbitrary Targets: If the attacker has enough by using hash collisions, the only missing tuple is the source
number of IP addresses, it can attack arbitrary TCP con- port number.
nections by alternating its IP addresses to generate the hash Assuming that a TCP connection from source port y has
collision. According to the geometric probability distribution, been established earlier by a legal user in the victim client,
if the attacker has more than 2048 IP addresses, it can collide an off-path attacker can identify this port number by sending
with any clients with above 63.2% probability. Especially, for out probing packets. First, the attacker continuously sends
servers running IPv4/IPv6 dual-stack, attackers can use ade- ICMP echo request packets to the server and observes the IPID
quate IPv6 addresses to construct hash collisions with arbitrary values of the reply packets from the server. Then, the attacker
target clients, since both IPv4 and IPv6 addresses share the impersonates the victim client and sends a forged SYN/ACK
same 2048 hash-based IPID counters (see Section VII-D for packet with a guessed source port number to the server. If the
implementations and evaluations of our attack in dual-stack source port number specified in the SYN/ACK packet does not
networks). equal y, according to the TCP specification [1], the server will
The detected hash-based IPID counter shared with the respond a RST packet to the client. Due to the patch fixing the
victim client is stable. That is, if the server does not vulnerability identified by Alexander et al. [21], Linux kernel
restart (i.e., the Boot_key in Eq. 1 is not altered), versions 4.18 and beyond assign an IPID of 0 to the RST
the client’s TCP connection will always share this IPID packet, which will not incur an increment to the shared IPID
counter with the attacker. In practice, servers (e.g., web counter. Hence, the IPID values in the reply packets observed
servers and BGP routers) do not restart frequently. Hence, by the attacker are continuous.
the attacker can detect shared IPID counters and victim If the guessed source port number specified in the forged
clients in advance, regardless of if TCP connections have been SYN/ACK packet equals y, the challenge ACK mechanism [6]
established. makes the server send a challenge ACK packet to the victim
Note Linux assigned IPID to RST packets based on hash client for confirming the legitimacy of the SYN/ACK packet.
counters before version 4.18, and thus an attacker can observe The IPID in the challenge ACK packet will be assigned based
its IPID distribution to determine if it shares the same counter on the shared IPID counter, which will incur an additional
with the client by spoofing SYN/ACK packets [21]. This increment to the counter. Thus, from the view of the attacker,
vulnerability has been fixed since Linux 4.18 by always setting the IPID values in the reply packets from the server will not
the IPID of RST packets to 0, incurring no changes on any be continuous.
IPID counters. However, we find that after the critical step of The attacker repeats the above procedure, i.e., changing
downgrading the IPID assignment, an attacker can still detect the source port number specified in the forged SYN/ACK
hash collisions through forging SYN packets and triggering the packet and then observing the IPID of the reply packets,
server to respond SYN/ACK packets and then identify a victim until the correct port number y is identified. Finally, the TCP
client. Moreover, we will show that the fix of assigning 0 to connection running on the identified four-tuple is all known
RST packets introduces yet another vulnerability, which can to the attacker. In practice, the attacker can adopt a parallel
be exploited by a pure off-path attacker to detect the presence approach to facilitate the identification of the source port,
of victim TCP connections (see Section V). i.e., to search the source port number by sending multiple
FENG et al.: OFF-PATH TCP HIJACKING ATTACKS VIA SIDE CHANNEL OF DOWNGRADED IPID 415
probing packets in a certain range during a period. If the attacker impersonates the victim client and sends a spoofed
source port is in the range, the shared IPID counter will have ACK packet with a guessed acknowledgment number ack to
an additional increment, so the attacker can further narrow the the server, the packet is also specified with an acceptable
range. Otherwise, the attacker can detect another port range in sequence number detected previously. If ack is in the challenge
parallel. In addition, the attacker can use a binary-search-like ACK window of the server, a challenge ACK packet will be
algorithm [8], [9] to further reduce the detection time cost. issued, incurring an additional increment to the shared IPID
counter. Instead, if ack is not in the challenge ACK window,
VI. I NFERRING S EQUENCE AND the observed IPID will be continuous from the view of the
ACKNOWLEDGMENT N UMBERS attacker. In practice, the challenge ACK window size is always
between 1G and 2G [8], [9], [32], i.e., one quarter of the
A. Inferring Acceptable Sequence Number
entire acknowledgment number space. Hence, to facilitate the
To infer the acceptable sequence numbers on the server detection, the attacker can divide the entire space into 4 blocks
side, the attacker continuously sends ICMP request packets to and probe each block to check which block the challenge ACK
the server and observes the IPID values of the reply packets. window falls in.
Then, the attacker impersonates the victim client to send a
spoofed RST packet to the server. The RST packet is specified
with the guessed sequence number seq. We need to consider C. Detecting the Exact Sequence Number
two cases: (i) seq not in the server’s receive window and Now we present the method of detecting the exact sequence
(ii) seq in the server’s receive window. According to the number (i.e., RCV.N XT , the lower boundary of the server’s
challenge ACK mechanism described in Section II-C, in the receive window) based on the previous inferred results. The
first case, the server will discard the spoofed RST packet attacker can forge multiple ACK packets with a constant
directly, so it does not influence the shared IPID counter. acknowledgment number ack_challenge in the challenge ACK
In the second case when the guessed seq is in the server’s window and the specified sequence number in each ACK
receive window, the server will respond to this RST packet and packet set to seq_acceptable − i, where seq_acceptable is
send a challenge ACK packet to the victim client to confirm an acceptable sequence number inferred previously. Then the
the legitimacy of the packet. The IPID of this challenge ACK attacker impersonates the victim client to send these forged
packet is assigned based on the shared IPID counter, and it ACK packets to the server. In the beginning, the server will be
will incur an additional increment to the counter. The attacker triggered to send challenge ACK packets at a rate of one packet
can observe the increment and then determine that the guessed per 500 ms due to the rate limit of challenge ACK, so the
seq is located in the server’s receive window.3 triggered challenge ACK packets will incur regular increments
In practice, in order to reduce the time cost of sequence to the shared IPID counter. However, once the specified
number inference, the attacker can divide the sequence number sequence number seq_acceptable−i reaches RCV.N XT (the
space into multiple blocks whose sizes are equal to the default lower boundary of the server’s receive window), the server will
receive window size in Linux (87380 octets), probing only switch to send duplicate ACK packets, which is not enforced
once per block. Besides, the attacker can apply parallel search by any rate limit. Thus, the shared IPID counter will have
methods similar to those used in connections detection to a jitter,4 and the attacker can observe this jitter and then detect
further reduce the time cost. the exact sequence number. The detecting procedure has no
side effects, e.g., resetting the connections, on the connections.
B. Locating the Challenge ACK Window
According to RFC 5961, when a segment arrives at the D. Detecting Acceptable ACK Number
server, the server also checks the segment’s acknowledgment
Once an acknowledgment number ack_challenge in the
number even if its sequence number is in the server’s receive
challenge ACK window is identified, the attacker can also
window. There are three cases in the whole acknowledgment
detect the boundary of the challenge ACK window by sending
number space: (i) the acknowledgment number in challenge
multiple probing ACK packets and then observing the shared
ACK window, (ii) in the acceptable ACK range, and (iii) invalid
IPID counter, similar to detecting the lower boundary of the
acknowledgment numbers. In the first case, the server will
server’s receive window. The forged probing ACK packets are
issue a challenge ACK packet to confirm the legitimacy of
specified with a constant sequence number seq_acceptable,
the triggering segment. In the second case, the server will
and the acknowledgment number of each ACK packet is set
accept the segment directly. Otherwise, if the segment carries
to ack_challenge − i. In turn, the attacker sends these forged
an invalid acknowledgment number, the server will discard it
ACK packets to the server. Challenge ACK packets will be
silently. The last two cases cannot be differentiated directly
triggered until ack_challenge − i reaches the lower boundary
because it cannot be observed from an off-path attacker.
of the challenge ACK window. Once this boundary is detected,
However, the attacker can first identify the challenge ACK
then SN D.U N A can be easily inferred, i.e., adding 2G to
window of the server and then infer the acceptable ACK
the detected boundary. SN D.U N A is in the acceptable ACK
numbers.
range. When all the data sent earlier has been acknowledged,
When locating the challenge ACK window, the attacker
SN D.U N A equals SN D.N XT . Instead, if the server has an
observes and records the shared IPID counter. Then the
amount of data to be sent to the client, SN D.N XT can also
3 In a special case when seq exactly matches the server’s RCV.N XT ,
the server will reset the connection directly. However, the probability of this 4 The increments to the shared IPID counter become 20 per 500 ms in our
case occurring is 1/232 , which is negligible. experiments, instead of 1 per 500 ms.
416 IEEE/ACM TRANSACTIONS ON NETWORKING, VOL. 30, NO. 1, FEBRUARY 2022
Fig. 5. Empirical CDF of time cost and the number of attacker IP addresses needed to detect a hash collision.
TABLE II
E XPERIMENTAL R ESULTS OF SSH C ONNECTION R ESET
the victim TCP connection has ongoing traffic, the acceptable IX. R ELATED W ORK
sequence and acknowledgment numbers may shift as the attack
IPID Side Channels: IPID ensures the uniqueness of a
is in progress. This problem can be solved by the repeated
packet for packet fragmentation and reassembly [14], [15].
inference of the acceptable sequence and acknowledgment
However, IPID has been widely abused to conduct off-path
numbers. We confirm that if the receive window does not
attacks due to the vulnerable assignment methods. Ensafi et al.
slide very quickly, e.g., under the scenarios of SSH and BGP,
performed idle port scan and network protocol analysis by
the success rate of the attack will not be affected obviously.
leveraging the side channel of global IPID counters [16].
Even if the receive window slides quickly enough to break
They also suggested that the global IPID counters can be
the attacker’s inference, the attacker can choose to exploit the
used to detect intentional packet drops [17]. By leveraging the
other side of the TCP connection where the receive window
side channel of global IPID counters, Pearce et al. measured
slides more slowly.
the reachability between any two Internet locations without
controlling a measurement vantage point [26], [27], and the
B. Countermeasures blind TCP hijacking attacks was demonstrated can be success-
We have reported the newly discovered IPID side channel to fully performed against early OSes of Windows 2K, Windows
the Linux community. Meanwhile, we also propose to throttle XP and FreeBSD 4 [41]. Jeffrey et al. showed that per-
the exploit via eliminating the root cause. destination IPID counters are also vulnerable, which can be
(1) Assigning IPID Based on the Protocol Field: The exploited to infer the number of packets between two machines
root cause of the attack is that Linux can be tricked into with UDP and ICMP and even learn the presence of a
choosing an incorrect IPID assignment policy for TCP packets. TCP connection by launching off-path attacks [19]. Alexander
When Linux assigns IPID to TCP packets, it decides which et al. detected TCP connections via IPID hash collisions.
policy to be chosen based on the DF flag in IP header, rather They leveraged the IPID of the triggered RST packets to
than the Protocol field. Therefore, attackers can clear the determine the presence of a victim TCP connection [21]. Their
DF bit of the TCP packets by forging ICMP “Fragmentation method can only detect TCP connections, but not hijacking
Needed” messages, which causes hash collisions and build a a TCP connection. Moreover, the vulnerabilities they used
side channel. To address this issue, we propose to assign IPID have been fixed since Linux kernel version 4.18. In this
by evaluating if a packet is originated from TCP based on paper, we identified a new vulnerability of abusing IPID,
the field of Protocol in IP header, instead of the DF flag. which can be exploited to perform an off-path TCP hijacking
If the packet’s Protocol field is specified as TCP, we assign attack.
IPID for the packet based on the per-socket assignment policy. TCP Hijacking Attacks: Cao et al. found that an off-
As a result, all TCP packets issued from the server will no path attacker can infer whether two arbitrary hosts on
longer share IPID counters with the attacker and the side the Internet are communicating using a TCP connection
channel can be eliminated, no matter the server enables the by utilizing a side channel in the challenge ACK mecha-
IPv4/IPv6 dual-stack or only the IPv4 stack. We implement nism, identify the sequence and acknowledgment numbers
the mechanism in Linux 4.18 and confirm its effectiveness of the connection, and then hijack the connections [8],
through real evaluation. [9]. The side channel vulnerability has been eliminated
(2) Enhancing IPID Assignment for RST Packets: Another by setting a random challenge ACK count limit. A timing
countermeasure is to change the IPID assignment of RST side channel has been uncovered in the half-duplex IEEE
packets. Since Linux kernel version 4.18, Linux directly sets 802.11 or Wi-Fi technology, which can be exploited by an
the IPID of RST packets to 0. When an attacker learn the off-path attacker to inject data into a TCP connection and force
presence of a TCP connection between the server and the the browser to cache malicious objects [10]. By exploiting
identified victim client, the attacker can forge SYN/ACK the global IPID counter which was adopted by the previous
packets. If there is no connection initiated from the specified Linux and Windows systems, Gilad et al. inferred if two
source port, the server responds with a RST packet, otherwise, hosts have established a TCP connection identified by a
with a challenge ACK packet. The IPID of the RST packet is 0, specific four-tuple and then launch off-path TCP injection
and hence it will not cause an increment to the shared IPID attacks [7], [42]–[44].
counter. It will be different from the behavior of the challenge Besides, unprivileged applications (called puppets) con-
ACK packet, which enables an indicator for the attacker to trolled by attackers running on victim hosts can also be
judge the existence of the connection. leveraged to perform off-path TCP attacks [12], [13], [45].
Thus, we propose to modify the IPID assignment for RST Qian et al. uncovered that the middlebox of firewall can
packets. Note we cannot assign IPID for RST packets based be abused to perform the TCP sequence number inference
on a socket preserved counter, since the RST packets may attack [13], and conducted a collaborative TCP sequence
be generated and issued independently of a TCP connection. number inference attack by exploiting the packet counter
Also, we cannot assign IPID for RST packets based on hash side channels [12]. Gilad et al. identified that attackers can
IPID counters, since this assignment is vulnerable to previ- conduct web cache poisoning attacks by leveraging a restricted
ous TCP/IP connections detecting attacks [21]. An empirical script in the user’s browser sandbox [45]. Compared with
method is to assign IPID for RST packets based on the these attacks, our off-path TCP attack does not need any assis-
destination of the packet. If there is a TCP connection to tance of puppets. Moreover, our attack leverages a new side
the destination (the victim client in our scenario) and the channel vulnerability appearing in the interactions among IP,
counter preserved in the socket will be selected, it can avoid ICMP, and TCP, which cannot be unearthed by the principled
the differences on the counter. methods [11].
FENG et al.: OFF-PATH TCP HIJACKING ATTACKS VIA SIDE CHANNEL OF DOWNGRADED IPID 421
TCP DoS Attacks: TCP SYN flooding is a major threat [12] Z. Qian, Z. M. Mao, and Y. Xie, “Collaborative TCP sequence number
that is difficult to be identified due to the similarity to inference attack: how to crack sequence number under a second,” in
Proc. ACM Conf. Comput. Commun. Secur., 2012, pp. 593–604.
the legitimate establishment of TCP connections [46]–[49]. [13] Z. Qian and Z. M. Mao, “Off-path TCP sequence number inference
Besides, more sophisticated and stealth DoS attacks have also attack-how firewall middleboxes reduce security,” in Proc. IEEE Symp.
been proposed to cause resource decreases or exhaustion of the Secur. Privacy, May 2012, pp. 347–361.
target TCP connections, such as low-rate TCP-targeted DoS [14] J. Postel, Internet Protocol, Internet Requests for Comments, Internet
Engineering Task Force, document RFC 791, Sep. 1981. [Online].
attacks [50]–[53], congesting intermediate links attacks [54], Available: http://www.rfc-editor.org/rfc/rfc791.txt
[55] and pulsing DoS attacks that manipulate the victim’s TCP [15] J. Touch, Updated Specification of the IPv4 ID Field, Internet Requests
congestion window to decrease the performance [56]. for Comments, Internet Engineering Task Force, document RFC 6864,
Feb. 2013. [Online]. Available: http://www.rfc-editor.org/rfc/rfc6864.txt
[16] R. Ensafi, J. C. Park, D. Kapur, and J. R. Crandall, “Idle port scanning
X. C ONCLUSION and non-interference analysis of network protocol stacks using model
checking,” in Proc. USENIX Secur. Symp., 2010, pp. 257–272.
In this paper, we uncover a new off-path TCP hijacking [17] R. Ensafi, J. Knockel, G. Alexander, and J. R. Crandall, “Detecting
attack that leverages a subtle side channel in the new mixed intentional packet drops on the Internet via TCP/IP side channels,” in
Proc. Int. Conf. Passive Active Netw. Meas. Berlin, Germany: Springer,
IPID assignment method of Linux kernel version 4.18 and 2014, pp. 109–118.
beyond. We find that a pure off-path attacker can downgrade [18] E. Dumazet. (2014). Inetpeer: Get RID of IP_ID_Count. [Online].
the IPID assignment for TCP packets from the more secure Available: https://lore.kernel.org/patchwork/patch/490770/
per-socket-based policy to hash-based policy, thus building a [19] J. Knockel and J. R. Crandall, “Counting packets sent between arbitrary
internet hosts,” in Proc. 4th USENIX Workshop Free Open Commun.
shared IPID counter that can be exploited to infer the state Internet (FOCI), 2014, pp. 1–14.
of a victim TCP connection. We evaluate the impacts of our [20] Bootlin. (2020). IPID Assignment in Linux Kernel. [Online]. Available:
attack on the Internet and implement the exploit under different https://elixir.bootlin.com/linux/latest/source/include/net/ip.h
[21] G. Alexander, A. M. Espinoza, and J. R. Crandall, “Detecting TCP/IP
scenarios. Our experiments show that off-path attackers can connections via IPID hash collisions,” Proc. Privacy Enhancing Tech-
perform various attacks by exploiting the newly discovered nol., vol. 2019, no. 4, pp. 311–328, Oct. 2019.
IPID side channel, e.g., resetting SSH connections, manipu- [22] X. Zhang, J. Knockel, and J. R. Crandall, “ONIS: Inferring TCP/IP-
lating web traffic and poisoning BGP routing tables. We also based trust relationships completely off-path,” in Proc. IEEE Conf.
Comput. Commun. (INFOCOM), Apr. 2018, pp. 2069–2077.
propose to eliminate the root cause of the exploit via repairing [23] J. Mogul and S. Deering, Path MTU Discovery, Internet Requests
the IPID assignment. We implement our countermeasure and for Comments, Internet Engineering Task Force, document RFC 1191,
confirm its effectiveness in practice. Nov. 1990. [Online]. Available: http://www.rfc-editor.org/rfc/rfc1191.txt
[24] J. McCann, S. Deering, and J. Mogul, Path MTU Discovery for
IP Version 6, Internet Requests for Comments, Internet Engineering
R EFERENCES Task Force, document RFC 1981, Aug. 1996. [Online]. Available:
http://www.rfc-editor.org/rfc/rfc1981.txt
[1] J. Postel, Transmission Control Protocol, Internet Requests for Com- [25] J. Postel, Internet Control Message Protocol, Internet Requests for Com-
ments, Internet Engineering Task Force, document RFC 793, Sep. 1981. ments, Internet Engineering Task Force, document RFC 792, Sep. 1981.
[Online]. Available: http://www.rfc-editor.org/rfc/rfc793.txt [Online]. Available: http://www.rfc-editor.org/rfc/rfc792.txt
[2] M. Duke, R. Braden, W. Eddy, E. Blanton, and A. Zimmermann, [26] P. Pearce, R. Ensafi, F. Li, N. Feamster, and V. Paxson, “Augur: Internet-
A Roadmap for Transmission Control Protocol (TCP) Specification wide detection of connectivity disruptions,” in Proc. IEEE Symp. Secur.
Documents, Internet Requests for Comments, Internet Engineering Privacy (SP), May 2017, pp. 427–443.
Task Force, document RFC 7414, Feb. 2015. [Online]. Available: [27] P. Pearce, R. Ensafi, F. Li, N. Feamster, and V. Paxson, “Toward
http://www.rfc-editor.org/rfc/rfc7414.txt continual measurement of global network-level censorship,” IEEE Secur.
[3] J. Touch, Defending TCP Against Spoofing Attacks, Internet Requests Privacy, vol. 16, no. 1, pp. 24–33, Jan. 2018.
for Comments, Internet Engineering Task Force, document RFC 4953, [28] M. Luckie, R. Beverly, R. Koga, K. Keys, J. A. Kroll, and K. claffy,
Jul. 2007. [Online]. Available: http://www.rfc-editor.org/rfc/rfc4953.txt “Network hygiene, incentives, and regulation: Deployment of source
[4] F. Gont and S. Bellovin, Defending Against Sequence Number Attacks, address validation in the internet,” in Proc. ACM SIGSAC Conf. Comput.
Internet Requests for Comments, Internet Engineering Task Force, Commun. Secur., 2019, pp. 465–480.
document RFC 6528, Feb. 2012. [Online]. Available: http://www.rfc- [29] B. Wu et al., “Enabling efficient source and path verification via
editor.org/rfc/rfc6528.txt probabilistic packet marking,” in Proc. IEEE/ACM 26th Int. Symp. Qual.
[5] M. Larsen and F. Gont, Recommendations for Transport-Protocol Port Service (IWQoS), Jun. 2018, pp. 1–10.
Randomization, Internet Requests for Comments, Internet Engineer- [30] F. Baker, Requirements for IP Version 4 Routers, Internet Requests
ing Task Force, document RFC 6056, Jan. 2011. [Online]. Available: for Comments, Internet Engineering Task Force, document RFC 1812,
http://www.rfc-editor.org/rfc/rfc6056.txt Jun. 1995. [Online]. Available: http://www.rfc-editor.org/rfc/rfc1812.txt
[6] A. Ramaiah, R. Stewart, and M. Dalal, Improving TCP’s Robustness [31] D. Farinacci, T. Li, S. Hanks, D. Meyer, and P. Traina, Generic
to Blind In-Window Attacks, Internet Requests for Comments, Internet Routing Encapsulation (GRE), Internet Requests for Comments, Internet
Engineering Task Force, document RFC 5961, Aug. 2010. [Online]. Engineering Task Force, document RFC 2784, Mar. 2000. [Online].
Available: http://www.rfc-editor.org/rfc/rfc5961.txt Available: http://www.rfc-editor.org/rfc/rfc2784.txt
[7] Y. Gilad and A. Herzberg, “Off-path TCP injection attacks,” ACM Trans. [32] D. Borman, B. Braden, and V. Jacobson, TCP Extensions for High
Inf. Syst. Secur., vol. 16, no. 4, p. 13, 2014. Performance, Internet Requests for Comments, Internet Engineering
[8] Y. Cao, Z. Qian, Z. Wang, T. Dao, S. V. Krishnamurthy, and Task Force, document RFC 7323, Sep. 2014. [Online]. Available:
L. M. Marvel, “Off-path TCP exploits of the challenge ACK global rate http://www.rfc-editor.org/rfc/rfc7323.txt
limit,” IEEE/ACM Trans. Netw., vol. 26, no. 2, pp. 765–778, Apr. 2018. [33] R. S. Raman, A. Stoll, J. Dalek, R. Ramesh, W. Scott, and
[9] Y. Cao et al., “Off-path TCP exploits: Global rate limit considered R. Ensafi, “Measuring the deployment of network censorship filters at
dangerous,” in Proc. 25th USENIX Secur. Symp. (USENIX Secur.), 2016, global scale,” in Proc. Netw. Distrib. Syst. Secur. Symp. (NDSS), 2020,
pp. 209–225. pp. 1–16.
[10] W. Chen and Z. Qian, “Off-path TCP exploit: How wireless routers can [34] V. Le Pochat, T. Van Goethem, S. Tajalizadehkhoob, M. Korczynski,
jeopardize your secrets,” in Proc. 27th USENIX Secur. Symp. (USENIX and W. Joosen, “Tranco: A research-oriented top sites ranking hard-
Secur.), 2018, pp. 1581–1598. ened against manipulation,” in Proc. Netw. Distrib. Syst. Secur. Symp.,
[11] Y. Cao, Z. Wang, Z. Qian, C. Song, S. V. Krishnamurthy, and P. Yu, San Diego, CA, USA, 2019, pp. 1–15.
“Principled unearthing of TCP side channel vulnerabilities,” in Proc. [35] Rocket.Chat. (2020). Web Application. [Online]. Available: https://
ACM SIGSAC Conf. Comput. Commun. Secur., Nov. 2019, pp. 211–224. rocket.chat/
422 IEEE/ACM TRANSACTIONS ON NETWORKING, VOL. 30, NO. 1, FEBRUARY 2022
[36] Y. Gilad, A. Cohen, A. Herzberg, M. Schapira, and H. Shulman, “Are we [54] J. M. Smith and M. Schuchard, “Routing around congestion: Defeating
there yet? On RPKI’s deployment and security,” in Proc. NDSS, 2017, DDoS attacks and adverse network conditions via reactive BGP routing,”
pp. 1–15. in Proc. IEEE Symp. Secur. Privacy (SP), May 2018, pp. 599–617.
[37] K. Ishiguro. (2020). Quagga Routing Suite. [Online]. Available: [55] M. Tran, M. S. Kang, H.-C. Hsiao, W.-H. Chiang, S.-P. Tung, and
https://www.quagga.net/ Y.-S. Wang, “On the feasibility of rerouting-based DDoS defenses,” in
[38] X. Feng, C. Fu, Q. Li, K. Sun, and K. Xu, “Off-path TCP exploits Proc. IEEE Symp. Secur. Privacy (SP), May 2019, pp. 798–813.
of the mixed IPID assignment,” in Proc. ACM SIGSAC Conf. Comput. [56] X. Luo et al., “On a new class of pulsing denial-of-service attacks and
Commun. Secur., Oct. 2020, pp. 1323–1335. the defense,” in Proc. NDSS, 2005, pp. 1–19.
[39] A. Conta, S. Deering, and M. Gupta, Internet Control Message Protocol
(ICMPv6) for the Internet Protocol Version 6 (IPv6) Specification,
Internet Requests for Comments, Internet Engineering Task Force,
document RFC 4443, Mar. 2006. [Online]. Available: http://www.rfc- Xuewei Feng received the B.E. degree from the Department of Computer
editor.org/rfc/rfc4443.txt Science and Technology, Xi’an Jiaotong University. He is currently pursuing
[40] P. Srisuresh and M. Holdrege, IP Network Address Translator (NAT) the Ph.D. degree with Tsinghua University. His research interests include
Terminology and Considerations, Internet Requests for Comments, Inter- network security and software vulnerability detection.
net Engineering Task Force, document RFC 2663, Aug. 1999. [Online].
Available: http://www.rfc-editor.org/rfc/rfc2663.txt
[41] LKM. (2007). Blind TCP/IP Hijacking is Still Alive. [Online]. Available:
http://phrack.org/issues/64/13.html Qi Li (Senior Member, IEEE) received the Ph.D. degree from Tsinghua
[42] Y. Gilad and A. Herzberg, “Spying in the dark: TCP and Tor traffic University. He has worked with ETH Zurich and The University of Texas
analysis,” in Proc. Int. Symp. Privacy Enhancing Technol. Symp. Berlin, at San Antonio. He is currently an Associate Professor with the Institute
Germany: Springer, 2012, pp. 100–119. for Network Sciences and Cyberspace, Tsinghua University. His research
[43] Y. Gilad, A. Herzberg, and H. Shulman, “Off-path hacking: The illusion interests include network and system security, particularly in internet and
of challenge-response authentication,” IEEE Secur. Privacy, vol. 12, cloud security, mobile security, and big data security. He is an Editorial
no. 5, pp. 68–77, Sep. 2014. Board Member of the IEEE T RANSACTIONS ON D EPENDABLE AND S ECURE
[44] Y. Gilad and A. Herzberg, “Off-path attacking the web,” in Proc. WOOT, C OMPUTING and ACM DTRAP.
2012, pp. 41–52.
[45] Y. Gilad and A. Herzberg, “When tolerance causes weakness: The case
of injection-friendly browsers,” in Proc. 22nd Int. Conf. World Wide
Web, 2013, pp. 435–446. Kun Sun (Member, IEEE) received the Ph.D. degree in computer science
[46] W. Eddy, TCP SYN Flooding Attacks and Common Mitigations, Inter- from North Carolina State University. He has more than 15 years of working
net Requests for Comments, Internet Engineering Task Force, doc- experience in both industry and academia. He serves as the Director for
ument RFC 4987, Aug. 2007. [Online]. Available: http://www.rfc- the Sun Security Laboratory (SunLab) and the Associate Director for the
editor.org/rfc/rfc4987.txt Center for Secure Information Systems (CSIS). He has published more than
[47] R. Bani-Hani and Z. Al-Ali, “SYN flooding attacks and counter- 100 peer-reviewed conference papers and journal articles. His research focuses
measures: A survey,” in Proc. Int. Conf. Inf. Commun. Syst., 2013, on systems and network security.
pp. 149–155.
[48] H. Wang, D. Zhang, and K. G. Shin, “Detecting SYN flooding attacks,”
in Proc. 21st Annu. Joint Conf. IEEE Comput. Commun. Societies, vol. 3,
Jun. 2002, pp. 1530–1539. Chuanpu Fu received the B.E. degree from the Department of Networking
[49] A. Aborujilah, M. N. Ismail, and S. Musa, “Detecting TCP SYN based Engineering, Dalian University of Technology, in 2020. He is currently
flooding attacks by analyzing CPU and network resources performance,” pursuing the Ph.D. degree with Tsinghua University. His research interests
in Proc. 3rd Int. Conf. Adv. Comput. Sci. Appl. Technol., Dec. 2014, include machine learning for security, and network and system security.
pp. 157–161.
[50] A. Kuzmanovic and E. W. Knightly, “Low-rate TCP-targeted denial of
service attacks: The shrew vs. the mice and elephants,” in Proc. Conf.
Appl., Technol., Archit., Protocols Comput. Commun., 2003, pp. 75–86. Ke Xu (Senior Member, IEEE) received the Ph.D. degree from the Department
[51] A. Shevtekar, K. Anantharam, and N. Ansari, “Low rate TCP denial-of- of Computer Science and Technology, Tsinghua University, Beijing, China.
service attack detection at edge routers,” IEEE Commun. Lett., vol. 9, He serves as a Full Professor for the Department of Computer Science and
no. 4, pp. 363–365, Apr. 2005. Technology, Tsinghua University. He has published more than 200 technical
[52] A. Herzberg and H. Shulman, “Stealth DoS attacks on secure channels,” papers and holds 11 U.S. patents in the research areas of next-generation
in Proc. NDSS, 2010, pp. 1–19. internet, blockchain systems, the Internet of Things, and network security.
[53] S. Jero, M. E. Hoque, D. R. Choffnes, A. Mislove, and C. Nita-Rotaru, He is a member of ACM. He served as the Steering Committee Chair for
“Automated attack discovery in TCP congestion control using a model- IEEE/ACM IWQoS and has guest-edited several special issues in IEEE and
guided approach,” in Proc. NDSS, 2018, pp. 1–15. Springer journals. He is an Editor of IEEE I NTERNET OF T HINGS J OURNAL.