Stock Management System (SMS) v1.0 — SQL injection challeng
The login form and several other parameters were vulnerable to SQL injection, allowing an attacker to bypass authentication and extract the admin password hash. The verbose error messages leaked the backend query structure, making exploitation straightforward.
Hi there, It is Jimmy — the web pentesting hater — In this write-up, I’ll walk you through how I approached a simple web challenge. The goal was to bypass the authentication form without valid credentials and extract the admin’s password, which also serves as the flag for this challenge.
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, and verbose error messages revealed the query structure.
Impact
An attacker could bypass authentication to log in as admin and extract the admin password hash, which could then be cracked and reused on other services.
What the attacker needed
Access to the login form; ability to intercept HTTP requests
The fix
The application should use parameterised queries and disable verbose error messages.
How it was found
- Visit the authentication form and intercept the login request.
- Try SQL injection payloads in the username field to bypass authentication.
- Use a payload that makes the query true, logging in as admin.
- Find other vulnerable parameters such as id in page URLs.
- Determine the number of columns using ORDER BY until an error occurs.
- Use UNION SELECT with LIMIT to extract the admin password hash.
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 query without proper handling, letting an attacker change the query's meaning. Here, the login form and other parameters allowed an attacker to log in as admin without a password and read data from the database.
What is SQL injection?
Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.