draft-ietf-tcpm-tcpsecure-07.txt   draft-ietf-tcpm-tcpsecure-08.txt 
TCP Maintenance and Minor A. Ramaiah TCP Maintenance and Minor A. Ramaiah
Extensions Working Group R. Stewart Extensions Working Group R. Stewart
Internet-Draft M. Dalal Internet-Draft M. Dalal
Intended status: Standards Track Editor Intended status: Standards Track Cisco Systems
Expires: August 26, 2007 February 22, 2007 Expires: January 9, 2008 July 8, 2007
Improving TCP's Robustness to Blind In-Window Attacks Improving TCP's Robustness to Blind In-Window Attacks
draft-ietf-tcpm-tcpsecure-07.txt draft-ietf-tcpm-tcpsecure-08.txt
Status of this Memo Status of this Memo
By submitting this Internet-Draft, each author represents that any By submitting this Internet-Draft, each author represents that any
applicable patent or other IPR claims of which he or she is aware applicable patent or other IPR claims of which he or she is aware
have been or will be disclosed, and any of which he or she becomes have been or will be disclosed, and any of which he or she becomes
aware will be disclosed, in accordance with Section 6 of BCP 79. aware will be disclosed, in accordance with Section 6 of BCP 79.
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF), its areas, and its working groups. Note that Task Force (IETF), its areas, and its working groups. Note that
skipping to change at page 1, line 35 skipping to change at page 1, line 35
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
The list of current Internet-Drafts can be accessed at The list of current Internet-Drafts can be accessed at
http://www.ietf.org/ietf/1id-abstracts.txt. http://www.ietf.org/ietf/1id-abstracts.txt.
The list of Internet-Draft Shadow Directories can be accessed at The list of Internet-Draft Shadow Directories can be accessed at
http://www.ietf.org/shadow.html. http://www.ietf.org/shadow.html.
This Internet-Draft will expire on August 26, 2007. This Internet-Draft will expire on January 9, 2008.
Copyright Notice Copyright Notice
Copyright (C) The IETF Trust (2007). Copyright (C) The IETF Trust (2007).
Abstract Abstract
TCP has historically been considered protected against spoofed packet TCP has historically been considered protected against spoofed off-
injection attacks by relying on the fact that it is difficult to path packet injection attacks by relying on the fact that it is
guess the 4-tuple (the source and destination IP addresses and the difficult to guess the 4-tuple (the source and destination IP
source and destination ports) in combination with the 32 bit sequence addresses and the source and destination ports) in combination with
number(s). A combination of increasing window sizes and applications the 32 bit sequence number(s). A combination of increasing window
using a longer term connections (e.g. H-323 or Border Gateway sizes and applications using longer term connections (e.g. H-323 or
Protocol [RFC4271]) have left modern TCP implementation more Border Gateway Protocol [RFC4271]) have left modern TCP
vulnerable to these types of spoofed packet injection attacks. implementations more vulnerable to these types of spoofed packet
injection attacks.
Many of these long term TCP applications tend to have predictable IP Many of these long term TCP applications tend to have predictable IP
addresses and ports which makes it far easier for the 4-tuple to be addresses and ports which makes it far easier for the 4-tuple to be
guessed. Having guessed the 4-tuple correctly, an attacker can guessed. Having guessed the 4-tuple correctly, an attacker can
inject a RST, SYN or DATA segment into a TCP connection by carefully inject a RST, SYN or DATA segment into a TCP connection by
crafting the sequence number of the spoofed segment to be in the systematically guessing the sequence number of the spoofed segment to
current receive window. This can cause the connection to either be in the current receive window. This can cause the connection to
abort or possibly cause data corruption. This document specifies either abort or possibly cause data corruption. This document
small modifications to the way TCP handles inbound segments that can specifies small modifications to the way TCP handles inbound segments
reduce the chances of a successful attack. that can reduce the chances of a successful attack.
Table of Contents Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 4 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.1. Basic Attack Methodology . . . . . . . . . . . . . . . . . 4 1.1. Basic Attack Methodology . . . . . . . . . . . . . . . . . 4
1.2. Attack probabilities . . . . . . . . . . . . . . . . . . . 6 1.2. Attack probabilities . . . . . . . . . . . . . . . . . . . 6
2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 8 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 8
3. Blind reset attack using the RST bit . . . . . . . . . . . . . 9 3. Blind reset attack using the RST bit . . . . . . . . . . . . . 9
3.1. Description of the attack . . . . . . . . . . . . . . . . 9 3.1. Description of the attack . . . . . . . . . . . . . . . . 9
3.2. Mitigation . . . . . . . . . . . . . . . . . . . . . . . . 9 3.2. Mitigation . . . . . . . . . . . . . . . . . . . . . . . . 9
skipping to change at page 4, line 10 skipping to change at page 4, line 10
13.1. Normative References . . . . . . . . . . . . . . . . . . . 23 13.1. Normative References . . . . . . . . . . . . . . . . . . . 23
13.2. Informative References . . . . . . . . . . . . . . . . . . 23 13.2. Informative References . . . . . . . . . . . . . . . . . . 23
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 25 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 25
Intellectual Property and Copyright Statements . . . . . . . . . . 26 Intellectual Property and Copyright Statements . . . . . . . . . . 26
1. Introduction 1. Introduction
TCP [RFC0793] is widely deployed and the most common reliable end to TCP [RFC0793] is widely deployed and the most common reliable end to
end transport protocol used for data communication in today's end transport protocol used for data communication in today's
Internet. Yet when it was standardized over 20 years ago, the Internet. Yet when it was standardized over 20 years ago, the
Internet, as we know it, was a different place, lacking many of the Internet, was a different place, lacking many of the threats that are
threats that are now common. TCP spoofing attacks are one such now common. The TCP spoofing attacks, which are seen in the Internet
attack that are seen on the Internet today. today, fall into this category.
In a TCP spoofing attack, an off-path attacker crafts TCP packets by In a TCP spoofing attack, an off-path attacker crafts TCP packets by
forging the IP source and destination addresses as well as the source forging the IP source and destination addresses as well as the source
and destination ports (commonly referred to as a 4-tuple value). The and destination ports (commonly referred to as a 4-tuple value). The
targeted TCP endpoint will then associate such a packet with an targeted TCP endpoint will then associate such a packet with an
existing TCP connection. Note that in and of itself guessing this existing TCP connection. It needs to be noted that, guessing this
4-tuple value is not always easy for an attacker. But there are some 4-tuple value is not always easy for an attacker. But there are some
applications (e.g. BGP [RFC4271]) that may have a tendency to use applications (e.g. BGP [RFC4271]) that have a tendency to use the
the same set(s) of ports on either endpoint making the odds of same set(s) of ports on either endpoint making the odds of guessing
guessing correctly the 4-tuple value much easier. When an attacker correctly the 4-tuple value much easier. When an attacker is
is successful in guessing the 4-tuple value, one of three types of successful in guessing the 4-tuple value, one of three types of
injection attacks may be waged against a long-lived connection. injection attacks may be waged against a long-lived connection.
RST - Where an attacker injects a RST segment hoping to cause the RST - Where an attacker injects a RST segment hoping to cause the
connection to be torn down. connection to be torn down.
SYN - Where an attacker injects a SYN hoping to cause the receiver SYN - Where an attacker injects a SYN hoping to cause the receiver
to believe the peer has restarted and so tear down the connection to believe the peer has restarted and so tear down the connection
state. state.
DATA - Where an attacker tries to inject a DATA segment to corrupt DATA - Where an attacker tries to inject a DATA segment to corrupt
the contents of the transmission. the contents of the transmission.
The mitigations described in this document SHOULD be implemented by
TCP stacks. Those mitigations have required and optional aspects
that are further described below.
1.1. Basic Attack Methodology 1.1. Basic Attack Methodology
Focusing upon the RESET attack, we examine this attack in more detail Focusing upon the RST attack, we examine this attack in more detail
to get an overview as to how it works and how this document addresses to get an overview as to how it works and how this document addresses
the issue. For this attack the goal is for the attacker to cause one the issue. For this attack the goal is for the attacker to cause one
of the two endpoints of the connection to incorrectly tear down the of the two endpoints of the connection to incorrectly tear down the
connection state, effectively aborting the connection. One of the connection state, effectively aborting the connection. One of the
important things to note is that, for the attack to succeed the RST important things to note is that, for the attack to succeed the RST
needs to be in the valid receive window. It also needs to be needs to be in the valid receive window. It also needs to be
emphasised that the receive window is independent of the current emphasized that the receive window is independent of the current
congestion window of the TCP connection. The attacker would try to congestion window of the TCP connection. The attacker would try to
forge many RST segments to try to cover the space of possible windows forge many RST segments to try to cover the space of possible windows
by putting out a packet in each potential window. To do this the by putting out a packet in each potential window. To do this the
attacker needs to have or guess several pieces of information namely: attacker needs to have or guess several pieces of information namely:
1) The 4-tuple value containing the IP address and TCP port number of 1) The 4-tuple value containing the IP address and TCP port number of
both ends of the connection. For one side (usually the server) both ends of the connection. For one side (usually the server)
guessing the port number is a trivial exercise. The client side guessing the port number is a trivial exercise. The client side
may or may not be easy for an attacker to guess depending on a may or may not be easy for an attacker to guess depending on a
number of factors, most notably the operating system and number of factors, most notably the operating system and
skipping to change at page 5, line 21 skipping to change at page 5, line 22
2) A sequence number that will be used in the RST. This sequence 2) A sequence number that will be used in the RST. This sequence
number will be a starting point for a series of guesses to attempt number will be a starting point for a series of guesses to attempt
to present a RST segment to a connection endpoint that would be to present a RST segment to a connection endpoint that would be
acceptable to it. Any random value may be used to guess the acceptable to it. Any random value may be used to guess the
initial sequence number. initial sequence number.
3) The window size that the two endpoints are using. This value does 3) The window size that the two endpoints are using. This value does
NOT have to be the exact window size since a smaller value used in NOT have to be the exact window size since a smaller value used in
lieu of the correct one will just cause the attacker to generate lieu of the correct one will just cause the attacker to generate
more segments before succeeding in his mischieve. Most modern more segments before succeeding in his mischief. Most modern
operating systems have a default window size which usually is operating systems have a default window size which usually is
applied to most connections. Some applications however may change applied to most connections. Some applications however may change
the window size to better suit the needs of the application. So the window size to better suit the needs of the application. So
often times the attacker, with a fair degree of certainty (knowing often times the attacker, with a fair degree of certainty (knowing
the application that is under attack), can come up with a very the application that is under attack), can come up with a very
close approximation as to the actual window size in use on the close approximation as to the actual window size in use on the
connection. connection.
After assembling the above set of information the attacker begins After assembling the above set of information the attacker begins
sending spoofed TCP segments with the RST bit set and a guessed TCP sending spoofed TCP segments with the RST bit set and a guessed TCP
skipping to change at page 6, line 13 skipping to change at page 6, line 13
DATA). DATA).
1.2. Attack probabilities 1.2. Attack probabilities
Every application has control of a number of factors that effect Every application has control of a number of factors that effect
drastically the probability of a successful spoofing attack. These drastically the probability of a successful spoofing attack. These
factors include such things as: factors include such things as:
Window Size - Normally settable by the application but often times Window Size - Normally settable by the application but often times
defaulting to 32,768 or 65,535 depending upon the operating system defaulting to 32,768 or 65,535 depending upon the operating system
(Medina05 [Medina05]). ([Medina05]).
Server Port number - This value is normally a fixed value so that a Server Port number - This value is normally a fixed value so that a
client will know where to connect to the peer at. Thus this value client will know where to connect to the peer at. Thus this value
normally provides no additional protection. normally provides no additional protection.
Client Port number - This value may be a random ephemeral value, if Client Port number - This value may be a random ephemeral value, if
so, this makes a spoofing attack more difficult. There are some so, this makes a spoofing attack more difficult. There are some
clients, however, that for whatever reason either pick a fixed clients, however, that for whatever reason either pick a fixed
client port or have a very guessable one (due to the range of client port or have a very guessable one (due to the range of
ephemeral ports available with their operating system or other ephemeral ports available with their operating system or other
skipping to change at page 6, line 42 skipping to change at page 6, line 42
provide us with some amount of randomness (depending on the operating provide us with some amount of randomness (depending on the operating
system). system).
To successfully inject a spoofed packet (RST, SYN or DATA), in the To successfully inject a spoofed packet (RST, SYN or DATA), in the
past, the entire sequence space (i.e. 2^32) was often considered past, the entire sequence space (i.e. 2^32) was often considered
available to make such an attack unlikely. [SITW] demonstrated that available to make such an attack unlikely. [SITW] demonstrated that
this assumption was incorrect and that instead of [1/2 * 2^32] this assumption was incorrect and that instead of [1/2 * 2^32]
packets (assuming a random distribution) [1/2 * (2^32/window)] packets (assuming a random distribution) [1/2 * (2^32/window)]
packets is required. packets is required.
Placing real numbers on this formula we see that for a window size of Substituting numbers into this formula we see that for a window size
32,768, an average of 65,536 packets would need to be transmitted in of 32,768, an average of 65,536 packets would need to be transmitted
order to "spoof" a TCP segment that would be acceptable to a TCP in order to "spoof" a TCP segment that would be acceptable to a TCP
receiver. A window size of 65,535 reduces this even further to receiver. A window size of 65,535 reduces this even further to
32,768 packets. With rises in bandwidth to both the home and office, 32,768 packets. At today's access bandwidths an attack of that size
it can only be expected that the values for default window sizes will is feasible.
continue to rise in order to better take advantage of the newly
available bandwidth. It also needs to be noted that this attack can With rises in bandwidth to both the home and office, it can only be
be performed in a distributed fashion in order potentially gain expected that the values for default window sizes will continue to
access to more bandwidth. rise in order to better take advantage of the newly available
bandwidth. It also needs to be noted that this attack can be
performed in a distributed fashion in order potentially gain access
to more bandwidth.
As we can see from the above discussion this weakness lowers the bar As we can see from the above discussion this weakness lowers the bar
quite considerably for likely attacks. But there is one additional quite considerably for likely attacks. But there is one additional
dependency which is the duration of the TCP connection. A TCP dependency which is the duration of the TCP connection. A TCP
connection that lasts only a few brief packets, as often is the case connection that lasts only a few brief packets, as often is the case
for web traffic, would not be subject to such an attack since the for web traffic, would not be subject to such an attack since the
connection may not be established long enough for an attacker to connection may not be established long enough for an attacker to
generate enough traffic. However there is a set of applications such generate enough traffic. However there is a set of applications such
as BGP [RFC4271] which is judged to be potentially most affected by as BGP [RFC4271] which is judged to be potentially most affected by
this vulnerability. BGP relies on a persistent TCP session between this vulnerability. BGP relies on a persistent TCP session between
BGP peers. Resetting the connection can result in medium term BGP peers. Resetting the connection can result in medium term
unavailability due to the need to rebuild routing tables and route unavailability due to the need to rebuild routing tables and route
flapping; see [NISCC] for further details. flapping; see [NISCC] for further details.
It also needs to be emphasized that, for applications like BGP, use For applications that can use the TCP MD5 option [RFC2385], such as
of the TCP MD5 option [RFC2385], can make the attacks described in BGP, that option makes the attacks described in this specification
this specification effectively impossible. effectively impossible. However, some applications or
implementations may find that option expensive to implement.
It should be noted that there are existing alternative protections There are alternative protections against the threats that this
against the threats that this document addresses. For further document addresses. For further details regarding the attacks and
details regarding the attacks and the existing techniques, please the existing techniques, please refer to draft
refer to draft [I-D.ietf-tcpm-tcp-antispoof] [I-D.ietf-tcpm-tcp-antispoof]
2. Terminology 2. Terminology
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in [RFC2119]. TCP document are to be interpreted as described in [RFC2119]. TCP
terminology should be interpreted as described in [RFC0793]. terminology should be interpreted as described in [RFC0793].
3. Blind reset attack using the RST bit 3. Blind reset attack using the RST bit
skipping to change at page 10, line 5 skipping to change at page 10, line 5
next expected sequence number (RCV.NXT), then TCP MUST reset the next expected sequence number (RCV.NXT), then TCP MUST reset the
connection. connection.
C) If the RST bit is set and the sequence number does not exactly C) If the RST bit is set and the sequence number does not exactly
match the next expected sequence value, yet is within the current match the next expected sequence value, yet is within the current
receive window (RCV.NXT < SEG.SEQ < RCV.NXT+RCV.WND), TCP MUST receive window (RCV.NXT < SEG.SEQ < RCV.NXT+RCV.WND), TCP MUST
send an acknowledgment (challenge ACK): send an acknowledgment (challenge ACK):
<SEQ=SND.NXT><ACK=RCV.NXT><CTL=ACK> <SEQ=SND.NXT><ACK=RCV.NXT><CTL=ACK>
After sending the challenge ACK, TCP MUST drop the unacceptable After sending the challenge ACK, TCP MUST drop the unacceptable
segment and stop processing the incoming packet further. segment and stop processing the incoming packet further. Further
segments destined to this connection will be processed as normal.
The previous text, quoted from [RFC0793] pg 37 would thus become: The previous text, quoted from [RFC0793] pg 37 would thus become:
In all states except SYN-SENT, all reset (RST) segments are In all states except SYN-SENT, all reset (RST) segments are validated
validated by checking their SEQ-fields [sequence numbers]. A by checking their SEQ-fields [sequence numbers]. A reset is valid if
reset is valid if its sequence number exactly matches the next its sequence number exactly matches the next expected sequence
expected sequence number. If the RST arrives and its sequence number. If the RST arrives and its sequence number field does NOT
number field does NOT match the next expected sequence number but match the next expected sequence number but is within the window,
is within the window, then the receiver should generate an ACK. then the receiver should generate an ACK. In all other cases where
In all other cases where the SEQ-field does not match and is the SEQ-field does not match and is outside the window, the receiver
outside the window, the receiver MUST silently discard the MUST silently discard the segment.
segment.
In the SYN-SENT state (a RST received in response to an initial In the SYN-SENT state (a RST received in response to an initial SYN),
SYN), the RST is acceptable if the ACK field acknowledges the SYN. the RST is acceptable if the ACK field acknowledges the SYN. In all
In all other cases the receiver MUST silently discard the segment. other cases the receiver MUST silently discard the segment.
With the above slight change to the TCP state machine, it becomes With the above slight change to the TCP state machine, it becomes
much harder for an attacker to generate an acceptable reset much harder for an attacker to generate an acceptable reset segment.
segment.
In cases where the remote peer did generate a RST but it fails to In cases where the remote peer did generate a RST but it fails to
meet the above criteria (the RST sequence number was within the meet the above criteria (the RST sequence number was within the
window but NOT the exact expected sequence number) when the window but NOT the exact expected sequence number) when the challenge
challenge ACK is sent back, it will no longer have the ACK is sent back, it will no longer have the transmission control
transmission control block (TCB) related to this connection and block (TCB) related to this connection and hence as per [RFC0793],
hence as per [RFC0793], the remote peer will send a second RST the remote peer will send a second RST back. The sequence number of
back. The sequence number of the second RST is derived from the the second RST is derived from the acknowledgment number of the
acknowledgment number of the incoming ACK. This second RST, if it incoming ACK. This second RST, if it reaches the sender, will cause
reaches the sender, will cause the connection to be aborted since the connection to be aborted since the sequence number would now be
the sequence number would now be an exact match. an exact match.
A valid RST received out-of-order would still generate a challenge
ACK in response. If this RST happens to be a genuine one, the other
end would send an RST with an exact sequence number match which would
cause the connection to be dropped.
Note that the above mitigation may cause a non-amplification ACK Note that the above mitigation may cause a non-amplification ACK
exchange. This concern is discussed in Section 9. exchange. This concern is discussed in Section 9.
4. Blind reset attack using the SYN bit 4. Blind reset attack using the SYN bit
4.1. Description of the attack 4.1. Description of the attack
The analysis of the reset attack using the RST bit highlights another The analysis of the reset attack using the RST bit highlights another
possible avenue for a blind attacker using a similar set of sequence possible avenue for a blind attacker using a similar set of sequence
skipping to change at page 12, line 14 skipping to change at page 12, line 14
will not affect the established connection. will not affect the established connection.
Note that this mitigation does leave one corner case un-handled which Note that this mitigation does leave one corner case un-handled which
will prevent the reset of a connection when it should be reset (i.e. will prevent the reset of a connection when it should be reset (i.e.
it is a non-spoofed SYN wherein a peer really did restart). This it is a non-spoofed SYN wherein a peer really did restart). This
problem occurs when the restarting host chooses the exact same IP problem occurs when the restarting host chooses the exact same IP
address and port number that it was using prior to its restart. By address and port number that it was using prior to its restart. By
chance the restarted host must also choose an initial sequence number chance the restarted host must also choose an initial sequence number
of exactly (RCV.NXT - 1) of the remote TCP endpoint that is still in of exactly (RCV.NXT - 1) of the remote TCP endpoint that is still in
the established state. Such a case would cause the receiver to the established state. Such a case would cause the receiver to
generate a "challenge" ack as described above. But since the ACK generate a "challenge" ACK as described above. But since the ACK
would be within the outgoing connections window the inbound ACK would would be within the outgoing connections window the inbound ACK would
be acceptable, and the sender of the SYN will do nothing with the be acceptable, and the sender of the SYN will do nothing with the
response ACK. This sequence will continue as the SYN sender response ACK. This sequence will continue as the SYN sender
continually times out and retransmits the SYN until such time as the continually times out and retransmits the SYN until such time as the
connection attempt fails. connection attempt fails.
This corner case is a result of the [RFC0793] specification and is This corner case is a result of the [RFC0793] specification and is
not introduced by these new requirments. not introduced by these new requirements.
Note that the above mitigation may cause a non-amplification ACK Note that the above mitigation may cause a non-amplification ACK
exchange. This concern is discussed in Section 9. exchange. This concern is discussed in Section 9.
5. Blind data injection attack 5. Blind data injection attack
5.1. Description of the attack 5.1. Description of the attack
A third type of attack is also highlighted by both the RST and SYN A third type of attack is also highlighted by both the RST and SYN
attacks. It is also possible to inject data into a TCP connection by attacks. It is also possible to inject data into a TCP connection by
simply guessing a sequence number within the current receive window simply guessing a sequence number within the current receive window
of the victim. The ACK value of any data segment is considered valid of the victim. The ACK value of any data segment is considered valid
as long as it does not acknowledge data ahead of the next segment to as long as it does not acknowledge data ahead of the next segment to
send. In other words an ACK value is acceptable if it is ((SND.UNA- send. In other words an ACK value is acceptable if it is ((SND.UNA-
(2^31-1)) <= SEG.ACK <= SND.NXT). This means that an attacker has to (2^31-1)) <= SEG.ACK <= SND.NXT). The (2^31 - 1) in the above
guess two ACK values with every guessed sequence number so that the inequality takes into account the fact that comparisons on TCP
chances of successfully injecting data into a connection are 1 in sequence and acknowledgement numbers is done using the modulo 32 bit
((2^32 / RCV.WND) * 2). arithmetic to accommodate the number wraparound. This means that an
attacker has to guess two ACK values with every guessed sequence
number so that the chances of successfully injecting data into a
connection are 1 in ((2^32 / RCV.WND) * 2).
When an attacker successfully injects data into a connection the data When an attacker successfully injects data into a connection the data
will sit in the receiver's re-assembly queue until the peer sends will sit in the receiver's re-assembly queue until the peer sends
enough data to bridge the gap between the RCV.NXT value and the enough data to bridge the gap between the RCV.NXT value and the
injected data. At that point one of two things will occur : injected data. At that point one of two things will occur :
a) A packet war will ensue with the receiver indicating that it has a) A packet war will ensue with the receiver indicating that it has
received data up until RCV.NXT (which includes the attackers data) received data up until RCV.NXT (which includes the attackers data)
and the sender sending an ACK with an acknowledgment number less and the sender sending an ACK with an acknowledgment number less
than RCV.NXT. than RCV.NXT.
skipping to change at page 13, line 49 skipping to change at page 13, line 52
Note that the protections illustrated in this section neither cause Note that the protections illustrated in this section neither cause
an ACK war nor prevent one from occurring if data is actually an ACK war nor prevent one from occurring if data is actually
injected into a connection. The ACK war is a product of the attack injected into a connection. The ACK war is a product of the attack
itself and cannot be prevented (other than by preventing the data itself and cannot be prevented (other than by preventing the data
from being injected). from being injected).
5.2. Mitigation 5.2. Mitigation
All TCP stacks SHOULD implement the following mitigation. TCP stacks All TCP stacks SHOULD implement the following mitigation. TCP stacks
which implement the mitigation requires that an additional input which implement this mitigation, requires that an additional input
check MUST be added to any incoming segment. The ACK value MUST be check MUST be added to any incoming segment. The ACK value is
acceptable only if it is in the range of ((SND.UNA - MAX.SND.WND) <= considered acceptable only if it is in the range of ((SND.UNA -
SEG.ACK <= SND.NXT). All incoming segments whose ACK value doesn't MAX.SND.WND) <= SEG.ACK <= SND.NXT). All incoming segments whose ACK
satisfy the above condition MUST be discarded silently. A new state value doesn't satisfy the above condition MUST be discarded silently.
variable MAX.SND.WND is defined as the largest window that the local A new state variable MAX.SND.WND is defined as the largest window
sender has ever received from its peer. This window may be scaled to that the local sender has ever received from its peer. This window
a value larger than 65,535 bytes ([RFC1323]). This small check will may be scaled to a value larger than 65,535 bytes ([RFC1323]). This
reduce the vulnerability to an attacker guessing a valid sequence small check will reduce the vulnerability to an attacker guessing a
number, since he/she not only must guess the in-window sequence valid sequence number, since he/she not only must guess the in-window
number, but also guess a proper ACK value within a scoped range. sequence number, but also guess a proper ACK value within a scoped
This mitigation reduces, but does not eliminate, the ability to range. This mitigation reduces, but does not eliminate, the ability
generate false segments. It does however reduce the probability that to generate false segments. It does however reduce the probability
invalid data will be injected. that invalid data will be injected.
Implementations can also chose to hard code the MAX.SND.WND value to
the maximum permissible window size i.e., 65535 in the absence of
window scaling. In the presence of window scaling option the value
becomes (MAX.SND.WND << Snd.Wind.Scale).
This mitigation also helps in improving robustness on accepting
spoofed FIN segments (FIN attacks). Among other things, this
mitigation requires that the attacker also needs to get the
acknowledgment number to fall in the range mentioned above in order
to successfully spoof a FIN segment leading to the closure of the
connection. Thus, this mitigation greatly improves the robustness to
spoofed FIN segments.
Note that the above mitigation may cause a non-amplification ACK Note that the above mitigation may cause a non-amplification ACK
exchange. This concern is discussed in Section 9. exchange. This concern is discussed in Section 9.
6. ACK throttling 6. ACK throttling
In order to alleviate multiple RSTs/SYNs from triggering multiple In order to alleviate multiple RSTs/SYNs from triggering multiple
challenge ACKs, an ACK throttling mechanism is suggested as follows : challenge ACKs, an ACK throttling mechanism is suggested as follows :
1) The system administrator can configure the number of challenge 1) The system administrator can configure the number of challenge
ACK's that can be sent out in a given interval. For example, in ACK's that can be sent out in a given interval. For example, in
any 5 second window, no more than 10 challenge ACK's should be any 5 second window, no more than 10 challenge ACK's should be
sent. sent.
2) The values for both the time and number of ACK's SHOULD be tunable 2) The values for both the time and number of ACK's SHOULD be tunable
by the system administrator to accommodate different perceived by the system administrator to accommodate different perceived
levels of threat and/or system resources. levels of threat and/or system resources.
It should be noted that these numbers are empirical in nature and It should be noted that these numbers are empirical in nature and
have been obtained from the RST throttling mechanism implemented in have been obtained from the RST throttling mechanisms existing in
some OS's. Also note that no timer is needed to implement the above some implementations. Also note that no timer is needed to implement
mechanism, instead a timestamp and a counter can be used. the above mechanism, instead a timestamp and a counter can be used.
An implementation SHOULD include an ACK throttling mechanism to be An implementation SHOULD include an ACK throttling mechanism to be
conservative. Currently there is no known bad behavior that can be conservative. Currently there is no known bad behavior that can be
attributed to the lack of ACK throttling, but as a general principle, attributed to the lack of ACK throttling, but as a general principle,
if ever invoked, something incorrect is occurring and such a if ever invoked, something incorrect is occurring and such a
mechanism will act as a failsafe that protects both the sender and mechanism will act as a failsafe that protects both the sender and
the network. the network.
An administrator who is more concerned about protecting his bandwidth An administrator who is more concerned about protecting his bandwidth
and CPU utilization may set smaller ACK throttling values whereas an and CPU utilization may set smaller ACK throttling values whereas an
skipping to change at page 17, line 9 skipping to change at page 17, line 9
For the mitigation to be maximally effective against the For the mitigation to be maximally effective against the
vulnerabilities discussed in this document, both ends of the TCP vulnerabilities discussed in this document, both ends of the TCP
connection need to have the fix. Although, having the mitigations at connection need to have the fix. Although, having the mitigations at
one end might prevent that end from being exposed to the attack, the one end might prevent that end from being exposed to the attack, the
connection is still vulnerable at the other end. connection is still vulnerable at the other end.
8. Middlebox considerations 8. Middlebox considerations
8.1. Middlebox that resend RST's 8.1. Middlebox that resend RST's
Consider a middlebox M-B tracking connections between two TCP Consider a middlebox M-B tracking connections between two TCP end
endhosts E-A and E-C. If E-C sends a RST with a sequence number that hosts E-A and E-C. If E-C sends a RST with a sequence number that is
is within the window but not an exact match to reset the connection within the window but not an exact match to reset the connection and
and M-B does not have the fix recommended in this document, it may M-B does not have the fix recommended in this document, it may clear
clear the connection and forward the RST to E-A saving an incorrect the connection and forward the RST to E-A saving an incorrect
sequence number. If E-A does not have the fix the connection would sequence number. If E-A does not have the fix the connection would
get cleared as required. However if E-A does have the required fix, get cleared as required. However if E-A does have the required fix,
it will send a challenge ACK to E-C. M-B, being a middlebox, may it will send a challenge ACK to E-C. M-B, being a middlebox, may
intercept this ACK and resend the RST on behalf of E-C with the old intercept this ACK and resend the RST on behalf of E-C with the old
sequence number. This RST, will again, not be acceptable and may sequence number. This RST will, again, not be acceptable and may
trigger a challenge ACK. trigger a challenge ACK.
The above situation may result in a RST/ACK war. However, we believe The above situation may result in a RST/ACK war. However, we believe
that if such a case exists in the Internet, the middle box design that if such a case exists in the Internet, the middle box design
does not comply to [RFC0793]. [RFC0793] dictates that the sequence does not comply to [RFC0793]. [RFC0793] dictates that the sequence
number of a RST has to be derived from the acknowledgment number of number of a RST has to be derived from the acknowledgment number of
the incoming ACK segment. It is outside the scope of this document the incoming ACK segment. It is outside the scope of this document
to suggest mitigations to the ill-behaved middleboxes. to suggest mitigations to the ill-behaved middleboxes.
Consider a similar scenario where the RST from M-B to E-A gets lost, Consider a similar scenario where the RST from M-B to E-A gets lost,
skipping to change at page 17, line 41 skipping to change at page 17, line 41
For this case, M-B will have to cache the RST for an arbitrary amount For this case, M-B will have to cache the RST for an arbitrary amount
of time till until it is confirmed that the connection has been of time till until it is confirmed that the connection has been
cleared at E-A. cleared at E-A.
8.2. Middleboxes that advance sequence numbers 8.2. Middleboxes that advance sequence numbers
Some middleboxes may compute RST sequence numbers at the higher end Some middleboxes may compute RST sequence numbers at the higher end
of the acceptable window. The scenario is the same as the earlier of the acceptable window. The scenario is the same as the earlier
case, but in this case instead of sending the cached RST, the case, but in this case instead of sending the cached RST, the
middlebox (M-B) sends a RST that computes its sequence number as the middlebox (M-B) sends a RST that computes its sequence number as the
sum of the ack field in the ACK and the window advertised by the ACK sum of the acknowledgement field in the ACK and the window advertised
that was sent by E-A to challenge the RST as depicted below. The by the ACK that was sent by E-A to challenge the RST as depicted
difference in the sequence numbers between step 1 and 2 below is due below. The difference in the sequence numbers between step 1 and 2
to data lost in the network. below is due to data lost in the network.
TCP A Middlebox TCP A Middlebox
1. ESTABLISHED <-- <SEQ=500><ACK=100><CTL=RST> <-- CLOSED 1. ESTABLISHED <-- <SEQ=500><ACK=100><CTL=RST> <-- CLOSED
2. ESTABLISHED --> <SEQ=100><ACK=300><WND=500><CTL=ACK> --> CLOSED 2. ESTABLISHED --> <SEQ=100><ACK=300><WND=500><CTL=ACK> --> CLOSED
3. ESTABLISHED <-- <SEQ=800><ACK=100><CTL=RST> <-- CLOSED 3. ESTABLISHED <-- <SEQ=800><ACK=100><CTL=RST> <-- CLOSED
4. ESTABLISHED --> <SEQ=100><ACK=300><WND=500><CTL=ACK> --> CLOSED 4. ESTABLISHED --> <SEQ=100><ACK=300><WND=500><CTL=ACK> --> CLOSED
skipping to change at page 19, line 15 skipping to change at page 19, line 15
9. Security Considerations 9. Security Considerations
These changes to the TCP state machine do NOT protect an These changes to the TCP state machine do NOT protect an
implementation from on-path attacks. It also needs to be emphasized implementation from on-path attacks. It also needs to be emphasized
that while mitigations within this document make it harder for off- that while mitigations within this document make it harder for off-
path attackers to inject segments, it does NOT make it impossible. path attackers to inject segments, it does NOT make it impossible.
The only way to fully protect a TCP connection from both on and off The only way to fully protect a TCP connection from both on and off
path attacks is by using either IPSEC-AH [RFC4302] or IPSEC-ESP path attacks is by using either IPSEC-AH [RFC4302] or IPSEC-ESP
[RFC4303]. [RFC4303].
implementers also should be aware that the attacks detailed in this Implementers also should be aware that the attacks detailed in this
specification are not the only attacks available to an off-path specification are not the only attacks available to an off-path
attacker and that the counter measures described herein are not a attacker and that the counter measures described herein are not a
comprehensive defense against such attacks. comprehensive defense against such attacks.
In particular, administrators should be aware that forged ICMP In particular, administrators should be aware that forged ICMP
messages provide off-path attackers the opportunity to disrupt messages provide off-path attackers the opportunity to disrupt
connections or degrade service. Such attacks may be subject to even connections or degrade service. Such attacks may be subject to even
less scrutiny than the TCP attacks addressed here, especially in less scrutiny than the TCP attacks addressed here, especially in
stacks not tuned for hostile environments. It is important to note stacks not tuned for hostile environments. It is important to note
that some ICMP messages, validated or not, are key to the proper that some ICMP messages, validated or not, are key to the proper
skipping to change at page 19, line 40 skipping to change at page 19, line 40
on the assumptions and guarantees developers and administrators can on the assumptions and guarantees developers and administrators can
make about their network. This specification does not attempt to do make about their network. This specification does not attempt to do
more than note this and related issues. more than note this and related issues.
In any case, this RFC details only part of a complete strategy to In any case, this RFC details only part of a complete strategy to
prevent off-path attackers from disrupting services that use TCP. prevent off-path attackers from disrupting services that use TCP.
Administrators and implementers should consider the other attack Administrators and implementers should consider the other attack
vectors and determine appropriate mitigations in securing their vectors and determine appropriate mitigations in securing their
systems. systems.
Another consideration that should be noted is, a reflector attack is Another notable consideration is that a reflector attack is possible
possible with the required RST/SYN mitigation techniques. In this with the required RST/SYN mitigation techniques. In this attack, an
attack, an off-path attacker can cause a victim to send an ACK off-path attacker can cause a victim to send an ACK segment for each
segment for each spoofed RST/SYN segment that lies within the current spoofed RST/SYN segment that lies within the current receive window
receive window of the victim. It should be noted, however, that this of the victim. It should be noted, however, that this does not cause
does not cause any amplification since the attacker must generate a any amplification since the attacker must generate a segment for each
segment for each one that the victim will generate. one that the victim will generate.
10. IANA Considerations 10. IANA Considerations
This document contains no IANA considerations. This document contains no IANA considerations.
11. Contributors 11. Contributors
Mitesh Dalal and Amol Khare of Cisco Systems came up with the Mitesh Dalal and Amol Khare of Cisco Systems came up with the
solution for the RST/SYN attacks. Anantha Ramaiah and Randall solution for the RST/SYN attacks. Anantha Ramaiah and Randall
Stewart of Cisco Systems discovered the data injection vulnerability Stewart of Cisco Systems discovered the data injection vulnerability
and together with Patrick Mahan and Peter Lei of Cisco Systems found and together with Patrick Mahan and Peter Lei of Cisco Systems found
solutions for the same. Paul Goyette, Mark Baushke, Frank solutions for the same. Paul Goyette, Mark Baushke, Frank
Kastenholz, Art Stine and David Wang of Juniper Networks provided the Kastenholz, Art Stine and David Wang of Juniper Networks provided the
insight that apart from RSTs, SYNs could also result in formidable insight that apart from RSTs, SYNs could also result in formidable
attacks. Shrirang Bage of Cisco Systems, Qing Li and Preety Puri of attacks. Shrirang Bage of Cisco Systems, Qing Li and Preety Puri of
Wind River Systems and Xiaodan Tang of QNX Software along with the Wind River Systems and Xiaodan Tang of QNX Software along with the
folks above helped in ratifying and testing the interoperability of folks above helped in ratifying and testing the interoperability of
the suggested solutions. the suggested solutions.
Ack throttling was introduced to this document by combining the ACK throttling was introduced to this document by combining the
suggestions from the tcpm working group. suggestions from the tcpm working group.
12. Acknowledgments 12. Acknowledgments
Special thanks to Mark Allman, Ted Faber, Steve Bellovin, Vern Special thanks to Mark Allman, Ted Faber, Steve Bellovin, Vern
Paxson, Allison Mankin, Sharad Ahlawat, Damir Rajnovic, John Wong, Paxson, Allison Mankin, Sharad Ahlawat, Damir Rajnovic, John Wong,
Joe Touch, and other members of the tcpm WG members for suggestions Joe Touch, Alfred Hoenes and other members of the tcpm WG for
and comments. suggestions and comments.
13. References 13. References
13.1. Normative References 13.1. Normative References
[RFC0793] Postel, J., "Transmission Control Protocol", STD 7, [RFC0793] Postel, J., "Transmission Control Protocol", STD 7,
RFC 793, September 1981. RFC 793, September 1981.
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119, March 1997. Requirement Levels", BCP 14, RFC 2119, March 1997.
skipping to change at page 23, line 25 skipping to change at page 23, line 25
[RFC4302] Kent, S., "IP Authentication Header", RFC 4302, [RFC4302] Kent, S., "IP Authentication Header", RFC 4302,
December 2005. December 2005.
[RFC4303] Kent, S., "IP Encapsulating Security Payload (ESP)", [RFC4303] Kent, S., "IP Encapsulating Security Payload (ESP)",
RFC 4303, December 2005. RFC 4303, December 2005.
13.2. Informative References 13.2. Informative References
[I-D.ietf-tcpm-tcp-antispoof] [I-D.ietf-tcpm-tcp-antispoof]
Touch, J., "Defending TCP Against Spoofing Attacks", Touch, J., "Defending TCP Against Spoofing Attacks",
draft-ietf-tcpm-tcp-antispoof-05 (work in progress), draft-ietf-tcpm-tcp-antispoof-06 (work in progress),
October 2006. February 2007.
[Medina05] [Medina05]
Medina, A., Allman, M., and S. Floyd, "Measuring the Medina, A., Allman, M., and S. Floyd, "Measuring the
Evolution of Transport Protocols in the Internet. ACM Evolution of Transport Protocols in the Internet. ACM
Computer Communication Review, 35(2), April 2005. Computer Communication Review, 35(2), April 2005.
http://www.icir.org/mallman/papers/tcp-evo-ccr05.ps http://www.icir.org/mallman/papers/tcp-evo-ccr05.ps
(figure 6)". (figure 6)".
[NISCC] NISCC, "NISCC Vulnerability Advisory 236929 - [NISCC] NISCC, "NISCC Vulnerability Advisory 236929 -
Vulnerability Issues in TCP". Vulnerability Issues in TCP".
skipping to change at page 25, line 8 skipping to change at page 25, line 8
[RFC4271] Rekhter, Y., Li, T., and S. Hares, "A Border Gateway [RFC4271] Rekhter, Y., Li, T., and S. Hares, "A Border Gateway
Protocol 4 (BGP-4)", RFC 4271, January 2006. Protocol 4 (BGP-4)", RFC 4271, January 2006.
[SITW] Watson, P., "Slipping in the Window: TCP Reset attacks, [SITW] Watson, P., "Slipping in the Window: TCP Reset attacks,
Presentation at 2004 CanSecWest Presentation at 2004 CanSecWest
http://www.cansecwest.com/archives.html". http://www.cansecwest.com/archives.html".
Authors' Addresses Authors' Addresses
Anantha Ramaiah Anantha Ramaiah
Editor Cisco Systems
170 Tasman Drive 170 Tasman Drive
San Jose, CA 95134 San Jose, CA 95134
USA USA
Phone: +1 (408) 525-6486 Phone: +1 (408) 525-6486
Email: ananth@cisco.com Email: ananth@cisco.com
Randall R. Stewart Randall R. Stewart
Editor Cisco Systems
4875 Forest Drive 4875 Forest Drive
Suite 200 Suite 200
Columbia, SC 29206 Columbia, SC 29206
USA USA
Phone: +1 (803) 345-0369 Phone: +1 (803) 345-0369
Email: rrs@cisco.com Email: rrs@cisco.com
Mitesh Dalal Mitesh Dalal
Editor Cisco Systems
170 Tasman Drive 170 Tasman Drive
San Jose, CA 95134 San Jose, CA 95134
USA USA
Phone: +1 (408) 853-5257 Phone: +1 (408) 853-5257
Email: mdalal@cisco.com Email: mdalal@cisco.com
Full Copyright Statement Full Copyright Statement
Copyright (C) The IETF Trust (2007). Copyright (C) The IETF Trust (2007).
 End of changes. 38 change blocks. 
118 lines changed or deleted 147 lines changed or added

This html diff was produced by rfcdiff 1.33. The latest version is available from http://tools.ietf.org/tools/rfcdiff/