How I found SQL Injection on State Government
A state government website accepted a base64-encoded date parameter that was vulnerable to SQL injection, allowing an attacker to read the entire database including usernames, encrypted passwords, and authentication tokens. The attacker could not execute operating system commands due to some safe coding practices.
medium.com
Published on medium.com
So we meet again. Well, this is a story after which I started to believe in myself.
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 read the entire database, including usernames, encrypted passwords, and authentication tokens, but could not execute operating system commands due to some safe coding practices.
What the attacker needed
Access to the vulnerable URL
How it was found
- Notice a URL that pulls past data based on a base64-encoded date parameter.
- Decode the base64 date, add a single quote at the end, and re-encode to base64.
- Send the modified request and observe a blank page, indicating a SQL error.
- Use sqlmap with a base64 tamper script to exploit the injection.
- Extract database contents including usernames, encrypted passwords, and authentication tokens.
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 query without proper handling, so an attacker can change the query's meaning. Here, the date was encoded in base64 and sent in the URL; by adding a single quote and re-encoding, the attacker made the database return an error or blank page, confirming the injection. This let them extract 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.