Lame (Easy)
Last updated
Last updated
Vulnerable Exploit: CVE-2007-2447 and CVE-2004-2687
System Vulnerable: 10.10.10.3
Vulnerability Explanation: This machine is vulnerable on the MS-RPC functionality in smbd in Samba 3.0.0 through 3.0.25rc3 allows remote attackers to execute arbitrary commands via shell metacharacters and service distcc when not configured to restrict access to the server port, allows remote attackers to execute arbitrary command via compilation jobs, which are executed by the server without authorized checks.
Privilege Escalation Vulnerability: Nmap version out of dated and misconfigure set SUID.
Vulnerability Fix: Update service version and apply patch on Software and Restrict access on Samba port from outside network.
Severity: High
Step to Compromise the Host:
Again, we will run the nmap scan against all ports in the background while we are enumerating.
Let start enumerate each service if any of these services are either contain vulnerable versions or misconfigured.
Port 21 vsftpd 2.3.4
We found that on FTP which allow anonymous login but nothing is interesting.
Port 139 and 445 Samba 3.0.20-Debian
Scanning nmap script to check the service vulnerable but it doesn't contain any vulnerable.
Let stat listing all the available share folder on server. We found interesting folder tmp and opt.
Let check the permission on that share drives and we got Read, Write permission on tmp.
By connected to tmp share drive and downloaded all the files, but it doesn't have anything.
Searching on google we found samba 3.0.20 is vulnerable to CVE-2007-2447. We found that it is vulnerable to username field. If we send shell metacharacters into the username field which allow us to execute arbitrary commands.
On exploit code we found the function def exploit at the bottom, it is creating an SMB session using:
username = "/=nohup " + payload.encoded + "`"
password = random 16 characters
domain = user provided domain
Port 3632 distcc v1
By searching on internet, we found this service is vulnerable to remote code execute.
We will run start our netcat listener on port 4444.
Execute command from smbclient on the username field but it failed.
For 2nd attempt, we will connect smbclient first. Then, we have logon command used for changing users once connected on smbclient.
First we will download script and place it in nmap script directory
Now let start testing with exploit script by execute command "id" on the remote machine.
Then, let check whether netcat installed on the remote machine or not. If netcat installed, we will use netcat as reverse shell connect back to our machine.
Let start netcat listener on our kali machine and execute reverse shell via nmap script.
Start finding set SUID misconfigure on the machine whether could allow us to escalate privilege. We found nmap script allow permission binary.
If nmap version is below 5.21, we can escalation by this technique. We found nmap version on machine is 4.53 which is vulnerable to this. By executing this, we got root on machine.
(No Hang Up) is a command in Linux systems that runs the process even after logging out from the shell/terminal.
on website could allow us to find so many UNIX binaries that can be used to bypass local security restrictions in misconfigured systems and we got nmap too.