OWASP Web Application Firewall

A web application firewall, or WAF, sits in front of a web application and inspects every request. It blocks traffic that matches known attack patterns and lets normal visitors pass. A WAF adds a protective layer without changing the application code.

The Security Guard Comparison

A guard at a building entrance checks bags for forbidden items. The guard does not repair broken doors inside the building, yet the checks stop many problems at the entrance. A WAF plays that role for a website.

Where the WAF Sits

 Visitors
    |
    ↓
+----------------+
|      WAF       |   inspects requests and responses
+----------------+
    |  allowed requests only
    ↓
+----------------+
|  Web server /  |
|  application   |
+----------------+
    |
    ↓
 Database

How a WAF Decides

Rule Matching

Rules describe suspicious patterns in URLs, headers, and request bodies. A request that matches a rule receives a score or a direct block.

Anomaly Scoring

Many WAFs add points for each suspicious sign. The request passes while the total stays below a threshold and blocks when the total rises above it. Scoring reduces false alarms compared with one-rule decisions.

Behavior Checks

Modern WAFs also watch request rates, known bad sources, and bot behavior.

The OWASP Core Rule Set

OWASP maintains the Core Rule Set, often shortened to CRS. The free rule collection works with engines such as ModSecurity and Coraza. CRS covers common categories: SQL injection patterns, cross-site scripting, local file inclusion, protocol violations, and scanner detection. Many commercial and cloud WAFs build on the same ideas.

Deployment Types

TypeDescriptionTypical Choice For
Cloud serviceTraffic passes through a provider's networkFast setup and public websites
Reverse proxy applianceA dedicated server sits before the applicationData centers with strict control
Host moduleA module runs inside the web serverSmall projects and testing

Detection Mode and Blocking Mode

New WAFs start in detection mode. The WAF logs matches without blocking anything. Teams review the log, find legitimate requests that look suspicious, and write exceptions. After tuning, the team switches to blocking mode. Skipping this step breaks real features and frustrates users.

What a WAF Can Do

  • Block many automated attacks and scanning tools.
  • Provide virtual patching: a quick rule that shields a known flaw while developers prepare the real fix.
  • Limit abusive traffic and bots.
  • Record attack attempts for investigation.

What a WAF Cannot Do

  • Fix insecure code. Attackers adapt payloads to slip past rules.
  • Understand business logic, so abuse of valid features passes through.
  • Replace authentication and authorization checks inside the application.

Treat the WAF as a safety net under a secure application, never as the only protection.

Operating Tips

  1. Start in detection mode and review logs for at least a week of normal traffic.
  2. Tune rules per application instead of disabling whole categories.
  3. Send WAF logs to a central monitoring system.
  4. Update rule sets regularly.
  5. Test the WAF after each application release.

Key Takeaways

  • A WAF filters web traffic before it reaches the application.
  • The OWASP Core Rule Set offers a free, widely used rule collection.
  • Tuning in detection mode prevents false blocks.
  • Secure code remains the primary defense.