AppSec / Repository
waf-defense-rulepacks
Battle-tested, production-ready rule sets for Web Application Firewalls (WAFs), providing comprehensive protection against OWASP Top 10 attacks, API abuse, and modern bypass techniques for ModSecurity, AWS WAF, and Cloudflare.
View on GitHub ↗About the Project
WAF Defense Rulepacks is a curated collection of optimized security rules designed for the most widely deployed Web Application Firewalls in the industry. A Web Application Firewall (WAF) sits between users and web applications, inspecting every HTTP request and blocking those that match known attack patterns — such as SQL injection, cross-site scripting (XSS), command injection, path traversal, and more. This project provides three complete rule sets, each optimized for a specific WAF platform: ModSecurity (the open-source standard used with Apache and Nginx), AWS WAF (Amazon's cloud-native firewall), and Cloudflare WAF (the widely-used CDN-integrated firewall). Each rule set covers the full OWASP Top 10 vulnerability categories, API-specific attack patterns (broken authentication, excessive data exposure, mass assignment), and modern bypass techniques that evade default WAF configurations. Every rule includes detailed comments explaining what attack it detects, how the detection pattern works, potential false positive scenarios, and tuning recommendations. Rules are organized by attack category and severity level, making it easy for security teams to enable protections incrementally — starting with high-confidence rules and gradually adding more aggressive detection as they tune for their specific application. The project also includes a comprehensive testing suite with known-good and known-bad request samples, allowing teams to validate rule effectiveness and measure false positive rates before deploying to production.
Why This Matters
Web Application Firewalls are a critical defense layer for any internet-facing application, yet they are only as effective as their rule configuration. Default WAF rules from most vendors provide basic protection but miss sophisticated attacks, modern bypass techniques, and application-specific vulnerabilities. Studies show that over 40% of organizations using WAFs have significant gaps in their rule coverage, leaving them vulnerable despite having a WAF deployed. Misconfigured WAFs create a dangerous false sense of security — organizations believe they are protected when in reality their WAF is easily bypassed. This project addresses that gap by providing rules that have been tested against real-world attack traffic, refined based on years of web application security experience, and documented thoroughly so that security teams understand exactly what each rule does and why. For organizations subject to PCI-DSS, SOC 2, or GDPR compliance, having a well-configured WAF with documented rules is often a regulatory requirement. These rulepacks provide both the technical protection and the audit documentation needed for compliance.
Step-by-Step Guide
- Select the appropriate rulepack for your WAF platform (ModSecurity, AWS WAF, or Cloudflare). Each rulepack is in its own directory with a README explaining prerequisites and compatibility requirements. Ensure your WAF version meets the minimum requirements listed.
- Import the rules using the automated installation script provided for each platform. For ModSecurity, run 'install-modsec.sh' which will place rules in the correct directory and update your configuration. For AWS WAF, use the Terraform templates in /aws-waf/terraform/ to create rule groups. For Cloudflare, use the API script in /cloudflare/deploy.sh.
- Configure blocking thresholds and sensitivity levels for your environment. Start in 'detection-only' mode (logging without blocking) by setting DETECTION_MODE=true. Monitor for false positives over 1-2 weeks before switching to active blocking mode. The tuning guide in /docs/tuning.md provides step-by-step instructions.
- Monitor WAF logs regularly and adjust rules based on your application's legitimate traffic patterns. Use the included log analysis scripts to identify potential false positives and create exception rules for known-good requests. Review the quarterly update bulletins for new rules addressing emerging attack techniques.