hping wiki

SYN cookies are particular choices of TCP initial sequence numbers (ISNs) by TCP servers. SYN cookies are used to defend against a type of denial of service attack known as SYN flooding. Special calculations are used to create initial sequence number so that the difference between the server's ISN and the client's ISN is:
  • top 5 bits: t mod 32, where t is a 32-bit time counter that increases every 64 seconds;
  • next 3 bits: an encoding of a maximum segment size (MSS) selected by the server in response to the client's MSS;
  • bottom 24 bits: a server-selected secret function of the client IP address and port number, the server IP address and port number, and t.

This choice of sequence number complies with the basic TCP requirement that sequence numbers increase slowly; the server's initial sequence number increases slightly faster than the client's initial sequence number.
A server that uses SYN cookies doesn't have to drop connections when its SYN queue fills up. Instead it sends back a SYN-ACK, exactly as if the SYN queue had been larger. (Exceptions: the server must reject TCP options such as large windows, and it must use one of the eight MSS values that it can encode.) When the server receives an ACK, it checks that the secret function works for a recent value of t, and then rebuilds the SYN queue entry from the encoded MSS.
Edit this page Upload file Page history - Page last update: Mon Sep 05 15:19:29 GMT 2005 by | Your address: | Admin