How I Hacked an Admin Panel with Millions of Dollars
The admin login form was vulnerable to SQL injection because of inconsistent escaping, allowing an attacker to bypass authentication and access the admin dashboard. From there, the attacker could view all user data, approve orders, and reset any user's account to take over accounts and steal funds.
Published on zhenwarx.medium.com
Today, I want to share details about a recent bug I discovered. I’ll guide you through the reconnaissance and testing steps I took to find this security vulnerability, but all information related to the program will be fully redacted, in accordance with Bug Bounty Platform’s policy and out of respect for the program.
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 inconsistent escaping at the application layer altered how the database parsed the input, so only certain inputs broke out of the string literal.
Impact
An attacker could bypass admin authentication, access all user data, approve orders, and take over any user account to steal funds; the text says the company fixed the issues.
What the attacker needed
Access to the admin login page; no account needed
The fix
The company fixed the vulnerabilities after the report.
How it was found
- Open the admin login page and submit a login request.
- Try a single quote, backslash, and double quote in the username field and observe a SQL error.
- Craft a payload that closes the string literal and adds a true condition to bypass login.
- Log in to the admin dashboard and view user data.
- Reset a user's account using a reset token visible in the admin panel to take over the account.
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 command without proper handling, letting an attacker change the command's meaning. Here, the login form built a database query by pasting in the username, and the escaping was inconsistent, so a specially crafted username could trick the database into logging the attacker in as an admin. Once inside, the attacker could see and control other users' accounts.
What is SQL injection?
Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.