What to do when NMAP does not scan ports

Overview

A seemingly simple question comes up often about infrastructure discovery: “Why is NMAP not able to identify the OS Platform?” There is actually a larger question behind that one: “What is NMAP identifying and why can it not gather the required information to identify the OS Platform?” This article looks into the answer for this best practice. 

What is Nmap?

From Wikipedia, the free encyclopedia: 

Nmap (Network Mapper) is a free and open-source network scanner...Nmap is used to discover hosts and services on a computer network by sending packets and analyzing the responses.

Nmap usage in Tanium

 Nmap scanning is one of four endpoint Distributed discovery methods that can be enabled with Tanium Discover:

NMAP requirements for operating system identification

NMAP OS identification is dependent on port scans. To identify an Operating System platform (that is, Windows, Linux, Mac, AIX, Solaris, ESXi, NX-OS, etc.) a remote NMAP scan must be able to connect to one open port and one closed port on the remote endpoint.Various software elements can restrict this access including:

  • Antivirus (AV) software blocking communication

  • Software firewall on the client side (where NMAP is running) restricting outbound port communication, often restricted per client software (NMAP cannot scan but Telnet or Microsoft PowerShell is allowed to connect)

  • Software firewall on the remote side (where NMAP is connecting to) restricting inbound port communication to particular endpoints or ports

  • Edge or infrastructure firewall blocking and routing traffic between networks allowing only specific traffic between endpoints on specific ports

Note:

There are a few ways that you can determine if AV or firewalls are blocking ports, however the ability to do so is highly dependent on the permissions given. In many cases, the end user does not have rights to modify or even view their firewall policies, and so needs to open requests with the correct infrastructure team. Also, even if an end user can modify a policy, this does not mean that the rules pushed from a central location are not going to overwrite changes made. The outbound ports are being viewed on the system performing the NMAP scan for Tanium Discover.  The inbound ports cannot be controlled on the remote systems. 

Checking for a Disabled Windows 10 (Defender) local firewall

In some cases, the software firewall built into the operating system may be disabled. Looking at the firewall policy in the control panel is an easy way to check this:


WhatdowhenNMAPd_dbe2e585-d201-47e4-b90b-e5028c629890.png

This does not mean you are out of the woods; there can be other software blocking access.There are three general profiles and they change how access is granted depending on the network the system is in. Each has its own properties. In most cases, the Domain profile is the one we are concerned with.In the Windows Firewall rule properties, the monitoring section in the firewall control panel shows all active rules, both inbound and outboundand what is allowed or blocked. However, access to this may be restricted to administrators only.


WhatdowhenNMAPd_23a533f3-6cbf-405a-9776-0400e7a0f973.png

Also in the monitoring section is the log file location and an indicator about whether anything is being recorded.


WhatdowhenNMAPd_eac9a34a-ca46-481d-b997-54eeb807a33d.png

The log file can show exactly what has been blocked, however in the  screen capture above, dropped packets are not being logged. If permissions allow, this can be changed in the firewall properties. Examining the dropped packets can provide vital information about why NMAP is being blocked.


WhatdowhenNMAPd_7febd962-fde4-418b-a68e-7dbda84adafb.png

Checking for disabled firewalls on other operating systems

A similar process can be used on Windows 7 and Windows Server Operating Systems by looking in control panel, verify if the firewall is operational, and then check logs and rules to find why there may be a problem.Generally, iptables are used on Linux; pf and ApplicationFirewall on Macs. Consult your local support for assistance on these platforms.For third-party software protection verification, check with the internal support team of your organization.

How to Correct Port Scan Failures

There are many variables at play when it comes to remediating port scan failures. In many organizations, the security or infrastructure team owns the firewall configuration. There may be a local policy controlling configurations, or a general group policy (AD). There could be Windows software or third-party software like McAfee or Symantec Endpoint Protection influencing configurations. Tanium Protect may even be pushing out Windows firewall or iptables (Linux) firewall policies. Earlier in the document, it showed how to check Windows 10 Defender for issues restricting NMAP discovery. Once you identify the issue, the next step is engaging the team that manages firewall rule policies, and requesting to allow the scans. Because general NMAP scans can be difficult to differentiate from malicious behavior, security teams often restrict their use. Tanium Discover has a feature designed to designate a customizable Source Port for NMAP, allowing instant and unmistakable identification of the scan source.


WhatdowhenNMAPd_56190063-9b11-414d-aec1-bd0d5295257f.png

If you have additional questions, contact your TAM. 

Other Suggested Best Practices