What is a WAF?
A WAF (Web Application Firewall) is a security layer that inspects HTTP requests headed to a web application and blocks those that break its rules. A network firewall asks whether an IP may connect to a port. A WAF reads the inside of the request: URL, query parameters, headers and body.
That difference matters. A SQL injection attack arrives on an allowed port (443) over a valid TCP connection, so a network firewall counts it as normal traffic. The attack shows only in the HTTP content, which is why you need a filter at the application layer.
How does a WAF work?
A WAF takes three steps for every request:
- Parsing. It parses the request and undoes URL encoding and similar transformations. This step is called normalization; it stops an attacker from hiding a
'as%27. - Evaluation. It compares the normalized input against rules and signatures and, where needed, produces a risk score.
- Decision. It passes, blocks or logs the request, or asks the client to verify.
A sample SQL injection attempt looks like this:
GET /products?id=1' OR '1'='1 HTTP/1.1
Host: example.com
If the application pastes id straight into a query, the condition is always true and every row comes back. The WAF recognizes the ' OR '1'='1 pattern and does not forward the request.
An XSS attempt arrives the same way, inside a parameter:
GET /search?q=<script>alert(document.cookie)</script> HTTP/1.1
Host: example.com
If the application writes q to the page without escaping, the browser runs the script. The WAF catches the <script> tag and the cookie access.
Where does a WAF sit?
There are three typical positions:
| Position | How it works | Upside | Downside |
|---|---|---|---|
| Reverse proxy, cloud or service | DNS sends traffic to the WAF | Quick to set up, takes load off the origin | The proxy becomes a dependency |
| Module on the server | Runs as an nginx or Apache module | No extra network hop | Uses your server's CPU |
| Library inside the app | Called from code | Knows application context | Needs separate integration per app |
The reverse proxy guide covers the proxy model in detail.
How does it relate to the OWASP Top 10?
The OWASP Top 10 lists the most common risk categories in web applications. Broken access control, injection, cryptographic failures and insecure design appear on it. Most WAF rule sets organize their rules around these categories.
Do not skip one point: a WAF does not solve the Top 10 alone. Logic flaws such as broken access control usually look like valid requests. A WAF cannot know whether this user should see this record; your application code settles that. The open-source OWASP Core Rule Set is one widely used example of a rule collection in this area.
Signature-based vs behavioral detection
Signature-based detection looks for known attack patterns, usually regular expressions. It is fast, the decision is explainable, and you can see which rule fired. Its weakness is that it can miss a new or obfuscated pattern.
Behavioral or anomaly-based detection builds a profile of normal traffic and flags deviation, such as one IP requesting hundreds of distinct paths in a minute. It has a better chance of catching an unknown attack, but it also raises the odds of false alarms, and learning the profile takes time.
In practice a good setup combines both: signatures for attack patterns in the payload, anomaly signals for request rate and client behavior.
Negative vs positive security model
- Negative model (blocklist): blocks the known bad and lets the rest through. It is easy to deploy, so most WAFs use it by default.
- Positive model (allowlist): lets through only the known good. For example, the
idparameter may contain digits only. It is very strong, but it requires writing and maintaining rules for every endpoint.
Apply the positive model at least on critical endpoints (login, payment, admin). For APIs, schema-based validation is its natural form; see API security: rate limits and WAF.
False positives and tuning in monitor mode
A false positive blocks a legitimate request. A CMS admin panel sends HTML in the body, and the WAF may read it as XSS. A developer blog publishes a SQL example, and a signature trips on it.
The safe path:
- Turn the WAF on in monitor mode first: it evaluates and logs requests but blocks nothing.
- Review the event log for one to two weeks. Which rule catches which legitimate request?
- Write exceptions or rule fixes for those legitimate requests.
- Switch to blocking mode and watch the log closely for the first days.
Do not trust a vendor's statement about a WAF's false-positive rate; measure it on your own traffic, and ask the vendor what it measured. We collected more questions in 10 questions to ask when choosing a WAF.
Limits of a WAF
- It does not replace secure code. A WAF is not a patch. Parameterized queries, output escaping and access control stay in the application.
- It cannot see logic flaws. A request that looks valid but is unauthorized passes through.
- Evasion paths exist. Every signature engine struggles against encoding and fragmentation tricks. Normalization reduces this; it does not eliminate it.
- It fails if you leave the origin exposed. An attacker who finds your origin IP bypasses the WAF. See origin IP hiding and Origin Lock.
- It offers limited help against data leaks. Masking source error messages (CWE-209) helps but does not fix the application's own bug.
When should you add a WAF?
If your application faces the internet and you cannot review the whole codebase every day, a WAF is a sensible extra layer. It helps most when you protect an old CMS, a plugin whose patch is late, or a third-party application whose source you cannot touch: until the patch arrives, the WAF keeps known exploit patterns away from the application.
Keep the order, though. Get parameterized queries, output escaping and authorization right first. Put the WAF on top of that foundation as a second line of defense.
How Nexren Shield handles this
Verified facts only:
- The WAF runs 600+ signature rules covering the SQLi, XSS, RCE, LFI and SSRF families, which overlap with OWASP Top 10 categories.
- The engine is based on regex and input normalization. It does not parse input into a syntax tree.
- We have not measured the false-positive rate. That is why we recommend opening a new site in Monitor mode first.
- Protection modes: Off, Monitor (detects and logs, does not block), Balanced and Under Attack.
- You can write custom rules on header, path, query, IP and method.
- Source error messages are masked (CWE-209).
- Bodies of legitimate requests are not stored for analysis; security-event records keep rule matches.
For a product overview read what is Nexren Shield; the pricing page lists the plans.
Sources
Related product pages:Technology
Frequently asked questions
How is a WAF different from a network firewall?
A network firewall looks at IP, port and protocol. A WAF reads inside the HTTP request: path, parameters, headers and body.
How does a WAF inspect HTTPS traffic?
The WAF terminates TLS itself, decrypts and inspects the request, then forwards it to the origin. It therefore has to sit at a point where it can decrypt.
Do I still need to patch my software with a WAF?
Yes. A WAF slows known exploit patterns until you patch, but it does not close the vulnerability.
What is a false positive?
A false positive is a legitimate request that the WAF mistakes for an attack and blocks. A SQL example in a blog comment can trip a signature, for instance.
Does every WAF use AI?
No. Many WAFs rely on signatures and rules. Ask a vendor what its 'smart' feature actually is and which input drives which decision.
Related guides
What Is Nexren Shield? A Reverse-Proxy Web Security Service
Nexren Shield is a reverse-proxy security service that sits in front of your web applications.
API Security: What Rate Limiting and a WAF Do and Do Not Solve
API security covers two separate jobs: filtering bad traffic from outside and getting the application's authorization logic right.
10 Questions to Ask When Choosing a WAF: A Buyer's Guide
When buying WAF, DDoS or bot protection, look past the marketing page to ten questions: who holds the TLS key, how capacity is evidenced, what happens with false positives, where data lives, how the origin is protected and how you leave.
What Is a Reverse Proxy? TLS, Real Client IP and Security
A reverse proxy is an intermediary that clients connect to and that forwards requests to the server behind it.