Behavioral Analysis
Advanced browser vs. bot detection using behavioral patterns and TLS fingerprinting. Baseline defenses that separate real browsers from automated abuse.
Overview
💡 How it works: Every request passes through two independent scoring layers. FastBlocker evaluates structural signals immediately - Sec-Fetch headers, Accept quality, header count, UA shape, path anomalies, and IP rate. BehaviorEngine builds a per-fingerprint profile and scores velocity, timing regularity, path entropy, error rates, static asset ratio, burst patterns, and more over a sliding 5-minute window. A fingerprint reaching score ≥70 is sticky-blocked for 15 minutes. JA3 hash from the TLS ClientHello is the primary profile key - IP rotation, VPN hops, and proxy chains don't reset the profile if the TLS fingerprint is consistent. The entire system runs in-process with no external dependencies.
Feature details
Request-1 Blocking
FastBlocker fires on the very first request - no history needed. Missing Sec-Fetch-*, bare Accept headers, and low header count score instantly before any proxying occurs
JA3 TLS Fingerprinting
Computed directly from Go's tls.ClientHelloInfo via GetConfigForClient hook - no nginx module required. CipherSuites, SupportedVersions, SupportedCurves, SignatureSchemes, ALPN, and SNI all contribute to the hash
Known Browser Database
Chrome, Firefox, Safari, Edge, Opera, Brave, and Tor Browser JA3 hashes pre-loaded. Exact match = instant allow with zero behavioral scoring overhead
UA Structure Analysis
Detects tools by shape, not name - no hardcoded tool strings. Checks Mozilla/ token, platform () grouping, and AppleWebKit/Gecko presence. All three must exist simultaneously
Sec-Fetch Header Detection
Injected by all browsers since Chrome 76 / Firefox 90 - absent in every HTTP library. Missing all three Sec-Fetch-Site/Mode/Dest headers scores +35pts instantly
Tiered Velocity Scoring
Three escalating tiers - warn (+20), high (+35), extreme (+50) - scored per JA3 fingerprint over a 5-minute sliding window. IP rotation doesn't help if TLS stack is consistent
Machine Timing Detection
Coefficient of variation (stddev/mean) of inter-request intervals. CV <0.05 AND mean <2s = machine precision timing (+45pts). Requires only 4 requests to compute
Uniform Response Time Detection
Tools receive consistent server response times. CV <0.1 across 6+ requests flags automated polling (+20pts)
Shannon Path Entropy
Entropy <0.6 on normalized paths = scanner repeating same endpoints (+20pts). Entropy <0.3 with 10+ requests = very low entropy (+35pts). Paths normalized: /api/users/123 → /api/users/*
Sequential Enumeration
Detects /item/1, /item/2, /item/3 numeric crawl patterns. Fires when >30% of consecutive path pairs are sequential (+35pts)
High Path Density
>90% unique paths in <8 requests = scanner walking endpoints (+25pts). Combined with velocity = strong scanner signal
Zero Static Assets
Real users load CSS/JS/images - tools never do. 0% static asset ratio after 10+ requests adds +30pts. Checked against 18 file extensions
Method Probing Detection
4+ distinct HTTP methods (GET/POST/PUT/DELETE/PATCH/OPTIONS/HEAD) against the same path = method enumeration attack (+30pts)
Error Rate Analysis
Three tiers - elevated (>25% 4xx → +12pts), high (>50% 4xx/5xx → +25pts), 404-dominant (>50% 404 → +35pts). Distinguishes path probing from application errors
Parameter Fuzzing Detection
Same endpoint with 10+ unique parameter names across 20+ requests = automated parameter discovery (+30pts)
UA Rotation Detection
>30% unique User-Agents across 10+ requests = evasion attempt via UA cycling (+25pts)
Burst Pattern Detection
Zero requests in the prior 9-minute window followed by 20+ in the last minute = attack burst after reconnaissance silence (+30pts)
Path Traversal Scoring
Double-dot sequences (../, ..\, %2e%2e), null bytes (\x00, %00), CRLF injection (\r, \n) in request paths scored independently in both FastBlocker and BehaviorEngine layers
Query String Injection
Structural injection patterns in query strings - union+select, <script, onerror=, exec(, base64_decode(, javascript: - scored +50–55pts on first occurrence
Sticky Block System
Score ≥70 triggers a 15-minute hard block written to the profile. Pre-request IsBlocked() check fires before WAF rules, DDoS engine, or upstream proxy
Block Auto-Expiry
Block TTL auto-expires on the next request after 15 minutes. Profile demoted to challenge state rather than deleted - retains behavioral history
Session Trust Bonus
Established sessions older than 10 minutes with score <20 receive a −15pts reduction. Prevents over-blocking legitimate power users
New Profile Penalty
Profile younger than 10 seconds with 15+ requests scores +20pts - human-impossible volume in that window
Domain Isolation
Profile store is per-domain. Dashboard locked to r.Host - ?domain= query parameter is completely ignored server-side, preventing cross-tenant data leakage
IP Rate Limiter
Sliding window 30 req/10s per IP. Fires independently of behavioral scoring - instant 5-minute block regardless of headers or UA
Health Check Bypass
Silent monitoring probes (no UA, GET /, no body) are whitelisted at FastBlocker level - load balancer checks never accumulate false-positive scores
Learning Mode
Monitor-only mode records detections and flags profiles without blocking. Safe for baseline establishment. Toggle live via /waf-dashboard/behavior-learning endpoint
Profile Ring Buffer
Each profile stores the last 100 requests in memory with O(1) eviction. Fixed memory footprint regardless of request volume
Background Sweeper
Idle profiles evicted every 5 minutes after 30-minute TTL. Prevents unbounded memory growth under sustained scan traffic
2 Layers, 20+ Signals
Layer 1 (FastBlocker) - 7 instant signals on request 1. Layer 2 (BehaviorEngine) - 13 multi-request signals over sliding 5-minute window. Both run synchronously before upstream proxy. No external dependencies - no Redis, no database, no sidecar
How CloFix WAF uses it
💡 How it works: Every request passes through two independent scoring layers. FastBlocker evaluates structural signals immediately - Sec-Fetch headers, Accept quality, header count, UA shape, path anomalies, and IP rate. BehaviorEngine builds a per-fingerprint profile and scores velocity, timing regularity, path entropy, error rates, static asset ratio, burst patterns, and more over a sliding 5-minute window. A fingerprint reaching score ≥70 is sticky-blocked for 15 minutes. JA3 hash from the TLS ClientHello is the primary profile key - IP rotation, VPN hops, and proxy chains don't reset the profile if the TLS fingerprint is consistent. The entire system runs in-process with no external dependencies.
Canonical URL: https://clofix.com/features/clofix-waf/behavior-analysis/