> 文章列表 > TryHackMe-Year of the Dog(Linux渗透测试)

TryHackMe-Year of the Dog(Linux渗透测试)

TryHackMe-Year of the Dog(Linux渗透测试)

Year of the Dog

谁知道呢?狗咬了一口!


端口扫描

循例nmap

TryHackMe-Year of the Dog(Linux渗透测试)

Web枚举

进80

TryHackMe-Year of the Dog(Linux渗透测试)

用gobuster扫了一圈没有任何发现,图像也没有隐写

在主页的请求头的cookie有一个id

TryHackMe-Year of the Dog(Linux渗透测试)

改成其他错误值会导致异常,看见叫id,习惯性加个了引号

TryHackMe-Year of the Dog(Linux渗透测试)

爆库

TryHackMe-Year of the Dog(Linux渗透测试)

爆表

TryHackMe-Year of the Dog(Linux渗透测试)

爆字段

TryHackMe-Year of the Dog(Linux渗透测试)

获取信息

TryHackMe-Year of the Dog(Linux渗透测试)

然而这些东西并没有什么用

尝试写入文件,发现有waf

TryHackMe-Year of the Dog(Linux渗透测试)

payload转hex

TryHackMe-Year of the Dog(Linux渗透测试)

通过lines terminated by追加内容

TryHackMe-Year of the Dog(Linux渗透测试)

写入成功,直接用python3reverse shell

TryHackMe-Year of the Dog(Linux渗透测试)

TryHackMe-Year of the Dog(Linux渗透测试)

横向移动

在dylan的家目录有一个work_analysis文件

TryHackMe-Year of the Dog(Linux渗透测试)

这看着像是ssh日志,并且记录了被ssh爆破的信息

TryHackMe-Year of the Dog(Linux渗透测试)
过滤dylan,dylan后应该就是密码,它一定是忘记回车了

TryHackMe-Year of the Dog(Linux渗透测试)

ssh直接登,同时拿到user flag

TryHackMe-Year of the Dog(Linux渗透测试)

权限提升

在根目录下有个gitea

TryHackMe-Year of the Dog(Linux渗透测试)

本地开了个3000

TryHackMe-Year of the Dog(Linux渗透测试)

ssh做一下本地端口转发

TryHackMe-Year of the Dog(Linux渗透测试)

进本地3000,用dylan的凭据登录,有2fa

TryHackMe-Year of the Dog(Linux渗透测试)

创建一个账户

TryHackMe-Year of the Dog(Linux渗透测试)

在/gitea目录下有个gitea.db文件,并且dylan是所有者

TryHackMe-Year of the Dog(Linux渗透测试)

下载到攻击机查看

由于我们是db文件的所有者,我们可以修改数据库,将我们的账户设置成admin,再覆盖掉原文件

TryHackMe-Year of the Dog(Linux渗透测试)

但这样做似乎并不行

再找到two_factor表把2fa code给删掉,然后再登录dylan

TryHackMe-Year of the Dog(Linux渗透测试)

依然不行,我不理解

从官方文档找到,gitea允许http base身份验证,这意味着我们可能可以绕过正常登录时需要验证2fa

TryHackMe-Year of the Dog(Linux渗透测试)

TryHackMe-Year of the Dog(Linux渗透测试)

成功进来,再使用burp的匹配和修改规则为我们的每个请求自动添加上该请求头

TryHackMe-Year of the Dog(Linux渗透测试)

在一个仓库里有几个githook,这由sh脚本编写,这意味着能利用其来执行命令

TryHackMe-Year of the Dog(Linux渗透测试)

写payload

TryHackMe-Year of the Dog(Linux渗透测试)

随便修改readme.md然后提交

TryHackMe-Year of the Dog(Linux渗透测试)

同时getshell

查看sudo -l,直接到root,但在docker里

TryHackMe-Year of the Dog(Linux渗透测试)

在根目录下有个/data, 与宿主机/gitea一致

TryHackMe-Year of the Dog(Linux渗透测试)

他们是连通的, 应该是挂载过去的

在docker中我们是root,那么就可以直接cp一个带root suid的bash过去,dylan就可以利用其提升到root

由于docker里的bash在宿主机用不了,需要先在宿主机复制个bash过去再由docker里的root操作

TryHackMe-Year of the Dog(Linux渗透测试)

dylan利用

TryHackMe-Year of the Dog(Linux渗透测试)

getroot