# ============================================================================= # WEB APPLICATION FIREWALL (WAF) CONFIGURATION - EXAMPLE # ============================================================================= # Copy this file to waf.toml and customize for your environment # ============================================================================= # ----------------------------------------------------------------------------- # CORE SETTINGS # ----------------------------------------------------------------------------- [Core] # Enable or disable the WAF entirely Enabled = true # Log all WAF detections (even if not blocked) LogAllDetections = true # Maximum request body size to analyze (in bytes) MaxBodySize = 10485760 # 10MB # WAF operation mode: "detect" or "prevent" # detect = log only, prevent = actively block Mode = "prevent" # ----------------------------------------------------------------------------- # DETECTION SETTINGS # ----------------------------------------------------------------------------- [Detection] # Enable specific attack detection categories SQLInjection = true XSS = true CommandInjection = true PathTraversal = true LFI_RFI = true NoSQLInjection = true XXE = true LDAPInjection = true SSRF = true XMLRPCAttacks = true # Sensitivity levels: low, medium, high Sensitivity = "medium" # Paranoia level (1-4) ParanoiaLevel = 2 # ----------------------------------------------------------------------------- # SCORING CONFIGURATION # ----------------------------------------------------------------------------- [Scoring] # Base scores for each attack type - significantly increased for aggressive detection SQLInjection = 80 # Increased from 35 XSS = 90 # Increased from 30 - XSS is extremely dangerous CommandInjection = 100 # Increased from 40 - most dangerous PathTraversal = 70 # Increased from 25 LFI_RFI = 80 # Increased from 35 NoSQLInjection = 60 # Increased from 30 XXE = 80 # Increased from 35 LDAPInjection = 50 # Increased from 30 SSRF = 75 # Increased from 35 XMLRPCAttacks = 45 # Increased from 25 # Score modifiers based on confidence HighConfidenceMultiplier = 1.2 MediumConfidenceMultiplier = 1.0 LowConfidenceMultiplier = 0.8 # ----------------------------------------------------------------------------- # RATE LIMITING # ----------------------------------------------------------------------------- [RateLimit] # Maximum WAF detections per IP in the time window MaxDetectionsPerIP = 5 # More aggressive - reduced from 10 # Time window for rate limiting (in seconds) TimeWindow = 600 # 10 minutes - increased window # Action when rate limit exceeded: "block" or "challenge" RateLimitAction = "block" # Changed from challenge to block # Decay factor for repeated offenses DecayFactor = 0.8 # More aggressive decay # ----------------------------------------------------------------------------- # ADVANCED DETECTION # ----------------------------------------------------------------------------- [Advanced] # Enable machine learning-based detection MLDetection = false # Enable payload deobfuscation Deobfuscation = true MaxDeobfuscationLevels = 3 # Enable response analysis (detect info leakage) ResponseAnalysis = true # Enable timing attack detection TimingAnalysis = false # ----------------------------------------------------------------------------- # CUSTOM RULES EXAMPLES # ----------------------------------------------------------------------------- [[CustomRules]] Name = "WordPress Admin Probe" Pattern = "(?i)/wp-admin/(admin-ajax\\.php|post\\.php)" Category = "reconnaissance" Score = 15 Enabled = true Action = "log" Field = "uri_path" [[CustomRules]] Name = "Block Headless Browsers" Field = "user_agent" Pattern = "(?i)HeadlessChrome/" Category = "bad_bot" Score = 100 Enabled = true Action = "block" # Example of blocking specific paths on specific hosts [[CustomRules]] Name = "Block Setup Endpoint" Field = "uri_path" Pattern = "(?i)/setup" Category = "access_control" Score = 100 Enabled = false # Disabled by default Action = "block" Hosts = ["example.com"] # Example of chained conditions (both must match) [[CustomRules]] Name = "Chained Demo Rule" Category = "demo" Score = 25 Enabled = false # Disabled by default Action = "block" [[CustomRules.Conditions]] Field = "uri_query" Pattern = "(?i)debug=true" [[CustomRules.Conditions]] Field = "user_agent" Pattern = "(?i)curl" # Block javascript: protocol in any part of the URL - CRITICAL [[CustomRules]] Name = "Block JavaScript Protocol" Field = "uri" Pattern = "(?i)javascript:" Category = "xss" Score = 100 Enabled = true Action = "block" # Block dangerous data: URLs [[CustomRules]] Name = "Block Data URL XSS" Field = "uri" Pattern = "(?i)data:.*text/html" Category = "xss" Score = 100 Enabled = true Action = "block" # Block data: URLs with JavaScript [[CustomRules]] Name = "Block Data URL JavaScript" Field = "uri" Pattern = "(?i)data:.*javascript" Category = "xss" Score = 100 Enabled = true Action = "block" # Block vbscript: protocol [[CustomRules]] Name = "Block VBScript Protocol" Field = "uri" Pattern = "(?i)vbscript:" Category = "xss" Score = 100 Enabled = true Action = "block" # Block any script tags in URL parameters [[CustomRules]] Name = "Block Script Tags in Query" Field = "uri_query" Pattern = "(?i)