This Derpnstink room is on the TJNull list for OSCP preparation. This room involved the following steps.
- Enumerating using gobuster
- Enumerating using wp-scan
- Exploiting the vulnerable wp plugins for gaining Reverse Shell
- Looking into wp-config file to find the username and password for database
- Exploiting Sudo for priv escalation
As usual, let’s start with an autorecon scan. The initial Nmap scan result is as below.
Nmap scan report for 10.0.0.8
Host is up, received arp-response (0.00048s latency).
Scanned at 2022-03-31 06:49:17 EDT for 9s
Not shown: 997 closed tcp ports (reset)
PORT STATE SERVICE REASON VERSION
21/tcp open ftp syn-ack ttl 64 vsftpd 3.0.2
22/tcp open ssh syn-ack ttl 64 OpenSSH 6.6.1p1 Ubuntu 2ubuntu2.8 (Ubuntu Linux; protocol 2.0)
80/tcp open http syn-ack ttl 64 Apache httpd 2.4.7 ((Ubuntu))
| http-robots.txt: 2 disallowed entries
|_/php/ /temporary/
|_http-title: DeRPnStiNK
| http-methods:
|_ Supported Methods: GET HEAD POST OPTIONS
|_http-server-header: Apache/2.4.7 (Ubuntu)
Uptime guess: 198.839 days (since Mon Sep 13 10:41:03 2021)
Network Distance: 1 hop
TCP Sequence Prediction: Difficulty=259 (Good luck!)
IP ID Sequence Generation: All zeros
Service Info: OSs: Unix, Linux; CPE: cpe:/o:linux:linux_kernel
TRACEROUTE
HOP RTT ADDRESS
1 0.48 ms 10.0.0.8
Looking at robots.txt we find two pages of which one is forbidden and one says `Tryharder.On my feroxbuster scan from autorecon I see a new directory called weblog.
We can see the WordPress site now. Let’s run the wpscan.
wpscan --url http://derpnstink.local/weblog -e ap,u
The scan result shows the user name admin and a vulnerable plugin.
For this exploit to run we need authentication. Let’s perform Bruteforce for user admin. I was able to crack the password and it was admin:admin.
Now let’s perform that arbitrary upload exploit. I tried using the python script from searchsploit for arbitrary file upload but the script ran into an error. Upon diving deep, I found that you can upload the script in the manage slide section of the plugin.
I used the pentest monkey PHP reverse shell and got the reverse shell.
I didn’t find anything looking around. So uploaded the linpeas.sh script. Linpeas found something interesting immediately. But couldn’t proceed ahead with this vector.
There must be something else to gain access to this system. Looking at /var/www/html we find a php folder. Inside it there is info.php file.
So we can see that there is an /phpmyadmin interface running inside the /php directory. Let us see if we can find some credentials to gain access to the PHPMyAdmin. Let’s search for the wp-config file and see if we can find anything important in there. And I found the database username and password.
Inside the database, I was able to find the username and password hash for user admin and unclestinky for WordPress.
Looking further into the database, I found another password hash for unclestinky. This might be the password to the OS.
I was able to crack it using crackstaion.net. The password is wedgie57 .
I tried changing the user to unclestinky but the user didn’t exist. Checking the home directory I found stinky and sprayed my password for user stinky and it worked.
Enumerating further I found derpissues.pcap file inside the Documents folder in the stinky Home Directory. I fired up Wireshark and started looking into the pcap file.
Form item: "pass1" = "derpderpderpderpderpderpderp"
It tried changing the user to mrderp with the password derpderpderpderpderpderpderp and it worked.
Running sudo -l command, we can see the mrderp can run derpy* (* wildcard means can be with any file extension) command. And is inside the home directory of mrderp.
The binaries folder does not even exist. SWEET! . I am going to create a directory and derpy.sh file which runs simple bash shell command. Executing it with sudo gives us root access.
This box has everything to learn and help in developing your enumeration skills.