SQL Injection in Login Page: https://█████/█████████/login.php
The login page's username field was vulnerable to error-based SQL injection, as entering control characters produced an Oracle SQL error. An attacker could potentially exploit this to gain unauthorised access to the database, though the reporter did not attempt full exploitation.
- Triaged in 9 days
- Fixed in 17 days
- Disclosed after 18 months
Summary: I believe I've discovered an error based SQL injection in the login page for https://████/██████/login.php.
Description: When browsing to the webpage https://█████/██████/login.php and entering certain control characters into the "Username" field, and SQL error (Oracle) is produced.
Impact
This is hard to gauge as I did not attempt to fully exploit the SQL injection point. Once I identified that it was an error-based SQL injection, I stopped. The website also has a Web Application Firewall and IPS implemented, so bypasses would need to be used to fully exploit it. I didn't know the rules for this program in regard to bypasses defenses with automated tools like sqlmap the --tamper parameter.
Step-by-step Reproduction Instructions
- Browse to https://█████████/███/login.php
- Enter " '; -- " into the username field
- The error "ORA-00933: SQL command not properly ended" is produced
Product, Version, and Configuration (If applicable)
██████████ █████████ Portal Version: 3.0.89 Last Modified: Oct 04, 2018
Suggested Mitigation/Remediation Actions
Parameterized queries should be used to separate the command and data portions of the intended query to the database. These queries prevent an attacker from tampering with the query logic and extending a concatenated database query string. Code reviews should be conducted to identify any additional areas were the application or other applications in the organization are vulnerable to this attack. Additionally, input validation should be enforced on the server side in order to ensure that only expected data is sent in queries. Where possible security specific libraries should be used in order to provide an additional layer of protection.
Impact
A skilled attacker could likely gain access to the database for the website, and depending on the privileges of the database user, gain access to other databases or compromise the system hosting the database engine.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the application concatenates user input directly into an SQL query without proper parameterisation, causing syntax errors when special characters are entered.
Impact
A skilled attacker could likely gain access to the database and potentially compromise the hosting system, but a Web Application Firewall and IPS are in place, so bypasses would be needed for full exploitation.
What the attacker needed
Access to the login page; no authentication needed
The fix
Parameterised queries should be used to separate SQL commands from data, along with server-side input validation and code reviews.
How it was found
- Browse to the login page.
- Enter a specific string containing a single quote and comment characters into the username field.
- Observe the Oracle SQL error message.
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 report has not been written yet. The Original tab links to the source.
SQL injection is a flaw where user input is inserted directly into a database command, letting an attacker change the command's meaning. Here, typing special characters into the login form caused the database to show an error message, which is a sign that the input is not safely handled. This could let an attacker read or modify data in 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.