# Offsec Proving Grounds - FunBoxRookie Walkthrough #### Machine Details #### Name: FunBoxRookie #### IP address: 192.168.66.107 #### Difficulty: Easy #### Points: 5 --- ## It all began with nmap Once the box has been started, as usual the first step is to run a scan. nmap comes to the rescue and the result is shown below. ![](https://i.imgur.com/2i1uZ4l.png) From the scan results, there are three services running on this box; an FTP service on port 21, an SSH service on port 22 and also an HTTP service on port 80. Interestingly, the FTP service allows [anonymous login](https://whatis.techtarget.com/definition/anonymous-FTP-File-Transfer-Protocol). Before checking out the FTP service, I quickly entered the IP address of the box into a browser to see what is on the webpage and I was greeted with the following page: ![](https://i.imgur.com/tqUJGgn.png) I ran directory enumeration with gobuster in the background but did not obtain much information. I visited /robots.txt on the page and got this: ![](https://i.imgur.com/x193MW4.png) Awesome! We found /logs/. I proceeded quickly to access this page but to my surprise I got the page below: ![](https://i.imgur.com/v6UjyPZ.png) ## I am ANONYMOUS At this point, I went back to the FTP server and logged in as anonymous. Listing the files on the server shows some zips files and some hidden files which I downloaded to my local machine. ![](https://i.imgur.com/eGqPTU2.png) I opened the welcome.msg as displayed below but did not get much information. ![](https://i.imgur.com/IEcg0vd.png) Opening the .@admin file gives some sort of encoded message. ![](https://i.imgur.com/2WOXG3K.png) The .@users file on the other hand provides much information on the next line of action. ![](https://i.imgur.com/DtSQshR.png) I tried to unzip each of the zip files but they all require a password. ![](https://i.imgur.com/bliMzf4.png) ## Crack 'em all Since the root user hinted that the passwords are the old ones, I proceeded to try to crack each zip file using fcrackzip and rockyou.txt wordlist. Out of the eleven zip files, I was able to crack two of them: cathrine.zip and tom.zip and extract their id_rsa files. ``` fcrackzip -u -D -v -p /usr/share/wordlists/rockyou.txt file.zip ``` ![](https://i.imgur.com/iGMlvcs.png) ![](https://i.imgur.com/CY5UCnf.png) ## Let me in After I obtained the id_rsa, I changed the file permission. I then tried to access SSH using cathrine id_rsa file but I kept getting a connection closed message. ``` chmod 0600 id_rsa ``` ![](https://i.imgur.com/m77GxPN.png) I moved to trying tom id_rsa file and I was logged into the box. From here I could read the local.txt file. ![](https://i.imgur.com/SdRrZ3C.png) ![](https://i.imgur.com/Jb7UbSH.png) ## Oh my! It's jailbreak time One thing I noticed is that, the user tom is in a restricted shell (rbash). So I had to breakout of this shell. ![](https://i.imgur.com/GTn9uZQ.png) ``` ssh -i id_rsa tom@192.168.66.107 -t "bash --noprofile" ``` ![](https://i.imgur.com/Z8SYUdl.png) Now I can use commands such as cd. One of the first enumeraction checks I do is to find out what commands I can run as other users by running: ``` sudo -l ``` but I was prompted for a password which I don't have. ## History I listed all files in the tom folder again and noticed there is a .mysql_history file. Opening this file, I found creds for tom (\040 represents space). ![](https://i.imgur.com/5L9diuo.png) ``` tom:xx11yy22! ``` Since there is no mysql service running, I proceeded to pass the password to the sudo -l command I ran earlier. ![](https://i.imgur.com/v7KYDGz.png) ## ROOOOOOOOT! Luckily, tom can run all commands as all users, including root, on the box. To obtain a root shell, I only need to do: ``` sudo -i ``` And BOOM! we're root! ![](https://i.imgur.com/GRcXA14.png) ###### tags: `offsec proving grounds` `funboxrookie` `anonymous ftp` `password reuse` `fcrackzip` `zip cracking` `bypassing restricted shells` `history`