CCyberwiki

Web application firewall

Web application firewall
Also known asWAF
Works onHTTP requests and responses
PlacedIn front of the application, as a reverse proxy, a CDN service or a web server plugin
ExamplesModSecurity, Coraza, Cloudflare WAF, AWS WAF, Vercel WAF
Common rule setOWASP CRS

A request for /api/orders?id=1 OR 1=1 reaches a server that sits in front of the application. That server checks the query string against its rules, finds several that match SQL injection, and refuses the request, so the application never runs. The server doing this is a web application firewall (WAF): a filter that applies a set of rules to each HTTP exchange, with rules written mostly for attacks such as SQL injection and cross-site scripting.1 Because it stands in front of the servers it protects, a WAF works as a Reverse proxy.1

Rules and scores

Rules follow one of two models. A positive model, or allowlist, describes valid input for each parameter (its characters, its length) and refuses everything else. A negative model, or denylist, describes known attacks and lets the rest through.2 An allowlist has to be written for one application, from the inputs it is known to expect.2 Hosted products also offer rule sets written by the vendor, called managed rulesets at Cloudflare and managed rule groups at AWS.34

In the OWASP Core Rule Set (CRS), an open rule set written for ModSecurity, also run by the Coraza engine and reimplemented by Cloudflare, a matching rule adds points to an anomaly score for the request instead of blocking it. Most attack rules add 5. Once every request rule has run, the request is refused if the total meets the threshold, 5 by default.5 SQL injection alone is covered by more than 50 rules, so a real attack can easily score 15 or 20, while a rare protocol attack may trip one rule and score 5. A threshold above 5 lets that rare attack through.5 Responses get a second score, and a response that reaches its threshold, 4 by default, is withheld from the visitor, though the application has already handled the request.5

A matched rule has an action. AWS WAF offers Allow, Block, Count, and a CAPTCHA or challenge, plus a default action for requests no rule decided.4

Where it runs

A WAF can be an appliance, a plugin in the web server or a filter in the application.1 Cloudflare's Free Managed Ruleset, aimed at widely exploited flaws, is available on every plan; the broader Cloudflare Managed Ruleset and Cloudflare's version of the CRS start at the Pro plan.3 On Vercel, DDoS mitigation is free for all customers and needs no setup. Its OWASP core ruleset needs Enterprise, or on Pro a project upgraded to Priority, and is billed per inspected request and per GB of inspected payload.67

False positives and tuning

Rules that catch more attacks also block more normal requests. The CRS has four paranoia levels: level 1 hardly ever blocks legitimate traffic, while level 4 flags a lot of it, and tuning a site at that level can take many weeks.8 The fix for a false alarm is a rule exclusion, which turns another rule off entirely or only for one parameter or URL.8 Cloudflare's equivalents are exceptions, which skip rules, and overrides, which change a rule's action or turn it off.3 New rules are safer when they first run in a log-only mode, with blocking switched on after the logs look clean.2 Vercel's dashboard has that switch per rule, Log or Deny, and its CLI turns on the OWASP core ruleset, sets the SQL injection group to deny and publishes the change with these commands:7

vercel firewall managed-rulesets enable owasp --yes
vercel firewall managed-rulesets update owasp --group sqli --action deny --yes
vercel firewall publish

WAF alert logs can hold passwords and payment data from the requests they record, so those fields are left out or redacted before logging.2

What a WAF leaves in place

A rule written for one known flaw is called a virtual patch: it blocks attempts to exploit the flaw without changing the vulnerable code, and the flaw stays.2 It covers only the traffic the WAF inspects and only the variants its rules recognise; blocking the exact <script>alert('XSS Test')</script> string from a test report stops little, because a small change to the payload passes.2 Cloudflare's managed rules also read a request body only up to a set size, and content past it may not be analysed.3 Fixes in the code, such as parameterized queries and Input validation, still decide whether the flaw exists. Code fixes and virtual patches run in tandem, often handled by different teams, as separate layers of Defence in depth.2

Traffic that goes around it

A hosted WAF sees only requests that pass through the provider. If the server's own address is known, from a DNS record that is not proxied or from historical DNS data, requests can go to it directly. At Cloudflare the fix is to accept connections only from Cloudflare's IP ranges, to change the server's address after onboarding because old DNS records keep the previous one, or to connect through Cloudflare Tunnel so the server needs no public address.9

Capital One, 2019

A person with direct knowledge of the investigation told KrebsOnSecurity that Capital One ran the open-source ModSecurity WAF for operations hosted on AWS, and that a misconfiguration let an intruder make the WAF relay requests to the instance metadata service. That service handed out credentials for the WAF's own role, which could list and read the files in any of the company's storage buckets. Krebs called the method server-side request forgery.10 Amazon said the intrusion "was caused by a misconfiguration of a web application firewall".10 The access took place on 22 and 23 March 2019 and affected about 100 million people in the United States and 6 million in Canada.11 AWS later wrote that many WAFs pass requests on unchanged, without adding the X-Forwarded-For header that names the original caller, and built IMDSv2 to require a PUT request to start a session, a method most open WAFs do not forward.12

In SecFlash

SecFlash reports a site with no web firewall in front as SF-SEC-301 on the Security page. On the Cloud page, SF-CLD-305 marks a Cloudflare zone with no managed ruleset switched on and SF-CLD-407 a Vercel project whose firewall is off. Ways around a proxy's WAF show as SF-CLD-306 and SF-CLD-304 for DNS records that point at the server directly, and as SF-SRV-105 on the Server page when the site answers on the server's bare IP.

See also

References

  1. a b c OWASP Foundation (n.d., read 22 November 2026). "Web Application Firewall". OWASP Community.
  2. a b c d e f g OWASP Foundation (n.d., read 22 November 2026). "Virtual Patching Cheat Sheet". OWASP Cheat Sheet Series.
  3. a b c d Cloudflare (n.d., read 22 November 2026). "Managed Rules". Cloudflare WAF docs.
  4. a b Amazon Web Services (n.d., read 22 November 2026). "How AWS WAF works". AWS WAF Developer Guide.
  5. a b c OWASP CRS project (n.d., read 22 November 2026). "Anomaly Scoring". CRS Documentation.
  6. back Vercel (10 September 2026). "Vercel Firewall". Vercel Docs.
  7. a b Vercel (10 September 2026). "WAF Managed Rulesets". Vercel Docs.
  8. a b OWASP CRS project (n.d., read 22 November 2026). "Paranoia Levels". CRS Documentation.
  9. back Cloudflare (n.d., read 22 November 2026). "Protect your origin server". Cloudflare Fundamentals docs.
  10. a b Krebs, Brian (2 August 2019). "What We Can Learn from the Capital One Hack". KrebsOnSecurity.
  11. back Capital One. [Notice on the 2019 cybersecurity incident]. capitalone.com.
  12. back "Add defense in depth against open firewalls, reverse proxies, and SSRF vulnerabilities with enhancements to the EC2 Instance Metadata Service". AWS Security Blog. AWS (19 November 2019).