| 1 |
<pre>Internet Engineering Task Force (IETF) A. Ramaiah |
| 2 |
Request for Comments: 5961 Cisco |
| 3 |
Category: Standards Track R. Stewart |
| 4 |
ISSN: 2070-1721 Huawei |
| 5 |
M. Dalal |
| 6 |
Cisco |
| 7 |
August 2010 |
| 8 |
|
| 9 |
|
| 10 |
<span class="h1">Improving TCP's Robustness to Blind In-Window Attacks</span> |
| 11 |
|
| 12 |
Abstract |
| 13 |
|
| 14 |
TCP has historically been considered to be protected against spoofed |
| 15 |
off-path packet injection attacks by relying on the fact that it is |
| 16 |
difficult to guess the 4-tuple (the source and destination IP |
| 17 |
addresses and the source and destination ports) in combination with |
| 18 |
the 32-bit sequence number(s). A combination of increasing window |
| 19 |
sizes and applications using longer-term connections (e.g., H-323 or |
| 20 |
Border Gateway Protocol (BGP) [<a href="./rfc4271" title=""A Border Gateway Protocol 4 (BGP-4)"">RFC4271</a>]) have left modern TCP |
| 21 |
implementations more vulnerable to these types of spoofed packet |
| 22 |
injection attacks. |
| 23 |
|
| 24 |
Many of these long-term TCP applications tend to have predictable IP |
| 25 |
addresses and ports that makes it far easier for the 4-tuple (4-tuple |
| 26 |
is the same as the socket pair mentioned in <a href="./rfc793">RFC 793</a>) to be guessed. |
| 27 |
Having guessed the 4-tuple correctly, an attacker can inject a TCP |
| 28 |
segment with the RST bit set, the SYN bit set or data into a TCP |
| 29 |
connection by systematically guessing the sequence number of the |
| 30 |
spoofed segment to be in the current receive window. This can cause |
| 31 |
the connection to abort or cause data corruption. This document |
| 32 |
specifies small modifications to the way TCP handles inbound segments |
| 33 |
that can reduce the chances of a successful attack. |
| 34 |
|
| 35 |
Status of This Memo |
| 36 |
|
| 37 |
This is an Internet Standards Track document. |
| 38 |
|
| 39 |
This document is a product of the Internet Engineering Task Force |
| 40 |
(IETF). It represents the consensus of the IETF community. It has |
| 41 |
received public review and has been approved for publication by the |
| 42 |
Internet Engineering Steering Group (IESG). Further information on |
| 43 |
Internet Standards is available in <a href="./rfc5741#section-2">Section 2 of RFC 5741</a>. |
| 44 |
|
| 45 |
Information about the current status of this document, any errata, |
| 46 |
and how to provide feedback on it may be obtained at |
| 47 |
<a href="http://www.rfc-editor.org/info/rfc5961">http://www.rfc-editor.org/info/rfc5961</a>. |
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
<span class="grey">Ramaiah, et al. Standards Track [Page 1]</span></pre> |
| 53 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-2" ></span> |
| 54 |
<span class="grey"><a href="./rfc5961">RFC 5961</a> TCP Security August 2010</span> |
| 55 |
|
| 56 |
|
| 57 |
Copyright Notice |
| 58 |
|
| 59 |
Copyright (c) 2010 IETF Trust and the persons identified as the |
| 60 |
document authors. All rights reserved. |
| 61 |
|
| 62 |
This document is subject to <a href="https://www.rfc-editor.org/bcp/bcp78">BCP 78</a> and the IETF Trust's Legal |
| 63 |
Provisions Relating to IETF Documents |
| 64 |
(<a href="http://trustee.ietf.org/license-info">http://trustee.ietf.org/license-info</a>) in effect on the date of |
| 65 |
publication of this document. Please review these documents |
| 66 |
carefully, as they describe your rights and restrictions with respect |
| 67 |
to this document. Code Components extracted from this document must |
| 68 |
include Simplified BSD License text as described in Section 4.e of |
| 69 |
the Trust Legal Provisions and are provided without warranty as |
| 70 |
described in the Simplified BSD License. |
| 71 |
|
| 72 |
Table of Contents |
| 73 |
|
| 74 |
<a href="#section-1">1</a>. Introduction ....................................................<a href="#page-3">3</a> |
| 75 |
<a href="#section-1.1">1.1</a>. Applicability Statement ....................................<a href="#page-3">3</a> |
| 76 |
<a href="#section-1.2">1.2</a>. Basic Attack Methodology ...................................<a href="#page-4">4</a> |
| 77 |
<a href="#section-1.3">1.3</a>. Attack probabilities .......................................<a href="#page-5">5</a> |
| 78 |
<a href="#section-2">2</a>. Terminology .....................................................<a href="#page-7">7</a> |
| 79 |
<a href="#section-3">3</a>. Blind Reset Attack Using the RST Bit ............................<a href="#page-7">7</a> |
| 80 |
<a href="#section-3.1">3.1</a>. Description of the Attack ..................................<a href="#page-7">7</a> |
| 81 |
<a href="#section-3.2">3.2</a>. Mitigation .................................................<a href="#page-7">7</a> |
| 82 |
<a href="#section-4">4</a>. Blind Reset Attack Using the SYN Bit ............................<a href="#page-9">9</a> |
| 83 |
<a href="#section-4.1">4.1</a>. Description of the Attack ..................................<a href="#page-9">9</a> |
| 84 |
<a href="#section-4.2">4.2</a>. Mitigation .................................................<a href="#page-9">9</a> |
| 85 |
<a href="#section-5">5</a>. Blind Data Injection Attack ....................................<a href="#page-10">10</a> |
| 86 |
<a href="#section-5.1">5.1</a>. Description of the Attack .................................<a href="#page-10">10</a> |
| 87 |
<a href="#section-5.2">5.2</a>. Mitigation ................................................<a href="#page-11">11</a> |
| 88 |
<a href="#section-6">6</a>. Suggested Mitigation Strengths .................................<a href="#page-12">12</a> |
| 89 |
<a href="#section-7">7</a>. ACK Throttling .................................................<a href="#page-12">12</a> |
| 90 |
<a href="#section-8">8</a>. Backward Compatibility and Other Considerations ................<a href="#page-13">13</a> |
| 91 |
<a href="#section-9">9</a>. Middlebox Considerations .......................................<a href="#page-14">14</a> |
| 92 |
<a href="#section-9.1">9.1</a>. Middlebox That Resend RSTs ................................<a href="#page-14">14</a> |
| 93 |
<a href="#section-9.2">9.2</a>. Middleboxes That Advance Sequence Numbers .................<a href="#page-15">15</a> |
| 94 |
<a href="#section-9.3">9.3</a>. Middleboxes That Drop the Challenge ACK ...................<a href="#page-15">15</a> |
| 95 |
<a href="#section-10">10</a>. Security Considerations .......................................<a href="#page-16">16</a> |
| 96 |
<a href="#section-11">11</a>. Contributors ..................................................<a href="#page-17">17</a> |
| 97 |
<a href="#section-12">12</a>. Acknowledgments ...............................................<a href="#page-17">17</a> |
| 98 |
<a href="#section-13">13</a>. References ....................................................<a href="#page-17">17</a> |
| 99 |
<a href="#section-13.1">13.1</a>. Normative References .....................................<a href="#page-17">17</a> |
| 100 |
<a href="#section-13.2">13.2</a>. Informative References ...................................<a href="#page-17">17</a> |
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
<span class="grey">Ramaiah, et al. Standards Track [Page 2]</span></pre> |
| 109 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-3" ></span> |
| 110 |
<span class="grey"><a href="./rfc5961">RFC 5961</a> TCP Security August 2010</span> |
| 111 |
|
| 112 |
|
| 113 |
<span class="h2"><a class="selflink" id="section-1" href="#section-1">1</a>. Introduction</span> |
| 114 |
|
| 115 |
TCP [<a href="./rfc0793" title=""Transmission Control Protocol"">RFC0793</a>] is widely deployed and the most common reliable end-to- |
| 116 |
end transport protocol used for data communication in today's |
| 117 |
Internet. Yet, when it was standardized over 20 years ago, the |
| 118 |
Internet was a different place, lacking many of the threats that are |
| 119 |
now common. The off-path TCP spoofing attacks, which are seen in the |
| 120 |
Internet today, fall into this category. |
| 121 |
|
| 122 |
In a TCP spoofing attack, an off-path attacker crafts TCP packets by |
| 123 |
forging the IP source and destination addresses as well as the source |
| 124 |
and destination ports (referred to as a 4-tuple value in this |
| 125 |
document). The targeted TCP endpoint will then associate such a |
| 126 |
packet with an existing TCP connection. It needs to be noted that, |
| 127 |
guessing this 4-tuple value is not always easy for an attacker. But |
| 128 |
there are some applications (e.g., BGP [<a href="./rfc4271" title=""A Border Gateway Protocol 4 (BGP-4)"">RFC4271</a>]) that have a |
| 129 |
tendency to use the same set(s) of ports on either endpoint, making |
| 130 |
the odds of correctly guessing the 4-tuple value much easier. When |
| 131 |
an attacker is successful in guessing the 4-tuple value, one of three |
| 132 |
types of injection attacks may be waged against a long-lived |
| 133 |
connection. |
| 134 |
RST - Where an attacker injects a RST segment hoping to cause the |
| 135 |
connection to be torn down. "RST segment" here refers to a TCP |
| 136 |
segment with the RST bit set. |
| 137 |
SYN - Where an attacker injects a SYN hoping to cause the receiver |
| 138 |
to believe the peer has restarted and therefore tear down the |
| 139 |
connection state. "SYN segment" here refers to a TCP segment with |
| 140 |
SYN bit set. |
| 141 |
DATA - Where an attacker tries to inject a DATA segment to corrupt |
| 142 |
the contents of the transmission. "DATA segment" here refers to |
| 143 |
any TCP segment containing data. |
| 144 |
|
| 145 |
<span class="h3"><a class="selflink" id="section-1.1" href="#section-1.1">1.1</a>. Applicability Statement</span> |
| 146 |
|
| 147 |
This document talks about some known in-window attacks and suitable |
| 148 |
defenses against these. The mitigations suggested in this document |
| 149 |
SHOULD be implemented in devices that regularly need to maintain TCP |
| 150 |
connections of the kind most vulnerable to the attacks described in |
| 151 |
this document. Examples of such TCP connections are the ones that |
| 152 |
tend to be long-lived and where the connection endpoints can be |
| 153 |
determined, in cases where no auxiliary anti-spoofing protection |
| 154 |
mechanisms like TCP MD5 [<a href="./rfc2385" title=""Protection of BGP Sessions via the TCP MD5 Signature Option"">RFC2385</a>] can be deployed. These mitigations |
| 155 |
MAY be implemented in other cases. |
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
<span class="grey">Ramaiah, et al. Standards Track [Page 3]</span></pre> |
| 165 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-4" ></span> |
| 166 |
<span class="grey"><a href="./rfc5961">RFC 5961</a> TCP Security August 2010</span> |
| 167 |
|
| 168 |
|
| 169 |
<span class="h3"><a class="selflink" id="section-1.2" href="#section-1.2">1.2</a>. Basic Attack Methodology</span> |
| 170 |
|
| 171 |
Focusing upon the RST attack, we examine this attack in more detail |
| 172 |
to get an overview as to how it works and how this document addresses |
| 173 |
the issue. For this attack, the goal is for the attacker to cause |
| 174 |
one of the two endpoints of the connection to incorrectly tear down |
| 175 |
the connection state, effectively aborting the connection. One of |
| 176 |
the important things to note is that for the attack to succeed the |
| 177 |
RST needs to be in the valid receive window. It also needs to be |
| 178 |
emphasized that the receive window is independent of the current |
| 179 |
congestion window of the TCP connection. The attacker would try to |
| 180 |
forge many RST segments to try to cover the space of possible windows |
| 181 |
by putting out a packet in each potential window. To do this, the |
| 182 |
attacker needs to have or guess several pieces of information namely: |
| 183 |
|
| 184 |
1) The 4-tuple value containing the IP address and TCP port number of |
| 185 |
both ends of the connection. For one side (usually the server), |
| 186 |
guessing the port number is a trivial exercise. The client side |
| 187 |
may or may not be easy for an attacker to guess depending on a |
| 188 |
number of factors, most notably the operating system and |
| 189 |
application involved. |
| 190 |
|
| 191 |
2) A sequence number that will be used in the RST. This sequence |
| 192 |
number will be a starting point for a series of guesses to attempt |
| 193 |
to present a RST segment to a connection endpoint that would be |
| 194 |
acceptable to it. Any random value may be used to guess the |
| 195 |
starting sequence number. |
| 196 |
|
| 197 |
3) The window size that the two endpoints are using. This value does |
| 198 |
NOT have to be the exact window size since a smaller value used in |
| 199 |
lieu of the correct one will just cause the attacker to generate |
| 200 |
more segments before succeeding in his mischief. Most modern |
| 201 |
operating systems have a default window size that usually is |
| 202 |
applied to most connections. Some applications however may change |
| 203 |
the window size to better suit the needs of the application. So |
| 204 |
often times the attacker, with a fair degree of certainty (knowing |
| 205 |
the application that is under attack), can come up with a very |
| 206 |
close approximation as to the actual window size in use on the |
| 207 |
connection. |
| 208 |
|
| 209 |
After assembling the above set of information, the attacker begins |
| 210 |
sending spoofed TCP segments with the RST bit set and a guessed TCP |
| 211 |
sequence number. Each time a new RST segment is sent, the sequence |
| 212 |
number guess is incremented by the window size. The feasibility of |
| 213 |
this methodology (without mitigations) was first shown in [<a href="#ref-SITW" title=""Slipping in the Window: TCP Reset attacks"">SITW</a>]. |
| 214 |
This is because [<a href="./rfc0793" title=""Transmission Control Protocol"">RFC0793</a>] specifies that any RST within the current |
| 215 |
window is acceptable. Also, [<a href="./rfc4953" title=""Defending TCP Against Spoofing Attacks"">RFC4953</a>] talks about the probability of |
| 216 |
a successful attack with varying window sizes and bandwidth. |
| 217 |
|
| 218 |
|
| 219 |
|
| 220 |
<span class="grey">Ramaiah, et al. Standards Track [Page 4]</span></pre> |
| 221 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-5" ></span> |
| 222 |
<span class="grey"><a href="./rfc5961">RFC 5961</a> TCP Security August 2010</span> |
| 223 |
|
| 224 |
|
| 225 |
A slight enhancement to TCP's segment processing rules can be made, |
| 226 |
which makes such an attack much more difficult to accomplish. If the |
| 227 |
receiver examines the incoming RST segment and validates that the |
| 228 |
sequence number exactly matches the sequence number that is next |
| 229 |
expected, then such an attack becomes much more difficult than |
| 230 |
outlined in [<a href="#ref-SITW" title=""Slipping in the Window: TCP Reset attacks"">SITW</a>] (i.e., the attacker would have to generate 1/2 the |
| 231 |
entire sequence space, on average). This document will discuss the |
| 232 |
exact details of what needs to be changed within TCP's segment |
| 233 |
processing rules to mitigate all three types of attacks (RST, SYN, |
| 234 |
and DATA). |
| 235 |
|
| 236 |
<span class="h3"><a class="selflink" id="section-1.3" href="#section-1.3">1.3</a>. Attack probabilities</span> |
| 237 |
|
| 238 |
Every application has control of a number of factors that drastically |
| 239 |
affect the probability of a successful spoofing attack. These |
| 240 |
factors include such things as: |
| 241 |
|
| 242 |
Window Size - Normally settable by the application but often times |
| 243 |
defaulting to 32,768 or 65,535 depending upon the operating system |
| 244 |
(see Figure 6 of [<a href="#ref-Medina05" title=""Measuring the Evolution of Transport Protocols in the Internet"">Medina05</a>]). |
| 245 |
|
| 246 |
Server Port number - This value is normally a fixed value so that a |
| 247 |
client will know where to connect to the peer. Thus, this value |
| 248 |
normally provides no additional protection. |
| 249 |
|
| 250 |
Client Port number - This value may be a random ephemeral value, if |
| 251 |
so, this makes a spoofing attack more difficult. There are some |
| 252 |
clients, however, that for whatever reason either pick a fixed |
| 253 |
client port or have a very guessable one (due to the range of |
| 254 |
ephemeral ports available with their operating system or other |
| 255 |
application considerations) for such applications a spoofing |
| 256 |
attack becomes less difficult. |
| 257 |
|
| 258 |
For the purposes of the rest of this discussion we will assume that |
| 259 |
the attacker knows the 4-tuple values. This assumption will help us |
| 260 |
focus on the effects of the window size versus the number of TCP |
| 261 |
packets an attacker must generate. This assumption will rarely be |
| 262 |
true in the real Internet since at least the client port number will |
| 263 |
provide us with some amount of randomness (depending on the operating |
| 264 |
system). |
| 265 |
|
| 266 |
To successfully inject a spoofed packet (RST, SYN, or DATA), in the |
| 267 |
past, the entire sequence space (i.e., 2^32) was often considered |
| 268 |
available to make such an attack unlikely. [<a href="#ref-SITW" title=""Slipping in the Window: TCP Reset attacks"">SITW</a>] demonstrated that |
| 269 |
this assumption was incorrect and that instead of (1/2 * 2^32) |
| 270 |
packets (assuming a random distribution), (1/2 * (2^32/window)) |
| 271 |
|
| 272 |
|
| 273 |
|
| 274 |
|
| 275 |
|
| 276 |
<span class="grey">Ramaiah, et al. Standards Track [Page 5]</span></pre> |
| 277 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-6" ></span> |
| 278 |
<span class="grey"><a href="./rfc5961">RFC 5961</a> TCP Security August 2010</span> |
| 279 |
|
| 280 |
|
| 281 |
packets are required. In other words, the mean number of tries |
| 282 |
needed to inject a RST segment is (2^31/window) rather than the 2^31 |
| 283 |
assumed before. |
| 284 |
|
| 285 |
Substituting numbers into this formula, we see that for a window size |
| 286 |
of 32,768, an average of 65,536 packets would need to be transmitted |
| 287 |
in order to "spoof" a TCP segment that would be acceptable to a TCP |
| 288 |
receiver. A window size of 65,535 reduces this even further to |
| 289 |
32,768 packets. At today's access bandwidths, an attack of that size |
| 290 |
is feasible. |
| 291 |
|
| 292 |
With rises in bandwidth to both the home and office, it can only be |
| 293 |
expected that the values for default window sizes will continue to |
| 294 |
rise in order to better take advantage of the newly available |
| 295 |
bandwidth. It also needs to be noted that this attack can be |
| 296 |
performed in a distributed fashion in order potentially gain access |
| 297 |
to more bandwidth. |
| 298 |
|
| 299 |
As we can see from the above discussion this weakness lowers the bar |
| 300 |
quite considerably for likely attacks. But there is one additional |
| 301 |
dependency that is the duration of the TCP connection. A TCP |
| 302 |
connection that lasts only a few brief packets, as often is the case |
| 303 |
for web traffic, would not be subject to such an attack since the |
| 304 |
connection may not be established long enough for an attacker to |
| 305 |
generate enough traffic. However, there is a set of applications, |
| 306 |
such as BGP [<a href="./rfc4271" title=""A Border Gateway Protocol 4 (BGP-4)"">RFC4271</a>], that is judged to be potentially most affected |
| 307 |
by this vulnerability. BGP relies on a persistent TCP session |
| 308 |
between BGP peers. Resetting the connection can result in term- |
| 309 |
medium unavailability due to the need to rebuild routing tables and |
| 310 |
route flapping; see [<a href="#ref-NISCC" title=""NISCC Vulnerability Advisory 236929 - Vulnerability Issues in TCP"">NISCC</a>] for further details. |
| 311 |
|
| 312 |
For applications that can use the TCP MD5 option [<a href="./rfc2385" title=""Protection of BGP Sessions via the TCP MD5 Signature Option"">RFC2385</a>], such as |
| 313 |
BGP, that option makes the attacks described in this specification |
| 314 |
effectively impossible. However, some applications or |
| 315 |
implementations may find that option expensive to implement. |
| 316 |
|
| 317 |
There are alternative protections against the threats that this |
| 318 |
document addresses. For further details regarding the attacks and |
| 319 |
the existing techniques, please refer to [<a href="./rfc4953" title=""Defending TCP Against Spoofing Attacks"">RFC4953</a>]. It also needs to |
| 320 |
be emphasized that, as suggested in [<a href="#ref-TSVWG-PORT" title=""Transport Protocol Port Randomization Recommendations"">TSVWG-PORT</a>] and [<a href="./rfc1948" title=""Defending Against Sequence Number Attacks"">RFC1948</a>], port |
| 321 |
randomization and initial sequence number (ISN) randomization would |
| 322 |
help improve the robustness of the TCP connection against off-path |
| 323 |
attacks. |
| 324 |
|
| 325 |
|
| 326 |
|
| 327 |
|
| 328 |
|
| 329 |
|
| 330 |
|
| 331 |
|
| 332 |
<span class="grey">Ramaiah, et al. Standards Track [Page 6]</span></pre> |
| 333 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-7" ></span> |
| 334 |
<span class="grey"><a href="./rfc5961">RFC 5961</a> TCP Security August 2010</span> |
| 335 |
|
| 336 |
|
| 337 |
<span class="h2"><a class="selflink" id="section-2" href="#section-2">2</a>. Terminology</span> |
| 338 |
|
| 339 |
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", |
| 340 |
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this |
| 341 |
document are to be interpreted as described in [<a href="./rfc2119" title=""Key words for use in RFCs to Indicate Requirement Levels"">RFC2119</a>]. TCP |
| 342 |
terminology should be interpreted as described in [<a href="./rfc0793" title=""Transmission Control Protocol"">RFC0793</a>]. |
| 343 |
|
| 344 |
<span class="h2"><a class="selflink" id="section-3" href="#section-3">3</a>. Blind Reset Attack Using the RST Bit</span> |
| 345 |
|
| 346 |
<span class="h3"><a class="selflink" id="section-3.1" href="#section-3.1">3.1</a>. Description of the Attack</span> |
| 347 |
|
| 348 |
As described in the introduction, it is possible for an attacker to |
| 349 |
generate a RST segment that would be acceptable to a TCP receiver by |
| 350 |
guessing in-window sequence numbers. In particular [<a href="./rfc0793" title=""Transmission Control Protocol"">RFC0793</a>], page |
| 351 |
37, states the following: |
| 352 |
|
| 353 |
In all states except SYN-SENT, all reset (RST) segments are |
| 354 |
validated by checking their SEQ-fields [sequence numbers]. A |
| 355 |
reset is valid if its sequence number is in the window. In the |
| 356 |
SYN-SENT state (a RST received in response to an initial SYN), the |
| 357 |
RST is acceptable if the ACK field acknowledges the SYN. |
| 358 |
|
| 359 |
<span class="h3"><a class="selflink" id="section-3.2" href="#section-3.2">3.2</a>. Mitigation</span> |
| 360 |
|
| 361 |
[<a id="ref-RFC0793">RFC0793</a>] currently requires handling of a segment with the RST bit |
| 362 |
when in a synchronized state to be processed as follows: |
| 363 |
|
| 364 |
1) If the RST bit is set and the sequence number is outside the |
| 365 |
current receive window (SEG.SEQ <= RCV.NXT || SEG.SEQ > RCV.NXT+ |
| 366 |
RCV.WND), silently drop the segment. |
| 367 |
|
| 368 |
2) If the RST bit is set and the sequence number is acceptable, i.e., |
| 369 |
(RCV.NXT <= SEG.SEQ < RCV.NXT+RCV.WND), then reset the connection. |
| 370 |
|
| 371 |
Instead, implementations SHOULD implement the following steps in |
| 372 |
place of those specified in [<a href="./rfc0793" title=""Transmission Control Protocol"">RFC0793</a>] (as listed above). |
| 373 |
|
| 374 |
1) If the RST bit is set and the sequence number is outside the |
| 375 |
current receive window, silently drop the segment. |
| 376 |
|
| 377 |
2) If the RST bit is set and the sequence number exactly matches the |
| 378 |
next expected sequence number (RCV.NXT), then TCP MUST reset the |
| 379 |
connection. |
| 380 |
|
| 381 |
|
| 382 |
|
| 383 |
|
| 384 |
|
| 385 |
|
| 386 |
|
| 387 |
|
| 388 |
<span class="grey">Ramaiah, et al. Standards Track [Page 7]</span></pre> |
| 389 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-8" ></span> |
| 390 |
<span class="grey"><a href="./rfc5961">RFC 5961</a> TCP Security August 2010</span> |
| 391 |
|
| 392 |
|
| 393 |
3) If the RST bit is set and the sequence number does not exactly |
| 394 |
match the next expected sequence value, yet is within the current |
| 395 |
receive window (RCV.NXT < SEG.SEQ < RCV.NXT+RCV.WND), TCP MUST |
| 396 |
send an acknowledgment (challenge ACK): |
| 397 |
|
| 398 |
<SEQ=SND.NXT><ACK=RCV.NXT><CTL=ACK> |
| 399 |
|
| 400 |
After sending the challenge ACK, TCP MUST drop the unacceptable |
| 401 |
segment and stop processing the incoming packet further. Further |
| 402 |
segments destined to this connection will be processed as normal. |
| 403 |
|
| 404 |
The modified RST segment processing would thus become: |
| 405 |
|
| 406 |
In all states except SYN-SENT, all reset (RST) segments are validated |
| 407 |
by checking their SEQ-fields [sequence numbers]. A reset is valid if |
| 408 |
its sequence number exactly matches the next expected sequence |
| 409 |
number. If the RST arrives and its sequence number field does NOT |
| 410 |
match the next expected sequence number but is within the window, |
| 411 |
then the receiver should generate an ACK. In all other cases, where |
| 412 |
the SEQ-field does not match and is outside the window, the receiver |
| 413 |
MUST silently discard the segment. |
| 414 |
|
| 415 |
In the SYN-SENT state (a RST received in response to an initial SYN), |
| 416 |
the RST is acceptable if the ACK field acknowledges the SYN. In all |
| 417 |
other cases the receiver MUST silently discard the segment. |
| 418 |
|
| 419 |
With the above slight change to the TCP state machine, it becomes |
| 420 |
much harder for an attacker to generate an acceptable reset segment. |
| 421 |
|
| 422 |
In cases where the remote peer did generate a RST, but it fails to |
| 423 |
meet the above criteria (the RST sequence number was within the |
| 424 |
window but NOT the exact expected sequence number), when the |
| 425 |
challenge ACK is sent back, it will no longer have the transmission |
| 426 |
control block (TCB) related to this connection and hence as per |
| 427 |
[<a href="./rfc0793" title=""Transmission Control Protocol"">RFC0793</a>], the remote peer will send a second RST back. The sequence |
| 428 |
number of the second RST is derived from the acknowledgment number of |
| 429 |
the incoming ACK. This second RST, if it reaches the sender, will |
| 430 |
cause the connection to be aborted since the sequence number would |
| 431 |
now be an exact match. |
| 432 |
|
| 433 |
A valid RST received out of order would still generate a challenge |
| 434 |
ACK in response. If this RST happens to be a genuine one, the other |
| 435 |
end would send an RST with an exact sequence number match that would |
| 436 |
cause the connection to be dropped. |
| 437 |
|
| 438 |
Note that the above mitigation may cause a non-amplification ACK |
| 439 |
exchange. This concern is discussed in <a href="#section-10">Section 10</a>. |
| 440 |
|
| 441 |
|
| 442 |
|
| 443 |
|
| 444 |
<span class="grey">Ramaiah, et al. Standards Track [Page 8]</span></pre> |
| 445 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-9" ></span> |
| 446 |
<span class="grey"><a href="./rfc5961">RFC 5961</a> TCP Security August 2010</span> |
| 447 |
|
| 448 |
|
| 449 |
<span class="h2"><a class="selflink" id="section-4" href="#section-4">4</a>. Blind Reset Attack Using the SYN Bit</span> |
| 450 |
|
| 451 |
<span class="h3"><a class="selflink" id="section-4.1" href="#section-4.1">4.1</a>. Description of the Attack</span> |
| 452 |
|
| 453 |
The analysis of the reset attack using the RST bit highlights another |
| 454 |
possible avenue for a blind attacker using a similar set of sequence |
| 455 |
number guessing. Instead of using the RST bit, an attacker can use |
| 456 |
the SYN bit with the exact same semantics to tear down a connection. |
| 457 |
|
| 458 |
<span class="h3"><a class="selflink" id="section-4.2" href="#section-4.2">4.2</a>. Mitigation</span> |
| 459 |
|
| 460 |
[<a id="ref-RFC0793">RFC0793</a>] currently requires handling of a segment with the SYN bit |
| 461 |
set in the synchronized state to be as follows: |
| 462 |
|
| 463 |
1) If the SYN bit is set and the sequence number is outside the |
| 464 |
expected window, send an ACK back to the sender. |
| 465 |
|
| 466 |
2) If the SYN bit is set and the sequence number is acceptable, i.e., |
| 467 |
(RCV.NXT <= SEG.SEQ < RCV.NXT+RCV.WND), then send a RST segment to |
| 468 |
the sender. |
| 469 |
|
| 470 |
Instead, the handling of the SYN in the synchronized state SHOULD be |
| 471 |
performed as follows: |
| 472 |
|
| 473 |
1) If the SYN bit is set, irrespective of the sequence number, TCP |
| 474 |
MUST send an ACK (also referred to as challenge ACK) to the remote |
| 475 |
peer: |
| 476 |
|
| 477 |
<SEQ=SND.NXT><ACK=RCV.NXT><CTL=ACK> |
| 478 |
|
| 479 |
After sending the acknowledgment, TCP MUST drop the unacceptable |
| 480 |
segment and stop processing further. |
| 481 |
|
| 482 |
By sending an ACK, the remote peer is challenged to confirm the loss |
| 483 |
of the previous connection and the request to start a new connection. |
| 484 |
A legitimate peer, after restart, would not have a TCB in the |
| 485 |
synchronized state. Thus, when the ACK arrives, the peer should send |
| 486 |
a RST segment back with the sequence number derived from the ACK |
| 487 |
field that caused the RST. |
| 488 |
|
| 489 |
This RST will confirm that the remote peer has indeed closed the |
| 490 |
previous connection. Upon receipt of a valid RST, the local TCP |
| 491 |
endpoint MUST terminate its connection. The local TCP endpoint |
| 492 |
should then rely on SYN retransmission from the remote end to |
| 493 |
re-establish the connection. |
| 494 |
|
| 495 |
|
| 496 |
|
| 497 |
|
| 498 |
|
| 499 |
|
| 500 |
<span class="grey">Ramaiah, et al. Standards Track [Page 9]</span></pre> |
| 501 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-10" ></span> |
| 502 |
<span class="grey"><a href="./rfc5961">RFC 5961</a> TCP Security August 2010</span> |
| 503 |
|
| 504 |
|
| 505 |
A spoofed SYN, on the other hand, will then have generated an |
| 506 |
additional ACK that the peer will discard as a duplicate ACK and will |
| 507 |
not affect the established connection. |
| 508 |
|
| 509 |
Note that this mitigation does leave one corner case un-handled, |
| 510 |
which will prevent the reset of a connection when it should be reset |
| 511 |
(i.e., it is a non-spoofed SYN wherein a peer really did restart). |
| 512 |
This problem occurs when the restarting host chooses the exact same |
| 513 |
IP address and port number that it was using prior to its restart. |
| 514 |
By chance, the restarted host must also choose an initial sequence |
| 515 |
number of exactly (RCV.NXT - 1) of the remote peer that is still in |
| 516 |
the established state. Such a case would cause the receiver to |
| 517 |
generate a "challenge" ACK as described above. But since the ACK |
| 518 |
would be within the outgoing connections window, the inbound ACK |
| 519 |
would be acceptable, and the sender of the SYN will do nothing with |
| 520 |
the response ACK. This sequence will continue as the SYN sender |
| 521 |
continually times out and retransmits the SYN until such time as the |
| 522 |
connection attempt fails. |
| 523 |
|
| 524 |
This corner case is a result of the [<a href="./rfc0793" title=""Transmission Control Protocol"">RFC0793</a>] specification and is |
| 525 |
not introduced by these new requirements. |
| 526 |
|
| 527 |
Note that the above mitigation may cause a non-amplification ACK |
| 528 |
exchange. This concern is discussed in <a href="#section-10">Section 10</a>. |
| 529 |
|
| 530 |
<span class="h2"><a class="selflink" id="section-5" href="#section-5">5</a>. Blind Data Injection Attack</span> |
| 531 |
|
| 532 |
<span class="h3"><a class="selflink" id="section-5.1" href="#section-5.1">5.1</a>. Description of the Attack</span> |
| 533 |
|
| 534 |
A third type of attack is also highlighted by both the RST and SYN |
| 535 |
attacks. It is also possible to inject data into a TCP connection by |
| 536 |
simply guessing a sequence number within the current receive window |
| 537 |
of the victim. The ACK value of any data segment is considered valid |
| 538 |
as long as it does not acknowledge data ahead of the next segment to |
| 539 |
send. In other words, an ACK value is acceptable if it is |
| 540 |
((SND.UNA-(2^31-1)) <= SEG.ACK <= SND.NXT). The (2^31 - 1) in the |
| 541 |
above inequality takes into account the fact that comparisons on TCP |
| 542 |
sequence and acknowledgment numbers is done using the modulo 32-bit |
| 543 |
arithmetic to accommodate the number wraparound. This means that an |
| 544 |
attacker has to guess two ACK values with every guessed sequence |
| 545 |
number so that the chances of successfully injecting data into a |
| 546 |
connection are 1 in ( 1/2 (2^32 / RCV.WND) * 2). Thus, the mean |
| 547 |
number of tries needed to inject data successfully is |
| 548 |
1/2 (2*2^32/RWND) = 2^32/RCV.WND. |
| 549 |
|
| 550 |
|
| 551 |
|
| 552 |
|
| 553 |
|
| 554 |
|
| 555 |
|
| 556 |
<span class="grey">Ramaiah, et al. Standards Track [Page 10]</span></pre> |
| 557 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-11" ></span> |
| 558 |
<span class="grey"><a href="./rfc5961">RFC 5961</a> TCP Security August 2010</span> |
| 559 |
|
| 560 |
|
| 561 |
When an attacker successfully injects data into a connection, the |
| 562 |
data will sit in the receiver's re-assembly queue until the peer |
| 563 |
sends enough data to bridge the gap between the RCV.NXT value and the |
| 564 |
injected data. At that point, one of two things will occur: |
| 565 |
|
| 566 |
1) A packet war will ensue with the receiver indicating that it has |
| 567 |
received data up until RCV.NXT (which includes the attacker's |
| 568 |
data) and the sender sending an ACK with an acknowledgment number |
| 569 |
less than RCV.NXT. |
| 570 |
|
| 571 |
2) The sender will send enough data to the peer that will move |
| 572 |
RCV.NXT even further along past the injected data. |
| 573 |
|
| 574 |
Depending upon the TCP implementation in question and the TCP traffic |
| 575 |
characteristics at that time, data corruption may result. In case |
| 576 |
(a), the connection will eventually be reset by one of the sides |
| 577 |
unless the sender produces more data that will transform the ACK war |
| 578 |
into case (b). The reset will usually occur via User Time Out (UTO) |
| 579 |
(see <a href="./rfc1122#section-4.2.3.5">section 4.2.3.5 of [RFC1122]</a>). |
| 580 |
|
| 581 |
Note that the protections illustrated in this section neither cause |
| 582 |
an ACK war nor prevent one from occurring if data is actually |
| 583 |
injected into a connection. The ACK war is a product of the attack |
| 584 |
itself and cannot be prevented (other than by preventing the data |
| 585 |
from being injected). |
| 586 |
|
| 587 |
<span class="h3"><a class="selflink" id="section-5.2" href="#section-5.2">5.2</a>. Mitigation</span> |
| 588 |
|
| 589 |
All TCP stacks MAY implement the following mitigation. TCP stacks |
| 590 |
that implement this mitigation MUST add an additional input check to |
| 591 |
any incoming segment. The ACK value is considered acceptable only if |
| 592 |
it is in the range of ((SND.UNA - MAX.SND.WND) <= SEG.ACK <= |
| 593 |
SND.NXT). All incoming segments whose ACK value doesn't satisfy the |
| 594 |
above condition MUST be discarded and an ACK sent back. It needs to |
| 595 |
be noted that <a href="./rfc793">RFC 793</a> on page 72 (fifth check) says: "If the ACK is a |
| 596 |
duplicate (SEG.ACK < SND.UNA), it can be ignored. If the ACK |
| 597 |
acknowledges something not yet sent (SEG.ACK > SND.NXT) then send an |
| 598 |
ACK, drop the segment, and return". The "ignored" above implies that |
| 599 |
the processing of the incoming data segment continues, which means |
| 600 |
the ACK value is treated as acceptable. This mitigation makes the |
| 601 |
ACK check more stringent since any ACK < SND.UNA wouldn't be |
| 602 |
accepted, instead only ACKs that are in the range ((SND.UNA - |
| 603 |
MAX.SND.WND) <= SEG.ACK <= SND.NXT) get through. |
| 604 |
|
| 605 |
A new state variable MAX.SND.WND is defined as the largest window |
| 606 |
that the local sender has ever received from its peer. This window |
| 607 |
may be scaled to a value larger than 65,535 bytes ([<a href="./rfc1323" title=""TCP Extensions for High Performance"">RFC1323</a>]). This |
| 608 |
small check will reduce the vulnerability to an attacker guessing a |
| 609 |
|
| 610 |
|
| 611 |
|
| 612 |
<span class="grey">Ramaiah, et al. Standards Track [Page 11]</span></pre> |
| 613 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-12" ></span> |
| 614 |
<span class="grey"><a href="./rfc5961">RFC 5961</a> TCP Security August 2010</span> |
| 615 |
|
| 616 |
|
| 617 |
valid sequence number, since, not only one must guess the in-window |
| 618 |
sequence number, but also guess a proper ACK value within a scoped |
| 619 |
range. This mitigation reduces, but does not eliminate, the ability |
| 620 |
to generate false segments. It does however reduce the probability |
| 621 |
that invalid data will be injected. |
| 622 |
|
| 623 |
Implementations can also chose to hard code the MAX.SND.WND value to |
| 624 |
the maximum permissible window size, i.e., 65535 in the absence of |
| 625 |
window scaling. In the presence of the window scaling option, the |
| 626 |
value becomes (MAX.SND.WND << Snd.Wind.Scale). |
| 627 |
|
| 628 |
This mitigation also helps in improving robustness on accepting |
| 629 |
spoofed FIN segments (FIN attacks). Among other things, this |
| 630 |
mitigation requires that the attacker also needs to get the |
| 631 |
acknowledgment number to fall in the range mentioned above in order |
| 632 |
to successfully spoof a FIN segment leading to the closure of the |
| 633 |
connection. Thus, this mitigation greatly improves the robustness to |
| 634 |
spoofed FIN segments. |
| 635 |
|
| 636 |
Note that the above mitigation may cause a non-amplification ACK |
| 637 |
exchange. This concern is discussed in <a href="#section-10">Section 10</a>. |
| 638 |
|
| 639 |
<span class="h2"><a class="selflink" id="section-6" href="#section-6">6</a>. Suggested Mitigation Strengths</span> |
| 640 |
|
| 641 |
As described in the above sections, recommendation levels for RST, |
| 642 |
SYN, and DATA are tagged as SHOULD, SHOULD, and MAY, respectively. |
| 643 |
The reason that DATA mitigation is tagged as MAY, even though it |
| 644 |
increased the TCP robustness in general is because, the DATA |
| 645 |
injection is perceived to be more difficult (twice as unlikely) when |
| 646 |
compared to RST and SYN counterparts. However, it needs to be noted |
| 647 |
that all the suggested mitigations improve TCP's robustness in |
| 648 |
general and hence the choice of implementing some or all mitigations |
| 649 |
recommended in the document is purely left to the implementer. |
| 650 |
|
| 651 |
<span class="h2"><a class="selflink" id="section-7" href="#section-7">7</a>. ACK Throttling</span> |
| 652 |
|
| 653 |
In order to alleviate multiple RSTs/SYNs from triggering multiple |
| 654 |
challenge ACKs, an ACK throttling mechanism is suggested as follows: |
| 655 |
|
| 656 |
1) The system administrator can configure the number of challenge |
| 657 |
ACKs that can be sent out in a given interval. For example, in |
| 658 |
any 5 second window, no more than 10 challenge ACKs should be |
| 659 |
sent. |
| 660 |
|
| 661 |
2) The values for both the time and number of ACKs SHOULD be tunable |
| 662 |
by the system administrator to accommodate different perceived |
| 663 |
levels of threat and/or system resources. |
| 664 |
|
| 665 |
|
| 666 |
|
| 667 |
|
| 668 |
<span class="grey">Ramaiah, et al. Standards Track [Page 12]</span></pre> |
| 669 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-13" ></span> |
| 670 |
<span class="grey"><a href="./rfc5961">RFC 5961</a> TCP Security August 2010</span> |
| 671 |
|
| 672 |
|
| 673 |
It should be noted that these numbers are empirical in nature and |
| 674 |
have been obtained from the RST throttling mechanisms existing in |
| 675 |
some implementations. Also, note that no timer is needed to |
| 676 |
implement the above mechanism, instead a timestamp and a counter can |
| 677 |
be used. |
| 678 |
|
| 679 |
An implementation SHOULD include an ACK throttling mechanism to be |
| 680 |
conservative. While we have not encountered a case where the lack of |
| 681 |
ACK throttling can be exploited, as a fail-safe mechanism we |
| 682 |
recommend its use. An implementation may take an excessive number of |
| 683 |
invocations of the throttling mechanism as an indication that network |
| 684 |
conditions are unusual or hostile. |
| 685 |
|
| 686 |
An administrator who is more concerned about protecting his bandwidth |
| 687 |
and CPU utilization may set smaller ACK throttling values whereas an |
| 688 |
administrator who is more interested in faster cleanup of stale |
| 689 |
connections (i.e., concerned about excess TCP state) may decide to |
| 690 |
set a higher value thus allowing more RST's to be processed in any |
| 691 |
given time period. |
| 692 |
|
| 693 |
The time limit SHOULD be tunable to help timeout brute force attacks |
| 694 |
faster than a potential legitimate flood of RSTs. |
| 695 |
|
| 696 |
<span class="h2"><a class="selflink" id="section-8" href="#section-8">8</a>. Backward Compatibility and Other Considerations</span> |
| 697 |
|
| 698 |
All of the new required mitigation techniques in this document are |
| 699 |
totally compatible with existing ([<a href="./rfc0793" title=""Transmission Control Protocol"">RFC0793</a>]) compliant TCP |
| 700 |
implementations as this document introduces no new assumptions or |
| 701 |
conditions. |
| 702 |
|
| 703 |
There is a corner scenario in the above mitigations that will require |
| 704 |
more than one round-trip time to successfully abort the connection as |
| 705 |
per the figure below. This scenario is similar to the one in which |
| 706 |
the original RST was lost in the network. |
| 707 |
|
| 708 |
|
| 709 |
|
| 710 |
|
| 711 |
|
| 712 |
|
| 713 |
|
| 714 |
|
| 715 |
|
| 716 |
|
| 717 |
|
| 718 |
|
| 719 |
|
| 720 |
|
| 721 |
|
| 722 |
|
| 723 |
|
| 724 |
<span class="grey">Ramaiah, et al. Standards Track [Page 13]</span></pre> |
| 725 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-14" ></span> |
| 726 |
<span class="grey"><a href="./rfc5961">RFC 5961</a> TCP Security August 2010</span> |
| 727 |
|
| 728 |
|
| 729 |
TCP A TCP B |
| 730 |
1.a. ESTAB <-- <SEQ=300><ACK=101><CTL=ACK><DATA> <-- ESTAB |
| 731 |
b. (delayed) ... <SEQ=400><ACK=101><CTL=ACK><DATA> <-- ESTAB |
| 732 |
c. (in flight) ... <SEQ=500><ACK=101><CTL=RST> <-- CLOSED |
| 733 |
2. ESTAB --> <SEQ=101><ACK=400><CTL=ACK> --> CLOSED |
| 734 |
(ACK for 1.a) |
| 735 |
... <SEQ=400><ACK=0><CTL=RST> <-- CLOSED |
| 736 |
3. CHALLENGE --> <SEQ=101><ACK=400><CTL=ACK> --> CLOSED |
| 737 |
(for 1.c) |
| 738 |
... <SEQ=400><ACK=0><CTL=RST> <-- RESPONSE |
| 739 |
4.a. ESTAB <-- <SEQ=400><ACK=101><CTL=ACK><DATA> 1.b reaches A |
| 740 |
b. ESTAB --> <SEQ=101><ACK=500><CTL=ACK> |
| 741 |
c. (in flight) ... <SEQ=500><ACK=0><CTL=RST> <-- CLOSED |
| 742 |
5. RESPONSE arrives at A, but dropped since its outside of window. |
| 743 |
6. ESTAB <-- <SEQ=500><ACK=0><CTL=RST> 4.c reaches A |
| 744 |
7. CLOSED CLOSED |
| 745 |
|
| 746 |
For the mitigation to be maximally effective against the |
| 747 |
vulnerabilities discussed in this document, both ends of the TCP |
| 748 |
connection need to have the fix. Although, having the mitigations at |
| 749 |
one end might prevent that end from being exposed to the attack, the |
| 750 |
connection is still vulnerable at the other end. |
| 751 |
|
| 752 |
<span class="h2"><a class="selflink" id="section-9" href="#section-9">9</a>. Middlebox Considerations</span> |
| 753 |
|
| 754 |
<span class="h3"><a class="selflink" id="section-9.1" href="#section-9.1">9.1</a>. Middlebox That Resend RSTs</span> |
| 755 |
|
| 756 |
Consider a middlebox M-B tracking connections between two TCP end |
| 757 |
hosts E-A and E-C. If E-C sends a RST with a sequence number that is |
| 758 |
within the window but not an exact match to reset the connection and |
| 759 |
M-B does not have the fix recommended in this document, it may clear |
| 760 |
the connection and forward the RST to E-A saving an incorrect |
| 761 |
sequence number. If E-A does not have the fix, the connection would |
| 762 |
get cleared as required. However, if E-A does have the required fix, |
| 763 |
it will send a challenge ACK to E-C. M-B, being a middlebox, may |
| 764 |
intercept this ACK and resend the RST on behalf of E-C with the old |
| 765 |
sequence number. This RST will, again, not be acceptable and may |
| 766 |
trigger a challenge ACK. |
| 767 |
|
| 768 |
The above situation may result in a RST/ACK war. However, we believe |
| 769 |
that if such a case exists in the Internet, the middlebox is |
| 770 |
generating packets a conformant TCP endpoint would not generate. |
| 771 |
[<a href="./rfc0793" title=""Transmission Control Protocol"">RFC0793</a>] dictates that the sequence number of a RST has to be |
| 772 |
derived from the acknowledgment number of the incoming ACK segment. |
| 773 |
It is outside the scope of this document to suggest mitigations to |
| 774 |
the ill-behaved middleboxes. |
| 775 |
|
| 776 |
|
| 777 |
|
| 778 |
|
| 779 |
|
| 780 |
<span class="grey">Ramaiah, et al. Standards Track [Page 14]</span></pre> |
| 781 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-15" ></span> |
| 782 |
<span class="grey"><a href="./rfc5961">RFC 5961</a> TCP Security August 2010</span> |
| 783 |
|
| 784 |
|
| 785 |
Consider a similar scenario where the RST from M-B to E-A gets lost, |
| 786 |
E-A will continue to hold the connection and E-A might send an ACK an |
| 787 |
arbitrary time later after the connection state was destroyed at M-B. |
| 788 |
For this case, M-B will have to cache the RST for an arbitrary amount |
| 789 |
of time until it is confirmed that the connection has been cleared at |
| 790 |
E-A. |
| 791 |
|
| 792 |
<span class="h3"><a class="selflink" id="section-9.2" href="#section-9.2">9.2</a>. Middleboxes That Advance Sequence Numbers</span> |
| 793 |
|
| 794 |
Some middleboxes may compute RST sequence numbers at the higher end |
| 795 |
of the acceptable window. The scenario is the same as the earlier |
| 796 |
case, but in this case instead of sending the cached RST, the |
| 797 |
middlebox (M-B) sends a RST that computes its sequence number as the |
| 798 |
sum of the acknowledgment field in the ACK and the window advertised |
| 799 |
by the ACK that was sent by E-A to challenge the RST as depicted |
| 800 |
below. The difference in the sequence numbers between step 1 and 2 |
| 801 |
below is due to data lost in the network. |
| 802 |
|
| 803 |
TCP A Middlebox |
| 804 |
|
| 805 |
1. ESTABLISHED <-- <SEQ=500><ACK=100><CTL=RST> <-- CLOSED |
| 806 |
|
| 807 |
2. ESTABLISHED --> <SEQ=100><ACK=300><WND=500><CTL=ACK> --> CLOSED |
| 808 |
|
| 809 |
3. ESTABLISHED <-- <SEQ=800><ACK=100><CTL=RST> <-- CLOSED |
| 810 |
|
| 811 |
4. ESTABLISHED --> <SEQ=100><ACK=300><WND=500><CTL=ACK> --> CLOSED |
| 812 |
|
| 813 |
5. ESTABLISHED <-- <SEQ=800><ACK=100><CTL=RST> <-- CLOSED |
| 814 |
|
| 815 |
Although the authors are not aware of an implementation that does the |
| 816 |
above, it could be mitigated by implementing the ACK throttling |
| 817 |
mechanism described earlier. |
| 818 |
|
| 819 |
<span class="h3"><a class="selflink" id="section-9.3" href="#section-9.3">9.3</a>. Middleboxes That Drop the Challenge ACK</span> |
| 820 |
|
| 821 |
It also needs to be noted that, some middleboxes (Firewalls/NATs) |
| 822 |
that don't have the fix recommended in the document, may drop the |
| 823 |
challenge ACK. This can happen because, the original RST segment |
| 824 |
that was in window had already cleared the flow state pertaining to |
| 825 |
the TCP connection in the middlebox. In such cases, the end hosts |
| 826 |
that have implemented the RST mitigation described in this document, |
| 827 |
will have the TCP connection left open. This is a corner case and |
| 828 |
can go away if the middlebox is conformant with the changes proposed |
| 829 |
in this document. |
| 830 |
|
| 831 |
|
| 832 |
|
| 833 |
|
| 834 |
|
| 835 |
|
| 836 |
<span class="grey">Ramaiah, et al. Standards Track [Page 15]</span></pre> |
| 837 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-16" ></span> |
| 838 |
<span class="grey"><a href="./rfc5961">RFC 5961</a> TCP Security August 2010</span> |
| 839 |
|
| 840 |
|
| 841 |
<span class="h2"><a class="selflink" id="section-10" href="#section-10">10</a>. Security Considerations</span> |
| 842 |
|
| 843 |
These changes to the TCP state machine do NOT protect an |
| 844 |
implementation from on-path attacks. It also needs to be emphasized |
| 845 |
that while mitigations within this document make it harder for off- |
| 846 |
path attackers to inject segments, it does NOT make it impossible. |
| 847 |
The only way to fully protect a TCP connection from both on- and off- |
| 848 |
path attacks is by using either IPsec Authentication Header (AH) |
| 849 |
[<a href="./rfc4302" title=""IP Authentication Header"">RFC4302</a>] or IPsec Encapsulating Security Payload (ESP) [<a href="./rfc4303" title=""IP Encapsulating Security Payload (ESP)"">RFC4303</a>]. |
| 850 |
|
| 851 |
Implementers also should be aware that the attacks detailed in this |
| 852 |
specification are not the only attacks available to an off-path |
| 853 |
attacker and that the counter measures described herein are not a |
| 854 |
comprehensive defense against such attacks. |
| 855 |
|
| 856 |
In particular, administrators should be aware that forged ICMP |
| 857 |
messages provide off-path attackers the opportunity to disrupt |
| 858 |
connections or degrade service. Such attacks may be subject to even |
| 859 |
less scrutiny than the TCP attacks addressed here, especially in |
| 860 |
stacks not tuned for hostile environments. It is important to note |
| 861 |
that some ICMP messages, validated or not, are key to the proper |
| 862 |
function of TCP. Those ICMP messages used to properly set the path |
| 863 |
maximum transmission unit are the most obvious example. There are a |
| 864 |
variety of ways to choose which, if any, ICMP messages to trust in |
| 865 |
the presence of off-path attackers and choosing between them depends |
| 866 |
on the assumptions and guarantees developers and administrators can |
| 867 |
make about their network. This specification does not attempt to do |
| 868 |
more than note this and related issues. Unless implementers address |
| 869 |
spoofed ICMP messages [<a href="./rfc5927" title=""ICMP Attacks against TCP"">RFC5927</a>], the mitigations specified in this |
| 870 |
document may not provide the desired protection level. |
| 871 |
|
| 872 |
In any case, this RFC details only part of a complete strategy to |
| 873 |
prevent off-path attackers from disrupting services that use TCP. |
| 874 |
Administrators and implementers should consider the other attack |
| 875 |
vectors and determine appropriate mitigations in securing their |
| 876 |
systems. |
| 877 |
|
| 878 |
Another notable consideration is that a reflector attack is possible |
| 879 |
with the required RST/SYN mitigation techniques. In this attack, an |
| 880 |
off-path attacker can cause a victim to send an ACK segment for each |
| 881 |
spoofed RST/SYN segment that lies within the current receive window |
| 882 |
of the victim. It should be noted, however, that this does not cause |
| 883 |
any amplification since the attacker must generate a segment for each |
| 884 |
one that the victim will generate. |
| 885 |
|
| 886 |
|
| 887 |
|
| 888 |
|
| 889 |
|
| 890 |
|
| 891 |
|
| 892 |
<span class="grey">Ramaiah, et al. Standards Track [Page 16]</span></pre> |
| 893 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-17" ></span> |
| 894 |
<span class="grey"><a href="./rfc5961">RFC 5961</a> TCP Security August 2010</span> |
| 895 |
|
| 896 |
|
| 897 |
<span class="h2"><a class="selflink" id="section-11" href="#section-11">11</a>. Contributors</span> |
| 898 |
|
| 899 |
Mitesh Dalal and Amol Khare of Cisco Systems came up with the |
| 900 |
solution for the RST/SYN attacks. Anantha Ramaiah and Randall |
| 901 |
Stewart of Cisco Systems discovered the data injection vulnerability |
| 902 |
and together with Patrick Mahan and Peter Lei of Cisco Systems found |
| 903 |
solutions for the same. Paul Goyette, Mark Baushke, Frank |
| 904 |
Kastenholz, Art Stine, and David Wang of Juniper Networks provided |
| 905 |
the insight that apart from RSTs, SYNs could also result in |
| 906 |
formidable attacks. Shrirang Bage of Cisco Systems, Qing Li and |
| 907 |
Preety Puri of Wind River Systems, and Xiaodan Tang of QNX Software |
| 908 |
along with the folks above helped in ratifying and testing the |
| 909 |
interoperability of the suggested solutions. |
| 910 |
|
| 911 |
<span class="h2"><a class="selflink" id="section-12" href="#section-12">12</a>. Acknowledgments</span> |
| 912 |
|
| 913 |
Special thanks to Mark Allman, Ted Faber, Steve Bellovin, Vern |
| 914 |
Paxson, Allison Mankin, Sharad Ahlawat, Damir Rajnovic, John Wong, |
| 915 |
Joe Touch, Alfred Hoenes, Andre Oppermann, Fernando Gont, Sandra |
| 916 |
Murphy, Brian Carpenter, Cullen Jennings, and other members of the |
| 917 |
tcpm WG for suggestions and comments. ACK throttling was introduced |
| 918 |
to this document by combining the suggestions from the tcpm working |
| 919 |
group. |
| 920 |
|
| 921 |
<span class="h2"><a class="selflink" id="section-13" href="#section-13">13</a>. References</span> |
| 922 |
|
| 923 |
<span class="h3"><a class="selflink" id="section-13.1" href="#section-13.1">13.1</a>. Normative References</span> |
| 924 |
|
| 925 |
[<a id="ref-RFC0793">RFC0793</a>] Postel, J., "Transmission Control Protocol", STD 7, |
| 926 |
<a href="./rfc793">RFC 793</a>, September 1981. |
| 927 |
|
| 928 |
[<a id="ref-RFC2119">RFC2119</a>] Bradner, S., "Key words for use in RFCs to Indicate |
| 929 |
Requirement Levels", <a href="https://www.rfc-editor.org/bcp/bcp14">BCP 14</a>, <a href="./rfc2119">RFC 2119</a>, March 1997. |
| 930 |
|
| 931 |
<span class="h3"><a class="selflink" id="section-13.2" href="#section-13.2">13.2</a>. Informative References</span> |
| 932 |
|
| 933 |
[<a id="ref-Medina05">Medina05</a>] Medina, A., Allman, M., and S. Floyd, "Measuring the |
| 934 |
Evolution of Transport Protocols in the Internet", ACM |
| 935 |
Computer Communication Review, 35(2), April 2005, |
| 936 |
<<a href="http://www.icir.org/mallman/papers/tcp-evo-ccr05.ps">http://www.icir.org/mallman/papers/tcp-evo-ccr05.ps</a>>. |
| 937 |
|
| 938 |
[<a id="ref-NISCC">NISCC</a>] NISCC, "NISCC Vulnerability Advisory 236929 - |
| 939 |
Vulnerability Issues in TCP". |
| 940 |
|
| 941 |
[<a id="ref-RFC1122">RFC1122</a>] Braden, R., "Requirements for Internet Hosts - |
| 942 |
Communication Layers", STD 3, <a href="./rfc1122">RFC 1122</a>, October 1989. |
| 943 |
|
| 944 |
|
| 945 |
|
| 946 |
|
| 947 |
|
| 948 |
<span class="grey">Ramaiah, et al. Standards Track [Page 17]</span></pre> |
| 949 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-18" ></span> |
| 950 |
<span class="grey"><a href="./rfc5961">RFC 5961</a> TCP Security August 2010</span> |
| 951 |
|
| 952 |
|
| 953 |
[<a id="ref-RFC1323">RFC1323</a>] Jacobson, V., Braden, B., and D. Borman, "TCP |
| 954 |
Extensions for High Performance", <a href="./rfc1323">RFC 1323</a>, May 1992. |
| 955 |
|
| 956 |
[<a id="ref-RFC1948">RFC1948</a>] Bellovin, S., "Defending Against Sequence Number |
| 957 |
Attacks", <a href="./rfc1948">RFC 1948</a>, May 1996. |
| 958 |
|
| 959 |
[<a id="ref-RFC2385">RFC2385</a>] Heffernan, A., "Protection of BGP Sessions via the TCP |
| 960 |
MD5 Signature Option", <a href="./rfc2385">RFC 2385</a>, August 1998. |
| 961 |
|
| 962 |
[<a id="ref-RFC4271">RFC4271</a>] Rekhter, Y., Li, T., and S. Hares, "A Border Gateway |
| 963 |
Protocol 4 (BGP-4)", <a href="./rfc4271">RFC 4271</a>, January 2006. |
| 964 |
|
| 965 |
[<a id="ref-RFC4302">RFC4302</a>] Kent, S., "IP Authentication Header", <a href="./rfc4302">RFC 4302</a>, |
| 966 |
December 2005. |
| 967 |
|
| 968 |
[<a id="ref-RFC4303">RFC4303</a>] Kent, S., "IP Encapsulating Security Payload (ESP)", |
| 969 |
<a href="./rfc4303">RFC 4303</a>, December 2005. |
| 970 |
|
| 971 |
[<a id="ref-RFC4953">RFC4953</a>] Touch, J., "Defending TCP Against Spoofing Attacks", |
| 972 |
<a href="./rfc4953">RFC 4953</a>, July 2007. |
| 973 |
|
| 974 |
[<a id="ref-RFC5927">RFC5927</a>] Gont, F., "ICMP Attacks against TCP", <a href="./rfc5927">RFC 5927</a>, |
| 975 |
July 2010. |
| 976 |
|
| 977 |
[<a id="ref-SITW">SITW</a>] Watson, P., "Slipping in the Window: TCP Reset |
| 978 |
attacks", Presentation at 2004 CanSecWest, |
| 979 |
<<a href="http://cansecwest.com/csw04archive.html">http://cansecwest.com/csw04archive.html</a>>. |
| 980 |
|
| 981 |
[<a id="ref-TSVWG-PORT">TSVWG-PORT</a>] Larsen, M. and F. Gont, "Transport Protocol Port |
| 982 |
Randomization Recommendations", Work in Progress, |
| 983 |
August 2010. |
| 984 |
|
| 985 |
|
| 986 |
|
| 987 |
|
| 988 |
|
| 989 |
|
| 990 |
|
| 991 |
|
| 992 |
|
| 993 |
|
| 994 |
|
| 995 |
|
| 996 |
|
| 997 |
|
| 998 |
|
| 999 |
|
| 1000 |
|
| 1001 |
|
| 1002 |
|
| 1003 |
|
| 1004 |
<span class="grey">Ramaiah, et al. Standards Track [Page 18]</span></pre> |
| 1005 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-19" ></span> |
| 1006 |
<span class="grey"><a href="./rfc5961">RFC 5961</a> TCP Security August 2010</span> |
| 1007 |
|
| 1008 |
|
| 1009 |
Authors' Addresses |
| 1010 |
|
| 1011 |
Anantha Ramaiah |
| 1012 |
Cisco Systems |
| 1013 |
170 Tasman Drive |
| 1014 |
San Jose, CA 95134 |
| 1015 |
USA |
| 1016 |
|
| 1017 |
Phone: +1 (408) 525-6486 |
| 1018 |
EMail: [email protected] |
| 1019 |
|
| 1020 |
|
| 1021 |
Randall R. Stewart |
| 1022 |
Huawei |
| 1023 |
148 Crystal Cove Ct |
| 1024 |
Chapin, SC 29036 |
| 1025 |
USA |
| 1026 |
|
| 1027 |
Phone: +1 (803) 345-0369 |
| 1028 |
EMail: [email protected] |
| 1029 |
|
| 1030 |
|
| 1031 |
Mitesh Dalal |
| 1032 |
Cisco Systems |
| 1033 |
170 Tasman Drive |
| 1034 |
San Jose, CA 95134 |
| 1035 |
USA |
| 1036 |
|
| 1037 |
Phone: +1 (408) 853-5257 |
| 1038 |
EMail: [email protected] |
| 1039 |
|
| 1040 |
|
| 1041 |
|
| 1042 |
|
| 1043 |
|
| 1044 |
|
| 1045 |
|
| 1046 |
|
| 1047 |
|
| 1048 |
|
| 1049 |
|
| 1050 |
|
| 1051 |
|
| 1052 |
|
| 1053 |
|
| 1054 |
|
| 1055 |
|
| 1056 |
|
| 1057 |
|
| 1058 |
|
| 1059 |
|
| 1060 |
Ramaiah, et al. Standards Track [Page 19] |
| 1061 |
</pre> |