CORAZA v3 WAF & OWASP CRS v4 TUNING
Hackergate embeds the Coraza v3 Web Application Firewall engine in 100% native Go. It executes the industry-standard OWASP Core Rule Set (CRS) v4 directly inside the reverse proxy process without CGO bindings, context switches, or external daemon hops.
Inspection Pipeline & Processing Phases
Coraza models HTTP inspection in 5 sequential phases matching the ModSecurity / SecLang execution lifecycle. Requests that exceed anomaly scoring thresholds in Phase 1 or 2 are aborted immediately before backend invocation, saving upstream compute capacity.
OWASP CRS v4 Paranoia Levels (PL 1 – PL 4)
Paranoia levels balance detection sensitivity against operational overhead. As paranoia level increases, additional rule families are evaluated, requiring targeted exclusions for legitimate application patterns.
PL 1: Baseline Production
RECOMMENDEDDesigned for zero false positives. Catches obvious SQL injection, Cross-Site Scripting (XSS), Local File Inclusion (LFI), Remote Code Execution (RCE), PHP code evaluation, and HTTP protocol anomalies.
PL 2: Hardened Services
STRICTAdds rigorous protocol checks: validates UTF-8 byte sequences, disallows null bytes and carriage returns in headers, verifies Content-Type match against body, and enforces parameter length caps.
PL 3: Banking & High Risk
ADVANCEDDetects advanced evasion techniques: character hex encoding expansions, repetition of SQL statement keywords (UNION, SELECT), multiple URL encodings, and strict parameter format matching.
PL 4: Forensic Lockdown
MAXIMUMExtreme defensive containment. Drops requests containing Unix/Windows shell metacharacters (| & ; $ ` > <) or non-alphanumeric parameter structures.
Anomaly Scoring Mechanics
Unlike traditional WAFs that block on the first matched pattern (traditional regex mode), Hackergate uses OWASP CRS collaborative anomaly scoring. Each rule match contributes an anomaly weight based on severity. The request is only blocked when the cumulative score reaches the inbound threshold.
| Severity Level | Score Added | Example Triggers | Typical Action |
|---|---|---|---|
| CRITICAL | +5 | SQLi UNION SELECT, Command Injection, Directory Traversal | Immediate block on PL 1 (threshold 5 reached) |
| ERROR | +4 | XSS event handler in URL, Missing Host header | Warns on PL 1, blocks if combined with notice |
| WARNING | +3 | Unknown Content-Type, Obsolete HTTP/1.0 without Keep-Alive | Contributes to total anomaly score |
| NOTICE | +2 | Missing Accept header, Generic crawler User-Agent | Informational telemetry indicator |
Configuring WAF in Virtual Host YAML
WAF settings are configured declaratively per virtual host in /etc/hackergate/vhosts.d/. Different domains on the same server can run different paranoia levels and custom rule files.
Custom SecLang Directives & Rule Exclusions
When legitimate application behavior triggers CRS rules, write target-scoped exclusions rather than disabling the entire WAF or entire rule families. Hackergate supports standard SecLang directives.
Response Body Shielding (Data Leakage Prevention)
Hackergate inspects outbound backend HTTP response bodies in Phase 4. If an upstream service accidentally reflects database credentials, private cryptographic keys, or unmasked credit card numbers, Hackergate intercepts the response, substitutes a safe HTTP 500 error, and fires a high-priority threat alert to the mesh.
Credential & Key Leaks
Pre-compiled regex patterns identify AWS Access Keys, Google Cloud service account JSON blocks, RSA / EC private key headers (-----BEGIN PRIVATE KEY-----), and GitHub / GitLab personal access tokens.
PII & PCI-DSS Card Validation
Outbound credit card number patterns are verified with real-time Luhn checksum calculation. False matches (such as numeric product barcodes) pass through unaffected.
Stack Trace & Debug Suppression
Suppresses unhandled backend exceptions exposing database connection strings, SQL dialect query dumps, or internal microservice IP addresses to public clients.