Understanding SYN Flood Attacks
A SYN flood occurs when a host becomes so overwhelmed by SYN segments initiating incomplete connection requests that it can no longer process legitimate connection requests.
Two hosts establish a TCP connection with a triple exchange of packets known as a three-way handshake: A sends a SYN segment to B; B responds with a SYN/ACK segment; and A responds with an ACK segment. A SYN flood attack inundates a site with SYN segments containing forged (spoofed) IP source addresses with nonexistent or unreachable addresses. B responds with SYN/ACK segments to these addresses and then waits for responding ACK segments. Because the SYN/ACK segments are sent to nonexistent or unreachable IP addresses, they never elicit responses and eventually time out. See Figure 74.
Figure 74: SYN Flood Attack

By flooding a host with incomplete TCP connections, the attacker eventually fills the memory buffer of the victim. Once this buffer is full, the host can no longer process new TCP connection requests. The flood might even damage the victim's operating system. Either way, the attack disables the victim and its normal operations.
This topic includes the following sections:
SYN Flood Protection
Junos OS can impose a limit on the number of SYN segments permitted to pass through the firewall per second. You can base the attack threshold on the destination address and port, the destination address only, or the source address only. When the number of SYN segments per second exceeds one of these thresholds, Junos OS starts proxying incoming SYN segments, replying with SYN/ACK segments and storing the incomplete connection requests in a connection queue. The incomplete connection requests remain in the queue until the connection is completed or the request times out. In Figure 75, the SYN attack threshold has passed, and Junos OS has started proxying SYN segments.
Figure 75: Proxying SYN Segments

In Figure 76, the proxied connection queue has completely filled up, and Junos OS is rejecting new incoming SYN segments. This action shields hosts on the protected network from the bombardment of incomplete three-way handshakes.
Figure 76: Rejecting New SYN Segments

The device starts receiving new SYN packets when the proxy queue drops below the maximum limit.
![]() | Note: The procedure of proxying incomplete SYN connections above a set threshold pertains only to traffic permitted by existing policies. Any traffic for which a policy does not exist is automatically dropped. |
SYN Flood Options
You can set the following parameters for proxying uncompleted TCP connection requests:
- Attack Threshold—This option allows you to set the number of SYN segments (that is, TCP segments with the SYN flag set) to the same destination address and port number per second required to activate the SYN proxying mechanism. Although you can set the threshold to any number, you need to know the normal traffic patterns at your site to set an appropriate threshold for it. For example, if it is an e-business site that normally gets 20,000 SYN segments per second, you might want to set the threshold to 30,000 per second. If a smaller site normally gets 20 SYN segments per second, you might consider setting the threshold to 40.
- Alarm Threshold—This option allows you to set the
number of proxied, half-complete TCP connection requests per second
after which Junos OS enters an alarm in the event log.The value you
set for an alarm threshold triggers an alarm when the number of proxied,
half-completed connection requests to the same destination address
and port number per second exceeds that value. For example, if you
set the SYN attack threshold at 2000 SYN segments per second and the
alarm at 1000, then a total of 3001 SYN segments to the same destination
address and port number per second is required to trigger an alarm
entry in the log. More precisely:
- The firewall passes the first 2000 SYN segments per second that meet policy requirements.
- The firewall proxies the next 1000 SYN segments in the same second.
- The 1001st proxied connection request (or 3001st connection
request in that second) triggers the alarm.
For each SYN segment to the same destination address and port number in excess of the alarm threshold, the attack detection module generates a message. At the end of the second, the logging module compresses all similar messages into a single log entry that indicates how many SYN segments to the same destination address and port number arrived after exceeding the alarm threshold. If the attack persists beyond the first second, the event log enters an alarm every second until the attack stops.
- Source Threshold—This option allows you to specify
the number of SYN segments received per second from a single source
IP address—regardless of the destination IP address and port
number—before Junos OS begins dropping connection requests from
that source.
Tracking a SYN flood by source address uses different detection parameters from tracking a SYN flood by destination address and destination port number. When you set a SYN attack threshold and a source threshold, you put both the basic SYN flood protection mechanism and the source-based SYN flood tracking mechanism in effect.
- Destination Threshold—This option allows you to
specify the number of SYN segments received per second for a single
destination IP address before Junos OS begins dropping connection
requests to that destination. If a protected host runs multiple services,
you might want to set a threshold based on destination IP address
only—regardless of the destination port number.
When you set a SYN attack threshold and a destination threshold, you put both the basic SYN flood protection mechanism and the destination-based SYN flood tracking mechanism in effect.
Tracking a SYN flood by destination address uses different detection parameters from tracking a SYN flood by destination address and destination port number. Consider the following case where Junos OS has policies permitting FTP requests (port 21) and HTTP requests (port 80) to the same server. If the SYN flood attack threshold is 1000 packets per second (pps) and an attacker sends 999 FTP packets and 999 HTTP pps, neither set of packets (where a set is defined as having the same destination address and port number) activates the SYN proxying mechanism. The basic SYN flood attack mechanism tracks destination address and port number, and neither set exceeds the attack threshold of 1000 pps. However, if the destination threshold is 1000 pps, Junos OS treats both FTP and HTTP packets with the same destination address as members of a single set and rejects the 1001st packet—FTP or HTTP—to that destination.
- Timeout—This option allows you to set the maximum length of time before a half-completed connection is dropped from the queue.The default is 20 seconds, and you can set the timeout from 0–50 seconds. You might try decreasing the timeout value to a shorter length until you begin to see any dropped connections during normal traffic conditions. Twenty seconds is a very conservative timeout for a three-way handshake ACK response.
Related Topics
- Junos OS Feature Support Reference for SRX Series and J Series Devices
Hide Navigation Pane
Show Navigation Pane
Download
SHA1
