How I Ethically Hacked a Government Portal: SQL Injection in a Go
The search function of a government portal was vulnerable to SQL injection because user input was inserted directly into a database query. An attacker could use this to extract database names, table names, and potentially sensitive records or credentials.
Published on infosecwriteups.com
Free Link
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 potentially dump sensitive government records, extract usernames, passwords, and PII, or modify and delete database entries.
What the attacker needed
None
The fix
The application should use parameterised queries, validate input, disable detailed SQL error messages, and deploy a WAF; the text does not state that it was fixed.
How it was found
- Enter a random string in the search function and observe a database error message.
- Modify the search parameter with a true condition and see the page load normally.
- Modify the search parameter with a false condition and see no results.
- Use a time-based delay in the parameter and observe the response takes longer.
- Use an automated tool to confirm the injection and list databases.
- Use UNION queries to extract the database name, current user, and table names.
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 what you type into a database command without checking it, so you can sneak in extra commands. Here, typing a special character in the search box caused a database error, showing the input was not handled safely. An attacker could then ask the database to reveal its structure and 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.