Chill Hack
https://tryhackme.com/room/chillhack
Last updated
https://tryhackme.com/room/chillhack
Last updated
Port 80 takes us to the following page:
Running dirsearch against the target machine reveals a directory called secret.
The following page for /secret/ contains a command box.
Running the id command shows we are running as www-data.
Attempting to run binaries and commands such as cat are filtered presenting with the following page.
The following page from https://book.hacktricks.xyz/linux-unix/useful-linux-commands/bypass-bash-restrictions shows that we have multiple ways to attempt to bypass the filter. The first section regarding Reverse shell shows a reliable method for gaining a shell.
Once the command has been run on the attacking machine take the output and run it on the command box on the target machine.
The output below was run on the target machine and netcat
on my attacking machine caught a shell.
Running linpeas.sh on the target machine reveals the following interesting information:\
Running sudo -u aparr /home/apaar/.helpline.sh
produces an interactive shell script. Which can be escaped by running bash
.
Linpeas shows a service is running locally on port 9001.
We can drop a SSH key onto the attacking server to get SSH service to then forward the port to our attacking machine.
Attacking machine
Hit enter until the command completes. Copy the contents of the id_rsa.pub file in the attacking machines home directory and echo this into authorized_keys file for the user apaar.
Target machine
We can then connect to SSH as the user apaar without specifcying the password. Using the following syntax we can forward the target machine local port of 9001 to our attacking machine with SSH.
We can then access http://127.0.0.1:9001 in a web browser.
Performing directory enumeration on this reveals the /images/ directory.
Saving the image file hacker-with-laptop_23-2147985341.jpg and running steghide
reveals the following.
The archive backup.zip is password protected. Using zip2john we can create a hash and crack with john.
Extracting the contents reveals the file source_code.php.
Running the base64 value through -d reveals the following:
We also have the user anurodh. The credentials can then be used to SSH into anurodh.
Viewing the groups anurodh is a member of we do see docker. Running the following command taken from GTFOBins will give us root access. https://gtfobins.github.io/gtfobins/docker/