Skip to main content

Custom WAF Rules

Aegis supports three rule match modes: Condition Builder for structured field/operator/value rules, Raw Regex for advanced RE2-based pattern matching, and Correlated for multi-request Mnemos correlation rules.
Image

Rule Options

Every custom rule supports the following configuration:

Condition Builder Mode

Condition Builder is the standard rule-authoring flow. It supports multi-line field-based rules with AND / OR logic.

Available Fields

Available Operators

Per-Condition Options

  • Case Sensitive — toggle case sensitivity
  • Negate Result — invert the condition match

Examples

  • Block requests where Request Path contains /wp-admin
  • Block requests where Specific Header matches regex a malicious header pattern
  • Allow requests where Source IP is IP in range 10.0.0.0/8

Raw Regex Mode

Raw Regex mode is for advanced rules and built-in style pattern matching. You provide a Go RE2 pattern and one or more request targets to inspect.

Supported Targets

Notes

  • Patterns are compiled with Go’s regexp engine (RE2 syntax)
  • Inline flags such as (?i) are supported (server-side evaluation)
  • Rules require both a pattern and at least one target

Rule Testing

The rule tester uses the real backend WAF evaluation path — the same compiled Go regex engine and condition evaluator that runs in production. This is not a browser-side JavaScript approximation.

Single Rule Test

Test an individual rule against a crafted request:
Response:
The response includes:

Test All Rules

Test a crafted request against all enabled WAF rules to see which ones fire:
Response:

Testing Correlation Rules

Correlated (Mnemos) rules can be tested by providing an array of requests that simulate a multi-request sequence:

What Gets Tested

All three modes run through the same code paths as the live WAF — engine.TestRule() and engine.Evaluate() — so test results accurately predict production behavior.

Rule Import (JSON / YAML)

Aegis supports bulk importing WAF rules from JSON or YAML files via the admin API. This allows you to share rule sets between Aegis instances, version-control your custom rules, or ingest community rule definitions.

Endpoint

Upload a .json, .yaml, or .yml file (max 4 MB). The format is auto-detected from the file extension.

File Format

Rules can be provided in either a wrapped or direct array format: Wrapped format (JSON):
Wrapped format (YAML):
Direct array format (JSON):

Import Behavior

  • IDs are reset — imported rules receive new IDs; existing rules are not overwritten
  • Host ID is cleared — all imported rules become global (not host-specific)
  • Defaults applied — missing fields are normalized:
    • Category defaults to custom
    • Severity defaults to medium
    • Action defaults to block
    • Paranoia defaults to 1
    • Regex rules with no targets default to path, query, body, headers
  • Validation — each rule is validated through the same logic used by the UI (regex compilation, condition field/operator checks, etc.)
  • Proxy reload — after import, the proxy manager reloads all rule chains

Rule Schema Reference

Condition Object Schema


Bundled Rule Sets

Aegis ships with importable rule sets in the rules/ directory. These can be imported via the admin API or loaded from the CLI.

PayloadsAllTheThings Rule Set

The payloads-all-the-things.yaml rule set provides 35 detection rules derived from the PayloadsAllTheThings repository. It covers attack categories beyond the 26 built-in rules, including: The rule set also includes 3 Mnemos correlation rules that link reconnaissance and exploitation patterns:
  • Recon to Exploitation Campaign — introspection/actuator probing followed by active injection
  • Multi-Vector Injection Campaign — 4+ distinct injection techniques from the same client in 3 minutes
  • Auth Attack Campaign — JWT, SAML, OAuth, and type juggling attacks correlated within 5 minutes

Mnemos OOB SQLi and Exfiltration Rule Set

The mnemos-oob-sqli-and-exfil.yaml rule set provides detection chains for:
  • Out-of-Band SQL Injection — OOB function primitives + DNS/UNC exfil, correlated by Mnemos
  • Data Exfiltration Campaigns — sensitive endpoint access + bulk extraction + schema recon, correlated by Mnemos

Importing a Rule Set