Skip to content
XSS Write-up Intermediate

From XSS to SQL Injection: My Journey Exploiting a Vulnerability

A stored XSS vulnerability in a feedback form allowed the attacker to hook an admin's browser and access admin functionality. The admin API for adding users was then found vulnerable to union-based SQL injection, enabling the attacker to dump the entire database.

Nitinbasera Follow

Published on medium.com

In this blog post, I’m going to share how I discovered and exploited a vulnerability chain, starting with a Stored Cross-Site Scripting (XSS) vulnerability in the feedback functionality of a website. This vulnerability eventually led me to escalate the attack to a SQL Injection (SQLi), ultimately gaining full control…

Nitinbasera, on medium.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 feedback form lacked input validation and output encoding, and the admin API used unsanitised input in SQL queries.

Impact

The attacker could execute scripts in the admin's browser, take over the admin session, and then dump the entire database including sensitive user and administrative data.

What the attacker needed

Victim (admin) views the feedback; attacker can submit feedback

How it was found

  1. Inject a script into the feedback form and confirm it executes when the feedback is viewed.
  2. Use a more advanced payload to hook the admin's browser with BeEF.
  3. Explore the admin session and identify the add/modify users API endpoints.
  4. Forward traffic to Burp Suite and find that the user-adding API is vulnerable to union-based SQL injection.
  5. Use SQLMap against the vulnerable API endpoint to dump the database.

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.

The feedback form saved whatever users typed without cleaning it, so a malicious script could run in the browser of anyone who viewed the feedback, including an administrator. That let the attacker act as the admin and find another bug in the admin's user-management feature that let them read the whole database.

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 Nitinbasera

View all

1 more disclosed report, 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.