Detection flow
The detection process follows these steps: The scan stops as soon as a WAF is detected to minimize unnecessary requests.Probe types
whatwaf sends four different HTTP probe requests to test how the target responds to potentially malicious input:1. Plain request
A baseline HTTP GET request with no payloads:2. XSS probe
Cross-site scripting payload in a query parameter:3. SQL injection probe
SQL injection payload designed to trigger database-related filters:4. LFI probe
Local file inclusion payload attempting directory traversal:Detection methods
For each probe response, whatwaf runs all registered detectors to check for WAF fingerprints. Detection is based on three primary indicators:HTTP status codes
Many WAFs respond with specific status codes when blocking requests:- 403 Forbidden: Most common WAF block response
- 404 Not Found: Some WAFs pretend the resource doesn’t exist
- 406 Not Acceptable: Used by some WAFs for content filtering
- 429 Too Many Requests: Rate limiting behavior
Response headers
WAFs often add vendor-specific headers to responses. For example, Incapsula detection:Set-Cookie headers containing incap_ses or visid_incap, which are Incapsula tracking cookies.
Response body patterns
WAFs often return custom block pages with distinctive content. Cloudflare detection:- Body contains both “Sorry, you have been blocked” AND “Cloudflare Ray ID”
- Status code is 403 Forbidden
Match modes
Detectors can require matching any or all patterns:Response analysis helpers
TheHttpResponse struct provides helper methods for detection logic:
| Method | Purpose | Example |
|---|---|---|
is_forbidden() | Status is 403 | Common block response |
is_not_found() | Status is 404 | Disguised blocks |
is_error() | Status 400-599 | Any error response |
header_has() | Header contains text | Cookie or vendor headers |
body_has() | Body contains text | Block page messages |
body_matches() | Body matches regex | Complex patterns |
asset_hash_is() | SVG asset hash match | Image-based fingerprinting |
Detection scenario example
Let’s walk through a real detection scenario:Run detectors
The Incapsula detector checks:Match found! The
Set-Cookie header contains both Incapsula cookie names.Source code architecture
Key files implementing the detection logic:src/lib.rs:76-81- Defines the four probe typessrc/lib.rs:101-128- Main scanning loop and probe executionsrc/detector.rs:6-19- Runs all detectors against responsesrc/detectors/mod.rs:3-6-Detectortrait definitionsrc/utils/http.rs:13-19-HttpResponsestructsrc/utils/checks.rs- Response analysis helper methods
Advantages of this approach
Fast
Stops scanning as soon as a WAF is detected, minimizing requests
Modular
Each detector is independent and easy to add or update
Accurate
Combines multiple signals (status, headers, body) for reliable detection
Stealthy
Uses realistic payloads that blend with normal security testing
Limitations
whatwaf detects WAF presence but doesn’t attempt to bypass or evade WAFs. It’s designed for reconnaissance and infrastructure mapping, not evasion.
Next steps
Library API
Use whatwaf as a Rust library in your applications
Supported WAFs
See the complete list of detectable WAFs