I Tested a Login Form and Accidentally Found Remote Code Execution
A login form was vulnerable to SQL injection, allowing an attacker to read database contents and, because stacked queries were enabled, execute operating system commands via xp_cmdshell. The author claims this led to full compromise of the server.
Published on medium.com
Category: Web Application Security Vulnerability Chain: SQL Injection → Database Access → Remote Code Execution Severity: Critical Status: Responsibly Reported
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 application concatenated user input directly into SQL queries instead of using parameterised queries.
Impact
An attacker could read sensitive data and execute operating system commands, leading to full server compromise.
What the attacker needed
Access to the login form; no authentication needed
The fix
The application should use parameterised queries and remove raw SQL errors from responses.
How it was found
- Notice that the login form relies on client-side validation and try unexpected input.
- Observe a raw SQL error returned by the application.
- Use SQLMap to confirm and enumerate the injection.
- Test stacked queries with a time delay to confirm execution.
- Enable xp_cmdshell via sp_configure and run a harmless command to verify OS command execution.
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 login form sends your input to a database. If the website builds the database command by gluing your input directly into it, you can trick the database into running extra commands. Here, the attacker could read data and even run system commands on the server.
What is SQL injection?
Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.