Skip to content
SQL injection Write-up Beginner

SQL Injection, Reflected XSS and Information Disclosure in one subdomain in just 10 minutes

A subdomain exposed a phpinfo page, a reflected cross-site scripting flaw in a search parameter, and a SQL injection in the same parameter. An attacker could run script in a victim's browser and read database contents through the injection.

Mahmoud Hamed Follow

Published on web.archive.org

{{media:0}}

Mahmoud Hamed, on web.archive.org

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 search parameter was echoed into the HTML and concatenated into a SQL query without validation or parameterisation.

Impact

An attacker could execute script in a victim's browser and use the injection to enumerate database names; the author did not demonstrate data extraction or RCE.

What the attacker needed

Target with many in-scope assets; internet-wide scanning data; archived URLs available

How it was found

  1. Find a subdomain that returns an empty page and confirm random paths give 404
  2. Fuzz directories and open the discovered phpinfo page
  3. Search the web archive for archived endpoints ending in .php
  4. Open the archived search page and inject HTML to confirm reflection
  5. Replace the HTML with a script tag to confirm reflected XSS
  6. Read the page source, spot the SQL query, and confirm injection with a boolean test

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.

A search box on a website was putting whatever the visitor typed straight into the page and into a database query without cleaning it. That let the author make the page run their own script (cross-site scripting) and make the database reveal its names (SQL injection). A separate page also leaked server setup details.

What is SQL injection?

Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.

More by Mahmoud Hamed

View all

2 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

SQL injection

The lesson behind this report.

Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.