skip to content
Back to GitHub.com
Home Bounties Research Advisories CodeQL Wall of Fame Get Involved Events
April 20, 2023

GHSL-2022-101_GHSL-2022-108: SQL injection in Archery - CVE-2023-30552, CVE-2023-30553, CVE-2023-30554, CVE-2023-30605, CVE-2023-30558, CVE-2023-30557, CVE-2023-30556, CVE-2023-30555

Sylwia Budzynska

Coordinated Disclosure Timeline

Summary

The Archery project contains multiple SQL injection vulnerabilities, that may allow an attacker to query the connected databases.

Product

Archery

Tested Version

v1.9.0

Details

SQL injection exists in the project due to unsafe user input being concatenated with a SQL query, that is passed to methods executing a query in a database. All identified issues exist due to the controller files in folder sql taking user input and not sanitizing it, which later is passed to execution. Since the controller methods are connected to and allows querying all the databases that are connected to Archery, then all databases making queries with concatenated input will be affected. In this way, one vulnerable endpoint allows for exploiting several databases. To exploit most of these SQL injections, knowledge of the exploited instance name that is defined in Archery, is needed.

The issues were found by using the default py/sql-injection CodeQL query with additional taint steps.

Issue 1: SQL injection in sql/instance.py endpoint describe method (GHSL-2022-101)

In several below listed cases, user input coming from the tb_name parameter value, db_name parameter value or schema_name in the sql/instance.py > describe endpoint is passed to the below defined describe_table methods in given SQL engine implementations, which concatenate user input unsafely into a SQL query and afterwards pass it to the query method of each database engine for execution. Please take into account that in some cases all three parameter values are concatenated, in other only one or two of them.

Issue 2: Multiple SQL injections in sql_api/api_workflow.py endpoint ExecuteCheck post method (GHSL-2022-102)

User input coming from the db_name parameter value and the full_sql parameter value in the api_workflow.py ExecuteCheck post endpoint is passed to the below defined methods in given SQL engine implementations, which concatenate user input unsafely into a SQL query and afterwards pass it to the query method of each database engine for execution.

Issue 3: SQL injection in sql_api/api_workflow.py endpoint ExecuteCheck post method passing unsafe input to sql/engines/oracle.py explain_check method (GHSL-2022-103)

User input coming from the db_name parameter value in the api_workflow.py ExecuteCheck post endpoint is passed through oracle.py execute_check method and to the explain_check method for execution on line 574.

Issue 4: Multiple SQL injections in sql/instance.py param_edit method (GHSL-2022-104)

User input coming from the variable_name and variable_value parameter value in the sql/instance.py param_edit endpoint is passed to the below defined methods in given SQL engine implementations, which concatenate user input unsafely into a SQL query and afterwards pass it to the query method of each database engine for execution.

Issue 5: Multiple SQL injections in sql/data_dictionary.py table_list method (GHSL-2022-105)

User input coming from the db_name in the sql/data_dictionary.py table_list endpoint is passed to the below defined methods in given SQL engine implementations, which concatenate user input unsafely into a SQL query and afterwards pass it to the query method of each database engine for execution.

Issue 6: SQL injection in data_dictionary.py table_info method (GHSL-2022-106)

User input coming from the db_name in and the tb_name parameter values in the sql/data_dictionary.py table_info endpoint is passed to the below defined methods in given SQL engine implementations, which concatenate user input unsafely into a SQL query and afterwards pass it to the query method of each database engine for execution.

Issue 7: SQL injection in sql_optimize.py optimize_sqltuningadvisor method (GHSL-2022-107)

User input coming from the db_name in parameter value in the sql_optimize.py optimize_sqltuningadvisor is passed to the oracle.py sqltuningadvisor on line 1347 method for execution.

Issue 8: SQL injection in sql_optimize.py explain method (GHSL-2022-108)

User input coming from the db_name in parameter value in the explain endpoint is passed to the below defined query methods of each database engine for execution.

Impact

All of the issues may lead to Information Disclosure.

Credit

These issues were discovered and reported by GHSL team member @sylwia-budzynska (Sylwia Budzynska).

Contact

You can contact the GHSL team at securitylab@github.com, please include a reference to GHSL-2022-101, GHSL-2022-102, GHSL-2022-103, GHSL-2022-104, GHSL-2022-105, GHSL-2022-106, GHSL-2022-107, or GHSL-2022-108 in any communication regarding these issues.