TryHackMe - Jack of All Trades
Jack is a man of a great many talents. The zoo has employed him to capture the penguins due to his years of penguin-wrangling experience, but all is not as it seems… We must stop him! Can you see through his facade of a forgetful old toymaker and bring this lunatic down?
Jack of All Trades is an easy Linux box and was originally part of the Securi-Tay 2020 conference.
It includes basic steganography and enumeration. Getting the root flag requires brute-forcing the initial access and then using a service with SUID bit
to print out the root flag.
Nmap results
So the SSH and HTTP ports are inverted. By default Firefox can’t open a website at port 22 and gives a warning:
This address uses a network port which is normally used for purposes other than Web browsing. Firefox has canceled the request for your protection.
You can bypass this by overriding banned ports in about:config
.
Guide: https://support.mozilla.org/en-US/questions/1083282
Website enumeration
At first I was just trying to speedrun this box and instead of searching how to bypass that Firefox warning, I curl’d the website:
curl 10.10.72.112:22
In the homepage source code we have a Base64 string and a comment:
The Base64 translates to:
Remember to wish Johny Graves well with his crypto jobhunting! His encoding systems are amazing! Also gotta remember your password: u?WtKSraq
Curl the recovery.php
site we get another Base64 looking string.
This one is in all caps so it’s probably Base32. Throwing this into CyberChef we get:
CyberChef automatically identifies this as Hex which translates to a ROT13 encrypted string, which translates to:
Steganoraphy and Initial Foothold
The shortened URL redirects to a Wikipedia article Stegosauria, hinting that the credentials are probably hidden
inside of a picture on the homepage.
First I grabbed the most obvious choice 10.10.72.112:22/assets/stego.jpg
.
Running steghide on that gave a text file called creds.txt
:
After this one there was to more options left, header.jpg and jackinthebox.jpg.
Thinking that I ain’t finna get finessed two times in a row, I went after the header.jpg
and
gave it the same treatment as stego.jpg. This resulted in file called cms.creds
:
We can use these credentials to login on 10.10.72.112:22/recovery.php
.
After logging in we are redirected to a new page:
It seems we have a simple webshell that we can use. Listing the contents of /home
-directory we see an interesting file jacks_password_list
.
We get twenty-something passwords we can try to login with. I saved the passwords to a text file and tried to brute-force the SSH-login (port 80).
Logging in to SSH with the credentials we find user.jpg
in jack’s home directory.
We can download it with SCP:
Root Flag
Running the enumeration tool linPEAS
on the victim machine, we see that string
-command has SUID bit set.
We can use this to read files like root.txt:
We could also use this to read the /etc/shadow and crack the hashes, or try to find SSH-keys.