WAF vs IPS: what each one reads before it refuses
An intrusion prevention system and a web application firewall both refuse traffic, and both are sold as the thing that stops attacks. They read different material. An IPS inspects network traffic for signs of known attacks across many protocols; a WAF takes one protocol, HTTP, and judges each request to one application. The question is which of those two readings your problem needs.
Quick facts
| IDS / IPS | Web application firewall | |
|---|---|---|
| Definition | An IDS analyses events for signs of incidents; an IPS does that and also attempts to stop them. NIST SP 800-94, Executive Summary | "An application firewall for HTTP applications" that applies a set of rules to an HTTP conversation. OWASP |
| Reads | Network traffic, host activity or both, depending on the type (NIST SP 800-94, Executive Summary) | HTTP requests, in full |
| Placement | Inline, so traffic must pass through it, or passive, on a copy of the traffic (NIST SP 800-94, §4.2.2) | In front of a web application, as a reverse proxy, plugin or filter |
| Known limit | Network-based IDPS cannot detect attacks inside encrypted traffic, HTTPS included (NIST SP 800-94, §4) | Rules need customising to the application, and keeping up as it changes (OWASP) |
| Fails by | False positives and false negatives; neither can be eliminated (NIST SP 800-94, §2) | Matching ordinary requests that resemble an attack |
The same table can be read as one sentence. An IPS is a general detector with an optional brake, and a WAF is a specialist that knows what a web request is. The sibling comparisons cover the neighbouring pairs: WAF vs firewall for the connection-level filter, and WAF vs WAAP for bundled offerings.
What an IPS reads
NIST defines intrusion detection as monitoring events in a system or network and analysing them for signs of possible incidents, and intrusion prevention as doing that and attempting to stop what it finds. An IDS only alerts. An IPS can also act, by stopping the attack itself, changing the security environment (reconfiguring a firewall, for example), or changing the content of the attack. The guide notes that prevention features of an IPS can usually be disabled so that it behaves as an IDS.
That last point is worth keeping. The detection half and the prevention half are separable, and every sensible deployment uses the first before trusting the second.
Four kinds, one family
NIST describes four types of technology: network-based, wireless, network behaviour analysis and host-based. The network-based sensor sits where a firewall would, at the division between networks, and either forwards traffic itself (inline) or watches a copy (passive). Inline is the placement that can block, since traffic has to pass through. Passive can only observe and signal. For most environments NIST recommends combining network-based and host-based types rather than choosing one.
How it decides
The guide names three detection methods. Signature-based detection compares events with patterns for known threats; NIST calls it very effective for known threats and largely ineffective against unknown ones, evasion and variants of known ones. Anomaly-based detection compares activity with a profile of normal. Stateful protocol analysis compares activity with vendor-built models of how a protocol should behave, tracking the state of the session. Each has a cost: signatures miss what has not been written yet, anomaly profiles raise false positives when normal changes, and protocol models are resource-heavy and can conflict with how a particular application implements the protocol.
None of this is specific to the web. An IPS is built to cover mail, file transfer, remote login and the rest. That breadth is its strength and it is also why it does not know what your search form is supposed to accept.
What a WAF reads
A web application firewall reads one thing: the HTTP request. The method, the path, the headers, the cookies and the body, decoded the way the application will decode them. OWASP defines it as an application firewall for HTTP applications and notes that it can be considered a reverse proxy, with proxies in general protecting clients and a WAF protecting servers. Where a network-based IPS has to be handed decrypted traffic to see inside HTTPS, a WAF in front of an application works on requests after the connection has been terminated, because a request is what it judges.
That narrower view buys precision. A parameter that carries a database query fragment is visible as a parameter, in the field where it was sent. An SQL injection attempt, a path traversal or a script in a query string can be matched against rules written for those cases, such as the ones grouped under the OWASP Top 10 rule set. A web application firewall can also count requests, which is how rate limits work.
It costs something too. OWASP notes that customising a WAF to an application can take significant effort and has to be maintained as the application changes. A WAF knows HTTP in general and nothing about your checkout flow until the rules and exceptions say so.
Where they overlap
The overlap is known exploits against web servers. An IPS signature for a published flaw in a web server can match traffic to a WAF's patch-style rule for the same flaw; the idea behind virtual patching is close to the signature idea. For these, which tool catches it first is mostly a matter of which sits earlier on the path and whether the traffic is readable there.
Outside the overlap the two part. A request that is perfectly well-formed HTTP, sent in a normal rhythm, containing a parameter the application should never accept, has no protocol violation for an IPS to find; stateful protocol analysis, per NIST, cannot detect attacks that do not violate acceptable protocol behaviour. On the other side, a WAF never sees an exploit aimed at a mail server, a database port or a remote-login service, because that is not HTTP to your site.
Most networks that run both put the IPS at the edge of the network, where a firewall or a next-generation firewall would also sit, and the WAF in front of the web application. How a vendor packages the two does not change what each one reads.
Where a WAF helps and where it does not
A WAF helps with requests: hostile or unwanted ones that arrive on a port you deliberately opened and look, at the network level, like the traffic you want. It sees the request in full and can refuse it before the application handles it, or count it against a limit.
It does not help with what is not an HTTP request. Exploits against other services never reach it. Volumetric floods that saturate a link do their damage before any request exists, which is the subject of DDoS protection, a different layer. It does not read a request it was never given: traffic that bypasses it and reaches the origin directly is untouched. And it does not repair code. A missing authorisation check stays missing; the filter only puts distance between it and some of the traffic.
It also makes mistakes. A rule that matches an ordinary request makes your site look broken to the person on the other end. That is why Bridge WAF has three modes and nothing between them: off, monitor and block. In monitor mode requests pass and the activity log records what block would have refused. The practice is the same one NIST describes for an IDPS, which is to expect false positives from a new deployment until it has been tuned. Read the log first, handle false positives with exceptions, then turn on block. The sequence is set out under monitor mode.
When to use which
Pick by the problem in front of you rather than by the product category.
- Use an IPS when the traffic is not only web. Exploit attempts against many kinds of service, or traffic inside your network, are what it is for. It is also the choice when you want one detector across hosts and segments.
- Use a WAF when the problem lives in requests to a site or API. Injection attempts, abusive form submissions, an expensive endpoint being hammered. These arrive as valid HTTP, and only something that reads the request can tell them from use.
- Use both when you have both problems, which is common once a network hosts services besides the website. One does not stand in for the other, and Bridge WAF is not presented as a replacement for an IPS.
- Fix the code anyway. Both are ways of keeping traffic away from a weakness, not ways of removing it. The full list of comparisons is on the comparisons page.
Questions
Is an IPS the same as a WAF?
No. An intrusion prevention system watches network traffic, across many protocols, and tries to stop traffic that matches signs of an attack. A WAF reads one protocol, HTTP, and judges each request to a web application the way the application will read it. Both can refuse traffic, but they refuse on different evidence.
Can an IPS stop SQL injection?
Sometimes, when the attempt matches a known signature and the IPS can read the traffic. It cannot read HTTPS payloads it has not been given the means to decrypt, and a signature written for a protocol exploit is a poor fit for a parameter in one form field. A WAF sees the decoded parameter, which is why it is the more precise tool for that case.
Do I need a WAF if I already have an IPS?
An IPS does not know your application's requests, so having one does not answer that question. If the problem is hostile or unwanted requests to a web application, a request filter addresses it. If the problem is exploit traffic against other services on your network, an IPS does, and a WAF never sees those protocols.
Is a WAF an IDS or an IPS?
It is neither by definition, but it borrows the same idea. NIST notes that prevention features in an IPS can usually be disabled so that it works as an IDS. Bridge WAF has the same shape as a setting: off, monitor or block, where monitor records what block would have refused.
Which should run first, detection or prevention?
Detection. NIST expects a new IDPS deployment to produce many false positives until it is tuned, and a request filter behaves the same way. Run the filter in monitor mode, read the log, add exceptions for legitimate traffic, and only then switch to block.