Security

What is WAF?

Also known as: Web Application Firewall

Definition

A WAF (Web Application Firewall) is a security device or service that monitors, filters, and blocks HTTP traffic to protect web applications from common attacks like SQL injection and cross-site scripting.

A Web Application Firewall (WAF) is a security appliance, software plugin, or cloud service that inspects HTTP and HTTPS traffic between a client and a web application. Its primary purpose is to detect and block malicious requests that exploit application-layer vulnerabilities, such as SQL injection (SQLi), cross-site scripting (XSS), cross-site request forgery (CSRF), and file inclusion attacks. Unlike a network firewall that operates at layers 3 and 4 of the OSI model, a WAF works at layer 7 (the application layer), allowing it to parse and understand the structure of HTTP requests and responses.

The WAF operates based on a set of rules, often called policies, which define what constitutes malicious traffic. These rules can be signature-based, matching known attack patterns, or anomaly-based, detecting deviations from normal traffic baselines. Many modern WAFs also use positive security models, where only explicitly allowed traffic is permitted, and negative security models, where known attack patterns are blocked. The WAF can be deployed in-line (proxying traffic) or out-of-band (receiving mirrored traffic), with in-line being the most common for active blocking. Cloud-based WAFs, such as those provided by AWS (AWS WAF), Cloudflare, and Akamai, are popular because they require no hardware and can scale with traffic.

In the wider security stack, a WAF complements other controls like intrusion prevention systems (IPS), DDoS protection, and API gateways. It is not a substitute for secure coding practices but provides a critical layer of defense, especially for legacy applications or those exposed to the public internet. The Open Web Application Security Project (OWASP) publishes the OWASP Top 10, a widely referenced list of the most critical web application security risks, which WAFs are designed to mitigate. WAFs are also a common requirement for compliance frameworks such as PCI DSS, which mandates their use for protecting cardholder data.

Key facts

  • Operates at OSI layer 7, inspecting HTTP/HTTPS request and response payloads.
  • Can be deployed as hardware, software, or cloud service; cloud WAFs are the most common today.
  • Uses signature-based, anomaly-based, or positive/negative security models to detect attacks.
  • Commonly blocks SQL injection, cross-site scripting, CSRF, and file inclusion attacks.
  • Required by PCI DSS for any web application handling credit card data.
  • Does not replace secure coding; it is a compensating control for unpatched or legacy apps.

How it works in practice

A retail website uses a cloud WAF from Cloudflare. An attacker sends a POST request to the login endpoint with the username field containing ' OR '1'='1. The WAF's SQLi signature rules match this pattern and drop the request before it reaches the application server. The attacker receives a 403 Forbidden response, and the WAF logs the event for security review.

Related terms

Intrusion Prevention System (IPS) DDoS Protection API Gateway OWASP Top 10 Reverse Proxy Content Delivery Network (CDN)

References

More in Security

2FA

Two-factor authentication (2FA) is a security method that requires a user to present two distinct types of evidence to verify their identity, typically a password and a time-based one-time code from an authenticator app or hardware key.

Bot Management

Bot management detects automated web traffic and distinguishes it from human users, using behavioral fingerprinting and other signals to block malicious bots while allowing benign ones.

Credential Stuffing

Credential stuffing is a cyberattack in which automated tools use username-password pairs leaked from one site to try logging into other sites, exploiting password reuse.

DDoS

A DDoS (Distributed Denial of Service) attack overwhelms a target server, service, or network with massive traffic from many compromised computers, making it unavailable to legitimate users.

DDoS Scrubbing

DDoS scrubbing diverts attack traffic to a specialized filtering facility that removes malicious packets and forwards only legitimate traffic to the target network.

Firewall

A network security device or software that monitors and controls incoming and outgoing traffic based on predetermined security rules, acting as a barrier between trusted and untrusted networks.

IDS

An Intrusion Detection System (IDS) monitors network traffic or host activity for signs of malicious behavior or policy violations and generates alerts for security personnel.

IPS

An Intrusion Prevention System (IPS) is a network security device that monitors traffic inline and actively blocks malicious packets before they reach their target.

OAuth 2.0

OAuth 2.0 is an authorization framework that allows a user to grant a third-party application limited access to their resources on another service without revealing their password.

OpenID Connect

OpenID Connect (OIDC) is an identity authentication layer built on OAuth 2.0 that provides a signed ID token containing verified user identity claims.

Who Is Online

In total there are 60 users online: 0 registered, 53 guests and 7 bots.

Most users ever online was 5,555 on 17 Jul 2026, 3:23 am.

Bots: AhrefsBot Applebot Baiduspider Other Bot Other Crawler PetalBot SemrushBot

Users active in the past 15 minutes. Total registered members: 369