Skip to content
SQL injection Write-up Intermediate

How I Exploited Sql Injection To Sql Shell With In 15 Minutes

A SQL injection was found in a URL parameter on a PHP site, and the attacker used it to obtain a SQL shell and then a command shell. The text does not give the exact payloads or the commands used.

Sahil Ojha🇳🇵 Follow

Published on systemweakness.com

So, this is my very first write up on SQL injection which is typically only associated with databases and their data, but it can actually be used as a vector to gain a command shell. Hope you guys will like it and get an insight from this write up.

Sahil Ojha🇳🇵, 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 application built SQL queries by concatenating user input without proper parameterisation or escaping.

Impact

An attacker could read and modify database data and potentially execute commands on the server, though the text does not show the exact commands or confirm the level of access.

What the attacker needed

A URL parameter that is vulnerable to SQL injection; no authentication mentioned

How it was found

  1. Browse the target website and fingerprint its technologies.
  2. Try SQL injection on normal pages without parameters, which fails.
  3. Collect .php URLs that have parameters.
  4. Manually test a parameter (id) and observe a database error.
  5. Confirm SQL injection success.
  6. Use the SQL injection to get a SQL shell and then a command shell.

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 a website puts user input directly into a database query, so an attacker can change the query. Here the tester found a parameter that caused a database error, then used it to run database commands and finally system commands.

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 Sahil Ojha🇳🇵

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.