Skip to content
SQL injection Write-up Beginner

Hacking 101: Exploiting SQL Injection to Dump Admin Credentials

A PHP page with an 'id' parameter was vulnerable to SQL injection, allowing an attacker to dump the admin username and password from the database. The attacker then used those credentials to locate and access the admin panel.

medium.com

Published on medium.com

In this blog, I’ll take you through my journey of exploiting a SQL injection (SQLi) vulnerability to gain access to an admin panel.

JeninSutradhar, 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 'id' parameter was concatenated directly into a SQL query without parameterisation or input validation.

Impact

An attacker could obtain admin credentials and access the admin panel, potentially leading to full control of the site.

What the attacker needed

None

How it was found

  1. Use Google dorks to find PHP pages with an 'id' parameter.
  2. Confirm SQL injection on the found URL using SQLMap.
  3. Enumerate the database tables to find credential tables.
  4. Dump the admin table to extract username and password.
  5. Dump the user access table for additional credentials.
  6. Use Dirsearch to locate the admin login page and test the credentials.

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.

SQL injection is a flaw where user input is inserted into a database query without proper handling, letting an attacker change the query's meaning. Here, the 'id' value in the web address was not sanitised, so the attacker could ask the database to return other data, including admin login details. With those details, the attacker could log into the site's admin area.

What is SQL injection?

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

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.