This room is the second in the Bypassing WAF module of the Web Application Red Teaming path, following the WAF: Introduction room. Where the intro room covered theory, fingerprinting, and CRS rule analysis, this one puts you hands-on with a vulnerable blog application protected by ModSecurity and OWASP CRS v3.3.5. You exploit XSS, SSTI, SQLi, command injection, rate-limit bypass, and content truncation across seven tasks, each demonstrating a different WAF evasion category.
Task 1: Introduction
Overview of the room’s scope: six evasion categories (outdated rules, weak configs, signature bypass, parsing normalization, protocol manipulation, content truncation) against a blog app on ModSecurity with custom rules.
No answer needed.
Task 2: Exploiting Outdated CRS v3.3.5 for XSS
The blog application at /comment/1 is protected by CRS v3.3.5. The task exploits a known bypass for this outdated ruleset. The payload uses HTML entities and Unicode escape sequences to evade the XSS signatures:
<a href=ja
vascript:eval(atob("BASE64_PAYLOAD"))>click</a>
The 
 (carriage return) breaks the javascript: keyword, : replaces the colon, and eval / atob use Unicode escapes for eval and atob. The browser normalizes all of these, but the WAF does not.
An admin bot visits /post/1 periodically and clicks links in comments. By posting a comment containing the above anchor tag (with a base64-encoded new Image().src callback), the bot’s cookie is exfiltrated to an attacker-controlled HTTP server on the AttackBox.
# attacker server log
/?c=FLAG=THM-REDACTED
What is the admin’s cookie value? THM-ac86450f15150c1ad46fe70bcf26ee76
Task 3: Exploiting Weak Configurations (SSTI)
The blog’s template preview endpoint at /preview renders user input through Jinja2 without sanitization. The WAF blocks common SSTI payloads containing _ (underscore), so hex encoding is used: \x5f in place of _.
The bypass payload:
{{ ''['\x5f\x5fclass\x5f\x5f']['\x5f\x5fmro\x5f\x5f'][1]['\x5f\x5fsubclasses\x5f\x5f']() }}
This lists all subclasses. From there, the subprocess.Popen class (index varies) executes arbitrary commands. The flag file is read via cat /flag.txt.
What is the flag? THM-17451c0950af7761e1b57e7ac924f4c8
Task 4: Signature and Pattern Bypass (SQLi and SSTI)
Two techniques in this task: SQLi authentication bypass and SSTI hostname extraction.
SQLi authentication bypass at /login uses mixed-case keywords and SQL comments as whitespace to evade the WAF:
admin'/**/Or/**/1=1--
The /**/ replaces spaces (which the WAF pattern expects between keywords), and Or uses mixed case to dodge the case-sensitive regex in Rule 5002.
SSTI hostname extraction reuses the hex-encoded \x5f technique from Task 3, this time running hostname through subprocess.Popen.
What is the hostname? 48e28fdbf2aa
What is Alice’s hashed password? 7abdccbea8473767e91378e37850d296
Task 5: Parsing and Normalization Bypass
This task covers three bypass categories: encoding tricks, command blocklist evasion, and content truncation.
Command blocklist evasion: Rule 5005 blocks cat, ls, and whoami using a case-insensitive regex. However, head, tail, more, tac, and wildcard-expanded commands (/bin/ca?) are not blocklisted. Using head to read the secret file bypasses the rule entirely.
Content truncation bypass: Rules 5006 through 5008 inspect only a fixed prefix of the input (50 characters for XSS, 100 for SQL keywords, 30 for path traversal). Padding the payload with 50 ‘A’ characters before <script> pushes the tag past the WAF’s inspection boundary, storing the XSS payload in the database.
What is the flag revealed when you successfully bypass the command blocklist? THM-e4dafa6151c56061d1428126caf8c212
How many ‘A’ characters are needed as padding to bypass the XSS truncation filter (Rule 5006)? 50
Task 6: Protocol Manipulation
Two protocol-level techniques: HTTP method switching and rate-limit bypass via header spoofing.
HTTP method switching: Rule 6001 only inspects POST requests for SQL injection patterns. The same endpoint accepts GET requests with identical parameters, so switching to GET bypasses the rule entirely.
Rate-limit bypass: The /api/posts endpoint implements rate limiting (5 requests per minute per IP), but it reads the client IP from the X-Forwarded-For header instead of the actual connection address. By rotating X-Forwarded-For values, an attacker resets the counter on every request.
The admin hash is obtained by brute-forcing the login endpoint with spoofed X-Forwarded-For headers to circumvent the rate limit.
What is the hash password for the user ‘admin’? 0192023a7bbd73250516f069df18b500
What HTTP header can be manipulated to bypass the rate-limiting protection? X-Forwarded-For
Task 7: Conclusion
The room wraps up by connecting all six evasion categories: outdated rules, weak configurations, signature patterns, parsing normalization, protocol manipulation, and content truncation. Two durable takeaways:
- WAF rules are only as current as their last update. A single outdated CRS version opens the door to documented bypasses that automated scanners know about.
- Rate limiting and access control that rely on client-supplied headers (
X-Forwarded-For) are trivially spoofable. Always validate against the actual connection source, not a header the attacker controls.
Room solved 100%: 7 tasks, 8 answers.