From Beginner to Finding My First Critical SQL Injection in a Real VAPT Project
A loan lookup API endpoint inserted the numeric loan_id parameter directly into a SQL query, so a single quote produced a database syntax error. The tester then confirmed error-based, boolean-based and time-based blind injection and used UNION queries to read table names from the information schema, which could expose customer, loan and KYC records.
Published on medium.com
I’m still learning. Still growing.
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 loan_id value was concatenated into the SQL statement instead of being passed as a bound parameter, and raw database errors were returned to the client.
Impact
An attacker with a session could read sensitive financial data such as customer records, loan details and KYC information, though the tester stayed within scope and used low-risk validation settings.
What the attacker needed
Authenticated session on the app; access to the loan lookup endpoint
How it was found
- Intercept the loan lookup request in a proxy and note the loan_id parameter.
- Append a single quote to the numeric value and send the request.
- Observe a SQL syntax error in the response, confirming injection.
- Compare true and false conditions to confirm boolean-based blind injection.
- Add a delay function and observe the delayed response to confirm time-based blind injection.
- Use ORDER BY to count columns, then a UNION query to read table names from the information schema.
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 database query is built by gluing text together, and the site pasted whatever the user typed straight into that text. Adding a quote character broke the query, which showed the input was being treated as code rather than plain data. From there the tester could ask the database questions and read back table names, meaning stored records were reachable.
What is SQL injection?
Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.