Vulnerabilities > CVE-2017-5344 - SQL Injection vulnerability in Dotcms
Summary
An issue was discovered in dotCMS through 3.6.1. The findChildrenByFilter() function which is called by the web accessible path /categoriesServlet performs string interpolation and direct SQL query execution. SQL quote escaping and a keyword blacklist were implemented in a new class, SQLUtil (main/java/com/dotmarketing/common/util/SQLUtil.java), as part of the remediation of CVE-2016-8902; however, these can be overcome in the case of the q and inode parameters to the /categoriesServlet path. Overcoming these controls permits a number of blind boolean SQL injection vectors in either parameter. The /categoriesServlet web path can be accessed remotely and without authentication in a default dotCMS deployment.
Vulnerable Configurations
Common Weakness Enumeration (CWE)
Common Attack Pattern Enumeration and Classification (CAPEC)
- Command Line Execution through SQL Injection An attacker uses standard SQL injection methods to inject data into the command line for execution. This could be done directly through misuse of directives such as MSSQL_xp_cmdshell or indirectly through injection of data into the database that would be interpreted as shell commands. Sometime later, an unscrupulous backend application (or could be part of the functionality of the same application) fetches the injected data stored in the database and uses this data as command line arguments without performing proper validation. The malicious data escapes that data plane by spawning new commands to be executed on the host.
- Object Relational Mapping Injection An attacker leverages a weakness present in the database access layer code generated with an Object Relational Mapping (ORM) tool or a weakness in the way that a developer used a persistence framework to inject his or her own SQL commands to be executed against the underlying database. The attack here is similar to plain SQL injection, except that the application does not use JDBC to directly talk to the database, but instead it uses a data access layer generated by an ORM tool or framework (e.g. Hibernate). While most of the time code generated by an ORM tool contains safe access methods that are immune to SQL injection, sometimes either due to some weakness in the generated code or due to the fact that the developer failed to use the generated access methods properly, SQL injection is still possible.
- SQL Injection through SOAP Parameter Tampering An attacker modifies the parameters of the SOAP message that is sent from the service consumer to the service provider to initiate a SQL injection attack. On the service provider side, the SOAP message is parsed and parameters are not properly validated before being used to access a database in a way that does not use parameter binding, thus enabling the attacker to control the structure of the executed SQL query. This pattern describes a SQL injection attack with the delivery mechanism being a SOAP message.
- Expanding Control over the Operating System from the Database An attacker is able to leverage access gained to the database to read / write data to the file system, compromise the operating system, create a tunnel for accessing the host machine, and use this access to potentially attack other machines on the same network as the database machine. Traditionally SQL injections attacks are viewed as a way to gain unauthorized read access to the data stored in the database, modify the data in the database, delete the data, etc. However, almost every data base management system (DBMS) system includes facilities that if compromised allow an attacker complete access to the file system, operating system, and full access to the host running the database. The attacker can then use this privileged access to launch subsequent attacks. These facilities include dropping into a command shell, creating user defined functions that can call system level libraries present on the host machine, stored procedures, etc.
- SQL Injection This attack exploits target software that constructs SQL statements based on user input. An attacker crafts input strings so that when the target software constructs SQL statements based on the input, the resulting SQL statement performs actions other than those the application intended. SQL Injection results from failure of the application to appropriately validate input. When specially crafted user-controlled input consisting of SQL syntax is used without proper validation as part of SQL queries, it is possible to glean information from the database in ways not envisaged during application design. Depending upon the database and the design of the application, it may also be possible to leverage injection to have the database execute system-related commands of the attackers' choice. SQL Injection enables an attacker to talk directly to the database, thus bypassing the application completely. Successful injection can cause information disclosure as well as ability to add or modify data in the database. In order to successfully inject SQL and retrieve information from a database, an attacker:
Exploit-Db
description | dotCMS 3.6.1 - Blind Boolean SQL Injection. CVE-2017-5344. Webapps exploit for PHP platform |
file | exploits/php/webapps/41377.sh |
id | EDB-ID:41377 |
last seen | 2017-02-16 |
modified | 2017-02-16 |
platform | php |
port | 80 |
published | 2017-02-16 |
reporter | Exploit-DB |
source | https://www.exploit-db.com/download/41377/ |
title | dotCMS 3.6.1 - Blind Boolean SQL Injection |
type | webapps |
Packetstorm
data source | https://packetstormsecurity.com/files/download/141122/dotcms361-sql.txt |
id | PACKETSTORM:141122 |
last seen | 2017-02-18 |
published | 2017-02-15 |
reporter | Ben Nott |
source | https://packetstormsecurity.com/files/141122/dotCMS-3.6.1-Blind-Boolean-SQL-Injection.html |
title | dotCMS 3.6.1 Blind Boolean SQL Injection |
Seebug
bulletinFamily | exploit |
description | ## Product Description dotCMS is a scalable, java based, open source content management system (CMS) that has been designed to manage and deliver personalized, permission based content experiences across multiple channels. dotCMS can serve as the plaform for sites, mobile apps, mini-sites, portals, intranets or as a headless CMS (content is consumed via RESTful APIs). dotCMS is used everywhere, from running small sites to powering multi-node installations for governemnts, Fortune 100 companies, Universities and Global Brands. A dotCMS environment can scale to support hundreds of editors managing thousands of sites with millions of content objects. ## Vulnerability Type Blind Boolean SQL injection ## Vulnerability Description dotCMS versions up to 3.6.1 (and possibly others) are vulnerable to blind boolean SQL injection in the q and inode parameters at the /categoriesServlet path. This servlet is a remotely accessible, unauthenticated function of default dotCMS installations and can be exploited to exfiltrate sensitive information from databases accessible to the DMBS user configured with the product. Exploitation of the vulnerability is limited to the MySQL DMBS in 3.5 - 3.6.1 as SQL escaping controls were added to address a similar vulnerability discovered in previous versions of the product. The means of bypassing these features which realise this vulnerability have only been successfully tested with MySQL 5.5, 5.6 and 5.7 and it is believed other DMBS's are not affected. Versions prior to 3.6 do not have these controls and can be exploited directly on a greater number of paired DMBS's. PostgreSQL is vulnerable in all described versions of dotCMS when PostgreSQL standard_confirming_strings setting is disabled (enabled by default). The vulnerability is the result of string interpolation and directly SQL statement execution without sanitising user input. The intermediate resolution for a previous SQLi vulnerability was to whitelist and partially filter user input before interpolation. This vulnerability overcomes this filtering to perform blind boolean SQL injection. The resolution to this vulnerability was to implement the use of prepared statements in the affected locations. This vulnerability has been present in dotCMS since at least since version 3.0. ## Exploit A proof of concept is available here: https://github.com/xdrr/webapp-exploits/tree/master/vendors/dotcms/2017.01.blind-sqli ## Versions dotCMS <= 3.3.2 and MYSQL, MSSQL, H2, PostgreSQL dotCMS 3.5 - 3.6.1 and (MYSQL or PostgreSQL w/ standard_confirming_strings disabled) ## Attack Type Unauthenticated, Remote ## Impact The SQL injection vulnerability can be used to exfiltrate sensitive information from the DBMS used with dotCMS. Depending of the DBMS configuration and type, the issue could be as severe as establishing a remote shell (such as by using xp_exec on MSSQL servers) or in the most limited cases, restricted only to exfiltration of data in dotCMS database tables. ## Credit This vulnerability was discovered by Ben Nott <pajexali () gmail com>. Credit goes to Erlar Lang for discovering similar SQL injection vulnerabilities in nearby code and for inspiring this discovery. ## Disclosure Timeline * Jan 2, 2017 - Issue discovered. * Jan 2, 2017 - Vendor advised of discovery and contact requested for full disclosure. * Jan 4, 2017 - Provided full disclosure to vendor. * Jan 5, 2017 - Vendor acknowledged disclosure and confirmed finding validity. * Jan 14, 2017 - Vendor advised patch developed and preparing for release. * Jan 24, 2017 - Vendor advised patching in progress. * Feb 15, 2017 - Vendor advises ready for public disclosure. ## References Vendor advisory: http://dotcms.com/security/SI-39 CVE: http://cve.mitre.org/cgi-bin/cvename.cgi?name=2017-5344 |
id | SSV:92691 |
last seen | 2017-11-19 |
modified | 2017-02-17 |
published | 2017-02-17 |
reporter | Root |
source | https://www.seebug.org/vuldb/ssvid-92691 |
title | dotCMS Blind Boolean SQL Injection in dotCMS <= 3.6.1 (CVE-2017-5344) |
References
- http://dotcms.com/security/SI-39
- http://dotcms.com/security/SI-39
- http://seclists.org/fulldisclosure/2017/Feb/34
- http://seclists.org/fulldisclosure/2017/Feb/34
- http://www.securityfocus.com/bid/96259
- http://www.securityfocus.com/bid/96259
- https://github.com/xdrr/webapp-exploits/blob/master/vendors/dotcms/2017.01.blind-sqli/dotcms-dump.sh
- https://github.com/xdrr/webapp-exploits/blob/master/vendors/dotcms/2017.01.blind-sqli/dotcms-dump.sh
- https://www.exploit-db.com/exploits/41377/
- https://www.exploit-db.com/exploits/41377/