How i Got 3 SQL injection in just 10 minutes.
Three SQL injection vulnerabilities were found in a private program's PHP application: a login form, a getimage.php endpoint with an id parameter, and a downloads.php endpoint with a dir parameter. An attacker could use these to extract database names and potentially other data.
Published on xdev05.github.io
Type: error-based Title: Microsoft SQL Server/Sybase AND error-based - WHERE or HAVING clause (IN) Payload: id=1 AND 7962 IN (SELECT (CHAR(113)+CHAR(113)+CHAR(118)+CHAR(122)+CHAR(113)+(SELECT (CASE WHEN (7962=7962) THEN CHAR(49) ELSE CHAR(48) END))+CHAR(113)+CHAR(112)+CHAR(122)+CHAR(112)+CHAR(113)))
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 parameterisation, as shown by error-based responses to a single quote.
Impact
An attacker could extract database names and potentially other data from the backend database.
What the attacker needed
Access to the private program's web application
How it was found
- Enumerate subdomains and find one with a login page running PHP.
- Inject a single quote into the username field and intercept the request.
- Save the request to a file and run sqlmap against it to confirm the injection and list databases.
- Discover the getimage.php endpoint with an id parameter and test it with sqlmap.
- Discover the downloads.php endpoint with a dir parameter and test it with sqlmap.
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 command, so an attacker can change the command. Here, the author found three places where typing a quote mark caused a database error, meaning input was not safely handled. They then used a tool to confirm and list database names.
What is SQL injection?
Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.