Discovery of Blind SQL Injection and OS Command Injection Vulnera
A university appraisal system built on ASPX and MSSQL was vulnerable to blind SQL injection in its login form, allowing authentication bypass and database dumping. The database account had high privileges, enabling the attacker to enable xp_cmdshell and achieve blind OS command execution, though outbound connections and webroot writes were blocked.
Published on infosecwriteups.com
One day during reconnaissance on a university website, I was exploring various endpoints and gathering intel that could potentially lead to vulnerabilities. While conducting subdomain enumeration, I came across two subdomains — one appeared to be quite old, while the other seemed relatively new.
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 login form concatenated user input into SQL queries without parameterisation, and the database account had excessive privileges allowing xp_cmdshell to be enabled.
Impact
An attacker could bypass authentication, dump the database containing sensitive student and employee data, and execute arbitrary OS commands on the server, though outbound connections and webroot writes were blocked.
What the attacker needed
Access to the login page; no special privileges needed
The fix
The vulnerabilities should be fixed by using parameterised queries, applying least privilege to database accounts, and disabling xp_cmdshell.
How it was found
- Performed subdomain enumeration and found two exposed subdomains.
- Tested the login portal by injecting quotes into input fields and observed a SQL syntax error.
- Used a classic SQL injection authentication bypass payload and gained access to employee appraisal information.
- Used Ghauri to automate database dumping.
- Checked if xp_cmdshell was enabled and found it blocked, then executed a query to enable it.
- Confirmed command execution by triggering a delay with a ping command.
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.
The login page inserted user input directly into database queries without proper handling, so specially crafted input could change the query's meaning. This let the attacker log in without valid credentials and later run operating system commands through the database, though they could not see the command output directly.
What is SQL injection?
Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.