Network Working Group P. Hoffman Internet-Draft Cybersecurity Association Expires: January 18, 2006 S. Guha P. Francis Cornell University July 17, 2005 NAT Behavioral Requirements for Unicast TCP draft-hoffman-behave-tcp-02.txt Status of this Memo By submitting this Internet-Draft, each author represents that any 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 aware will be disclosed, in accordance with Section 6 of BCP 79. Internet-Drafts are working documents of the Internet Engineering Task Force (IETF), its areas, and its working groups. Note that other groups may also distribute working documents as Internet- Drafts. Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress." The list of current Internet-Drafts can be accessed at http://www.ietf.org/ietf/1id-abstracts.txt. The list of Internet-Draft Shadow Directories can be accessed at http://www.ietf.org/shadow.html. This Internet-Draft will expire on January 18, 2006. Copyright Notice Copyright (C) The Internet Society (2005). Abstract This document defines a set of requirements for NATs that handle unicast TCP that would allow many applications, such as peer-to-peer reliable communications or on-line gaming, to work consistently. Developing NATs that meet this set of requirements will greatly increase the likelihood that these applications will function properly. Hoffman, et al. Expires January 18, 2006 [Page 1] Internet-Draft NAT TCP Unicast Requirements July 2005 1. Introduction [BEHAVE-UDP] defines many terms relating to NATs, lays out general requirements for all NATs, and sets requirements for NATs that handle unicast UDP traffic. This document is an adjunct to [BEHAVE-UDP] and sets requirements for NATs that handle unicast TCP traffic (that is, almost every NAT). All definitions and requirements in [BEHAVE-UDP] are inherited here. 2. Incoming SYN packets and outgoing SYNACK packets on an open TCP connection Some TCP-based protocols attempt to start multiple TCP connections for a single flow of traffic. Such protocols can sometimes work through NATs. In some cases, it may require a SYN packet to be received after a SYN packet is sent, or a SYNACK packet to be sent after a SYN packet it sent. Normal TCP stacks correctly handle such cases, in accordance with [RFC-TCP]. REQ-1: A NAT MUST allow all TCP packets in either direction on any open NAT mapping that is a TCP connection. Justification for REQ-1: This allows end-hosts to follow any valid transition defined in TCP. 3. Incoming SYN packets to non-existent mappings NATs have two basic choices when they receive a SYN packet for a mapping that does not exist: ignore it or respond to it with a RST or ICMP packet. A NAT that receives a SYN packet from the external side for an address and port mapping that does not exist must decide whether or not to respond. Ignoring the SYN instead of responding with an RST can help some applications that start multiple TCP connections. Sending an ICMP soft-error does not affect other NATs or OS stacks and allows the application to decide whether or not to abort the connection attempt. REQ-2: A NAT MUST NOT send a RST packet in response to a SYN packet sent from the external side to an address and port mapping that does not exist. a) A NAT MAY send an ICMP Host Unreachable (Type=3, Code=1) in response to such a SYN packet. Justification for REQ-2: Not sending an RST helps applications that open multiple TCP connections and attempt to trigger a TCP Simultaneous-open. Sending an ICMP soft error allows applications to choose to abort a TCP attempt without having to wait for a TCP timeout. Hoffman, et al. Expires January 18, 2006 [Page 2] Internet-Draft NAT TCP Unicast Requirements July 2005 4. Resource exhaustion and timers A NAT maintains state associated with the mappings that it maintains. Because of this, a NAT is susceptible to a resource-exhaustion attack whereby an attacker (or virus) on the internal side attempts to cause the NAT to create more state than it has resources. To prevent such an attack, a NAT needs to abandon mappings in order to free the state resources. A common method that is applicable only to TCP connections is to look for partially-open or partially closed TCP connections and abandon those based on timers specific to those states. The states of a TCP connection are defined in [RFC-TCP] and can be inferred by examining the TCP flags of incoming and outgoing packets for that mapping. The mapping timer is defined as the time a mapping will stay active without packets traversing the NAT. The timer values for various states are mentioned in [RFC-1122]. REQ-3: A NAT TCP mapping timer SHOULD NOT expire in less than 4 minutes for a TCP connection in SYN_SENT, SYN_RCVD, CLOSING, LAST_ACK or TIME_WAIT state. A NAT TCP mapping timer SHOULD NOT expire in less than 2 hours for a TCP connection in any other state except CLOSED. a) When a NAT closes an open TCP mapping, it MUST send RST packets to each end of the connection. b) To maximize application transparency, a NAT MAY expire mappings only when it is low on resources. Justification for REQ-3: TCP Keep-alive packets, when enabled, are sent at 2 hour intervals on an idle connection by default. During connection setup or teardown, TCP waits 2xMSL (4 minutes) for in- flight packets to be delivered and acknowledged. This requirement can be easily implemented by examining the ACK flag in both directions during connection setup and examining the FIN flag in both directions during connection teardown. 5. Requirements A NAT that supports all of the mandatory requirements of this specification (i.e., the "MUST"), is "compliant with this specification." A NAT that supports all of the requirements of this specification (i.e., included the "RECOMMENDED") is "fully compliant with all the mandatory and recommended requirements of this specification." Hoffman, et al. Expires January 18, 2006 [Page 3] Internet-Draft NAT TCP Unicast Requirements July 2005 REQ-1: A NAT MUST allow all TCP packets in either direction on any open NAT mapping that is a TCP connection. REQ-2: A NAT MUST NOT send a RST packet in response to a SYN packet sent from the external side to an address and port mapping that does not exist. a) A NAT MAY send an ICMP Host Unreachable (Type=3, Code=1) in response to such a SYN packet. REQ-3: A NAT TCP mapping timer SHOULD NOT expire in less than 4 minutes for a TCP connection in SYN_SENT, SYN_RCVD, CLOSING, LAST_ACK or TIME_WAIT state. A NAT TCP mapping timer SHOULD NOT expire in less than 2 hours for a TCP connection in any other state except CLOSED. a) When a NAT closes an open TCP mapping, it MUST send RST packets to each end of the connection. b) To maximize application transparency, a NAT MAY expire mappings only when it is low on resources. Requirements inherited from [BEHAVE-UDP]: [[Once finalized, BEHAVE-UDP requirement list with UDP changed to TCP where applicable.]] 6. Security considerations The security considerations for this document are the same as for [BEHAVE-UDP]. The fact that this document covers unicast TCP does not change any of the security considerations there. [[ Is this statement actually true? ]] [[If the NAT is examining TCP flags, then it needs to track sequence numbers and the TCP timestamp option to correctly determine out-of- window packets.]] 7. IANA considerations This document does not change or create any IANA-registered values. 8. Normative References [BEHAVE-UDP] Audet, F. and C. Jennings, "NAT Behavioral Requirements for Unicast UDP", draft-ietf-behave-nat-udp (work in progress). [RFC-1122] Braden, R., "Requirements for Internet Hosts -- Communication Layers", RFC 793. Hoffman, et al. Expires January 18, 2006 [Page 4] Internet-Draft NAT TCP Unicast Requirements July 2005 [RFC-TCP] Postel, J., "Transmission Control Protocol", RFC 793. Authors' Addresses Paul Hoffman Cybersecurity Association 127 Segre Place Santa Cruz, CA 95060 USA Email: paul.hoffman@cybersecurity.org Saikat Guha Cornell University 331 Upson Hall Ithaca, NY 14853 USA Email: saikat@cs.cornell.edu Paul Francis Cornell University 4108 Upson Hall Ithaca, NY 14853 USA Email: francis@cs.cornell.edu Hoffman, et al. Expires January 18, 2006 [Page 5] Internet-Draft NAT TCP Unicast Requirements July 2005 Intellectual Property Statement The IETF takes no position regarding the validity or scope of any Intellectual Property Rights or other rights that might be claimed to pertain to the implementation or use of the technology described in this document or the extent to which any license under such rights might or might not be available; nor does it represent that it has made any independent effort to identify any such rights. Information on the procedures with respect to rights in RFC documents can be found in BCP 78 and BCP 79. Copies of IPR disclosures made to the IETF Secretariat and any assurances of licenses to be made available, or the result of an attempt made to obtain a general license or permission for the use of such proprietary rights by implementers or users of this specification can be obtained from the IETF on-line IPR repository at http://www.ietf.org/ipr. The IETF invites any interested party to bring to its attention any copyrights, patents or patent applications, or other proprietary rights that may cover technology that may be required to implement this standard. Please address the information to the IETF at ietf-ipr@ietf.org. Disclaimer of Validity This document and the information contained herein are provided on an "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Copyright Statement Copyright (C) The Internet Society (2005). This document is subject to the rights, licenses and restrictions contained in BCP 78, and except as set forth therein, the authors retain all their rights. Acknowledgment Funding for the RFC Editor function is currently provided by the Internet Society. Hoffman, et al. Expires January 18, 2006 [Page 6]