Home Proving Grounds - Nukem
Post
Cancel

Proving Grounds - Nukem

Nukem Overview

Machine Details:

IPHostnameOperating System
192.168.66.105NukemLinux

Path to Exploitation

Nibbles is a box that requires us to attack a PostgreSQL server with weak credentials to gain access to the machine. From there, we abuse a vulnerable binary with the sticky bit (suid) to escalate to root.

Nukem Website

Landing page indicates that wordpress is on the host

Landing Page

After creating an account I can access the wp-admin page

WP Admin Page

Able to identify version of WordPress on the host

WP Version

We run wp-scan and identify several out dated plugins and themes.

Running WP Scan

We find an RCE affecting this version of simple-file-list here

WP RCE

Shell on Nukem

Use this exploit

modify the payload to send a shell to our host

Modified Exploit

Need to load the python virtual env to run the script with python3, run the following command in my home directory

1
source env/bin/activate

Setup a listener and run the exploit

1
python3 Proving-Grounds/Nukem/exploit.py http://192.168.66.105

Checking on our listener we see we have a reverse shell

Reverse Shell

We find the local flag in the /home/commander directory

Privilege Escalation

Interesting SUID Identified:

1
find / -perm -u=s -type f 2>/dev/null

We identify that the VNC server is running on the internal port 5901

VNC Server

Setup a local port forward to access the VNC server from our Kali machine

1
ssh -L 5901:127.0.0.1:5901 commander@192.168.66.105

Connect to the VNC server on Kali and provide commander’s password

1
vncviewer 127.0.0.1:5901

VNC Connection

We then launch the terminal application and will use the previously identified dosbox SUID binary

VNC Terminal

run the dosbox binary to get a DOS shell

VNC dosbox

mount a drive to /etc

VNC Mounted Drive

We can test our access and see that we can read the shows file, meaning we have elevated privileges

Check for Root Access

We can now add our current user to the sudoers file

1
echo commander ALL=(ALL) ALL >> sudoers

Add User to Sudoers

Checking back in our SSH connection we see that our sudo permissions have been updated

1
sudo -l

Checking Sudo Permissions

We can now switch to the root user

1
sudo -s

Root Shell

This post is licensed under CC BY 4.0 by the author.