A web application firewall is a server, and a flood is a workload.
Most WAF testing ignores that. It sends a crafted request, checks that the right rule matched, and moves on. That answers whether the WAF can recognise an attack. It says nothing about what the WAF does when ten thousand requests a second arrive and most of them look fine.
Under a flood the WAF stops being only a classifier. It is a component with a CPU budget, a body-size limit, a rule order that every request walks, a failure mode and a log pipeline. Any of those can give out before the origin does. This post is about testing the WAF as that component: the part of WAF testing that belongs to DDoS testing.
Two tests that share a name
"WAF testing" usually means one of two things, and only one of them tells you how the WAF behaves under a flood.
| Functional WAF test | WAF DDoS test | |
|---|---|---|
| Question | Does rule X match payload Y? | What does the WAF do at flood rates? |
| Traffic | A handful of crafted requests | Sustained volume, mostly valid-looking |
| Unit of result | One rule, matched or not | The WAF's throughput, latency and verdicts over time |
| Typical finding | A signature gap | Rule order, inspection limits, a failure mode, missing logs |
| Where it is read | The WAF's own log | The client, the WAF and the origin, compared |
The functional test is the security team's tool and it is worth doing. Everything below concerns the right-hand one. What every DDoS test shares (planning, ceilings, abort rules) is laid out in the complete guide to DDoS testing, and what a WAF is and where it sits is on the WAF definition page.
Before the first rule runs
A WAF can only judge a request, so it only acts once a whole request exists. A lot of the work a flood causes happens before that point.
Packets and handshakes
A SYN flood or a UDP flood is never a request, so no WAF rule ever sees it. The network layer, the provider edge or a scrubbing service has to absorb it.
The TLS handshake is the same story one step up. The WAF reads plaintext, so the handshake must finish before a rule can run, and a TLS handshake flood spends the terminator's CPU without ever producing a request to judge. Whoever terminates TLS in front of the WAF owns that load.
Headers that never finish
A slow-header attack sends a request one header at a time and never sends the blank line that ends the headers. ModSecurity's first phase runs once the request headers have been read, so a Slowloris connection never reaches it.
That attack belongs to the proxy's timeouts (in NGINX, client_header_timeout), not to the ruleset. A WAF report that says "slow attacks: covered" because a rule exists for them is reading the wrong layer.
Requests cancelled before they are answered
On HTTP/2 a client can open a stream and reset it a moment later. In the Rapid Reset pattern the cost is in stream setup and teardown inside the proxy, which happens whether or not a WAF rule ever weighs in. Whether the edge caps reset streams per connection is a proxy setting, and the test reads it there.
What this means for the test
A WAF DDoS test separates "the WAF did nothing" from "the WAF never saw it". For every vector in the plan, it records which layer met it first. Only the vectors that arrive as complete requests are fair questions for the WAF.
Rule order is a bill every request pays
A WAF evaluates rules in order. A request walks the list until a rule takes a terminating action (block, allow, challenge) or the list runs out. A flood request that looks valid matches nothing for most of the walk, so it pays for every rule in front of the one that finally stops it.
Cheap rules first
The cheap rules are exact lookups: an IP set, a country, a rate counter, a header that must be present. The expensive ones are pattern matches over the URI, the headers and the body, which is what most managed rule groups are.
Put the rate rule after the managed groups and every flood request is pattern-matched in full before the rate rule ever counts it. Put it first and most of the flood is dropped after one counter lookup. The verdict for the flood is the same either way. The work the WAF does to reach it is not.
AWS publishes the cost
AWS WAF prices rule complexity in web ACL capacity units (WCUs), its own measure of the resources a rule needs. An IP set match is 1 WCU and a rate-based rule starts at 2. The Amazon IP reputation list is 25. The core rule set is 700, and the SQL database and known bad inputs groups are 200 each. A web ACL's default budget is 1,500.
A WCU is a configuration measure, not a latency figure, so it does not say how long a request takes. It does say, in AWS's own units, how much inspection a request buys before it reaches a given rule. Add up the rules in front of the rate rule and the order becomes a number: 4 WCUs behind an IP set and a geo match, 1,102 behind the three big managed groups.
On a managed edge that work runs on the provider's machines, so it shows up as added latency, if at all, and the bill does not depend on the order. On AWS WAF the charge is per request processed, blocked or not, which is why a long flood shows up on the invoice even when every request was stopped. Measuring that invoice per meter is what EDoS testing does.
Anomaly scoring runs every rule
Self-hosted WAFs built on ModSecurity usually run the OWASP Core Rule Set in anomaly scoring mode. Each matching rule adds to a score, and the block decision is taken at the end of the request phase, after every rule in that phase has run. The default inbound threshold is 5, which one critical match reaches.
So in the default setup a flood request runs the whole ruleset before anything decides. Raising the paranoia level from 1 towards 4 adds rules and multiplies that work. CRS has an early-blocking setting that checks the score after the header phase too, and a test should know whether it is on.
On a self-hosted engine all of this is your CPU. With the ModSecurity connector for NGINX it is the worker process's CPU, so a saturated ruleset and a saturated proxy are the same event.
One pattern can cost a core
A regular expression with catastrophic backtracking turns one request into seconds of CPU. A WAF is a large collection of regular expressions, and one bad pattern in a ruleset update has taken a large provider's WAF down worldwide before. The mechanism and the fix (linear-time engines, match limits) are on the ReDoS page. For the test, the point is that a ruleset update is a change to the WAF's capacity, and deserves a re-run like any other capacity change.
The body the WAF stops reading
Every WAF inspects a request body only up to a limit. What happens to the rest is a setting, and under a flood it decides two things: how much memory the WAF spends, and what reaches the origin uninspected.
The limits
On AWS WAF, protections attached to an Application Load Balancer or AppSync inspect the first 8 KB of the body. CloudFront, API Gateway and a few other resource types inspect 16 KB by default, adjustable upwards to 64 KB. Each rule that reads the body carries an oversize setting: continue as if the part it saw was the whole body, treat the request as a match, or treat it as no match.
ModSecurity has the same decision in different words. SecRequestBodyLimit caps the body it will accept (the recommended configuration ships 13,107,200 bytes, SecRequestBodyNoFilesLimit caps bodies without file uploads at 131,072 bytes), and SecRequestBodyLimitAction chooses between Reject and ProcessPartial.
Why a flood cares
Continue and ProcessPartial let the part past the limit through without a look. That is a reasonable trade for legitimate uploads. Under a flood it means large-body requests that pass the first 8 KB of checks reach the application whole, and the application pays to parse them.
Reject and "treat as match" refuse oversize bodies outright. That protects the origin and turns away every legitimate client that sends a large body. Which side of that trade you are on is a decision; the test makes sure it was taken on purpose.
Buffering is the other half. A WAF that reads the body before deciding has to hold it, in memory up to SecRequestBodyInMemoryLimit and on disk after that. A slow-POST attack aimed at a buffering WAF occupies the WAF's memory and connections, not the origin's.
What the test does
The run sends a share of its requests with bodies just under the limit, just over it and far over it, at flood rate. It then reads the origin's logs to see which of them arrived and how large, and the WAF host's memory to see what the buffering cost.
When the WAF runs out first
If the WAF is the first component to saturate, it fails one of two ways. It fails closed and everyone waits, or it fails open and traffic reaches the origin without inspection. Each is a defensible design. A team that cannot say which design it runs has a gap.
In-process modules fail closed
A WAF compiled into the proxy, like ModSecurity in NGINX, cannot be bypassed by its own load. When rule evaluation eats the worker CPU, requests queue and time out. The origin is safe and the site is down anyway.
Agents and sidecars often fail open
Designs where the proxy calls out to a separate inspection service usually carry a timeout and an action for when it fires. Many default to letting the request through, because an inspection service that takes the site down on a hiccup will not be kept for long. Under a flood, that timeout turns the WAF into a pass-through at exactly the moment it is needed.
Appliances have a bypass
Inline appliances often have a bypass mode that passes traffic when the box is overloaded or fails. The on-premise post covers appliance placement; for the WAF the questions are which threshold triggers the bypass and whether anyone is told.
Managed edges move the limit, not the question
A managed cloud WAF has no CPU of yours to exhaust. What a flood strains there is the per-request bill and the rules' effect on latency. The platform-specific behaviour is covered for AWS WAF rate-based rules, for Azure Front Door and its WAF policies and for Cloud Armor's Adaptive Protection.
What the test records
Three facts per WAF: the load at which it stopped keeping up, which way it failed, and whether any alert reached a person. The second one is the one teams most often get wrong when asked from memory.
The settings teams change mid-incident
During an attack, people change WAF settings fast. Each emergency setting is a guess about what the flood will do to legitimate traffic, and the guess can be tested in advance.
Tighter managed rules
The usual move on a CRS-based WAF is to raise the paranoia level or lower the anomaly threshold. Both catch more, and both block more real users. Run the legitimate traffic mix against each emergency setting before the incident and record the false-positive rate for each. Then the person on call knows what the next notch costs before they turn it.
A challenge for everyone
Turning on a challenge for all traffic stops scripted floods that cannot run JavaScript. It also stops every client that is not a browser: your API consumers, the mobile app's background calls, payment webhooks and your own monitoring. The API and mobile backend posts cover those clients in detail.
A solved challenge also lasts. AWS WAF's default immunity time for a challenge or CAPTCHA token is 300 seconds, so a client that solves once is let through for five minutes. Against a flood driven by real browsers, the test measures what a token is worth in requests.
Count to block
Flipping a rule group from count to block is the most common mid-incident change and the one already covered most thoroughly: the block versus count page and the AWS rate-rule post both treat it. The new question here is load. A group in count mode still runs every pattern, so switching it to block saves origin capacity, not WAF capacity.
The WAF's own evidence under flood
After the test, the WAF's logs are where most teams look for the result. Under a flood those logs are themselves under load.
Samples are not records
The AWS WAF console shows sampled requests, a small sample per rule from recent hours. It is useful for looking at examples and useless for counting. Counting needs full logging to CloudWatch Logs, S3 or Firehose, and at flood rates that is a large, delayed and billed stream.
Self-hosted audit logs write in the request path
ModSecurity's audit log, with SecAuditEngine RelevantOnly, records requests whose status matches a pattern, and by default that includes 4xx responses. In a flood every blocked request is a 403, so every one is written. With SecAuditLogType Serial they all go to one file. The disk becomes part of the WAF's capacity, and a slow disk shows up as request latency.
The number to check
Count blocks at three points: the blocked responses the test client received, the blocks in the WAF's logs and the requests that reached the origin. If the WAF's log count is short of what the client saw, the logging dropped data under load, and any report built on those logs undercounts the attack.
A WAF DDoS test, area by area
| Area | What the run does | Passes when |
|---|---|---|
| Pre-request vectors | Sends handshake and slow-header traffic alongside the request flood | Each is met by the layer meant for it; the WAF is not credited for it |
| Rule order | Sends valid-looking requests that only the rate rule will stop | The rate or reputation rule terminates them before the managed groups run, or the cost of the order is known and accepted |
| Ruleset cost | Repeats the flood at each paranoia level or managed group set in use | WAF latency and CPU stay inside the budget at the planned level |
| Body limits | Sends bodies under, at and over the inspection limit | The oversize action matches the documented decision; origin receives what it was meant to |
| Saturation | Raises load on the WAF tier until it stops keeping up | The failure direction is the expected one and an alert reaches a person |
| Emergency settings | Runs the legitimate mix against each setting on the runbook | False-positive rate per setting is recorded before it is needed |
| Evidence | Counts blocks at client, WAF log and origin | The three counts agree within a stated margin |
The test runs under the same authorisation and abort rules as any other flood. How to keep it off real users is covered in testing without disrupting production, and how WAF behaviour fits with the rest of the application layer in L7 DDoS testing.
FAQ
Is WAF testing part of DDoS testing?
Partly. Checking that rules match attack payloads is application security testing. Checking how the WAF behaves at flood rates (rule cost, inspection limits, failure mode, logging) is DDoS testing, because the WAF is one of the components a flood can exhaust.
Does a WAF stop SYN floods or UDP floods?
No. A WAF only acts on complete HTTP requests, so network-layer floods and TLS handshake floods have to be absorbed by the layers in front of it: the provider edge, scrubbing, and whatever terminates TLS. A test should record which layer met each vector.
Should a WAF fail open or fail closed?
It depends on what the service can afford to lose: availability or inspection. A payment flow may prefer to refuse traffic rather than pass it uninspected; a news site may prefer the opposite. The important thing is that the choice is written down and a test confirms it.
Do blocked requests still cost money on a managed WAF?
On usage-priced managed WAFs, generally yes: AWS WAF charges per request processed, whether it is allowed or blocked. A long flood that is fully stopped can still produce a large bill, so the test plan should include a look at the invoice afterwards.
The firewall is inside the blast radius
Teams tend to treat the WAF as the thing that stands outside the system and protects it. Under a flood it is not outside anything. It is the first server most HTTP traffic meets, with its own CPU, memory, disk and limits, and the flood is aimed at whatever runs out first.
A few things about a WAF stay true for years: what it can see and what it cannot, the order in which its rules run, how much body it reads, which way it fails. Thresholds, managed rule versions and paranoia levels change every quarter, and each change moves the WAF's capacity a little.
The question a WAF DDoS test answers is not whether the WAF recognises an attack. It is how long the WAF keeps up once it does.
