Skip to content

Synapse Feature Reference

Complete feature inventory for the Synapse WAF engine.

Feature Matrix

FeatureModuleDefaultPerformance
WAF Detectionwaf/Enabled~10–25 μs
Entity Trackingentity/Enabled45 ns lookup
Actor Fingerprintingactor/Enabled
Session Managementsession/Enabled304 ns
DLP Scanningdlp/Disabled~34 μs (4 KB)
Rate Limitingratelimit/Enabled61 ns
Bot/Crawler Detectioncrawler/Enabled
Behavioral Profilingprofiler/Enabled
Campaign Correlationcorrelation/Enabled
Geo/Impossible Travelgeo/Enabled
Shadow Mirroringshadow/Disabled
Tarpittarpit/Enabled
TLS/SNItls/Disabled
CAPTCHA/JS Challengeinterrogator/Enabled
Honeypot Trapstrap/Enabled33 ns
Telemetry to Horizontelemetry/Disabled
Config Hot-Reloadreload/Enabled~240 μs
Access Listsaccess/Enabled156 ns (100 rules)

Detection Engine

WAF Rules

237 production rules with 99.8% OWASP CRS coverage (4,122/4,131 tests) and 0% false positives (GoTestWAF validated).

Rule categories:

CategoryCoverage
SQL Injection (SQLi)UNION, boolean, tautology, stacked, blind, time-based
Cross-Site Scripting (XSS)Script injection, event handlers, SVG, DOM manipulation
Path TraversalLiteral, URL-encoded, double-encoded, null byte variants
Command InjectionShell commands, pipe, backtick, semicolon chaining
LDAP InjectionDirectory service attack patterns
XML External Entity (XXE)XML parser exploitation

Each rule has a risk score (0–100). Scores accumulate per-request; the request is blocked when the total exceeds waf_threshold (default: 70).

Detection actions: block (HTTP 403), log (forward + log), challenge (CAPTCHA/JS).

Evasion resistance: All payloads pass through a multi-stage decoder (URL decode → HTML entity → Unicode normalization → case folding) before rule evaluation. Regex timeout at waf_regex_timeout_ms (default: 100 ms) prevents ReDoS. All evasion techniques detected under 34 μs.

Detection Pipeline (8 Phases)

Every request goes through the complete detection cycle in ~75 μs:

PhaseWhat It DoesCost
1. Context BuildingParse method, URI, query params, headers. Compute feature flags.~30 ns
2. Actor StoreLookup/create actor by IP. Update last-seen. Record UA fingerprint.~15 ns
3. Credential StuffingCheck if auth endpoint. Record attempt if yes.~3 ns (non-auth)
4. Profile AnomalyLookup endpoint baseline. Check for unusual params, payload, method.~40 ns
5. Candidate SelectionRule index filters 237 rules → ~35 candidates via bitmask. Cache lookup.~15 ns
6. Rule EvaluationEvaluate ~35 candidate rules at ~5.7 ns each. Short-circuit on first false.~200 ns
7. Entity TrackingUpdate entity risk. Apply decay. Record rule contributions.~30 ns
8. VerdictAggregate risk. Determine action (Allow/Challenge/Block).~15 ns

DLP Scanning

Data Loss Prevention scans request bodies for sensitive data.

Supported pattern types (22):

TypeDetection Method
Credit card numbersRegex + Luhn checksum validation
Social Security NumbersFormat validation
IBAN numbersMod-97 checksum
Phone numbersUS area code validation
API keys / tokensJWT, Bearer tokens, common key patterns
Private keysRSA, SSH key detection
Crypto addressesBTC, ETH wallet patterns
Database stringsConnection string detection
Custom patternsUser-defined regex

DLP actions: mask (redact in-place), hash (replace with hash), block (reject request), log (forward + log).

Performance optimizations:

  • Aho-Corasick prefilter for multi-pattern detection (30–50% faster than sequential regex)
  • Content-type short circuit — binary types automatically skipped
  • Inspection depth cap — truncate body scan at max_body_inspection_bytes (default: 8 KB)

Entity & Actor Tracking

Entity Tracking

Track IP addresses and fingerprints across requests with cumulative risk scoring.

  • Risk accumulation — entity risk grows with each detected threat
  • Automatic blocking — entities exceeding the block threshold are rejected on sight
  • Decay — risk scores decay over time to handle transient spikes

Actor Correlation

The ActorManager (1,450 LOC) correlates requests across multiple IPs into unified actor identities using composite signals:

SignalWeightPurpose
JA4 TLS FingerprintHighStable across IP rotation
JA4H HTTP FingerprintHighBrowser/client behavior
Auth TokenDefinitiveLinks authenticated sessions
User-Agent HashMediumClient identification
Header OrderLowImplementation fingerprint
  • 100K actor LRU cache with O(1) DashMap lookup
  • Probabilistic eviction — ~20x faster than linear scan
  • Persistence — snapshots to disk on interval, survives restarts

Session Intelligence

The SessionManager (1,562 LOC) provides stateful session tracking with hijack detection.

  • Session binding — JA4 fingerprint + auth token + IP composite key
  • 50K active sessions with LRU eviction
  • Token extraction — JWT parsing, Bearer tokens, Cookie session IDs
  • 304 ns per-request validation

Hijack detection signals:

DetectionSignalRisk
Fingerprint MutationJA4/JA4H change within session+40 points
Impossible TravelGeo-location change faster than possible+60 points
Token ReuseSame token from different fingerprints+50 points
Concurrent SessionsSame user, different locations simultaneously+35 points

Network Security

Rate Limiting

Per-client-IP rate limiting with configurable RPS threshold.

  • Pre-TLS — rate limiting runs in early_request_filter before TLS handshake
  • Per-site — hostname-aware rate limits when using virtual hosts
  • Performance — 61 ns per check

Access Lists

IP-based allow/deny lists per site.

  • CIDR support — allow or deny ranges
  • Per-site — different ACLs per virtual host
  • Performance — 156 ns for 100 rules

Tarpit

Progressive delays against malicious actors using non-blocking async delays (Tokio).

  • Formula: delay = base_delay × 1.5^(level-1), max 30 s
  • 10 levels of increasing delays
  • Per-IP state with automatic decay
  • LRU eviction — max 10K states

Bot Detection

Crawler Verification

500+ crawler signatures with multi-layer detection.

Detection layers:

LayerMethod
Signature-BasedUser-Agent pattern matching against 500+ known crawlers
DNS VerificationReverse DNS + forward validation for claimed identities (Googlebot, Bingbot, etc.)
Client IntegrityTLS fingerprint vs. User-Agent consistency (catches spoofed browser identities)
BehavioralRequest patterns, timing, coverage analysis for headless browsers

Bot categories: SearchEngine, SocialMedia, Monitoring, Security, DataMining, Automation, Malicious, AI (GPTBot, ClaudeBot), Unknown.

Bot policy is configurable per category — allow verified search engines, challenge unverified bots, block malicious bots, set AI crawler policy.

Headless Browser Detection

The InjectionTracker (1,078 LOC) detects headless browsers that bypass JS challenges:

SignalIndicator
Timing VarianceJS execution time too consistent
Fingerprint StabilityCanvas/WebGL identical across sessions
Navigator Anomaliesnavigator.webdriver, mismatched plugins
Request RateFaster than human possible

Detects Puppeteer, Playwright, Selenium, curl/wget, and Python requests through behavioral signals and challenge feedback loops.

Advanced Features

Schema Learning

The SchemaLearner (2,297 LOC) automatically learns and enforces API schemas at ~5 μs validation latency — 100x faster than the TypeScript implementation.

Type detection: UUID, email, ISO dates, credit cards, API keys, JWT — all auto-detected with format validation.

Enforcement signals:

CheckSignal
Missing required fieldSCHEMA_VIOLATION (Medium)
Type mismatchSCHEMA_VIOLATION (Medium)
Unknown field (strict mode)SCHEMA_VIOLATION (Low)
Array size anomalyPAYLOAD_ANOMALY (Low)

Response Profiling

Analyzes upstream server responses to detect exfiltration and application-layer attacks.

AnomalyDetectionIndicates
Unusual response size> 3σ from baselineData exfiltration, IDOR
Error rate spike> 2x baselineFuzzing, enumeration
Latency anomaly> 3σ from baselineBlind injection, DoS
Content-type mismatchUnexpected MIME typeContent injection
Status code anomalyUnusual distributionApplication errors

Baselines are learned per-endpoint. Minimum 100 observations before triggering anomalies.

Header Profiling

Per-endpoint header baselining and anomaly detection.

  • Profiled headers: Authorization, X-API-Key, Cookie, User-Agent, Accept-Language, Origin, Referer, Content-Type
  • Anomaly types: missing expected header, unexpected new header, value outside distribution, header order change

Credential Stuffing Detection

Detects automated login attacks using leaked credentials.

SignalThresholdIndicates
High failure rate> 90% failures over 10+ attemptsCredential list attack
Username enumeration> 20 unique usernames per IP in 5 minAccount enumeration
Distributed attackSame username from 5+ IPs in 1 hourDistributed stuffing
Velocity anomaly> 10 attempts per minute per IPAutomated tool
Fingerprint rotation3+ fingerprints per IP in 10 minEvasion attempt

Privacy

Synapse hashes usernames before storage. Actual credentials are never stored — only statistical patterns.

Campaign Correlation

8 weighted detectors identify coordinated attack campaigns:

DetectorWeightSignal
Graph Correlation55Multi-hop IP ↔ JA4 ↔ Token ↔ ASN relationships
Attack Sequence50Sequential attack patterns (probe → exploit → post-exploit)
Auth Token45Shared authentication tokens across IPs
HTTP Fingerprint40JA4H header fingerprint sharing
TLS Fingerprint35JA4 TLS fingerprint sharing across IPs
Behavioral Similarity30Anomaly behavior matching
Timing Correlation25Request timing pattern analysis
Network Proximity15IP geolocation clustering

Fingerprint indexing provides O(1) lookup. Heavy detection cycles run in background workers, not blocking requests.

Graph Correlation

Models attack infrastructure as a connected graph for multi-hop discovery.

Node types: IP, JA4, JA4H, AuthToken, ASN, UserAgent.

Edge types with weights:

EdgeRelationshipWeight
UsedFingerprintIP → JA4/JA4H0.7
UsedTokenIP → AuthToken0.9
SharedFingerprintIP ↔ IP (via JA4)0.8
SharedTokenIP ↔ IP (via Token)0.95
SameAsnIP → ASN0.3
SameUserAgentIP → UA Hash0.5

2nd-degree discovery: traverse from a known-bad IP through shared fingerprints and tokens to discover related attackers that share no direct attributes.

Shadow Mirroring

Test rules safely against production traffic.

  • Mirror mode — duplicate traffic to a shadow detection pipeline
  • Comparison reports — see what would be blocked by new rules
  • Zero impact — shadow results don't affect production responses

Impossible Travel Detection

GeoIP-based detection of physically impossible session movements.

  • Speed calculation — compare geographic distance vs. time between requests
  • Configurable thresholds — adjust for your user base's travel patterns

Challenge Escalation (Interrogator)

5-level progressive challenge system that separates legitimate users from automated attacks:

  1. Tarpit delays — progressive slowdown (100 ms → 30 s)
  2. Cookie challenge — inject tracking cookie with HMAC signing, verify acceptance
  3. JS proof-of-work — SHA-256 computational challenge
  4. CAPTCHA — human verification for persistent threats
  5. Block — full block after repeated failures

Includes automatic de-escalation — challenge level reduces after successful passes.

Honeypot Traps

Hidden endpoints that catch automated scanners.

  • Trap endpoints — configure fake paths that only automated tools would visit
  • Instant flagging — any request to a trap immediately escalates the actor's risk
  • Performance — 33 ns trap matching

Auto-Mitigation

Risk-based automated defensive actions without human intervention.

ActionTriggerEffect
AutoBlockEntity risk ≥ threshold (default: 80)Block all requests from IP for configured duration
Challenge EscalationRepeated challenge failuresEscalate Cookie → JS → CAPTCHA
TarpitSuspicious bot behaviorProgressive delay injection
Rate LimitHigh request velocityTemporary per-IP rate limit
Campaign BlockCampaign membership detectedBlock all IPs in coordinated campaign

Auto-blocks expire after configured duration. Risk decay and de-escalation prevent false positive lock-out. Admin API provides manual override.

Multi-Site Support

Single binary, multiple sites with independent WAF policies.

  • Exact hostname matching — O(1) lookup via ahash HashMap
  • Wildcard patterns*.example.com with specificity ordering
  • Default site_ or default as catch-all
  • Per-site config — independent WAF threshold, rate limits, access lists, rule overrides, upstreams
  • Multi-upstream load balancing — weighted round-robin per site

Configuration Hot-Reload

Update configuration without downtime.

  • Atomic swap — new config replaces old via RwLock swap in ~240 μs
  • No dropped requests — in-flight requests continue on the old config
  • Validation — new config is parsed and validated before swapping
  • Admin APIPOST /reload with admin key authentication

Memory Budget

ComponentLimitMemory
ActorManager100K actors~50 MB
SessionManager50K sessions~25–40 MB
ProfilerManager10K templates~30 MB
InterrogatorManager10K tarpit + 50K cookies + 10K challenges~40 MB
InjectionTracker50K records~25 MB
Total~170 MB

All state is in-memory with LRU eviction. Persistence snapshots to disk on interval — WAF retains intelligence across restarts with no cold-start learning period.

Licensed under AGPL-3.0 · atlascrew.dev