First things first, let’s see what services we can find on this box
Looks like it’s running ssh and a webserver. Let’s fire up the webserver and see what we find
Website
Well, this looks interesting, lets try the first one, ini.php and click submit
Loads of stuff. Looking at the url, this may be suseptible to LFI (Local File Inclusion). Let’s see if we can read /etc/passwd. Probably won’t work, but worth a try.
Excellent, it worked. We can see that there is a user on this box called charix
While we may be tempted to start looking for LFI exploits, such as writing a PHP reverse shell to the apache log and then viewing it, lets first go back and check the other php files we were provided with
The listfiles.php gives the following output
Hmm,what’s pwdbackup.txt. Lets take a look
Excellent. This looks like a very long base64 string. (The = on the end gives it away)
Let’s try decoding it.
First remove the spaces from the string so we have one unbroken string and put it in a file to make it easier to read on the screen.
So, the file pass contains our base64 string
Hmm, that’s not useful. However the pwdbackup.txt file said it had been encoded at least 13 times. Lets pipe the output to another base64 -d command and keep doing this until we see somthing useful
A password :)
Let’s try this with the charix user we found earlier
We’re in. Grab the user.txt and now we go for priv esc
PrivEsc
The user directory contains a file called secret.zip. Trying to unzip it gives an error about a passcode
The unzip command on the FreeBSD OS is to old to take a passphrase as a command line argument. So, use scp to copy the secrets.zip to your kali box and try unzipping it there
Well, before we try to crack the password. Let’s try the password we already have. Always try passwords you’ve found before time consuming cracking
Well, look at that. It worked! :)
Looking at the file, it’s rather small and appears to be garbage. A file command on the file reveals nothing.
Back to enumeration. Let’s see what services are running on the box. With freebsd you use the sockstat command, instead of netstat
We have a sendmail server running as root and a Xvnc server running as root. Excellent, let’s check those out
We can reconnect to the box and forward some ports to our local machine. SSH port forwarding is something your should read up on
This forwards ports 5901 and 5801 to the same port on our local kali instance and forwards port 25 to 2500 on our local kali instance
Lets try connecting to the VNC Server
Ok, so we need a password. Lets try the one we have again
Not so easy this time. But wait, what about that small secret file. Let’s check vncviewers help and see what we can do
ok, so -passwd lets us specfiy a passwd-filename. Let’s try our secret file
And we have a root shell. Grab the root.txt hash and do a little dance