What is a web application firewall?

A web application firewall, often known as WAF, protects web applications by filtering and analyzing HTTP traffic between them and the Internet. It generally covers online applications against cross-site request forgeryCSRF allows an attacker to induce a victim user to perform actions that they do not intend., cross-site scripting (XSS)It allows an attacker to execute arbitrary JavaScript within the browser of a victim user. , file inclusion, and SQL injection, among other things.

In basic terms, WAF functions as a barrier between a web application and the Internet. This shield guards the web application against several forms of threats.

A WAF deployed before a web application establishes a barrier between the web application and the Internet. Meanwhile, a proxy server protects the identity of a client machine by utilizing an intermediary. A WAF is a reverse proxy that secures the server from exposure by requiring clients to transit through the WAF before accessing the server.

Placement of WAF in a network

How does it work?

A WAF examines HTTP requests and applies rules determining which portions of the communication are benign and which are malicious. A WAF mainly inspects GET and POST requests in HTTP interactions. POST requests provide data to a server, while GET requests are used to obtain data from the server.

A WAF can analyze and filter the content of these HTTP requests using one of two methods (or a hybrid of the two): whitelisting and blacklisting.

Whitelisting

When using a whitelisting strategy, the WAF will block all requests by default and accept only those known to be trusted. It provides a list of IP addresses that are known to be secure. Whitelisting requires fewer resources than blacklisting. The disadvantage of using whitelisting is that it may mistakenly block innocent traffic. While it can throw a large net and be effective, it can also be inaccurate.

Blacklisting

A blacklisting solution allows packets to pass by default and employs predefined signaturesThese are distinctive pattern-based detection methods that use expressions or marks for identifying application traffic. to block harmful online traffic and safeguard against website or web application vulnerabilities. It's a set of rules that detect malicious packets.

Blacklisting is ideal for public websites and web applications since they receive a lot of traffic from unknown IP addresses that aren't recognized as malicious or benign. The disadvantage of a blacklisting strategy is that it takes more information to filter packets based on specific criteria instead of defaulting to trusted IP addresses.

A hybrid security model combines components of both blacklisting and whitelisting.

Whatever security paradigm a WAF employs, its ultimate goal is to monitor HTTP exchanges and decrease or eradicate harmful traffic before it reaches a server for processing.

Workflow of a WAF

Types of web application firewall

A WAF can be implemented in one of three methods, each with its own set of advantages and disadvantages:

Network-based WAFs

Network-based WAFs are often hardware-based. They can minimize latency since they are deployed locally and as near to the application as feasible through a dedicated appliance. Most major network-based WAF solutions provide rules and replication over several machines, allowing for large-scale deployment, setup, and maintenance. The most significant disadvantage of this WAF product is the expense. Besides an initial capital outlay, it needs continuing operational expenditures for upkeep.

Host-based WAFs

Host-based WAFs can be wholly incorporated into the application code. Using a host-based WAF installation is cheap and it allows more customization choices. Host-based WAFs can be difficult to administer since they require application libraries and rely on local server resources to function correctly. As a result, more staff resources may be necessary, such as developers, system analysts, and DevOps/DevSecOps.

Cloud-hosted WAFs

Cloud-hosted WAFs provide a low-cost alternative for enterprises looking for a turnkey offering with little resources required for deployment and monitoring. Cloud WAFs are straightforward to implement, offered on a subscription basis, and frequently need only a simple DNS or proxy update to divert application traffic. Although entrusting responsibility for filtering an organization's web application traffic to a third-party provider can be difficult, the technique allows applications to be secured across a wide range of hosting locations and uses similar principles to guard against application layer threats. Furthermore, these third parties have access to the most recent threat intelligence and may assist in identifying and blocking the most recent application security risks.

Attacks prevented by WAF

Here are some attacks that are prevented by the web application firewall:

  • DDOS attack

  • Cross-site scripting (XSS)

  • SQL injection attacks

  • Man-in-the-middle attacks

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved