Error-based blind SQL injection
The sites, rods and ous parameters were vulnerable to error-based blind SQL injection, allowing an attacker to trigger database errors and infer data character by character. This could let an attacker extract sensitive information such as database names, table names and stored data.
Originally disclosed on HackerOne
- Triaged in 3 days
- Fixed in 33 days
- Disclosed after 11 months
Description:
An error-based blind SQL injection at ██████. The sites, rods and ous parameters are vulnerable. By exploiting these parameters, it's possible to extract sensitive information by triggering errors that are returned by the database. During testing, I noticed that the characters =, |, ;, > and < were not allowed. However, it was still possible to write SQL injection payloads without them.
References
OWASP SQL Injection https://owasp.org/www-community/attacks/SQL_Injection
Similar report https://hackerone.com/reports/2759243
Impact
By exploiting this vulnerability, an attacker can:
- Confirm the existence of SQL injection by analyzing errors returned by the database
- Potentially extract sensitive information from the database, such as usernames, passwords, or other critical data. The sensitive information could be extracted by sending payloads like "21,19) AND (SELECT 1/(CASE WHEN SYS_CONTEXT('USERENV', 'DB_NAME') LIKE 'A%' THEN 0 ELSE 1 END) FROM dual) IS NOT NULL --". In this example, if the application returns an error (division by zero), the attacker would know that there is a database that starts with 'A'. They could continue sending more payloads until they discover the full database name. They could also discover additional information using the same method, such as table names, column names, and data stored in the database.
System Host(s)
██████████
Affected Product(s) and Version(s)
CVE Numbers
Steps to Reproduce
- Visit the following URL in a browser: ████
- Select an installation from the list on the left, then select items in one of the following fields: Sites, OUs or RODs
- Intercept the request using Burp Suite and modify any one of the following parameters:
sites,rodsorous.
Example payloads:
Returns error, the first table starts with D
21,19) AND (SELECT 1/(CASE WHEN (SELECT table_name FROM all_tables WHERE ROWNUM BETWEEN 1 AND 1) LIKE 'D%' THEN 0 ELSE 1 END) FROM dual) IS NOT NULL --
Does not return error, the first table does not start with A
21,19) AND (SELECT 1/(CASE WHEN (SELECT table_name FROM all_tables WHERE ROWNUM BETWEEN 1 AND 1) LIKE 'A%' THEN 0 ELSE 1 END) FROM dual) IS NOT NULL --
Does not return error, there is not a database that starts with W
21,19) AND (SELECT 1/(CASE WHEN SYS_CONTEXT('USERENV', 'DB_NAME') LIKE 'W%' THEN 0 ELSE 1 END) FROM dual) IS NOT NULL --
Returns error, there is a database that starts with A
21,19) AND (SELECT 1/(CASE WHEN SYS_CONTEXT('USERENV', 'DB_NAME') LIKE 'A%' THEN 0 ELSE 1 END) FROM dual) IS NOT NULL --
It is also possible to discover other database objects, such as columns and data, using the same technique with similar payloads.
The following video shows how the issue can be reproduced: █████████
Suggested Mitigation/Remediation Actions
- Implement input validation to prevent SQL queries from being executed. User-supplied data should be validated and sanitized to remove potentially harmful characters, such as single quotes ('), semicolons (;), and SQL keywords
- Use prepared statements and parameterized queries. User-supplied data should not be concatenated in SQL queries
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 user-supplied input in the sites, rods and ous parameters was concatenated into SQL queries without parameterisation, allowing injected SQL expressions to alter query behaviour.
Impact
An attacker could confirm the SQL injection and potentially extract sensitive information from the database, such as usernames, passwords, table names and stored data.
What the attacker needed
Access to the application; ability to intercept and modify requests
The fix
The application should use prepared statements and parameterised queries so that user-supplied data is never concatenated into SQL queries.
How it was found
- Visit the provided URL in a browser.
- Select an installation from the list on the left, then select items in the Sites, OUs or RODs fields.
- Intercept the request using Burp Suite and modify the sites, rods or ous parameter with a SQL injection payload.
- Observe whether the application returns a database error to infer information.
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 when user input is inserted into a database query without proper handling, so an attacker can change the query's meaning. In this blind variant, the attacker cannot see query results directly, but can ask yes/no questions by causing the database to return an error or not. By repeating these questions, they can slowly guess data such as database names and table contents.
What is SQL injection?
Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.