ESN 42680-090429-343941-13


Document Name: Testing for Conficker with Nmap
Document Description: Testing for Conficker with Nmap

Testing for Conficker with Nmap


2009/04/29

The latest nmap release can test Windows machines for Conficker infection. If you are running Linux, nmap may already be installed. You can download the latest nmap for OS X from http://nmap.org/book/inst-macosx.htm. You actually get more more than nmap with the .dmg: it also includes Zenmap (an X11 nmap), Ncat (good old netcat), and Ndiff (compares nmap scans). I briefly fired up Zenmap but used the command line tool for everything you'll see here.

For Linux or OS X you could also compile from source.

You need the very latest version to get the scripts that will check for Conficker. The version I used here was 4.85BETA8.

You will need to disable firewalls and security suites on the Windows machine to be checked. For absolute safety, that would mean disconnecting the machines from any external network as you'd potentially be exposed while this was shut off.

The XP machine I used here had Norton Antivirus installed, which includes an "Internet Worm Protection" component that will cause the Conficker check will fail:

 nmap -PN -T4 -p139,445 -n -v --script=smb-check-vulns --script-args safe=1 192.168.1.2
 
 Starting Nmap 4.85BETA8 ( http://nmap.org ) at 2009-04-29 16:19 EDT
 NSE: Loaded 1 scripts for scanning.
 Initiating Connect Scan at 16:19
 Scanning 192.168.1.2 [2 ports]
 Completed Connect Scan at 16:19, 2.00s elapsed (2 total ports)
 NSE: Script scanning 192.168.1.2.
 NSE: Script Scanning completed.
 Host 192.168.1.2 is up.
 Interesting ports on 192.168.1.2:
 PORT    STATE    SERVICE
 139/tcp filtered netbios-ssn
 445/tcp filtered microsoft-ds
 
 Read data files from: /usr/local/share/nmap
 Nmap done: 1 IP address (1 host up) scanned in 2.21 seconds
 

If I scan that machine with a normal "nmap 192.168.1.2", the scan will be detected and the scanning machine will be blocked from all access for 30 minutes. Attempting to run the Conficker script after that will usually just get you a hang.

However, with the Worm protection turned off, the scripts can tell us that this machine is clean:

 nmap -PN -T4 -p139,445 -n -v --script=smb-check-vulns --script-args safe=1 192.168.1.2
 
 Starting Nmap 4.85BETA8 ( http://nmap.org ) at 2009-04-29 16:38 EDT
 NSE: Loaded 1 scripts for scanning.
 Initiating Connect Scan at 16:38
 Scanning 192.168.1.2 [2 ports]
 Discovered open port 445/tcp on 192.168.1.2
 Discovered open port 139/tcp on 192.168.1.2
 Completed Connect Scan at 16:38, 1.10s elapsed (2 total ports)
 NSE: Script scanning 192.168.1.2.
 NSE: Starting runlevel 2 scan
 Initiating NSE at 16:38
 Completed NSE at 16:38, 0.18s elapsed
 NSE: Script Scanning completed.
 Host 192.168.1.2 is up (0.00042s latency).
 Interesting ports on 192.168.1.2:
 PORT    STATE SERVICE
 139/tcp open  netbios-ssn
 445/tcp open  microsoft-ds
 
 Host script results:
 |  smb-check-vulns:  
 |  MS08-067: Check disabled (remove 'safe=1' argument to run)
 |  Conficker: Likely CLEAN
 |_ regsvc DoS: Check disabled (add --script-args=unsafe=1 to run)
 
 Read data files from: /usr/local/share/nmap
 Nmap done: 1 IP address (1 host up) scanned in 1.56 seconds
 

If you are going to scan your entire network all at once, see How to use Nmap to scan very large networks for Conficker. However, remember that each of those machines probably has something running to prevent that, so it's not going to be all that easy usually.

Of course I also scanned the entire local network out of idle curiosity. Everything was as I expected except for these two machines:

 Interesting ports on IP-STB1.home (192.168.1.100):
 Not shown: 999 closed ports
 PORT     STATE SERVICE
 8082/tcp open  blackice-alerts
 
 Interesting ports on IP-STB3.home (192.168.1.102):
 Not shown: 999 closed ports
 PORT     STATE SERVICE
 8082/tcp open  blackice-alerts
 

Huh? What the heck are those? I had a moment of confusion until I realized that STB stands for "Set Top Box". Those are my Verizon TV boxes. It's interesting that they appear to be running a Black-Ice firewall. I wonder if my scan tripped any alarms?


Author: Anthony Lawrence - Contact Author
Publisher: Anthony Lawrence
Licensee Name: Anthony Lawrence
Reference URL: http://aplawrence.com/Security/conficker_nmap.html
Copyright: All Rights Reserved
Registration Date: 4/29/2009 9:42:56 PM UTC
Views: 978




NUMLY.COM