Web Application Firewall (WAF)
An L7 security filter positioned in front of web applications that inspects HTTP/HTTPS headers and payloads to detect and block SQL injection, XSS, malicious bots, and OWASP Top 10 exploits
Table of Contents
Structure Diagram
What is Web Application Firewall (WAF)?
An L7 security filter positioned in front of web applications that inspects HTTP/HTTPS headers and payloads to detect and block SQL injection, XSS, malicious bots, and OWASP Top 10 exploits. It is a core concept in Cloud Security within Cloud / DevOps.
Core Principles
Unlike traditional L3/L4 network firewalls that only inspect IPs and ports, a Web Application Firewall (WAF) operates at Layer 7, inspecting decrypted HTTP/HTTPS paths, headers, cookies, and JSON/form payloads.
Using managed rulesets (such as OWASP Core Rule Set) and custom policies, a WAF blocks SQL Injection (SQLi), Cross-Site Scripting (XSS), path traversal, automated vulnerability scanners, and credential-stuffing bots with HTTP 403 before requests ever hit your application code.
Practical Takeaways
- Always roll out new rules in Count (Monitor) mode first: Enabling strict Block rules immediately can break legitimate users submitting rich text, code snippets, or complex JSON payloads. Observe logs in Count mode, add scoped exceptions, and then switch to Block.
- Treat WAF as Defense in Depth, not a substitute for secure code: WAFs cannot fix broken authorization or business-logic flaws; always combine them with parameterized queries, output encoding, and strict auth checks.
- Use Virtual Patching for zero-days: When critical CVEs (like Log4Shell) drop, deploy a WAF signature in minutes to block exploit payloads while engineering teams patch and redeploy backend services.
Notable Examples
- AWS WAF: Attaches natively to CloudFront, ALB, and API Gateway with managed OWASP and Bot Control rule groups.
- Cloudflare WAF & Google Cloud Armor: Pushes emergency zero-day signatures globally across edge PoPs in seconds.
- Coraza / ModSecurity (OWASP CRS): Open-source L7 WAF engines embedded in Envoy and NGINX.