Bookmarks

WAF — web application firewall

A traffic filter in front of a web application: it parses HTTP requests and responses and, by matching them against a set of rules, blocks typical attacks — SQL injection, XSS and others.

Also: WAF, web app firewall

checked 9 Nov

All terms

An ordinary firewall looks at addresses and ports, whereas a WAF understands HTTP: it reads parameters, headers and the request body and decides whether a request looks like an attack. A proxy usually protects the client, while a WAF is put in place to protect a specific application — either in front of it, at the entry point of the infrastructure, or right in the web server.

How it works

Rules describe dangerous constructs: a quote mark in a parameter, a script in a form field, SQL keywords. The engine applies them to every request–response pair and, depending on the mode, either blocks the request or only flags it in the log. Adoption often starts in logging mode: first statistics are collected and the rules are tuned, then blocking is switched on.

The best known rule set is the OWASP Core Rule Set (CRS): open, general-purpose rules against typical attacks. Strictness is tuned through the “paranoia level”, from 1 to 4: level 1 gives almost no false positives, and each higher level catches more attacks but is also more likely to raise alerts on legitimate traffic. A high level without tuning to the application turns into a stream of false alarms.

Where it runs

TypeWhere it runsExample
Web server moduleinside Apache, Nginx and IISModSecurity
Libraryembedded in an application or a gatewayCoraza
Dedicated nodea hardware appliance or a cloud service in front of the applicationcommercial WAFs

Engines and rules

ModSecurity is the best known engine: started in 2002 as an Apache module, it now filters HTTP in Nginx and IIS alike; in 2024 the project was handed over from Trustwave to OWASP. Coraza is an engine written in Go that understands the same SecLang rule format. Thanks to the shared format, CRS rules are portable between engines, and rules of one’s own are written for a particular application: tuning them can be a substantial job, and they have to be maintained as the application changes.

Limitations

A WAF is a rule-based filter: it catches known attack patterns but does not replace secure code. It knows nothing about the application’s logic, so false positives are dealt with using exception rules, and bypassing the rules is the norm rather than a failure. It is most useful in combination: fixing vulnerabilities, rate limiting and log review.

Sources

the term is written from these pages

Verified 9 Nov

Not to be confused with

what it is mixed up with and how it differs

  • NGFWnext-generation firewall

    NGFW filters the network as a whole — addresses, ports, applications — while a WAF works only with the HTTP traffic of a specific web application.

  • IPSintrusion prevention system

    IPS looks for attacks in the network stream, while a WAF looks inside HTTP requests: parameters, headers and the body.

  • reverse proxy

    A reverse proxy only forwards requests, while a WAF additionally parses and filters their content.

In depth in the references

where the topic is covered in detail