diff --git a/.gitignore b/.gitignore
index 610534f..3b4ad02 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,3 +16,5 @@ sqli_payload.txt
xxe_payload.xml
dns_blacklist.txt
ip_blacklist.txt
+waf_test_results_alt.log
+waf_test_results_extended.log
diff --git a/rules.json b/rules.json
index 0a8b562..18b3188 100644
--- a/rules.json
+++ b/rules.json
@@ -1,4 +1,28 @@
[
+ {
+ "id": "allow-legit-browsers",
+ "phase": 1,
+ "pattern": "(?i)(Mozilla|Chrome|Safari|Edge|Firefox|Opera|AppleWebKit|Gecko|Trident|MSIE|Googlebot|Bingbot|Slurp|DuckDuckBot|Baiduspider|YandexBot|Sogou|Exabot|facebot|facebookexternalhit|Twitterbot|Slackbot|LinkedInBot|TelegramBot)",
+ "targets": [
+ "HEADERS:User-Agent"
+ ],
+ "severity": "LOW",
+ "action": "log",
+ "score": 1,
+ "description": "Allow and log traffic from legitimate browsers, search engine crawlers, and social media bots."
+ },
+ {
+ "id": "auth-login-form-missing",
+ "phase": 2,
+ "pattern": "^$",
+ "targets": [
+ "BODY"
+ ],
+ "severity": "LOW",
+ "action": "log",
+ "score": 3,
+ "description": "Log login requests that do not contain login form fields"
+ },
{
"id": "block-scanners",
"phase": 1,
@@ -12,54 +36,28 @@
"description": "Block traffic from known vulnerability scanners and penetration testing tools. Includes more scanners."
},
{
- "id": "sensitive-files-expanded",
+ "id": "crlf-injection-headers",
"phase": 1,
- "pattern": "(?i)(?:/\\.git/(?:HEAD|index|config|refs|objects)|/\\.env(?:\\.local|\\.dev|\\.prod)?$|/\\.htaccess$|/\\.htpasswd$|/\\.svn/|/\\.DS_Store$|\\/WEB-INF\\/|\\/WEB-INF\\/web.xml|\\/META-INF\\/|\\.git/\\s*(?:H\\.E\\.A\\.D|HEAD)|\\.dockerenv|server-status)",
+ "pattern": "(?i)(%0d|\\r)%0a|%0a(%0d|$)|\\n|%0d%0a|%0a%0d|\\r\\n",
"targets": [
- "URI"
+ "HEADERS"
],
- "severity": "HIGH",
- "action": "block",
- "score": 9,
- "description": "Expanded rule to block access to more sensitive files and account for obfuscation."
+ "severity": "MEDIUM",
+ "action": "log",
+ "score": 5,
+ "description": "Log requests with potential CRLF injection characters in headers. Improved pattern matching."
},
{
- "id": "sensitive-files",
- "phase": 1,
- "pattern": "(?i)(?:/\\.git/(?:HEAD|index|config|refs|objects)|/\\.env(?:\\.local|\\.dev|\\.prod)?$|/\\.htaccess$|/\\.htpasswd$|/\\.svn/|/\\.DS_Store$|\\/WEB-INF\\/|\\/WEB-INF\\/web\\.xml|\\/META-INF\\/|\\.git/\\s*(?:H\\.E\\.A\\.D|HEAD)|\\.dockerenv|server-status|\\b(?:config|database|credentials|secrets|private|local|development|staging|production|backup|default)\\b(?:[\\-_\\.]?)(?:[a-z0-9]+)?\\.(?:json|yaml|yml|ini|properties|txt|conf|toml|lock|log|bak|swp|orig|dist|sample|example|template|env|sql))",
+ "id": "csrf-missing-token-post",
+ "phase": 2,
+ "pattern": "^$",
"targets": [
- "URI"
- ],
- "severity": "HIGH",
- "action": "block",
- "score": 9,
- "description": "Block access to sensitive files and directories (Target: URI). Expanded rule to include more config and backup file names."
- },
- {
- "id": "http-request-smuggling",
- "phase": 1,
- "pattern": "(?i)(?:Transfer-Encoding.*?(?:chunked|identity)|Content-Length:\\s*0|(?:Content-Length:\\s*\\d+)(?:\\n.*){2,}|(?:Content-Length:\\s*\\d+)(?:\\n\\w+:\\s*.*?\\n+)|(?:TE:\\s*chunked)(?:\\n.*){2,}|(?:TE:\\s*identity)(?:\\n.*){2,})",
- "targets": [
- "HEADERS",
"BODY"
],
"severity": "HIGH",
- "action": "block",
- "score": 9,
- "description": "Detects HTTP request smuggling patterns. Targets Transfer-Encoding and Content-Length headers."
- },
- {
- "id": "path-traversal",
- "phase": 1,
- "pattern": "(?:\\.\\.[/\\\\]|\\.\\./|\\.\\.\\\\/|%2e%2e[/\\\\]|%2e%2e/|%2e%2e%5c|%252e%252e|\\b(?:etc(?:\\/|%2F)(?:passwd|shadow|hosts)|(?:proc|sys)(?:\\/|%2F)(?:self(?:\\/|%2F)environ|cmdline)|boot(?:\\/|%2F)grub(?:\\/|%2F)grub\\.cfg|\\/\\.\\.(?:\\/|%2F)|(?:\\/|%5c)(\\.\\.){2,}(?:\\/|%5c)|(?:\\.\\.){2,}(?:\\/|%5c)|(?:\\.\\.){2,}|(?:%2e%2e){2,}(?:%2f|%5c)|(?:%2e%2e%2f|%2e%2e%5c){2,}|(?:\\.\\.%2f|\\.\\.%5c){2,}|(?:%252e%252e%2f|%252e%252e%5c){2,}|%252e%252e|%252f%2e%2e|%255c%2e%2e|\\/\\.(?:\\/|%2F)|\\%2e(?:%2f|%5c))\\b)",
- "targets": [
- "URI",
- "HEADERS"
- ],
- "severity": "HIGH",
- "action": "block",
- "score": 9,
- "description": "Block path traversal attempts and direct access to sensitive files (Target: URI and Headers). Improved and more aggressive pattern matching, including more obfuscation techniques."
+ "action": "log",
+ "score": 6,
+ "description": "Log POST requests to write operation endpoints that are missing a CSRF token in the body (use this with a condition to ensure that a write operation was done)."
},
{
"id": "header-attacks-consolidated",
@@ -86,256 +84,17 @@
"description": "Block requests with potentially internal IPs in X-Forwarded-For. Added more internal IP ranges."
},
{
- "id": "crlf-injection-headers",
+ "id": "http-request-smuggling",
"phase": 1,
- "pattern": "(?i)(%0d|\\r)%0a|%0a(%0d|$)|\\n|%0d%0a|%0a%0d|\\r\\n",
+ "pattern": "(?i)(?:Transfer-Encoding.*?(?:chunked|identity)|Content-Length:\\s*0|(?:Content-Length:\\s*\\d+)(?:\\n.*){2,}|(?:Content-Length:\\s*\\d+)(?:\\n\\w+:\\s*.*?\\n+)|(?:TE:\\s*chunked)(?:\\n.*){2,}|(?:TE:\\s*identity)(?:\\n.*){2,})",
"targets": [
- "HEADERS"
- ],
- "severity": "MEDIUM",
- "action": "log",
- "score": 5,
- "description": "Log requests with potential CRLF injection characters in headers. Improved pattern matching."
- },
- {
- "id": "unusual-paths",
- "phase": 1,
- "pattern": "(?i)(?:/wp-admin|/phpmyadmin|/admin|/login|/cgi-bin|/shell|/backdoor|/cmd|/exec|/bin/(?:sh|bash|zsh)|/console|/setup|/test|\\.php$|\\.asp$|\\.aspx$|\\.jsp$|\\.do$|\\.action$|\\.pl$|\\.py$|\\.cgi$|\\.cfm$|\\.rb$|\\.php[0-9]?$|\\.phtml$|\\.htaccess$|\\.htpasswd$|\\.ini$|\\.config$|\\.lock$|\\.log$|\\.bak$|\\.swp$|\\.orig$|\\.dist$|\\.sample$|\\.example$|\\.template$|\\.env$)",
- "targets": [
- "URI"
- ],
- "severity": "MEDIUM",
- "action": "block",
- "score": 7,
- "description": "Block requests to unusual or suspicious paths and common scripting extensions (Target: URI). Expanded rule for more file types and endpoints."
- },
- {
- "id": "exposed-admin-panels-no-referer",
- "phase": 1,
- "pattern": "(?i)^(?:/wp-admin|/phpmyadmin|/admin|/login|/cpanel|/administrator|/webmin|/siteadmin|/config)",
- "targets": [
- "URI"
- ],
- "severity": "LOW",
- "action": "log",
- "score": 3,
- "description": "Log requests to common admin panel paths."
- },
- {
- "id": "allow-legit-browsers",
- "phase": 1,
- "pattern": "(?i)(Mozilla|Chrome|Safari|Edge|Firefox|Opera|AppleWebKit|Gecko|Trident|MSIE|Googlebot|Bingbot|Slurp|DuckDuckBot|Baiduspider|YandexBot|Sogou|Exabot|facebot|facebookexternalhit|Twitterbot|Slackbot|LinkedInBot|TelegramBot)",
- "targets": [
- "HEADERS:User-Agent"
- ],
- "severity": "LOW",
- "action": "log",
- "score": 1,
- "description": "Allow and log traffic from legitimate browsers, search engine crawlers, and social media bots."
- },
- {
- "id": "insecure-deserialization-java",
- "phase": 2,
- "pattern": "(?:rO0AB|aced0005|\\xac\\xed\\x00\\x05)",
- "targets": [
- "BODY",
"HEADERS",
- "COOKIES"
- ],
- "severity": "CRITICAL",
- "action": "block",
- "score": 9,
- "description": "Block requests containing potential Java serialized objects, including magic bytes for serialized objects."
- },
- {
- "id": "xss-attacks",
- "phase": 2,
- "pattern": "(?i)(?:"), # Expect block if strict CSP, otherwise may pass with 200 if no CSP
+ ("CSP Bypass", f"{TARGET_URL}/", "CSP Bypass (Level 12) - Unsafe-eval attempt (Blocked in strict CSP)", 403, None, ""), # Expect block if strict CSP blocks unsafe-eval
+ ("CSP Bypass", f"{TARGET_URL}/", "CSP Bypass (Level 13) - WASM in object (object-src check)", 403, None, ""), # Wasm object might be controlled by object-src
+ ("CSP Bypass", f"{TARGET_URL}/", "CSP Bypass (Level 14) - Form action to data URI (form-action policy)", 403, None, "
"), # Form to data URI
+ ("CSP Bypass", f"{TARGET_URL}/", "CSP Bypass (Level 15) - Sandboxed iframe escape attempt (If sandbox attr used, try breaking)", 403, None, ""), # Attempt to break sandbox with top.location. Expect block still by WAF if payload is recognized. Full sandbox bypass requires browser context usually for effective testing.
+ ("CSP Bypass", f"{TARGET_URL}/", "CSP Bypass (Level 16) - Plugin type (plugin-types policy, e.g. application/x-shockwave-flash)", 403, None, "