Introduction
- Name of Box : Stratosphere
- IP Address : 10.10.10.64
An interesting box showing the power of the Struts vulnerability CVE-2017-5638 and how python can be used for privesc
Further Reading
Service Detection
First things first, let’s see what services we can find on this box
OK, we have ssh, http on 80 and 8080, although nmap had some trouble identifying them
Website
Snazzy looking website. Looking around, we don’t find anything obvious to delve into, so lets enumerate.
Enumeration
/opt/dirsearch/dirsearch.py -u http://10.10.10.64/ -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -e html --plain-text-report=dirbus_80
The manager directory is password protected, we may need hydra later on.
The Monitoring directory redirects us to the URL http://10.10.10.64/Monitoring/example/Welcome.action
A quick google for urls ending in Action, mentions Struts. Struts has some pretty well documented exploits, so let’s try some
Struts Attack
We start with the CVE-2017-5638 that equifax were pwned by. A quick google gives us some POC code https://github.com/mazen160/struts-pwn
We have command execution. Now to get a reverse shell
Reverse Shell
Listen on port 9001
nc -lvnp 9001
Then lets send a reverse shell command via our struts exploit
Nothing seems to work, so I created a simple python script to loop the struts exploit and give me a kinda-shell
File System Enumeration
Within our working directory there is a db_connect file with some credentials
Database Enumeration
Users sounds interesting, lets try the credentials with the mysql command, through our kinda-shell
We have a username and a password. Always worth checking this out with the ssh service
SSH Connection
And we have user access. Grab the user flag
Privesc
Sudo
Whenever I have the users password, I always check sudo first
So we can run any version of python against the test.py file, as root
test.py
Contents of test.py
As sudo let’s us use any version of python, we can exploit an issue with the input function in python2, in order to get a root shell
Grab the root flag and do a little dance