Solving VulnHub CTF - Mercury
Used a walkthrough for tips here. Here are the rough steps:
- Run kali linux VM alongside the CTF vm with Running Virtualbox VMs with networking
- Run
sudo netdiscoverto find out the IP of target - Run
nmap <ip>to discover open ports and find that8080is open - Port 8080 hosts a web app that can be accessed through the browser
- Visit
/robots.txtto find a new path/mercuryfacts. (dirbcommand in kali can also be used to “discover” robots.txt if not known already) mercuryfacts/<id>is vulnerable to SQL injection as found by putting backtick in place of the IDsqlmapcan be used to further exploit this to eventually show passwords in the tableusersin the databasemercury- The password for
webmastercan be used to ssh into the machine.cat user_flag.txtfor user flag. - Check the
mercuryfacts/notes.txtfile to see a base64 encoded password forlinuxmaster. Login aslinuxmaster. Runsudo -lto figure out what all commands are allowed. Discover the script at/usr/bin/check_syslog.shthat uses thetailcommand - Add current directory to PATH. Create a symlink to
vimnamedtail - Run
sudo –preserve-env=PATH /usr/bin/check_syslog.shto enter vim as superuser - Run
:!/bin/shto enter root shell. cat /root/root_flag.txtfor root flag