Mustacchio CTF (THM)

Mustacchio

————————————————————————————————————————————————————————————————————————————————————————

————————————————————————————————————————————————————————————————————————————————————————

SCANNING and ENUMERATION

————————————————————————————————————————————————————————————————————————————————————————

NMAP scan

Image

I found a http server running at port 80

SSH running at port 22

Another http server running at port 8765

————————————————————————————————————————————————————————————————————————————————————————

Gobuster directory scan

————————————————————————————————————————————————————————————————————————————————————————

Image

I found a ‘’customs’’ and ‘’uploads’’ directory through the scan.

————————————————————————————————————————————————————————————————————————————————————————

Enumerating the website

Image

————————————————————————————————————————————————————————————————————————————————————————

On examine the custom directory I found a backup file. Luckily I got the username and password hash by using strings command.

Image

————————————————————————————————————————————————————————————————————————————————————————

————————————————————————————————————————————————————————————————————————————————————————

Logging into the admin panel

————————————————————————————————————————————————————————————————————————————————————————

Image

————————————————————————————————————————————————————————————————————————————————————————

The admin panel has an option to add comment to the website. I looked at the source code and found the format for the syntax to get private key of the user ‘’Barry’’.

Image

————————————————————————————————————————————————————————————————————————————————————————

————————————————————————————————————————————————————————————————————————————————————————

Logging into ssh

————————————————————————————————————————————————————————————————————————————————————————

The SSH key needed a password which I found using ‘’John the Ripper’’ .

————————————————————————————————————————————————————————————————————————————————————————

PRIVESC

I started to find SUID binaries using the command shown below.

————————————————————————————————————————————————————————————————————————————————————————

barry@mustacchio:~$ find / -perm -u=s -type f 2>/dev/null

————————————————————————————————————————————————————————————————————————————————————————

‘’/home/joe/live_log’’ binary looks interesting. After running strings command on this binary, I found that it is using tail command to read the ‘’nginx logs’’.

————————————————————————————————————————————————————————————————————————————————————————

“tail” is not called from it's actual path, we can take advantage of this by adding our own path in “$PATH” environment variable and creating a new file with name tail.

————————————————————————————————————————————————————————————————————————————————————————

Image

————————————————————————————————————————————————————————————————————————————————————————

Image

————————————————————————————————————————————————————————————————————————————————————————

Finally I got both the flags.

Was this helpful?