Expand description
wafrift-evolution — Genetic algorithm, MCTS, differential analysis, and WAF-aware advisor.
The adaptive feedback loop: detect WAF → analyze differential responses → evolve technique populations → recommend optimal evasion strategies.
Key modules:
evolution— genetic algorithm (crossover, mutation, fitness)ast_mcts— MCTS over the technique action spacedifferential— differential response analysis (surface divergences)advisor— WAF-class-aware technique recommenderbody_padding— inspection-window evasion (pad JSON/form past WAF scan cap)dilution— ensemble dilution for ML-WAF evasionintelligence— cross-scan intelligence aggregationlineage— technique lineage tracking across generationssearch— novelty search + MAP-Elites algorithmcustom_rules— operator-supplied TOML evasion rules
§Examples
Inflate a JSON request body past a WAF’s inspection-window cap.
Cloudflare and Akamai stop scanning after 8KB; AWS WAF after 16KB.
body_padding::pad produces a structure-preserving payload that
still parses on the origin while pushing the attack tokens past
the inspection ceiling:
use wafrift_evolution::body_padding::{PadOutcome, pad};
let body = br#"{"q":"' OR 1=1 --"}"#;
let outcome = pad(body, "application/json", 9000);
match outcome {
PadOutcome::Padded { bytes, added } => {
assert!(added >= 9000, "padded by at least 9000 bytes");
assert!(bytes.len() > body.len() + 8000);
// Still parses as valid JSON — origin sees the same payload.
let s = std::str::from_utf8(&bytes).unwrap();
assert!(s.contains("' OR 1=1 --"), "attack payload preserved");
}
other => panic!("expected Padded, got {other:?}"),
}Opaque content types (binary blobs) are left alone — padding would corrupt them:
use wafrift_evolution::body_padding::{PadOutcome, pad};
let outcome = pad(&[0u8; 64], "application/octet-stream", 9000);
assert_eq!(outcome, PadOutcome::SkippedOpaque);Modules§
- advisor
- WAF-aware strategy advisor.
- ast_
mcts - AST-MCTS: Monte-Carlo Tree Search over SQL/XSS AST rewrite rules for ML-WAF evasion.
- body_
padding - Body-size inspection bypass.
- coverage_
feedback - WAF rule-coverage feedback for MAP-Elites quality-diversity search.
- custom_
rules - Community-configurable WAF detection and evasion rules.
- differential
- WAF rule differential analysis — reverse-engineer what a WAF blocks.
- dilution
- #128 Ensemble sub-score dilution wiring for the evolutionary engine.
- edge_
pop_ coverage - Cross-region CF edge-POP coverage map. Tracks
(egress_label, target_host) → seen-POPsso the hunt loop can bias rotation toward egresses that haven’t yet hit a given POP, detect anycast pinning early, and report total POP coverage. Cross-region Cloudflare edge-POP coverage map. - encoding_
lattice - Encoding-stack lattice search — enumerate compositions of N encoders to find chains that defeat a target WAF rule. The systematic-search engine the hunt loop uses to fill the (rule × class) cells of the corpus. Encoding-stack lattice search — enumerate compositions of N encoders and find the ones that defeat a target WAF rule.
- evolution
- Feedback-driven evolutionary evasion engine.
- h1_
dedup - HackerOne submission-dedup fingerprint. Stable hash of (rule_id, encoding-chain-shape, payload-skeleton) so the submission queue rejects bypasses already filed in the public CumulusFire archive. HackerOne submission-dedup fingerprint for WAF bypasses.
- hunt_
corpus_ bridge - Single-call adapter from oracle verdicts → rule_corpus writes.
Hunt / bench / model-evade route every probe result through one
fn so corpus-key changes propagate without per-consumer churn.
Adapter from
wafrift_oracle::OracleVerdict(+ optional CF signal) tosuper::rule_corpuswrites. - intelligence
- Intelligence loop — connects differential analysis, evolution, and strategy.
- lineage
- Lineage tracking for replayable bypass discovery.
- min_
bypass_ set - Minimum Bypass Set computer — greedy set-cover on bypassing payloads. Computes the smallest subset that collectively exercises every WAF rule class reachable by the full input. Used to produce forensically minimal payload sets for security reports. Minimum Bypass Set computer.
- rule_
alphabet - Per-rule L* alphabet inference. Picks the bytes most discriminative for a given CF rule from its observed corpus (blocks vs bypasses) so the L* learner explores tight, rule-scoped symbolic automata instead of a generic alphabet. Per-rule alphabet refinement for the L* learner.
- rule_
corpus - Persistent per-rule bypass corpus — accumulates rule-level bypass records across hunt rounds and surfaces them to the genome-registry submission gate. Per-rule WAF-bypass corpus — persistent {rule_id → bucket} store.
- search
- Search algorithms for evolutionary WAF bypass discovery.
- types
- Core types for the evolution engine.