From nmap, there are ssh and http services opened.

Local Picture

Local Picture

This is the web page.

Local Picture

There is a hint telling where the source code is.

Local Picture

I used wfuzz to get the right directory develop.

Local Picture

Local Picture

This is the source code

Local Picture

And this part is interesting, it seems that there is a command injection vulnerability.

Local Picture

Try it with burp suite, and take the reverse shell script as payload.

Local Picture

I got a reverse shell as www-data. I need to become robert.

Local Picture

I got check.txt, out.txt, passwordreminder.txt, and SuperSecureCrypt.py.

Local Picture Local Picture Local Picture Local Picture

Since (check.txt + key) % 255 = out.txt, I make (out.txt - check.txt) % 255 to recover the key, which is alexandrovich. Decrypt passwordreminder.txt with this key, I got the password.

Local Picture

Now, I am robert. With sudo -l, I can run BetterSSH.py as root.

Local Picture

Local Picture

Local Picture

The vulnerability of BetterSSH.py is that it creates a copy of /etc/shadow to /tmp/SSH/<random string>, so I can use watch -n 0.1 cp * /tmp/ to copy all the created files in /tmp/SSH to /tmp. After executing BetterSSH.py, I got root’s hash.

Local Picture

Local Picture

Crack it with hashcat, the password is mercedes. Now, I am root.

Local Picture