WAF (web application firewall): what it is, how it works and what it will not stop
A WAF inspects every HTTP request before it reaches the application and blocks code injection, bots and attempts to exploit known vulnerabilities. We show how it differs from a network firewall, when it is required and why injection made up only 4% of vulnerabilities in CERT Polska audits.

A WAF (web application firewall) sits in front of a web application and inspects every HTTP request before it reaches the server. It lets ordinary traffic through and blocks code injection attempts, API abuse, malicious bot traffic and exploitation of known vulnerabilities. A traditional firewall decides who may connect to the server. A WAF judges what exactly they are sending. Below we explain how it works, how it differs from a network firewall, when it is required and what it will not stop, even when it is well configured.
How a WAF works
Every web application, whether an online shop, internet banking, a citizen portal or a customer panel, accepts data from people it does not know. They type it into forms, append it to URLs, send it in headers and in the body of API requests. An attack on an application usually means that instead of a name or an order number, that data carries a fragment of code or a query the developer never anticipated. A WAF analyses this data before the application sees it.
Where it sits: in front of the application, not the network
A WAF most often runs as a reverse proxy. Traffic addressed to the domain reaches it first and only then the application server. To see the content of requests, the WAF has to decrypt HTTPS traffic, inspect it and pass it on, so certificate management is part of its configuration too. There are three deployment models: a cloud WAF, to which traffic is redirected by a DNS change; an appliance or virtual machine in your own data centre; and a version that runs alongside applications in Kubernetes. Imperva offers all three (Cloud WAF, WAF Gateway and Elastic WAF), so the choice can follow the application architecture.
Rules: signatures, the positive model and reputation
The decision on each request is made against several layers of rules. Signatures recognise known attack patterns, such as typical SQL injection constructs or XSS scripts. The positive model describes what a valid request to a specific application looks like: which parameters a form accepts, of what length and type. Anything that deviates from it is suspicious. Reputation and behavioural analysis assess the sender: has this IP address sent attacks before, does the client behave like a browser or like a script firing a hundred requests a second. In managed solutions the vendor prepares and updates the baseline rule set. At Imperva this is done by the Imperva Threat Research team, which, according to the vendor, tests rules before releasing them.
Monitoring or blocking
Every rule can be set to alert only or to block. A new WAF usually starts in monitor mode: it records what it would have blocked, and the team checks whether any of those requests came from real customers. An entry in an "order notes" field into which a customer pasted a snippet of code can look like an attack. Once tuned, the rules move to blocking. According to the vendor, more than 90% of Imperva customers run in blocking mode. A WAF that has only been monitoring for six months does not protect the application. All it provides is a report on what it could have protected it from.
Virtual patching: protection before the fix arrives
OWASP describes virtual patching as a policy enforcement layer that detects and blocks attempts to exploit a specific, known vulnerability. In practice it is a WAF rule that stops requests targeting the flaw before the team has fixed the code or the vendor has released an update. This is one of a WAF's strongest points, because the time between a vulnerability being published and the first attacks can be shorter than the application's release cycle.
CVE-2025-55182 (React2Shell) in React Server Components, published on 3 December 2025, illustrates this well. It allowed arbitrary code execution on the server with a single crafted HTTP request, before any authentication. CERT Polska scanned the Polish internet from the first day after publication and found close to 2,000 vulnerable instances. An attack of this kind passes through the HTTP layer, so a WAF rule can stop it while the update is being rolled out. OWASP is explicit, however, that a virtual patch is temporary: it does not remove the flaw from the code, and attackers look for variants that get around it.
Bots and APIs
A growing share of application traffic does not come from people at all. According to the Imperva Bad Bot Report 2026, automated traffic makes up more than 53% of web traffic, and malicious bots alone account for 40% of all traffic. Bots are what test stolen passwords on login pages, buy up limited stock and copy price lists. The report also states that 27% of bot attacks targeted APIs. A modern WAF therefore has two additional jobs. The first is telling a human from a script, including one that is good at imitating a browser. The second is guarding APIs, which have no forms or buttons but take data directly from mobile apps and partner systems. We describe how stolen passwords are tested in more detail in our article on credential stuffing (in Polish).
WAF vs network firewall: how they differ
A network firewall, including a next-generation firewall (NGFW), controls who connects to a server and on which port. An attack on an application, however, arrives through a permitted channel: an ordinary HTTPS connection on port 443, which the firewall has to let through or the website would stop working. A WAF starts exactly where the network firewall stops: in the content of the request.
The two tools complement each other and neither replaces the other. The firewall protects the network and servers from unwanted connections; the WAF protects the application from malicious content inside permitted connections. Some next-generation firewalls include web traffic inspection modules, but they usually do not replace a WAF in the areas that determine its effectiveness: a model of the specific application, API protection and bot detection.
DDoS protection is a separate matter. A cloud WAF usually also protects against application-layer flood attacks, that is, a deluge of seemingly ordinary page requests. Volumetric attacks that saturate the link need protection on the carrier network side or at a traffic scrubbing centre. How to check whether an organisation is prepared for them is covered in our article on DDoS attacks (in Polish). The scope of the service is on the DDoS protection page.
What a WAF will stop, and what it will not
The limits of a WAF show up clearly in data from Polish audits. In 2025 the CERT Polska Security Testing Team carried out a series of audits, 72% of which included web application penetration tests. It classified the vulnerabilities found according to the OWASP Top 10:2025. Anyone who associates a WAF mainly with SQL injection may be surprised: injection accounted for only about 4% of findings. About 80% fell into four categories: misconfiguration, access control, authentication and cryptography.
This matters, because a WAF does best against attacks that have a recognisable pattern in the content of the request. Broken access control usually has no such pattern. If an application shows someone else's invoice after the number in the URL is changed from 1041 to 1042, the request looks entirely ordinary. The WAF does not know who invoice 1042 belongs to. Only the application knows that. The table shows how the work is split across the most common categories.
| OWASP Top 10:2025 category (share in CERT Polska audits) | What a WAF can do | What has to be fixed in the application |
|---|---|---|
| A02 Security Misconfiguration (about 40%) | Partly: it will block access to known paths such as a public .git folder, admin panels or backup files, and hide detailed error messages | Server, framework and service settings, default accounts, unnecessary features |
| A01 Broken Access Control (about 18%) | To a small extent: it will catch mass enumeration of sequential identifiers, but cannot judge whether a given user is entitled to a given record | Server-side authorisation checks on every request |
| A07 Authentication Failures (about 12%) | Partly: it will limit password guessing and credential stuffing and cut bots off from the login page | Session management, MFA, password policy, account reset |
| A04 Cryptographic Failures (about 10%) | To a small extent: it will enforce current TLS versions on the connection with the client | Algorithms, key generation and storage, encryption of data in the database |
| A05 Injection (about 4%) | To a large extent: SQL injection, XSS and command injection are the classic territory of WAF rules | Parameterised queries and input validation, because a WAF can sometimes be bypassed |
According to the Verizon DBIR 2026, exploitation of vulnerabilities, not only in web applications, was the point of entry in 31% of breaches, more often than credential abuse. A WAF shortens the exposure window and stops mass attacks, but it does not replace testing or fixes. The most value comes from combining three things: penetration testing, which shows what needs fixing; fixes in the application; and a WAF that protects it until those fixes reach production.
- The rules have been in monitor mode for months. A learning phase makes sense at the start, not as the end state
- The application server accepts connections from the whole internet, not only from the WAF. An attacker who learns its address will simply go around the firewall
- A new application or API went into production without being put behind the WAF. Protection covers only what someone has added to it
- The list of exceptions keeps growing, but nobody reviews it. Every exception added "for now" is a place the WAF no longer watches
- WAF logs go nowhere. Without them nobody will notice that someone has been systematically probing for a vulnerability for a week
When you need a WAF
The short answer: whenever an application is reachable from the internet and processes data whose loss or leak would be a problem. That covers customer logins, payments, forms with personal data, APIs for a mobile app and line-of-business systems made available to citizens. A brochure site with no forms and no admin panel reachable from the internet can usually do without a WAF, although it still needs updating.
Card payments: an explicit requirement
For organisations within the scope of PCI DSS the question is settled. Requirement 6.4.2, introduced in version 4.0 of the standard (currently 4.0.1), has applied since 31 March 2025. It requires an automated technical solution to be deployed in front of public-facing web applications that continually detects and prevents web-based attacks. The solution must be running and up to date, generate audit logs, and either block attacks or generate alerts that are investigated immediately. The text of the requirement does not call this solution a WAF, but in practice a WAF is exactly what fits the description.
NIS2 and the KSC Act: a WAF as a risk-management measure
Neither NIS2 nor the amended National Cybersecurity System Act (ustawa o krajowym systemie cyberbezpieczeństwa, KSC; amending act published as Dz.U. 2026 poz. 252) names a WAF. They require measures proportionate to risk, and for an entity that delivers services through a portal or an API, a WAF is one of the simplest ways to document several of them. Who the new obligations apply to is covered in our article on NIS2 and the KSC Act.
| Requirement | What a WAF contributes |
|---|---|
| PCI DSS 4.0.1, requirement 6.4.2: automated detection and prevention of attacks on public-facing web applications | Meets it, provided it is kept up to date, keeps audit logs and blocks attacks or generates alerts that are investigated immediately |
| Security in the development and maintenance of systems, including vulnerability handling (NIS2, Article 21(2)(e)) | Virtual patching of known vulnerabilities while a fix is prepared and deployed |
| Incident handling (NIS2, Article 21(2)(b)) | Blocking an attack on the application, plus logs showing who tried to attack it, when and with what |
| Reporting a significant incident: early warning within 24 hours, incident notification within 72 hours, final report within one month of the notification (NIS2, Article 23; KSC Act, Article 11(1)(4)–(4c)) | Request logs from which the scope and course of an attack on the service can be established quickly |
What to look for when choosing a WAF
Product descriptions sound alike: machine learning, API protection, managed rules. The differences only emerge when you ask how the WAF will behave with your applications and who will maintain it. The list below favours no product, and it is worth applying to the solution we propose as well.
- Where it will run: in the cloud, in your own data centre or alongside applications in Kubernetes, and whether these models can be combined when some applications are on premises and some in the cloud
- How it protects APIs: whether it can ingest an OpenAPI specification, discover APIs nobody remembered and enforce the request schema
- How it detects bots: whether it can tell a script imitating a browser from a human, and whether it allows different policies for the login page and for the product catalogue
- Who writes and updates the rules, and how soon after a critical vulnerability is published a protective rule appears
- How many false positives it produces on your traffic: you will only find out in a pilot in monitor mode, not in a demo
- Whether it also handles application-layer DDoS, and how it works with protection against volumetric attacks
- Where the logs go and in what format: whether they can be sent to a SIEM and SOC without manual processing
- Where traffic and logs are processed: for public bodies and entities under the KSC Act, location within the European Union is sometimes a prerequisite
- Who will tune the rules after every change to the application: if nobody, the WAF will soon be overgrown with exceptions or fall back to monitor mode
Two proposals to protect the same domain cannot be compared without first agreeing the scope. It is set by the number of applications and APIs to protect, traffic volume, the modules chosen (bot protection, API protection, DDoS), the deployment model and who takes over tuning and alert handling. That is why we start with a conversation in which we agree the scope and the course of the rollout together.
What a WAF rollout looks like
Rolling out a WAF is more work on the applications than on the tool itself. Redirecting traffic to a cloud WAF takes moments. Most of the time goes into learning the applications well enough for the rules to block attacks rather than customers. The order below does not depend on the product chosen.
- Stage 1IT and application ownersInventory of applications, domains and APIs
Establish which applications and APIs are reachable from the internet, who is responsible for them and which are critical. This step often uncovers forgotten test environments and old subdomains. They have to be brought under protection or switched off.
- Stage 2Implementation teamRedirecting traffic in monitor mode
Traffic to the first applications passes through the WAF, but the rules only alert. Certificates, headers carrying the real client address and forwarding to the server must all work before anything is blocked.
- Stage 3Implementation team and application ownersTuning and exceptions
A review of what the WAF would have blocked in normal traffic. Every exception has an owner, a justification and a review date. An exception without those three stays in the configuration forever.
- Stage 4Implementation teamBlocking and closing bypasses
Rules move to blocking, starting with the applications where monitoring showed no false positives. Application servers stop accepting traffic that bypasses the WAF; otherwise the firewall only protects those who politely use the domain.
- Stage 5SOC and application ownersLogs in the SIEM and ongoing maintenance
WAF logs flow into the SIEM and are assessed together with other events. Every new application release, every new API and every critical vulnerability is a reason to review the rules. How a WAF fits alongside SIEM, SOAR and XDR is covered in our comparison of those tools (in Polish).
An example of a WAF deployment in the public sector is described in our case study on protecting citizen portals in public administration: Imperva WAF with CDN in front of citizen portals, internal administrative systems and API gateways, with rules tuned to threats typical of the public sector and logs forwarded to the agency's SIEM.
Frequently asked questions
What is a WAF?
A WAF (web application firewall) is a firewall that sits in front of a web application. It inspects every HTTP request and blocks code injection (SQL injection, XSS), API abuse, malicious bot traffic and attempts to exploit known vulnerabilities.
How does a WAF differ from a regular firewall?
A network firewall decides who may connect to a server and on which port, and it has to let ordinary HTTPS traffic through to the website. A WAF analyses the content of that permitted traffic: parameters, headers and API requests. The two complement each other and neither replaces the other.
Does a WAF replace penetration testing and code fixes?
No. In CERT Polska's 2025 web application audits about 80% of vulnerabilities concerned configuration, access control, authentication and cryptography, and in those categories a WAF helps only partly. Testing shows what to fix, and the WAF protects the application until the fixes reach production. What such a test looks like is covered in our article on penetration testing.
What is virtual patching?
It is a WAF rule that blocks attempts to exploit a specific, known vulnerability before it is fixed in the code or by the software vendor. OWASP stresses that this is a temporary measure: it reduces risk but does not remove the flaw.
Does a WAF protect against DDoS?
A cloud WAF usually also protects against application-layer flood attacks, that is, a deluge of seemingly ordinary page requests. Volumetric attacks that saturate the link need protection on the carrier network side or at a traffic scrubbing centre. A WAF does not replace that.
Is a WAF required by law?
No law and no PCI DSS requirement mandates a WAF by name. Since 31 March 2025 PCI DSS (requirement 6.4.2) has required an automated solution in front of public-facing web applications that continually detects and prevents attacks or generates alerts that are investigated immediately. In practice a WAF fits that description. NIS2 and the KSC Act require measures proportionate to risk, and a WAF helps document vulnerability and incident handling.
How do you start a WAF rollout without blocking customers?
In monitor mode. The WAF records what it would have blocked, the team removes the false positives, and only then are the rules switched to blocking, one application at a time. Finally, direct access to the servers has to be closed so that traffic cannot bypass the WAF.
Summary
A WAF is the baseline protection for applications that handle logins, payments or user data. It stops mass attacks, bots and attempts to exploit freshly published vulnerabilities, which is exactly what a network firewall does not see, because it arrives through a permitted channel. It does not fix the application, though. Its effectiveness comes down to three things: whether it covers every application and API, whether the rules really block, and whether someone reads the logs and tunes the rules after every change. The most common vulnerabilities, namely errors in configuration, access control and authentication, still have to be found in testing and fixed in the application.
KEY TAKEAWAYS
- 1A WAF sits in front of a web application and inspects the content of every HTTP request: it blocks code injection, API abuse, malicious bots and attempts to exploit known vulnerabilities
- 2A network firewall has to let ordinary HTTPS traffic through to the website, while a WAF analyses what that traffic carries. The two complement each other
- 3Virtual patching protects an application from the moment a vulnerability is published until the fix is deployed, but it is temporary and does not remove the flaw from the code
- 4In CERT Polska's 2025 audits injection accounted for about 4% of vulnerabilities, while about 80% concerned configuration, access control, authentication and cryptography. A WAF does not replace testing or fixes
- 5A rollout starts in monitor mode and ends with blocking and closing direct access to the servers
- 6Since 31 March 2025 PCI DSS has required automated protection of public-facing web applications. NIS2 and the KSC Act do not name a WAF, but a WAF helps meet the requirements on vulnerabilities and incidents
Sources
- 1.Raport roczny z działalności CERT Polska 2025CERT Polska / NASK · 2026 · accessed 2026-10-23Security Testing Team audits: 72% included web application testing; breakdown of vulnerabilities by OWASP Top 10:2025 (A02 40%, A01 18%, A07 12%, A04 10%, A06 9%, A03 and A05 4% each, A08 2%, A09 1%). React2Shell (CVE-2025-55182): close to 2,000 vulnerable instances in Poland. A publicly accessible .git folder on an average of 367 IP addresses in Poland per day (table 22). Report in Polish.
- 2.OWASP Top 10:2025OWASP Foundation · 2025 · accessed 2026-10-23The ten web application risk categories in the 2025 edition, based on data from more than 2.8 million applications.
- 3.Virtual Patching Cheat SheetOWASP Cheat Sheet Series · accessed 2026-10-23Definition of virtual patching, the recommended process (log-only mode first, then blocking) and the caveat that a patch is temporary.
- 4.2026 Imperva Bad Bot ReportThales / Imperva · 2026-04 · accessed 2026-10-23Automated traffic more than 53% of web traffic, malicious bots 40% of all traffic, 27% of bot attacks aimed at APIs. 2025 data.
- 5.2026 Data Breach Investigations Report (komunikat prasowy)Verizon · 2026-05-19 · accessed 2026-10-23Vulnerability exploitation as the point of entry in 31% of breaches, ahead of credential abuse. Data from 10.2024–11.2025.
- 6.PCI DSS v4.0 Self-Assessment Questionnaire D for Service Providers (tekst wymagania 6.4.2)PCI Security Standards Council · 2022-04 · accessed 2026-10-24Wording of requirement 6.4.2 from the PCI SSC document for version 4.0 (version 4.0.1 is currently active): an automated solution that detects and prevents attacks on public-facing web applications, mandatory since 31 March 2025. The text of the requirement does not name a WAF.
- 7.Dyrektywa Parlamentu Europejskiego i Rady (UE) 2022/2555 (NIS2)Dziennik Urzędowy UE · 2022-12-27 · accessed 2026-10-23Article 21(2): the list of risk-management measures, including incident handling (point (b)) and vulnerability handling (point (e)); Article 23: deadlines for reporting significant incidents (24 hours, 72 hours, one month from notification).
- 8.Ustawa z dnia 23 stycznia 2026 r. o zmianie ustawy o krajowym systemie cyberbezpieczeństwa oraz niektórych innych ustaw (Dz.U. 2026 poz. 252)ISAP / Sejm RP · 2026-03-02 · accessed 2026-10-23The amendment transposing NIS2 into Polish law: obligations of essential and important entities, including incident handling and reporting (Article 11(1)(4)–(4c): 24 hours, 72 hours, one month from notification). Text in Polish.
- 9.Web Application Firewall (WAF)Imperva · accessed 2026-10-23Vendor documentation: deployment models (Cloud WAF, WAF Gateway, Elastic WAF), rules managed by Imperva Threat Research, share of customers in blocking mode.
Want to see what a WAF would stop in front of your applications?
We roll out Imperva WAF in stages: from an inventory of applications and APIs, through monitor mode, to blocking with logs in the SIEM, and we tie it into the rest of your security architecture.