Skip to content
SQL injection Write-up Beginner

My first SQLi vulnerability

The login form on an open-source school application built its SQL query by pasting the submitted email and password straight into the statement, so a crafted input could change the query. The author confirmed this with a time-based test that made the server pause, then used a tool to list the databases.

medium.com

Published on medium.com

In some situations, an attacker can escalate a SQL injection attack to compromise the underlying server or other back-end infrastructure. It can also enable them to perform denial-of-service attacks.

muhammed demir, 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

User input was concatenated into the SQL query string instead of being passed as separate parameters.

Impact

An attacker could read data the application can access, including other users' records, and potentially change or delete it.

What the attacker needed

Access to the login page; none

The fix

The query should be fixed by using prepared statements with bound parameters so input is never treated as SQL.

How it was found

  1. Look at the admin login page and the requests and responses in an intercepting proxy.
  2. Notice the login.php endpoint and review the source code behind it.
  3. Send a single quote and observe a SQL error.
  4. Send a time-based payload and see the response arrive about five seconds late.
  5. Run a SQL injection tool against the saved request to list the databases.

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 login form usually checks a username and password against a database. Here the site glued whatever the visitor typed directly into the database instruction, so typing special characters could change what the database was asked to do. The author proved this by sending input that made the server wait five seconds before answering.

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.