Instead of defining a web application firewall in the abstract, let us follow four requests arriving at one. The setting: an invented online pharmacy in Nashik, with a ordering site that has a login, a search box, a prescription upload and an order-status API. A WAF sits in front, either as a cloud service that receives all traffic first or as an appliance or module in the path. It terminates the HTTPS connection, so it can read the request in full.
What a WAF is, in one paragraph
A network firewall decides by address and port: who may talk to which service. A WAF works at the application layer (layer 7). It understands HTTP: URLs, methods, headers, cookies, parameters and bodies. It applies rules and, in some products, behavioural models to decide whether to allow, block, challenge or just log each request. Many rule sets are built on the open OWASP Core Rule Set or vendor-maintained equivalents.
Request one: a customer searches for a medicine
An ordinary request with a short, sensible search term. The WAF checks protocol sanity, finds nothing odd in the parameters and passes it on. The overwhelming majority of traffic looks like this, and a WAF that cannot pass it cheaply and quickly is a bad WAF.
Request two: a classic attack pattern in the search box
Now someone submits a search term containing the typical grammar of a database injection attempt, or markup that resembles an attempt to inject a page script. The WAF’s signatures recognise those shapes in the parameter and block the request with an error before it reaches the application. This is the case WAFs are sold on, and they handle it reasonably, especially for automated scanners and mass-exploitation attempts that fire the same known patterns at every site. The WAF also logs it, which gives the security team a view of who is probing.
Be clear about what happened: the WAF saw a pattern, not an intention. If the application were safe (using parameterised queries and output encoding), this request would have been harmless anyway. The WAF reduced noise and gave a second layer.
Request three: a patient views someone else’s order
A logged-in user changes the order number in the URL to a neighbour’s. The request is syntactically perfect: valid session, valid format, a normal request for an order. The WAF has no idea that this user should not see that order, because that rule lives in the application’s business logic. This is broken access control, among the most common serious web flaws, and the WAF is blind to it. No signature can distinguish “my order” from “someone else’s order”. The same goes for flaws in pricing logic, coupon abuse and password-reset design.
Some WAFs and API gateways can learn what a normal API call looks like and reject traffic that deviates from a published schema, which helps with malformed input. Authorisation errors with valid-looking requests remain a job for developers.
Request four: ten thousand login attempts from a rotating set of addresses
Here the WAF can contribute more, because the unit of analysis is behaviour over time. Rate limiting per address, challenges such as CAPTCHA for suspicious clients, bot reputation feeds, and detection of known automation fingerprints can slow credential stuffing. Sophisticated bots using residential addresses and human-like pacing will still get through some of it, so this works best together with application-level lockouts, multi-factor authentication and breach-password checks.
The false-positive problem
Back to the pharmacy. A pharmacist uploads a prescription note that includes text with quotation marks and symbols. A strict rule treats those characters as suspicious and blocks a legitimate upload. Multiply by thousands of users and the business complains. Typical practice, then, is to deploy a WAF first in detection (logging) mode, review what it would have blocked, write exceptions for legitimate patterns, and only then switch to blocking, with specific rules sometimes left in monitor mode. Tuning never ends, because each application release can change what normal looks like.
Evasion
Signature rules can be sidestepped. Attackers can change how a payload is encoded, split it across parameters, use unusual but valid HTTP features, or find an endpoint the WAF does not cover. Another common gap is the origin server being reachable directly: if the real server’s address is known and it accepts connections from anywhere, attackers simply bypass the WAF. Restrict the origin to accept traffic only from the WAF provider’s ranges or via authenticated tunnels.
Where a WAF earns its fee
- Virtual patching. When a serious flaw is announced in a framework you run, and you cannot upgrade for two weeks, a targeted rule can block the known exploit pattern in the meantime. It buys time, not a cure.
- Absorbing volumetric noise and some application-layer DDoS, particularly in cloud-delivered products.
- Visibility. A log of probes against your site, useful in an investigation.
- Compliance. PCI DSS, for public-facing web applications, accepts either regular application security reviews or a WAF, which is one reason many teams deploy one. A box ticked is not the same as risk removed.
So, a fair summary of the four requests: the WAF passes the first, usually stops the second, cannot see the third, and partly handles the fourth. Treat it as a useful outer layer. The inner layers, meaning secure code, authorisation checks and sound authentication, are where most real protection lives.
Figures and names in the examples are illustrative.
Leave a Reply