SYN flood attack
Protocol AttacksDec 21, 2022
8 min read
SYN Flood Attack
A SYN flood attack is a type of distributed denial of service (DDoS) attack that exploits a vulnerability in the way that TCP (Transmission Control Protocol) establishes a connection between two devices. The goal of a SYN flood attack is to overwhelm the target system with an excessive number of incomplete connection requests, causing the system to become unresponsive to legitimate traffic.
TCP is a connection-oriented protocol that requires a three-way handshake to establish a connection between two devices. This process involves the following steps:
- The client sends a SYN (synchronize) packet to the server, containing a unique sequence number.
- The server responds with a SYN-ACK (acknowledgment) packet, containing its own sequence number and the sequence number of the original SYN packet.
- The client responds with an ACK (acknowledgment) packet, acknowledging receipt of the SYN-ACK packet.
Once this three-way handshake is complete, the connection is established and data can be transmitted between the two devices.
In a SYN flood attack, the attacker sends a large number of SYN packets to the target system, typically using a network of compromised devices (a botnet) to amplify the attack. However, the attacker never responds to the SYN-ACK packets that the target system sends in response, leaving the connection in an incomplete state known as a "half-open" connection. As the target system continues to receive SYN packets and send SYN-ACK packets in response, it becomes overwhelmed with the number of half-open connections and can no longer accept new connections or process legitimate traffic.
Here's how a SYN flood attack works
- The attacker sends a large number of SYN packets to the target system, typically using a network of compromised devices (a botnet) to amplify the attack.
- Each SYN packet contains a unique identifier known as a sequence number, which is used to establish the connection between the two devices.
- When the target system receives a SYN packet, it responds with a SYN-ACK (acknowledgment) packet, which contains its own sequence number and the sequence number of the original SYN packet.
- The attacker never responds to the SYN-ACK packet, leaving the connection in an incomplete state known as a "half-open" connection.
- As the target system continues to receive SYN packets and send SYN-ACK packets in response, it becomes overwhelmed with the number of half-open connections and can no longer accept new connections or process legitimate traffic.
There are several ways that a SYN flood attack can occur:
- Single source attack: In this type of attack, the SYN packets are sent from a single source, such as a single compromised device or a group of devices under the control of the attacker. This type of attack can be relatively easy to defend against if the source can be identified and blocked. However, if the attacker is able to use multiple sources or rotate the source IP address frequently, the attack may be more difficult to mitigate.
- Distributed attack: In a distributed attack, the SYN packets are sent from multiple sources, often using a botnet to amplify the attack. This makes it more difficult to trace the attack back to the original source and can make the attack more difficult to defend against. Distributed SYN flood attacks can be particularly damaging because they can generate a high volume of traffic from multiple directions, making it harder for the target system to filter out the malicious packets. In addition, if the attacker is able to use a large and diverse botnet, the attack may be more difficult to detect and mitigate.
- Reflective attack: In a reflective attack, the attacker sends SYN packets to a third-party system with the target system's IP address as the source. The third-party system responds with SYN-ACK packets, which are then sent to the target system, amplifying the attack and making it more difficult to trace back to the original source. Reflective SYN flood attacks can be difficult to defend against because the attack traffic appears to be coming from a legitimate source. To mitigate this type of attack, it may be necessary to implement rate-limiting or blocking of SYN packets at the edge of the network or to use a load balancer or other traffic management device to distribute the incoming traffic across multiple servers.
- Direct attack: In a direct attack, the attacker sends SYN packets directly to the target system using the target's IP address as the destination. This type of attack is relatively easy to trace back to the source and can be easier to defend against than other types of SYN flood attacks. However, if the attacker is able to generate a high volume of SYN packets or use a botnet to amplify the attack, it may still be difficult for the target system to withstand the attack.
- Spoofed attack: Spoofed attack: In a spoofed attack, the attacker uses a fake IP address as the source of the SYN packets. This makes it difficult to trace the attack back to the original source and can make the attack more difficult to defend against. Spoofed SYN flood attacks can be particularly effective if the attacker is able to mimic the IP address of a trusted source, as the attack traffic may be more likely to bypass network security measures. To mitigate this type of attack, it may be necessary to implement network security measures that are capable of detecting and blocking spoofed traffic, such as anti-spoofing measures or ingress filtering. It may also be necessary to implement rate-limiting or blocking of SYN packets at the edge of the network or to use a load balancer or other traffic management device to distribute the incoming traffic across multiple servers.
Defending Against SYN Flood Attacks
There are several ways to defend against SYN flood attacks, including:
- Enabling SYN cookies: SYN cookies involve sending a SYN-ACK packet to the client without entering the connection into the system's connection queue, effectively bypassing the vulnerability that allows SYN flood attacks to occur. When the client responds with an ACK packet, the server can use the information in the packet to reassemble the connection and proceed with normal communication.
- Increasing the backlog queue: The backlog queue is a system resource that stores incoming connection requests when the system is unable to establish new connections. By increasing the size of the backlog queue, the system can store more incoming connection requests and may be better able to withstand a SYN flood attack. However, it's important to note that increasing the backlog queue may also increase the system's memory usage and may not be effective if the attack volume is particularly high.
- Recycling the oldest half-open TCP connection: In a SYN flood attack, the target system may become overwhelmed with half-open TCP connections that have not been completed. One way to mitigate this issue is to recycle the oldest half-open TCP connection when the system reaches a certain threshold of incomplete connections. This can free up resources and allow the system to accept new connections. However, it's important to note that recycling half-open connections may also disrupt legitimate connections and may not be effective if the attack volume is particularly high.
- Implementing rate-limiting: Rate-limiting involves setting a maximum number of SYN packets that the system will accept from a single IP address within a certain time period, effectively limiting the number of half-open connections that can be established.
- Using a load balancer: A load balancer can distribute incoming traffic across multiple servers, helping to prevent a single server from becoming overwhelmed with traffic.
It's important to note that SYN flood attacks are just one type of DDoS attack and that there are many other tactics and techniques that attackers can use to disrupt service. It's essential to have a comprehensive security strategy in place to protect against these types of attacks, including regular system updates, network monitoring, and incident response planning.
How does DiamWall mitigate SYN Flood attacks?
As a Content Delivery Network (CDN), DiamWall is positioned as the intermediate between a user's connection and the backend. This allows us to intercept and evaluate incoming traffic before it reaches our customers' backend, including SYN Flood attacks.
SYN Flood attacks are a type of Denial of Service (DoS) attack in which an attacker sends a large volume of SYN packets to a targeted server in an attempt to overwhelm its resources and disrupt its ability to handle legitimate requests. These attacks work by exploiting the TCP three-way handshake, in which a client sends a SYN packet to initiate a connection with a server, and the server responds with a SYN-ACK packet to confirm the connection. The client then sends an ACK packet to complete the handshake and establish the connection.
To mitigate SYN Flood attacks, DiamWall stands between the targeted server and the flood of SYN packets. When the initial SYN request is made, DiamWall handles the handshake process in the cloud, withholding the connection with the targeted server until the TCP handshake is complete. This strategy takes the resource cost of maintaining the connections with the bogus SYN packets off the targeted server and places it on DiamWall's Anycast network, effectively mitigating the attack.
In addition to this strategy, DiamWall also has advanced mitigation systems in place to detect and mitigate SYN Flood attacks at any scale. Our experienced team of security professionals works tirelessly to ensure that our customers are able to continue providing uninterrupted service to their users, even in the face of a SYN Flood attack. To learn more about how DiamWall's DDoS protection works, please read this topic.