keepcalculator

06 Numbers and Powers

DDoS Knock Services Offline: Pre-Capacity Guide

Card No. 06·67442 · Updated · Standard formula, shown below

This guide explains how distributed denial-of-service (DDoS) attacks can knock a service offline even when the attack traffic never comes close to saturating the internet link. You’ll learn the specific techniques—SYN floods, application-layer floods, and state-exhaustion attacks—that target server resources rather than bandwidth, and how to recognize and mitigate them. No prior security experience is needed, but a basic understanding of TCP/IP and web servers helps.

What You’ll Need

  • A test server or a lab environment (e.g., a virtual machine) where you can safely run and observe attacks.
  • Basic command-line access to the server (Linux recommended).
  • Optional: a network monitoring tool like tcpdump or iftop to observe traffic.
  • For demonstration only: a tool like hping3 or ab (ApacheBench) to generate controlled test traffic.

Step-by-Step

  1. Understand the target’s resource limits. A server has finite CPU, memory, file descriptors, and connection table slots. The goal of a resource-exhaustion DDoS is to fill these before the network link is saturated. For example, a single server can handle thousands of connections but only a few thousand half-open connections before its SYN backlog fills.
  2. Identify the attack surface. Determine which services are exposed (e.g., HTTP, HTTPS, DNS). Each service has its own resource limits. For HTTP, the number of concurrent connections and the speed of processing requests matter. For DNS, the rate of queries that require recursion is critical.
  3. Launch a SYN flood. This is the classic low-bandwidth attack. The attacker sends a stream of TCP SYN packets with spoofed source IP addresses. The server responds with SYN-ACK and waits for the final ACK that never comes. Each half-open connection consumes a slot in the server’s connection table. Once the table is full, legitimate connections are refused. This can be done with a single machine sending a few hundred packets per second—far below any link capacity.
  4. Use an application-layer flood. If the server has a public web endpoint, send a high volume of HTTP GET requests that require heavy processing, such as requests for large database queries or complex API endpoints. Even a modest number of such requests (e.g., 100 per second) can exhaust CPU or database connection pools, causing timeouts and errors for real users.
  5. Exhaust connection state with slowloris. Open many connections to the server and send partial HTTP requests, then keep them open by sending a small amount of data periodically. Each connection consumes a file descriptor and a thread. With 1,000 such connections, a typical Apache server can be brought down, all while using less than 1 Mbps of bandwidth.
  6. Amplify with DNS reflection (optional). If you have access to an open DNS resolver, send spoofed queries that generate large responses (e.g., ANY or DNSSEC records). The responses are sent to the victim. A single 60-byte query can produce a 4,000-byte response, amplifying traffic by ~70x. This can saturate the victim’s link, but the amplification also makes it a bandwidth attack; for pure resource exhaustion, the previous steps are more effective.
  7. Monitor the impact. Use netstat to check the number of half-open connections, top to see CPU usage, and free for memory. The service will become unresponsive when resources are exhausted, even though the link is idle.

Common Mistakes

  • Focusing only on bandwidth. Many beginners assume a DDoS must saturate the pipe. In reality, resource exhaustion attacks are more common and require far less traffic.
  • Using real IP addresses in SYN floods. Without spoofing, the server’s SYN-ACK responses will be sent to your IP, and your OS will send RST packets, clearing the half-open connections quickly.
  • Ignoring the server’s connection limits. A default Linux server can handle tens of thousands of connections, so a few hundred SYN packets won’t do anything. You need to exceed the limit, which is usually in the thousands.
  • Testing on a production server. Always use a lab environment to avoid causing real outages.

Tips

  • To make a SYN flood more effective, vary the source IPs and ports. Use a tool like hping3 with the --rand-source option.
  • For application-layer attacks, target the most expensive endpoints (e.g., search, login, or report generation).
  • Combine techniques: a SYN flood to fill the connection table, plus a slowloris to hold connections, plus a few HTTP POST requests that trigger heavy processing.
  • To defend, enable SYN cookies (net.ipv4.tcp_syncookies=1), limit connection rates with iptables, and use a reverse proxy with request rate limiting.

Troubleshooting

  • Attack has no effect. Check if the server’s connection table is actually filling. Use ss -s to see the number of TCP sockets. If it’s not increasing, your SYN packets may be getting dropped by the OS (e.g., due to iptables rules) or the server has SYN cookies enabled, which mitigates the attack.
  • Service crashes but recovers quickly. The server may be restarting automatically (e.g., via systemd). Check journalctl for crash logs. You may need to increase the intensity of the attack to keep it down.
  • Bandwidth is still low but the service is down. That’s the expected outcome. If the service is down but the link is fine, you’ve successfully exhausted resources. If you want to see the link also saturate, you’ll need a much larger botnet or amplification.
  • Can’t spoof IPs. Many cloud providers block spoofed source IPs. In that case, use a tool that doesn’t require spoofing, like slowloris or an HTTP flood.
  • Attack is being blocked by a firewall. Some hosting providers have DDoS protection that will null-route your IP. Use a VPN or rotate IPs, but note that this is often against terms of service.

Frequently Asked Questions

  1. Can a single computer really take down a server? Yes, if the server has limited resources and the attack targets those resources. A single machine can send thousands of SYN packets per second, which is enough to fill the connection table of a typical server.
  2. Why doesn’t the internet link get saturated? Because the attack is designed to exhaust server resources, not bandwidth. Each SYN packet is tiny (40 bytes), so even 10,000 packets per second is only 400 Kbps—far below a typical 1 Gbps link.
  3. What is the difference between a SYN flood and a slowloris attack? A SYN flood fills the connection table with half-open connections. A slowloris attack opens full connections and sends partial HTTP requests, holding them open to exhaust file descriptors and threads.
  4. How can I protect my server? Enable SYN cookies, limit the number of connections per IP, use a reverse proxy with rate limiting, and deploy a Web Application Firewall (WAF). For large-scale attacks, consider a DDoS mitigation service.
  5. Is it legal to test these attacks? Only on systems you own or have explicit permission to test. Unauthorized attacks are illegal and can result in criminal charges.
  6. Why do attackers use spoofed IPs? To hide their identity and to prevent the server from sending RST packets back, which would clear the half-open connections.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →