Re: packets with syn/fin vs pf_norm.c

From: Garrett Wollman (wollman_at_csail.mit.edu)
Date: 07/05/05

  • Next message: FreeBSD Security Advisories: "FreeBSD Security Advisory FreeBSD-SA-05:16.zlib"
    Date: Tue, 5 Jul 2005 16:35:29 -0400
    To: Darren Reed <avalon@caligula.anu.edu.au>
    
    

    <<On Wed, 6 Jul 2005 00:28:45 +1000 (Australia/ACT), Darren Reed <avalon@caligula.anu.edu.au> said:

    > No, you're wrong on this.

    > Packets for TCP with SYN + FIN set are valid under T/TCP.

    Packets for TCP with SYN + FIN set are valid under TCP, period. See
    RFC 793 page 66, where it describes the processing of segments with
    the SYN bit set:

            The connection state should be changed to SYN-RECEIVED. Note
            that any other incoming control or data (combined with SYN)
            will be processed in the SYN-RECEIVED state, but processing of
            SYN and ACK should not be repeated.

    Later, on page 75, the spec discusses the handling of FIN bits:

        eighth, check the FIN bit,

         Do not process the FIN if the state is CLOSED, LISTEN or SYN-SENT
         since the SEG.SEQ cannot be validated; drop the segment and
         return.

    [We are in SYN-RECEIVED at this point so this graf does not apply.]

          If the FIN bit is set, signal the user "connection closing" and
          return any pending RECEIVEs with same message, advance RCV.NXT
          over the FIN, and send an acknowledgment for the FIN. Note that
          FIN implies PUSH for any segment text not yet delivered to the
          user.

            SYN-RECEIVED STATE
            ESTABLISHED STATE

              Enter the CLOSE-WAIT state.

    See also section 3.4 on page 30.

    The only thing that RFC 1644 adds to this is the ability to
    short-circuit the three-way handshake by means of persistent sequence
    numbers. In short, SYN+FIN segments are legitimate *whether or not*
    one is using T/TCP (and one should not be at this point in time, as
    the T/TCP protocol is known to be flawed).

    Note that the specification does not require a receiver-TCP to buffer
    data (including the FIN bit) received on SYN, and FreeBSD in the
    current implementation does not do so unless RFC 1644 is in use. What
    PF is doing is not obviously wrong, since it is what FreeBSD's TCP
    would normally do anyway.

    -GAWollman

    _______________________________________________
    freebsd-security@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-security
    To unsubscribe, send any mail to "freebsd-security-unsubscribe@freebsd.org"


  • Next message: FreeBSD Security Advisories: "FreeBSD Security Advisory FreeBSD-SA-05:16.zlib"

    Relevant Pages

    • Improved TCP syncookie implementation
      ... rid of some locking in TCP syncache and to improve their functionality. ... The RFC1323 timestamp option is used to carry the full TCP SYN+SYN/ACK ... The purpose of SYN cookies is to avoid keeping track of all SYN's we ... The idea of SYN cookies is to encode and include all necessary information ...
      (freebsd-net)
    • Re: Seeking UFFI for sockets on Linux
      ... The problem might spring from the fact that closing a TCP socket does ... will send a TCP segment with the FIN flag set and change state to ... the client will change state ...
      (comp.lang.lisp)
    • Re: TCP: a practical question
      ... I think your referring to a part of the RFC that is attempting to describe ... passive and active opens. ... Normally TCP connection establishment is a three packet sequence. ... with real-world attacks from CORE IMPACT. ...
      (Focus-IDS)
    • Re: [fw-wiz] CERT vulnerability note VU# 539363
      ... > I've not seen much discussion on TCP SYN Cookies for SYN Flood ... I've been considering the pros and cons of using SYN cookies ... >] - LOGGING! ...
      (Firewall-Wizards)
    • Re: ISP Redundancy Configuration
      ... after that the end points will be send an ack packet with data, ... In line 2 of figure 7, TCP A begins by sending a SYN segment ... indicating that it will use sequence numbers starting with sequence ...
      (comp.security.firewalls)