Web & servers
DDoS response: keeping critical services reachable
A practical DDoS attack response guide: tell an attack from an outage, handle L3/4 and L7 floods, protect the origin IP, work with providers, prepare ahead.
Your site or API is slow or unreachable, and someone has said “DDoS.” Good DDoS attack response starts with checking that it is one, then picking mitigations that match the kind of flood you’re facing. This walks through both, plus the preparation that makes the next one shorter.
Is it a DDoS, an outage, or your own deployment?
Plenty of “attacks” turn out to be a release that shipped an N+1 query, an expired certificate, a cron job that locked a table, or a marketing email that sent everyone to an uncached landing page. Spend the first ten minutes ruling those out; the fixes are completely different.
Ask four questions:
- Did anything change? Deployments, config pushes, DNS edits, certificate renewals, scheduled jobs, campaigns. Check the deploy log before the firewall.
- Is inbound traffic actually up? Look at bandwidth, packets per second and requests per second against a normal day. If traffic is flat and errors are up, it’s probably you.
- Where are the errors produced? A CDN returning 502 or 504 means it can’t get a timely answer from your origin. Timeouts before anything reaches your CDN point further upstream.
- What else shares the link? If the VPN, email and phones died at the same time as the website, the pipe is full, which points toward a volumetric attack.
On a Linux web server, a few commands give you a fast picture:
# top client addresses in recent requests
tail -n 50000 /var/log/nginx/access.log | awk '{print $1}' | sort | uniq -c | sort -rn | head -20
# most requested paths
tail -n 50000 /var/log/nginx/access.log | awk '{print $7}' | sort | uniq -c | sort -rn | head -20
# half-open TCP connections (high counts suggest a SYN flood)
ss -n state syn-recv | wc -l
If you’re behind a CDN or load balancer, the first log field is probably the proxy’s address. Use the header you log for the real client (X-Forwarded-For, or your CDN’s equivalent) or the CDN’s own analytics.
One more lookalike. A flood of POST requests to /login with a different username each time is usually credential stuffing, not a DDoS. The outage is a side effect; the goal is account takeover, and the response includes checking which logins succeeded.
Layer 3/4 or layer 7: the distinction that drives every decision
Network and transport layer attacks (L3/4) try to fill your bandwidth or exhaust connection state. Think UDP reflection and amplification through open DNS, NTP, memcached or CLDAP servers, or SYN floods. They’re measured in gigabits and packets per second. By the time that traffic reaches your server, the link is already full, so nothing you configure on the server will help.
Application layer attacks (L7) send HTTP requests that look legitimate, often aimed at expensive pages: search, login, basket, report generation. They’re measured in requests per second and can bring down a database with very little bandwidth. These you can fight at the CDN, the WAF and in the application itself.
Many attacks mix the two, and attackers switch vectors when one stops working, so keep watching after the first mitigation lands. CISA’s primer on denial-of-service attacks and Cloudflare’s explainer on DDoS attack types are good background for colleagues.
For volumetric floods, the answer is upstream
If your link is saturated, call whoever sits in front of it: your ISP, your hosting provider, your cloud platform or your DDoS mitigation service. Have this ready before you dial:
- Account or contract number, and whether DDoS protection is part of it
- Target IP addresses or prefixes, and the start time in UTC
- Graphs showing the spike, and a small packet capture if you can get one, for example
tcpdump -n -i eth0 -c 2000 -w ddos-sample.pcap - What you need: scrubbing, filtering of specific protocols or source ports, or a blackhole
The options usually come down to three. Filtering upstream (dropping UDP from source port 123 or 11211, for example) is cheap and effective against simple reflection. Scrubbing, where traffic is diverted through a cleaning center via BGP or DNS, handles larger and messier attacks. Remote triggered blackholing drops all traffic to the target IP at the provider’s edge.
Blackholing deserves a clear-eyed decision. It completes the attacker’s job for that one address while saving everything else on the link. That’s a fine trade if the target is a marketing site and the same pipe carries your payment API. It’s a terrible trade if the target is the payment API.
In the cloud, AWS Shield Standard is applied automatically, with Shield Advanced, Azure DDoS Protection and Google Cloud Armor as paid layers. Know which you have before you need it.
For HTTP floods: find what’s expensive, then protect it
Rate limiting
Limit per path rather than globally. Five login attempts per minute per client is reasonable; five page views per minute is not. Remember that many genuine users can share one address behind corporate proxies and mobile carrier NAT, so blanket per-IP limits can lock out a whole office or a whole mobile network.
Caching
Anything an anonymous visitor sees should be served from the edge. Attackers know this and append random query strings (?q=8f3a…) to force cache misses, so configure the CDN to ignore or normalize query parameters your application doesn’t use. Serving stale content when the origin errors keeps the site looking alive while you work.
Challenges and blocking
JavaScript or managed challenges filter out most simple bots without bothering real users much. Blocking hosting-provider ASNs works when your customers are consumers. Geographic blocking is a blunt last resort with a business cost; agree it with whoever owns revenue. User-agent rules buy minutes at best.
Degrade on purpose
Turning off search or a report generator for two hours is better than losing the whole site. A static “we’re experiencing high load” page for the expensive paths is a perfectly respectable mitigation.
Is your origin IP already public?
A CDN only protects you if attackers can’t go around it. If they hit the origin directly, the CDN is decoration. Common leaks:
- Historical DNS records from before you moved behind the CDN
- Subdomains that aren’t proxied:
dev.,staging.,cpanel.,ftp. - MX records or SPF
ip4:entries pointing at the same server - Outbound connections from the server, such as webhooks or WordPress pingbacks
- Internet-wide certificate scans that match your TLS certificate on the origin’s IP
The fix is to accept web traffic at the origin only from your CDN’s published address ranges, add authenticated origin pulls if your CDN supports them, and move the origin to a new IP if the old one is known.
Warning: CDN providers change their published IP ranges from time to time. If your origin firewall allowlist is maintained by hand, a stale list will eventually block your own CDN and look exactly like an attack.
Talking to your ISP, host or CDN during the attack
Open a ticket and phone at the same time, and ask for the network operations or DDoS team rather than first-line support. Nominate one contact on your side. Ask what they see, what they’ve applied, and how long it stays in place. Log every change with a timestamp.
Keep customers informed through a status page hosted somewhere other than the infrastructure under attack. Say the service is degraded because of an attack and that you’re working with your providers. Only say no data was affected if you actually know that. A DDoS is occasionally used as noise to cover an intrusion elsewhere, so have someone keep watching EDR and sign-in alerts. If something else turns up during the flood, it becomes a different kind of incident; our emergency incident response desk takes those reports at [email protected], acknowledged within 15 minutes.
Extortion DDoS: when the email arrives first
Ransom DDoS letters follow a pattern: a demand in cryptocurrency, a deadline, sometimes a short demonstration attack, and often the borrowed name of a well-known group. Many of these threats are never followed by a sustained attack. Some are.
Don’t pay and don’t reply. Payment guarantees nothing and marks you as a payer. Preserve the email with full headers, warn your providers so they can pre-position mitigation before the deadline, and report it to law enforcement; in the US that means the FBI’s IC3.
Preparing your DDoS response before it happens
- Know who sits upstream of every critical service and whether DDoS mitigation is in the contract. Put their emergency numbers in the plan.
- Record normal traffic: bandwidth, packets per second, requests per second, by hour of day.
- Put public web properties behind a CDN now, with origins locked to its ranges. If you can’t, keep DNS TTLs short enough to move quickly.
- Pre-build “under attack” rules you can switch on: stricter rate limits on login and search, challenge mode, cache-everything for anonymous paths.
- Decide in advance which services you’d sacrifice to keep the critical ones up.
- Host the status page separately, and test the whole runbook once a year.
If you’re mid-attack right now, the next ten minutes look like this: check the deploy log, confirm traffic is genuinely up, work out whether the pipe or the application is choking, and call the provider who can act on it. If a second problem appears alongside the flood, report it to a responder rather than leaving it until the graphs calm down. Website compromises that surface after an attack are covered in our triage guide for hacked sites.
Dealing with this right now?
A responder will acknowledge your report within 15 minutes, 24/7.
Related service: Website & Server Compromise