## https://sploitus.com/exploit?id=CCC532AA-0515-56ED-85B3-ABECFA3454C4
# Lab 01: Vulnerable Linux Reconnaissance + Enumeration + Remote Code Execution
**Date:** June 6, 2026
**Objective:** Exploit a vulnerable Linux target (Metasploitable) using network reconnaissance, service enumeration, and Metasploit framework to achieve remote code execution and system information gathering.
---
## Overview
This lab demonstrates a complete attack chain against a vulnerable Linux system (Metasploitable). The target was identified through network scanning, vulnerable services were enumerated, and the distcc service was exploited to gain remote code execution with root privileges. Post-exploitation included system reconnaissance and credential harvesting.
**Target:** Metasploitable 2
**Vulnerability:** distcc Remote Code Execution (CVE-2004-2687)
**Impact:** Complete system compromise with root access
---
## Folder Structure
Lab01-VulnLinux-FirstAttack/
โโโ README.md # This report
โโโ commands.txt # All commands executed
โโโ notes.md # Lab notes and observations
โโโ outputs/ # Command output logs
โโโ screenshots/ # Attack phase screenshots
---
## Reconnaissance
### Network Connectivity Test
Initial connectivity was verified to the target system.

### Lab Setup
Directories were created to organize the penetration test data and maintain structured documentation.



---
## Enumeration
### Initial Network Scan
A rapid Nmap scan was performed to identify open ports and running services on the target.

**Key Findings:**
- Multiple vulnerable services detected
- distcc service running on port 3632
- Multiple other exploitable services identified
### Full Service Enumeration
A comprehensive Nmap scan with version detection and script scanning was executed to gather detailed service information.

**Services Identified:**
- SSH (22)
- Telnet (23)
- SMTP (25)
- DNS (53)
- HTTP (80)
- POP3 (110)
- IMAP (143)
- distcc (3632) - **VULNERABLE**
- VNC (5900)
---
## Exploitation
### Vulnerability Research
The distcc service (distributed C compiler) was identified as vulnerable to remote code execution. A search in the Metasploit Framework located the appropriate exploit module.

**Exploit Module:** `exploit/unix/misc/distcc_exec`
**CVE:** CVE-2004-2687
**Description:** distcc allows remote attackers to execute arbitrary commands via shell metacharacters
### Exploit Configuration
The exploit module was loaded and configured with the target IP address.

### Remote Code Execution
The exploit was successfully executed, yielding a remote shell with root privileges on the target system.

**Result:** Successful RCE as root (UID 0)
---
## Post-Exploitation Reconnaissance
### System Information Gathering
#### User Identification

**User:** root
#### Operating System Details

**Output:** Linux metasploitable 2.6.39-xenU #1 SMP Mon May 7 10:45:01 EDT 2012 i686 GNU/Linux
#### Current Working Directory

**Directory:** /tmp/distccd
#### Root Directory Listing

#### Home Directory Contents

### Credential Harvesting
#### /etc/passwd File

**System Users Identified:**
- root
- daemon
- bin
- sys
- sync
- games
- man
- lp
- mail
- news
- uucp
- proxy
- www-data
- backup
- list
- irc
- gnats
- msfadmin
- mysql
- postgres
- tomcat
- distccd
### System State Analysis
#### Hostname Resolution

**Target Hostname:** metasploitable
#### Running Processes

**Key Processes:**
- Apache web server
- PostgreSQL database
- MySQL database
- Samba file sharing
- vsftpd FTP server
- OpenSSH server
#### Network Connections

**Listening Services:**
- TCP/22 (SSH)
- TCP/23 (Telnet)
- TCP/25 (SMTP)
- TCP/53 (DNS)
- TCP/80 (HTTP)
- TCP/110 (POP3)
- TCP/143 (IMAP)
- TCP/3632 (distcc) - EXPLOITED
- TCP/5900 (VNC)
#### Environment Variables

**Notable Variables:**
- PATH configured for system binaries
- Shell environment accessible for command execution
---
## Attack Chain Summary
1. RECONNAISSANCE
โโ Ping target to verify connectivity
2. ENUMERATION
โโ Initial nmap scan to identify open ports
โโ Full nmap scan with service version detection
โโ Identified distcc service on port 3632
3. EXPLOITATION
โโ Searched Metasploit Framework for distcc exploits
โโ Located exploit/unix/misc/distcc_exec
โโ Configured exploit with target IP
โโ Executed exploit โ Remote shell as root
4. POST-EXPLOITATION
โโ System information gathering (id, uname, hostname)
โโ File system reconnaissance (ls, pwd)
โโ Credential harvesting (/etc/passwd)
โโ Process enumeration (ps aux)
โโ Network state analysis (netstat)
โโ Environment variable inspection (env)
5. IMPACT
โโ Complete system compromise with root privileges
---
## Lessons Learned
### What Worked
- **Service version enumeration** provided precise vulnerability identification
- **Metasploit Framework** simplified exploit development and delivery
- **Automated exploitation** reduced manual payload crafting requirements
- **Systematic post-exploitation** yielded comprehensive system intelligence
### Key Takeaways
1. **Outdated services are dangerous** โ distcc had unpatched RCE vulnerabilities
2. **Version detection is critical** โ enabled precise targeting of known CVEs
3. **Root execution is game-over** โ immediate access to all system resources
4. **Post-exploitation intel** is valuable for lateral movement and persistence planning
### Detection Gaps
- No firewall rules prevented distcc access
- No intrusion detection system flagged exploit execution
- No logging captured RCE commands executed
- No host-based security monitored unauthorized root activity
---
## Next Steps - Lab 02
**Planned Progression:**
1. **Windows Server Exploitation** โ Gain experience with Windows-based vulnerabilities and exploitation techniques
2. **Active Directory Enumeration** โ Learn domain structure, user accounts, and privilege levels
3. **Privilege Escalation** โ Advance from initial access to administrative privileges
4. **Lateral Movement** โ Move between systems within the network
5. **Persistence Mechanisms** โ Establish persistent access for long-term control
6. **Log Evasion** โ Understand detection avoidance and forensic countermeasures
---
## Tools & Technologies
- **Kali Linux** - Penetration testing distribution
- **Nmap** - Network reconnaissance and port scanning
- **Metasploit Framework** - Exploitation framework and payload delivery
- **distcc** - Vulnerable target service
- **Bash/Shell** - Command execution and post-exploitation
---
## References
- **CVE-2004-2687** - distcc Remote Code Execution
- **Metasploitable 2** - Intentionally vulnerable Linux distribution for lab training
- **MITRE ATT&CK Framework** - Exploitation and post-exploitation techniques
---
**Lab Status:** โ Complete
**Exploitation Success:** โ Root Access Achieved
**Documentation:** โ Full Attack Chain Documented