Skip to content
SQL injection Write-up Beginner

Easy SQLI in just 30 minutes

The sort parameter of a public endpoint was vulnerable to SQL injection, as shown by an error when a single quote was added. An attacker could use SQLMap to extract database names and tables, and a time-based payload could make the server pause for five seconds.

mohammed01550038865 Follow

Published on medium.com

While exploring mytarget.com, I came across an interesting endpoint: http://mytarget.com/?pageID=licensees&reportID=3003&sort=fullname.

Muhammed Mubarak, 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 sort parameter was concatenated directly into a SQL query without parameterisation or validation.

Impact

An attacker could extract database names and tables, and potentially other data, from the backend Microsoft SQL Server.

What the attacker needed

None

How it was found

  1. Browse the target with Burp Suite intercepting traffic and review the history for parameters.
  2. Find the endpoint with pageID, reportID and sort parameters.
  3. Add a single quote to the sort parameter and observe an SQL error.
  4. Use SQLMap with the sort parameter marked to extract database tables.
  5. Use a time-based payload to make the server wait five seconds as proof.

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 when user input is inserted into a database command without being properly separated, so an attacker can change the command. Here, the sort order in a web address was placed directly into a database query, letting the attacker ask the database to reveal its structure or wait on purpose.

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 mohammed01550038865

View all

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