Colddbox - Easy
Last updated
Was this helpful?
Last updated
Was this helpful?
As the machine description says - this is a WordPress machine with an easy level of difficulty. Machine can be found here : . It's an interesting room and I enjoyed the Privilege escalation part most.
1) First I need to discover machines IP. I have used netdiscover and found the IP : 10.0.2.44
netdiscover -i eth0 -r 10.0.0.0/16
2) First, searching all port using nmap: nmap -p- -v -T5 -Pn 10.0.2.44
3) Now scanning the services are running: nmap -sV -A -p 80,4512 -v 10.0.2.44
4) For Further enumeration, I have used another tool: enum4linux. Nothing found.
enum4linux -v 10.0.2.44
5) As the site is running WordPress, so I scan it. This scan gives me valuable info
6) I need some more info in order to start any attack. So, enumerate the web more. I have tried directory listing using gobuster:
This attack give me a - username: c0ldd and password: 9876543210
Now I can log in with them.
8) There are 4 ways to get a reverse shell from the WordPress site.
Upload shell through the Theme
Upload shell through the Plugin
Themes template into 404.php
Using pre-installed Plugins into header.php
After some googling, I have found 2 well written article about getting a reverse shell. Reading them won't waste your time
I have modified the code below (given my VM IP to connect back) and uploaded as a zip. This code successfully works as a plugin.
9) In my attack box I have started a listener and then just 'Activated' it from WordPress dashboard. And I get user access.
(Failed attempt) I have tried these ways below and failed. So I noted them.
I was able to create folder in /tmp
. So downloaded linpeas in /tmp
but failed to execute. SUID finding command works: find / -perm -u=s -type f 2>/dev/null
, but not useful. Python3 is running there.
10) After so many failed attempt, I have tried the command below. Database leaked some info there: cat wp-config.php | grep DB
11) DB password could work. So I started to try it, but neither there was any terminal open nor the sudo run access. So then I created a terminal using python3. I have marked them in the picture below
12) Further enumeration says, 3 service running as root: sudo -l
13) Running Vim can also give me root access, but I have tried FTP. Running ftp and then /bin/bash.
Thanks for reading. Hope this amazing CTF and write up will help you a lot.
wpscan -e -v --url
gobuster dir -u -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt
7) I have found some interesting directory and username. So first try brute force the /wp-admin login page: wpscan --url
-e u -t 50 -P /usr/share/wordlists/rockyou.txt