Skip to content
SQL injection Write-up Intermediate

Sql Injection Rce How I Got A Shell On My University Website

A blind SQL injection in a GET parameter of a university API allowed the attacker to extract the entire database and then use sqlmap to execute operating system commands, obtaining a shell on the server.

snoopy Follow

Published on systemweakness.com

I’m gonna tell you the story of an easy Blind SQL injection which led to RCE. I do not really spend my time on hacking non-bug bounty websites like my university and I found this vulnerability coincidentally.

snoopy, 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 concatenated user input directly into SQL queries without parameterisation or input validation.

Impact

An attacker could extract the entire database, including usernames, passwords, backups, addresses, phone numbers and emails, and execute operating system commands, potentially defacing the website, shutting down the server, extracting or deleting files.

What the attacker needed

Access to the API endpoint; no authentication required beyond a cookie

The fix

The university fixed it right away after being informed.

How it was found

  1. Observe that data is fetched through an API with GET parameters.
  2. Send blind SQL injection payloads using Burp Intruder in battering ram mode.
  3. Confirm the injection by observing a 5-second delay with a time-based payload.
  4. Use sqlmap to dump the database.
  5. Use sqlmap with --os-cmd to run the whoami command.
  6. Use sqlmap with --os-shell to obtain an interactive 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.

The website took a value from the URL and put it directly into a database query without checking it. By sending special database commands, the attacker could make the database wait, proving the injection, and then use a tool to run system commands on the server.

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.