
I built WAF Dojo: a hands-on game for learning AWS WAF
Attackers move faster than patches. This free, hands-on game teaches anyone to turn a vulnerability advisory into an AWS WAF rule and buy time until the fix is in.
WAF Dojo is a free, source-available game where you learn AWS WAF by stopping real attacks. You read a short briefing, write rules in the real AWS WAF console, and a traffic generator throws attacks and normal requests at your own ALB. You get a score for what you blocked, and lose points for blocking real users.
I built it because reading about AWS WAF and using it are two different skills. The docs tell you what a ByteMatch statement or a rate-based rule is. They do not tell you why your SQL injection rule lets one request in ten slip through, or why an XSS rule that looks perfect still misses an encoded payload. You only learn that by writing a rule, watching it fail, and fixing it.
The code is on GitHub: nishikawaakira/waf-dojo . It runs in your own AWS account with Terraform, in English and Japanese.
Why WAF skills matter more every year
The time between a vulnerability being published and attacks starting keeps getting shorter. A public PoC can turn into mass scanning within days, sometimes hours. Patching rarely moves that fast: you have to test the fix, wait for a change window, or wait for a vendor to ship one for an appliance you cannot touch.
A WAF rule fills that gap. If you can read an advisory and turn it into a precise rule, you can block the attack today and patch next week, without breaking real users. That is a virtual patch: it does not fix the bug, it buys you the time to fix it safely.
Today that skill usually sits with one or two specialists. My goal with WAF Dojo is to make it something anyone on the team can do: read the advisory, write the rule, check it does not block real traffic, and buy time until the patch is in.
How a round works
Every round is a real attack against real AWS resources, scored in about a minute.
- Read the briefing. The game screen describes the attack: sample requests in tutorials, only an outline in game mode, a vendor advisory or a PoC in the labs.
- Write your rules. You open the AWS WAF console with your own IAM user and edit your own Web ACL. No simulator, no fake console.
- Launch the attack. A Lambda sends a mix of attack requests and normal-user requests to your ALB. It uses uTLS to send browser-like and tool-like TLS ClientHellos, so JA4 fingerprints are real too.
- Get your score.
100 × attack block rate × (1 − false-positive rate), times 0.8 if you used a hint. After one attempt you can see a model-answer rule in JSON, ready to paste into the console.
What you learn: 58 challenges, from first rule to new CVE
The goal is not to memorize rules. It is to be the person who can write a rule on the day a new vulnerability is announced.
Stage | Challenges | What it trains |
|---|---|---|
Tutorials | 6 | Managed rules, custom rules, IP sets and X-Forwarded-For, header matching, rate-based rules, JA4. Every step has a toggle that explains the setting |
Game mode | 6 | Only an outline of the attack. AND / NOT logic, scope-down statements, rule priority, and rules from earlier stages that now block real users |
Vulnerability labs | 41 | Real CVEs in four levels: follow the advisory, translate prose into WAF, derive a rule from a PoC, and work around managed-rule false positives and WAF's own limits |
Ops drills | 2 | Find a false-positive culprit or a bot's JA4 in the WAF logs with Logs Insights |
Exams | 3 | Unseen variants of lab attacks. Copying the lab answers does not pass |
The labs cover Log4Shell, Spring4Shell, ProxyLogon, Citrix ADC, PAN-OS GlobalProtect (CVE-2024-3400), Ivanti Connect Secure and more. Every lab also sends look-alike legitimate traffic, such as
${name} in a template or __typename in GraphQL, so a lazy rule loses points.Two topics I wanted people to feel, not just read about:
- Body inspection limits. AWS WAF only inspects the first 8 KB of a body on ALB, and 16 KB by default on CloudFront (up to 64 KB). One lab hides the payload past 8 KB; another gives each player a real CloudFront distribution to raise the limit and choose an oversize handling.
- JA4. A tutorial explains how a JA4 fingerprint is built (
a_b_c). Game mode then sends a bot army that keeps changing its fingerprint, so you need a regex on the stable part without blocking a partner that uses the same library.
Clear all 6 tutorials and score 80+ on the other 52, and you are shown as a WAF specialist on the leaderboard.
Playing as a team
One Terraform variable,
player_count , sets how many people play. Each player gets their own ALB, Web ACL, CloudFront distribution and IAM user, all in one AWS account. You can raise the number later and re-run make deploy without touching existing players.Players share an account, so isolation matters. A player's IAM policy lets them edit only their own Web ACL, and create IP sets and regex sets only under their own name prefix. They cannot view or change anyone else's rules or logs, delete a Web ACL, or tamper with scores. I checked this with the IAM policy simulator.
Contest mode turns it into an event. The admin opens an admin page, picks a few problems and an end time, and every player's screen switches to the contest. Tutorials are skipped, hints still cost 20%, and model answers unlock only when time is up. A separate leaderboard ranks players by total score, and ties go to whoever got there first.
And there is a guide. Mamorin, a shiba inu (the name comes from mamoru, "to protect" in Japanese), sits in the corner of the screen. Mamorin suggests what to try next, gives tips, and reacts to your results. Ranks go from Trainee through the belt colors to Black belt, with 14 achievements and confetti for a perfect score.
What building it taught me about AWS WAF
Building the game was its own WAF lesson. These are the things that surprised me, and most of them became challenges.
- Saved is not applied. My first playtest scored 9 out of 10 on a tutorial I had followed exactly. The rule was right; it just had not reached the ALB yet. The game now says so when a score is almost perfect, instead of calling it a leak.
- X-Forwarded-For has a position, but not everywhere. IP set rules let you pick the first, last or any IP in the header. Rate-based rules, geo match and ASN match have no such option and always use the first IP.
- Rate-based rules have floors. The lowest limit is 10 requests, and the window is 1, 2, 5 or 10 minutes. The game ignores the first 60 seconds of a flood so the rule has time to act.
- The ALB answers before WAF does. ALB rejects some malformed paths with a 400 before WAF sees them. Tests make sure no attack in the game relies on such a path, so a 400 never counts as a block.
- Body inspection stops at a limit. 8 KB on ALB, no way to raise it. On CloudFront it is 16 KB by default and up to 64 KB. Whatever lies beyond is handled by your oversize setting: continue, match or no match.
- WAF regex is not PCRE. There is no lookahead, so vendor mitigations written in PCRE need to be rethought.
- Capacity runs out. The Core rule set alone uses 700 WCU, and a Web ACL holds 1,500 by default. Labs that tune managed rules teach you to override one rule to Count and match its label, instead of turning the whole group off.
To keep the model answers honest, the repo includes a small local evaluator that mimics AWS WAF matching.
go test checks that every model answer blocks every attack and no legitimate request, and that each "common pitfall" rule really fails. Every challenge was also run on real AWS: attacks get through with no rules, and the model answer scores 100.Try it yourself
You need Go 1.26+, Terraform 1.6+ and an AWS account you can deploy to. Use a sandbox account, not production.
git clone https://github.com/nishikawaakira/waf-dojo.gitcd waf-dojomake deploy # asks how many playersmake players # game URL and console sign-in for each playerWant to see the screens first?
make dev runs the whole UI locally with no AWS at all.Cost. The idle costs are about $0.0243 per hour per ALB plus LCUs, and $5 per Web ACL per month plus $1 per rule per month. Run
make destroy when you are done, and delete any IP sets you created by hand.License. WAF Dojo uses the PolyForm Shield License 1.0.0. Personal learning, company training and school classes are welcome. Selling it, or offering it as a competing training service, is not allowed. For paid training, contact info@i-wind.jp .
If you run it with your team, I would love to hear how it went. Issues and pull requests are welcome on GitHub .
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article