Vulnerabilities > CVE-2016-6195 - SQL Injection vulnerability in Vbulletin 4.2.2/4.2.3
Attack vector
NETWORK Attack complexity
LOW Privileges required
NONE Confidentiality impact
HIGH Integrity impact
HIGH Availability impact
HIGH Summary
SQL injection vulnerability in forumrunner/includes/moderation.php in vBulletin before 4.2.2 Patch Level 5 and 4.2.3 before Patch Level 1 allows remote attackers to execute arbitrary SQL commands via the postids parameter to forumrunner/request.php, as exploited in the wild in July 2016.
Vulnerable Configurations
Part | Description | Count |
---|---|---|
Application | 2 |
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:
D2sec
name | vBulletin 4 ForumRunner SQL Injection |
url | http://www.d2sec.com/exploits/vbulletin_4_forumrunner_sql_injection.html |
Exploit-Db
description | vBulletin 4.2.3 - 'ForumRunner' SQL Injection. CVE-2016-6195. Webapps exploit for PHP platform |
id | EDB-ID:40751 |
last seen | 2016-11-13 |
modified | 2015-08-25 |
published | 2015-08-25 |
reporter | Exploit-DB |
source | https://www.exploit-db.com/download/40751/ |
title | vBulletin 4.2.3 - 'ForumRunner' SQL Injection |
Packetstorm
data source | https://packetstormsecurity.com/files/download/139688/vbulletin423-sql.txt |
id | PACKETSTORM:139688 |
last seen | 2016-12-05 |
published | 2016-11-11 |
reporter | Manish Tanwar |
source | https://packetstormsecurity.com/files/139688/vBulletin-4.2.3-SQL-Injection.html |
title | vBulletin 4.2.3 SQL Injection |
Seebug
bulletinFamily | exploit |
description | Author: janes(know Chong Yu 404 security lab) Date: 2016-11-15 ## Vulnerability overview ### Vulnerability description vBulletin is a commercial Forum application, using PHP language, researchers have found that the VBulletin core plug-in `forumrunner `presence of SQL injection vulnerabilities: [CVE-2016-6195](<https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-6195>). Plug-in `forumrunner `turned on by default, exploit the vulnerability, an attacker can use SQL injection vulnerability release library. ### Vulnerability An attacker can use SQL injection vulnerability release library ### Impact version 3.6. x to 4.2.1 4.2.2 To 4.2.2 Patch Level 5 4.2.3 To 4.2.3 Patch Level 1 ## Vulnerability analysis > Analysis The with version `4.2.1` Vulnerability is the essence of `forumrunner/includes/moderation.php `file, `do_get_spam_data() `function()the parameters of the `postids `and the `threadid `filter is not strict lead to SQL injection vulnerabilities, the core code is as follows: ``php function do_get_spam_data (){ global $vbulletin, $db, $vbphrase; $vbulletin->input->clean_array_gpc('r', array( 'threadid' => TYPE_STRING, 'postids' => TYPE_STRING, )); ... }else if ($vbulletin->GPC['postids'] != ") { $postids = $vbulletin->GPC['postids']; $posts = $db->query_read_slave(" SELECT post. postid, post. threadid, post. visible, post. title, post. userid, thread. 'forumid', thread. title AS thread_title, thread. postuserid, thread. visible AS thread_visible, thread. firstpostid FROM " . TABLE_PREFIX . "post AS post LEFT JOIN " . TABLE_PREFIX . "thread AS thread USING (threadid) WHERE postid IN ($postids) "); `` VBulletin program does not directly use`$_GET `global variable to get the input data, but the use of the `clean_gpc() ` and `clean_array_gpc() ` function to filter the input data, and both the function and not the `STRING `type to do strict filtering, and the incoming parameter `postids `as `SRING `types of analysis, parameters `postids `then splice in the `SQL `statement for the query, resulting in SQL injection vulnerability. Looking for the call or contains `do_get_spam_data() `function code, found `forumrunner/support/common_methods.php` `php 'get_spam_data' => array( 'include' => 'moderation.php', 'function' => 'do_get_spam_data', ),` Continue backtracking, found `forumrunner/request.php `file contains `support/common_methods.php`. ``php ... $processed = process_input(array('cmd' => STRING, 'frv' => STRING, 'frp' => STRING)); if (!$ processed['cmd']) { return; } ... require_once(MCWD . '/support/common_methods.php'); ... if (! isset($methods[$processed['cmd']])) { json_error(ERR_NO_PERMISSION); } if ($methods[$processed['cmd']]['include']) { require_once(MCWD . '/include/' . $methods[$processed['cmd']]['include']); } if (isset($_REQUEST['d'])) { error_reporting(E_ALL); } $out = call_user_func($methods[$processed['cmd']]['function']); ... `` The above code in the `process_input() `function(forumrunner/support/utils.php), from the`$_REQUEST`, values, and simple type conversions, `STRING `type then it is returned, according to the above code, you can pass`$_REQUEST['cmd']the `arguments to call `get_spam_data() `function, and then call `do_get_spam_data() `function. Set`$_REQUEST['d'] `parameter will open the error reports, contribute to SQL injection, of course, also can not set the`$_REQUEST['d'] `parameter, which trigger a SQL injection vulnerability has no effect. The rest is the use of `postids `parameters to construct the SQL payload ### `postids `parameter injection payload: `forumrunner/request. php? d=1&cmd=get_spam_data&postids=-1)union select 1,2,3,(select concat(username, 0x3a, password) from user),5,1,7,8,9,10--+` Set a breakpoint and variable values,the injection results are as follows: ![code](http://ogb2rw42s.bkt.clouddn.com/code.png) ![post](http://ogb2rw42s.bkt.clouddn.com/post.png) ![erro](http://ogb2rw42s.bkt.clouddn.com/error.png) From the figure it can be seen that the SQL injection statement is executed successfully,`$post['title'] `variable is already acquired user name and password, where`'forumid'`is set to `1`, Ensure that the following code does not enter `the if `conditional statement. `php while ($post = $db->fetch_array($posts)) { $forumperms = fetch_permissions($post['to ' forumid'']); if ( ! ($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) OR ! ($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads']) OR (! ($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers']) AND $post['postuserid'] != $vbulletin->userinfo['userid']) ) { json_error(ERR_NO_PERMISSION); }` ## Patch analysis `includes/general_vb.php `file, `fr_clean_ids `function the `id of the `class variable for the integer conversion, thereby preventing SQL injection attacks. `function fr_clean_ids($list = ”) { $arr = explode(‘,’,$list); $cleanarr = array_map(‘intval’,$arr); return implode(‘,’,$cleanarr); }` `forumrunner/include/moderation.php `file, `do_get_spam_data `function filter`$postids `and`$threadid ` parameter `` $vbulletin->GPC[‘postids’] = fr_clean_ids($vbulletin->GPC[‘postids’]); ... if ($vbulletin->GPC[‘threadid’] != ”) { $threadids = $vbulletin->GPC[‘threadid’]; $threadids = fr_clean_ids($threadids); ... `` ## Solution 1. Direct Update Patch <http://members.vbulletin.com/patches.php> 2. Update the VBulletin version of the program(>4.2.3) ## reference <https://enumerated.wordpress.com/2016/07/11/1/> <http://blog.securelayer7.net/vbulletin-sql-injection-exploit-cve-2016-6195/> |
id | SSV:92354 |
last seen | 2017-11-19 |
modified | 2016-08-30 |
published | 2016-08-30 |
reporter | janes |
title | vBulletin /forumrunner/request.php SQL injection vulnerability |