Using nmap to scan for MS17-010 (CVE-2017-0143 EternalBlue), (Sat, Jul 1st)

With both WannaCry and NotPetya using MS17-010 for propagation it is important to be able to detect servers which are vulnerable. Even if you have comprehensive vulnerability management and patching programs there are almost certainly servers that have been missed, whether because they are vendor supported or part of your companyscottage IT. It is important to be able to find those servers and either remediate them or put additonal controls in place to protect them.

My fall back to do any kind of discovery scanning is always nmap. It is easy enough to identifydevices that have SMB open using nmap.

nmap -Pn -p445 ip-netblock

Starting Nmap 7.40 ( ) at 2017-06-30 23:40 EDT

Nmap scan report for ...

Host is up (0.11s latency).


445/tcp open microsoft-ds

While detecting SMB is the first step, there are legitimate reasons why a server may have SMB open. For the specific case of finding servers that are vulnerable to MS17-010 we need to dig a bit deeper.

Fortunately, Paulino Calderon has created an nmap NSE script which will reliably detect MS17-010. The script is not part of the standard nmap NSE scripts, so you will need to go and grab the smb-vuln-ms17-010 script from githuband place it into the NSE scripts directory before you can use it (on linux that directory is/usr/share/nmap/scripts/)

This is the nmap command line that seems to work best with this nse script. (with thanks to Neo23x0)

nmap -Pn -p445 --open --max-hostgroup 3 --script smb-vuln-ms17-010 ip_netblock

When the scan finds a server with SMB open and not vulnerable to MS17-010 then the output looks identical to the previous scan however a vulnerable server will generate additional output.

Starting Nmap 7.40 ( ) at 2017-07-01 11:13 EDT

Nmap scan report for ...

Host is up (0.23s latency).


445/tcp open microsoft-ds

Host script results:

| smb-vuln-ms17-010:


| Remote Code Execution vulnerability in Microsoft SMBv1 servers (ms17-010)


| IDs: CVE:CVE-2017-0143

| Risk factor: HIGH

| A critical remote code execution vulnerability exists in Microsoft SMBv1

| servers (ms17-010).


| Disclosure date: 2017-03-14

| References:




-- Rick Wanner MSISE - rwanner at isc dot sans dot edu - - Twitter:namedeplume (Protected)

© SANS Internet Storm Center. Creative Commons Attribution-Noncommercial 3.0 United States License.

Article Link: