Skip to content
XSS Write-up Beginner

Hacking The Marketplace

A deliberately vulnerable practice machine had a stored cross-site scripting flaw in its image report function, letting the author steal an administrator's cookie and reach an admin panel. The admin panel's URL parameter was then vulnerable to SQL injection, which exposed user data and a temporary password that allowed SSH login and further privilege escalation.

Martin Martinez Follow

Published on systemweakness.com

Guys! This room it’s great and I had a lot of fun, with this room you can learn this:

Martin Martinez, on systemweakness.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the report feature stored user input without sanitising it, and the admin panel built a database query from a URL parameter without parameterisation.

Impact

An attacker could take over an administrator session and read database contents including user hashes and a temporary password, then log in to the host and escalate to root.

What the attacker needed

A free tryhackme account; victim (admin) views the report; attacker-hosted listener

How it was found

  1. Find the report button on a published image and submit a script that sends the cookie to your own server
  2. Start a local HTTP server to receive the request
  3. Decode the base64 cookie, replace your own cookie with it and reload
  4. Use the admin panel and its URL parameter for SQL injection
  5. Brute force the recovered users with hydra and log in over SSH
  6. Escalate via wildcard injection to michael, then use docker group membership to reach root

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

This is a walkthrough of a practice machine built to be broken. A web page showed whatever text a user submitted without cleaning it, so a script could be planted and would run in an administrator's browser, handing over their login cookie. The cookie let the author act as the admin, and a database query on the admin page could be tricked into revealing other users' details.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

More by Martin Martinez

View all

2 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.