I decided to scan a /19 rang, how represent 8192 IP addresses with the 2 tools, compare the results and the time to do these scans.
Just play with Metasploit cli to have the possibility, without configuring the Metasploit database, to measure the needed time to do the complete scan.
time ./msfcli auxiliary/scanner/ftp/anonymous ConnectTimeout=1 FTPTimeout=1 RHOSTS=xxx.xxx.xxx.0/19 E
By default, the Metasploit ftp_anonymous auxiliary module is single threaded, you can if you want increase the number of thread by setting the THREADS variable. We will not change this default configuration, cause Nmap is single threaded. But we will decrease the ConnectTimeout and FTPTimeout advanced configuration to 1 second.
Metasploit has take around 75 minutes to scan all the 8192 IP addresses, and return us 35 anonymous FTP.
With 256 threads, to be fair ^^, Metasploit scans the 8192 IP addresses in 1 minute 27seconds. (LOL)
We had these kinds of results :
[*] aaa.aaa.aaa.aaa:21 Anonymous READ (220 aaa.aaa.aaa.aaa FTP server ready)[*] Scanned 4075 of 8192 hosts (050% complete)[*] Auxiliary module execution completed
[*] bbb.bbb.bbb.bbb:21 Anonymous READ/WRITE (220 Welcome to my FTP Server)[*] Scanned 5045 of 8192 hosts (060% complete)[*] Auxiliary module execution completed
To test if the anonymous FTP is writable, Metasploit try to create a directory with the MKD command, and if the creation is successful, this directory is directly deleted by the RMD command. If the anonymous FTP is not writable, then he is logically only readable 🙂 In addition Metasploit will also grab the FTP banners of the anonymous FTP server.
With Nmap, the following command will permit you to scan anonymous FTP, grab the banner and fingerprint the service, but will not test for you if the anonymous FTP is writable or not.
time sudo nmap -p21 -n -sC -sV –script=banner –script=ftp-anon xxx.xxx.xxx.0/19
Nmap has take around 20 minutes to scan all the 8192 IP addresses, and return us only 11 anonymous FTP.
We has these kinds of results :
Nmap scan report for aaa.aaa.aaa.aaaHost is up (0.026s latency).PORT STATE SERVICE VERSION21/tcp open ftp ProFTPD|_banner: 220 aaa.aaa.aaa.aaa FTP server ready|_ftp-anon: Anonymous FTP login allowedService Info: Host: aaa.aaa.aaa.aaa; OS: Unix
Nmap scan report for bbb.bbb.bbb.bbbHost is up (0.027s latency).PORT STATE SERVICE VERSION21/tcp open ftp|_banner: 220 Welcome to my FTP Server|_ftp-anon: Anonymous FTP login allowed1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at http://www.insecure.org/cgi-bin/servicefp-submit.cgi :SF-Port21-TCP:V=5.21%I=7%D=5/16%Time=4BF05218%P=i386-apple-darwin9.8.0%r(NSF:ULL,1E,”220\x20Welcome\x20to\x20my\x20FTP\x20Server\r\n”)%r(GenericLineSF:s,33,”220\x20Welcome\x20to\x20my\x20FTP\x20Server\r\n500\x20Unknown\x20SF:Command\r\n”)%r(Help,33,”220\x20Welcome\x20to\x20my\x20FTP\x20Server\r\SF:n500\x20Unknown\x20Command\r\n”)%r(SMBProgNeg,33,”220\x20Welcome\x20to\SF:x20my\x20FTP\x20Server\r\n500\x20Unknown\x20Command\r\n”);Service Info: Host: my
We have test 2 times the complete scans with Metasploit and Nmap, and we got the same results. What is surprising is the difference between the number of anonymous FTP detected by Metasploit (and verified by hand later) and the results of Nmap.
As suggested by Ron Bowes, I tested a different approach for the Nmap anon-ftp scanning, to increase the time optimization.
First test with :
time sudo nmap -p21 -PS -n –script=ftp-anon xxx.xxx.xxx.0/19
Nmap has finish the scan in 6 minutes and 20 seconds, still more than Metasploit, but no more 20 minutes.
Second test with :
time sudo nmap -p21 -PS -n -T4 –script=ftp-anon xxx.xxx.xxx.0/19
Nmap has finish the scan in 6 minutes and 35 seconds, the -T4 option doesn’t has change anything in term of performances.
Ron has also confirm that nmap anon-ftp LUA script is missing some anonymous FTP, and this randomly.