<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<?rfc toc="yes"?>
<?rfc symrefs="yes" ?>
<?rfc sortrefs="yes" ?>
<rfc category="info" docName="draft-ietf-tcpm-persist-07.txt"
     ipr="trust200902">
  <front>
    <title abbrev="TCP persist condition">TCP sender clarification for Persist
    Condition.</title>

    <author fullname="Murali Bashyam" initials="M." surname="Bashyam">
      <organization>Ocarina Networks, Inc</organization>

      <address>
        <postal>
          <street>42 Airport Parkway</street>

          <city>San Jose</city>

          <region>CA</region>

          <code>95110</code>

          <country>USA</country>
        </postal>

        <phone>+1 (408) 512-2966</phone>

        <email>mbashyam@ocarinanetworks.com</email>
      </address>
    </author>

    <author fullname="Mahesh Jethanandani" initials="M."
            surname="Jethanandani">
      <organization>Cisco</organization>

      <address>
        <postal>
          <street>170 Tasman Drive</street>

          <city>San Jose</city>

          <region>CA</region>

          <code>95134</code>

          <country>USA</country>
        </postal>

        <phone>+1 (408) 527-8230</phone>

        <email>mjethanandani@gmail.com</email>
      </address>
    </author>

    <author fullname="Anantha Ramaiah" initials="A." surname="Ramaiah">
      <organization>Cisco</organization>

      <address>
        <postal>
          <street>170 Tasman Drive</street>

          <city>San Jose</city>

          <region>CA</region>

          <code>95134</code>

          <country>USA</country>
        </postal>

        <phone>+1 (408) 525-6486</phone>

        <email>ananth@cisco.com</email>
      </address>
    </author>

    <date day="15" month="September" year="2011" />

    <area>Transport</area>

    <workgroup>TCP Maintenance and Minor Extensions Working Group</workgroup>

    <keyword>Internet-Draft</keyword>

    <abstract>
      <t>This document clarifies the Zero Window Probes (ZWP) described in
      <xref target="RFC1122">Requirements for Internet Hosts</xref>. In
      particular, it clarifies the actions that can be taken on connections
      which are experiencing the ZWP condition. This draft clarifies what has
      been till now a misinterpretation of the standard as specified in <xref
      target="RFC1122">RFC 1122</xref> rather than making a change to the
      standard.</t>
    </abstract>
  </front>

  <middle>
    <section title="Introduction">
      <t>Section 4.2.2.17 of <xref target="RFC1122">Requirements for Internet
      Hosts </xref> says:<list style="empty">
          <t>"A TCP MAY keep its offered receive window closed indefinitely.
          As long as the receiving TCP continues to send acknowledgments in
          response to the probe segments, the sending TCP MUST allow the
          connection to stay open.</t>

          <t>DISCUSSION:<list style="empty">
              <t>It is extremely important to remember that ACK
              (acknowledgment) segments that contain no data are not reliably
              transmitted by TCP."</t>
            </list></t>
        </list></t>

      <t>Therefore zero window probing needs to be supported to prevent a
      connection from hanging forever if ACK segments that re-opens the window
      is lost. The condition where the sender goes into the Zero Window Probe
      (ZWP) mode is typically known as the 'persist condition'.</t>

      <t>This guidance is not intended to preclude resource management by the
      operating system or application, which may request connections to be
      aborted regardless of them being in the persist condition, and the TCP
      implementation needs to, of course, comply by aborting such connections.
      TCP implementations that misinterpret Section 4.2.2.17 of <xref
      target="RFC1122">Requirements for Internet Hosts</xref> have the
      potential to make systems vulnerable to <xref target="RFC4732"> Denial
      of Service (DoS)</xref> scenarios where attackers tie up resources by
      keeping connections in the persist condition, if such resource
      management is not performed external to the protocol implementation.</t>

      <t>This draft clarifies what has been till now a misinterpretation of
      the standard as specified in <xref target="RFC1122"> RFC 1122</xref>,
      rather than making a change to the standard.</t>

      <t>Section 2 of this document describes why implementations might not
      close connections merely because they are in the persist condition, yet
      need to still allow such connections to be closed on command. Section 3
      outlines a simple attack on systems that do not sufficiently manage
      connections in this state. Section 4 concludes with a
      requirements-language clarification to the RFC 1122 requirement.</t>
    </section>

    <section title="Discussion on RFC 1122 Requirement">
      <t>Per <xref target="RFC1122">Requirements for Internet Hosts</xref> as
      long as the ACK's are being received for window probes, a connection can
      continue to stay in the persist condition. This is an important feature
      because typically applications would want the TCP connection to stay
      open unless an application explicitly closes the connection.</t>

      <t>For example take the case of user running a network print job during
      which the printer runs out of paper and is waiting for the user
      intervention to reload the paper tray. The printer may not be reading
      data from the printing application during this time. Although this may
      result in a prolonged ZWP state, it would be premature for TCP to take
      action on its own and close the printer connecting merely due to its
      lack of progress. Once the printer&rsquo;s paper tray is reloaded (which
      may be minutes, hours, or days later), the print job needs to be able to
      continue uninterrupted over the same TCP connection.</t>

      <t>However, systems that misinterpret the above section of <xref
      target="RFC1122">Requirements for Internet Hosts</xref> may fall victim
      to DoS attacks, by not supporting sufficient mechanisms to allow release
      of system resources tied up by connections in the persist condition
      during times of resource exhaustion. For example, if we take the case of
      a busy server where multiple (attacker) clients can advertise a zero
      window forever (by reliably acknowledging the ZWPs). This could
      eventually lead to the resource exhaustion in the server system. In such
      cases the application or operating system would need to take appropriate
      action on the TCP connection to reclaim their resources and continue to
      maintain legitimate connections.</t>

      <t>The problem is applicable to TCP and TCP derived flow-controlled
      transport protocols like SCTP.</t>

      <t>Clearly, a system needs to be robust to such attacks and allow
      connections in the persist condition to be aborted in the same way as
      any other connection. Section 4 of this document provides the requisite
      clarification, to permit such resource management</t>
    </section>

    <section title="Description of one Simple Attack">
      <t>To illustrate a potential DoS scenario, consider the case where many
      client applications open TCP connection with a <xref
      target="RFC2616">HTTP</xref> server, and each sends a GET request for a
      large page and stops reading the response partway through. This causes
      the client's TCP implementation to advertise a zero window to the
      server. For every large HTTP response, the server is left holding on to
      the response data in its sending queue. The amount of response data held
      will depend on the size of the send buffer and the advertised window. If
      the clients never read the data in their receive queues in order to
      clear the persist condition, the server will continue to hold that data
      indefinitely. Since there may be a limit to the operating system kernel
      memory available for TCP buffers, this may result in DoS to legitimate
      connections by locking up the necessary resources. If the above scenario
      persists for an extended period of time, it will lead to TCP buffers and
      connection blocks starvation causing legitimate existing connections and
      new connection attempts to fail.</t>

      <t>A clever application needs to detect such attacks with connections
      that are not making progress, and could close these connections.
      However, some applications might have transferred all the data to the
      TCP socket and subsequently closed the socket leaving the connection
      with no controlling process, hereby referred to as orphaned connections.
      Such orphaned connections might be left holding the data indefinitely in
      their sending queue.</t>

      <t>CERT has released an advisory in this regard<xref target="VU723308">
      </xref> and is making vendors aware of this DoS scenario.</t>
    </section>

    <section title="Clarification Regarding RFC 1122 Requirements">
      <t>As stated in <xref target="RFC1122">Requirements for Internet
      Hosts</xref>, a TCP implementation MUST NOT close a connection merely
      because it seems to be stuck in the ZWP or persist condition. Unstated
      in RFC 1122, but implicit for system robustness, a TCP implementation
      needs to allow connections in the ZWP or persist condition to be closed
      or aborted by their applications or other resource management routines
      in the operating system.</t>

      <t>An interface that allows an application to inform TCP on what to do
      when the connection stays in persist condition, or for application or
      other resource manager to query the health of the TCP connection is
      considered outside the scope of this document. All such techniques
      however are in complete compliance of <xref target="RFC0793">TCP</xref>
      and <xref target="RFC1122">Requirements for Internet Hosts</xref>.</t>
    </section>

    <section title="IANA Considerations">
      <t>This document has no actions for IANA.</t>
    </section>

    <section title="Security Considerations">
      <t>This document discusses one system security consideration as
      described in <xref target="RFC3552">Security Considerations
      Guidelines</xref>. In particular it describes a inappropriate use of a
      system that is acting as a server for many users. That and a possible
      DoS attack is discussed in Section 3.</t>

      <t>The document limits itself to clarifying RFC 1122. It does not
      discuss what can happen with orphaned connections and other possible
      mitigation techniques, as these are considered outside the scope of this
      document.</t>
    </section>

    <section title="Acknowledgments">
      <t>This document was inspired by the recent discussions that took place
      regarding the TCP persist condition issue in the TCPM WG mailing list
      <xref target="TCPM"></xref>. The outcome of those discussions was to
      come up with a draft that would clarify the intentions of the ZWP
      referred by RFC 1122. We would like to thank Mark Allman, Ted Faber and
      David Borman for clarifying the objective behind this draft. To Wesley
      Eddy for his extensive editorial comments and to Dan Wing, Mark Allman
      and Fernando Gont on providing feedback on the document.</t>
    </section>
  </middle>

  <back>
    <references title="Normative References">
      <?rfc include='reference.RFC.0793'?>

      <?rfc include='reference.RFC.1122'?>

      <?rfc include='reference.RFC.2119'?>
    </references>

    <references title="Informative References">
      <?rfc include="reference.RFC.2616"?>

      <?rfc include='reference.RFC.3552'?>

      <?rfc include='reference.RFC.4732'?>

      <reference anchor="TCPM">
        <front>
          <title>IETF TCPM Working Group and mailing list
          http://www.ietf.org/html.charters/tcpm.charter.html</title>

          <author fullname="TCPM" surname="TCPM">
            <organization></organization>
          </author>

          <date />
        </front>
      </reference>

      <reference anchor="VU723308">
        <front>
          <title>Vulnerability in Web Servers
          http://www.kb.cert.org/vuls/id/723308</title>

          <author fullname="Art Manion" surname="Manion">
            <organization>CERT</organization>

            <address>
              <uri>http://www.cert.org</uri>
            </address>
          </author>

          <date day="10" month="July" year="2009" />
        </front>
      </reference>
    </references>
  </back>
</rfc>
