How I hacked a State Results NIC portal with a simple SQL injection
The results lookup page inserted the name field directly into a SQL query, so a crafted name value could change the query's logic. An attacker could retrieve other students' exam results and, using true/false responses, extract arbitrary database strings such as the database version.
infosecwriteups.com
Published on infosecwriteups.com
Hello and welcome to my new blog post! I am Adithya M S a Masters student, cyber and web security enthusiast focused on uncovering hidden endpoints, probing data breaches, and exploring attack vectors in web servers and clients.
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
Impact
An attacker could view other students' exam results and could extract arbitrary strings from the database, potentially including table and column names and sensitive values.
What the attacker needed
Access to the public results page; ability to edit the page's maxlength attribute
How it was found
- Open the results login page and note the form posts to the results endpoint.
- Enter a random application number and a crafted name value that makes the condition always true.
- Bypass the four-character limit on the name field by editing the page's maxlength attribute.
- Submit and observe another student's result records.
- Change the condition to be false and observe a different response, confirming a boolean-based injection.
- Use a script that sends true/false queries to read the database version character by character.
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 website that builds database queries by pasting in what a user typed can be tricked into running different queries. Here the name box was meant to hold four letters, but a special value made the database return someone else's exam result. Because the page looked different when a condition was true versus false, the attacker could ask the database yes/no questions and slowly read out data.
What is SQL injection?
Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.