TCP Congestion Control with a Misbehaving Receiver
Total Page:16
File Type:pdf, Size:1020Kb
TCP Congestion Control with a Misbehaving Receiver Stefan Savage, Neal Cardwell, David Wetherall, and Tom Anderson Department of Computer Science and Engineering University of Washington, Seattle Abstract col modifications, a faulty or malicious receiver can at most cause the sender to transmit data at a slower rate than it otherwise would, In this paper, we explore the operation of TCP congestion control thus harming only itself. Because our work has serious practical when the receiver can misbehave, as might occur with a greedy ramifications for an Internet that depends on trust to avoid conges- Web client. We first demonstrate that there are simple attacks that tion collapse, we also describe backwards-compatible mechanisms allow a misbehaving receiver to drive a standard TCP sender ar- that can be implemented at the sender to mitigate the effects of un- bitrarily fast, without losing end-to-end reliability. These attacks trusted receivers. are widely applicable because they stem from the sender behavior As far as we are aware, the division of trust between sender specified in RFC 2581 rather than implementation bugs. We then and receiver has not been studied previously in the context of con- show that it is possible to modify TCP to eliminate this undesir- gestion control. While end-to-end congestion control protocols as- able behavior entirely, without requiring assumptions of any kind sume that both sender and receiver behave correctly, in many en- about receiver behavior. This is a strong result: with our solution vironments the interests of sender and receiver may differ consid- a receiver can only reduce the data transfer rate by misbehaving, erably – creating significant incentives to violate this “good faith” thereby eliminating the incentive to do so. doctrine. For example, in many wide-area data retrieval applica- tions, such as Web browsing, the sender's interest is to provide 1 Introduction uniform service to all clients requesting data, while the interest of each client receiver is to maximize its own data throughput. Tra- End-to-end congestion control mechanisms, such as those used in ditional cryptographic security mechanisms, such as embodied in TCP, are the primary means used for sharing scarce bandwidth re- IPSEC [KA98], can provide guarantees of authentication and con- sources in the Internet. These mechanisms implicitly rely on both fidentiality, but they can not prevent a receiver from violating TCP's endpoints to cooperate in determining the proper rate at which to congestion control specification and consequently undermining the send data. Obviously, if the sending endpoint misbehaves, and does fairness and stability provided therein. not obey the appropriate congestion control algorithms, then it may The potential congestion resulting from aggressive senders send data more quickly than well-behaved hosts – possibly forc- has received significant attention from the networking commu- ing competing traffic to be delayed or discarded. Less obviously, a nity [She94, FF99, RHE99, VRC98], and has produced proposals misbehaving receiver can achieve the same result. for per-flow bandwidth reservation [ZDE+ 93] and mechanisms to While the possibility of such attacks has been hinted at pre- detect and limit “unfriendly” flows in the network [FF99]. These viously [APS99, PAD + 99], we believe the ease of exploiting this solutions, if workable, would solve the more general problem of vulnerability and the potential impact are not fully appreciated. We unconstrained data transmission and would make the issue of trust note that the population of receivers is extremely large (all Inter- in end-to-end congestion control less pressing. However, given that net users) and has both the incentive (faster Web surfing) and the it is unlikely that such mechanisms will be widely deployed in the opportunity (open source operating systems) to exploit this vulner- near term, we feel it is still prudent to consider the potential im- ability. pact of untrusted receivers on the congestion control mechanisms In this paper, we explore the impact that a misbehaving receiver in today's Internet. can have on TCP congestion control. We present two kinds of re- sults. First, we identify several vulnerabilities that can be exploited 2 Vulnerabilities by a malicious receiver to defeat TCP congestion control. This can be done in a manner that does not break end-to-end reliability se- By systematically considering sequences of message exchanges, mantics and that relies only on the standard behavior of correctly we have been able to identify several vulnerabilities that allow mis- implemented TCP senders. Tests against live Web servers using a behaving receivers to control the sending rate of unmodified, con- modified TCP implementation that we produced for this purpose, forming TCP senders. This section describes these vulnerabilities “TCP Daytona”, confirm that common TCP implementations pos- and techniques for exploiting them. In addition to denial-of-service sess these vulnerabilities. Second, we show that it is possible to attacks, these techniques can be used to enhance the performance modify the design of TCP to eliminate this behavior – without re- of the attacker's TCP sessions at the expense of behaving clients. quiring that the receiver be trusted in any manner. With our proto- This work was funded by generous grants from NSF (CCR 94-53532), DARPA (F30602-98-1-0205), USENIX, the National Library of Medicine, Cisco, Fuji and In- tel. Correspondence concerning this paper may be sent to [email protected]. 2.1 TCP review Sender Receiver While a detailed description of TCP's error and congestion con- Data trol mechanisms is beyond the scope of this paper, we describe the 1:1461 rudiments of their behavior below to allow those unfamiliar with TCP to understand the vulnerabilities explained later. For simplic- 7 ACK 48 ity, we consider TCP without the Selective Acknowledgment op- RTT 3 tion (SACK) [MMFR96], although the vulnerabilities we describe ACK 97 61 also exist when SACK is used. ACK 14 TCP is a connection-oriented, reliable, ordered, byte-stream Da protocol with explicit flow control. A sending host divides the data ta 146 1:2921 stream into individual segments, each of which is no longer than the Da ta 292 Sender Maximum Segment Size (SMSS) determined during con- 1:4381 Da nection establishment. Each segment is labeled with explicit se- ta 438 1:5841 quence numbers to guarantee ordering and reliability. When a host Da ta 584 receives an in-sequence segment it sends a cumulative acknowl- 1:7301 edgment (ACK) in return, notifying the sender that all of the data preceding that segment's sequence number has been received and can be retired from the sender's retransmission buffers. If an out- of-sequence segment is received, then the receiver acknowledges the next contiguous sequence number that was expected. If out- Figure 1: Sample time line for a ACK division attack. The sender be- standing data is not acknowledged for a period of time, the sender gins with cwnd=1, which is incremented for each of the three valid ACKs will timeout and retransmit the unacknowledged segments. received. After one round-trip time, cwnd=4, instead of the expected value TCP uses several algorithms for congestion control, most no- of cwnd=2. tably slow start and congestion avoidance [Jac88, Ste94, APS99]. Each of these algorithms controls the sending rate by manipulating This attack is demonstrated in Figure 1 with a time line. Here, a congestion window (cwnd) that limits the number of outstanding each message exchanged between sender and receiver is shown as unacknowledged bytes that are allowed at any time. When a con- a labeled arrow, with time proceeding down the page. The labels nection starts, the slow start algorithm is used to quickly increase indicate the type of message, data or acknowledgment, and the se- cwnd to reach the bottleneck capacity. When the sender infers that quence space consumed. In this example we can see that each ac- a segment has been lost it interprets this has an implicit signal of knowledgment is valid, in that it covers data that was sent and pre- network overload and decreases cwnd quickly. After roughly ap- viously unacknowledged. This leads the TCP sender to grow the proximating the bottleneck capacity, TCP switches to the conges- congestion window at a rate that is M times faster than usual. The tion avoidance algorithm which increases the value of cwnd more receiver can control this rate of growth by dividing the segment slowly to probe for additional bandwidth that may become avail- at arbitrary points – up to one acknowledgment per byte received able. (when M = N). At this limit, a sender with a 1460 byte SMSS could We now describe three attacks on this congestion control pro- theoretically be coerced into reaching a congestion window in ex- cedure that exploit a sender's vulnerability to non-conforming re- cess of the normal TCP sequence space (4GB) in only four round- ceiver behavior. trip times! 1 Moreover, while high rates of additional acknowledg- ment traffic may increase congestion on the path to the sender, the 2.2 ACK division penalty to the receiver is negligible since the cumulative nature of TCP uses a byte granularity error control protocol and consequently acknowledgments inherently tolerates any losses that may occur. each TCP segment is described by sequence number and acknowl- edgment fields that refer to byte offsets within a TCP data stream. 2.3 DupACK spoofing However, TCP's congestion control algorithm is implicitly defined TCP uses two algorithms, fast retransmit and fast recovery, to miti- in terms of segments rather than bytes. For example, the most re- gate the effects of packet loss. The fast retransmit algorithm detects cent specification of TCP's congestion control behavior, RFC 2581, loss by observing three duplicate acknowledgments and it immedi- states: ately retransmits what appears to be the missing segment.