蚁景科技
- 关注
0
1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
6
7
8
9
原创: Lhaihai 合天智汇
Background Information
vulnhub 地址:
https://www.vulnhub.com/entry/dc-1-1,292/
There are multiple ways of gaining root, however, I have included some flags which contain clues for beginners.
There are five flags in total, but the ultimate goal is to find and read the flag in root's home directory. You don't even need to be root to do this, however, you will require root privileges.
作者说一共有五个flag,有多种方法去提权,我们最终目标是去拿到/root的flag。总的来说,难度不高,适合新人练手。
知识点
CVE-2018-7600 Drupal核心远程代码执行漏洞
drupal配置文件和重置管理员密码
suid提权
Information Gathering
发现主机:192.168.190.147
用masscan快速扫描端口
再用nmap发现更多信息
80端口是drupal 7 服务
111 端口是 rpcbind服务
入侵靶机
寻找drupal 7的漏洞,18年有两个CVE
CVE-2018-7600 Drupal核心远程代码执行漏洞
CVE-2018-7602
在github找到POC脚本
Exploit for Drupal 7 <= 7.57 CVE-2018-7600
https://github.com/pimps/CVE-2018-7600
试了一下可以用,真舒服
接着反弹一个shell
查看drupal版本,因为CHANGELOG.txt被删掉了,可以看includes/bootstrap.inc
在 /var/www/ 下有个flag1.txt,提示我们去看配置文件
drupal的配置文件是 /sites/default/settings.php ,主要是数据库连接配置,我们发现了flag2以及数据库账号密码
我们登录mysql查看下用户,发现有admin和Fred两个用户
搜了一下drupal怎么存储用户密码,它是把密码和用户名或其它随机字符串组合在一起后使用 MD5 方式加密。
下面这篇文章介绍了一个重置密码的方法,Drupal 7 忘记密码后重置管理员密码 :
https://www.yuzhi100.com/article/drupal-7-chongzhi-guanliyuan-mima
用hashcat暴力破解也是可以了,参考这篇:
https://klionsec.github.io/2017/04/26/use-hashcat-crack-hash/
但flag2都提示暴力破解不是唯一的方法,那就怎么省事怎么来了
用drupal自带的 password-hash.sh
加密 drupal
看一下flag3,要我们去查看shadow文件,看到perm 猜测是不是suid提权
看起来没有什么特别的,继续翻翻目录,在home目录发现flag4
提权
运行一些脚本看能不能发现什么,再手动探测一下
https://github.com/NullArray/RootHelper(脚本下载器,滑稽)
https://github.com/rebootuser/LinEnum
给予执行权限后执行
发现
结合之前flag3的提示,查看find文档,有个-exec的参数执行命令,cat后面的{}表示find查找到的文件名
拿到密码的sha256,试试能不能爆破密码出来
然后我用rockyou密码本去跑了一下.....
在我的电脑疯狂咆哮的时候,我终于想到了既然我可以用root权限读取shadow,那也可以读取/root目录下的文件
既然都可以用root执行命令了,那就试试反弹shell,把命令写进shell.sh脚本,然后执行,成功获取root shell
Thanks for reading.
参考链接:
http://topspeedsnail.com/John-the-Ripper-learn/
优化批量破解shadow
【安全科普】Linux提权——利用可执行文件SUID
https://www.anquanke.com/post/id/104697
https://www.freebuf.com/sectool/121847.html
https://wangchujiang.com/linux-command/c/find.html
https://justcoding.iteye.com/blog/1407697
本文为合天原创,未经允许,严禁转载。
如需授权、对文章有疑问或需删除稿件,请联系 FreeBuf 客服小蜜蜂(微信:freebee1024)
