Facebook Google Plus Twitter LinkedIn YouTube RSS Menu Search Resource - BlogResource - WebinarResource - ReportResource - Eventicons_066 icons_067icons_068icons_069icons_070

Tenable Blog

Subscribe

Auditing Open Ports on Windows Systems Using Nessus

Tenable recently released three new checks used for auditing the configurations of Windows systems. The new configuration auditing options allow users to audit open ports. This post provides details about the three new checks, and describes how Nessus users could use them to maintain tight control over the number of open ports on their Windows systems.

1. AUDIT_ALLOWED_OPEN_PORTS


This check allows users to audit the list of open ports against an "allowed" list of ports that can be open on a target. For example, let’s assume there is a company policy to only allow SMB ports 445 and 139 to be open on a target. The resulting configuration audit would look as follows:

&ltcustom_item&gt
type : AUDIT_ALLOWED_OPEN_PORTS
description : "Audit TCP Open Ports"
value_type : POLICY_PORTS
value_data : "445,139"
port_type : TCP
&lt/custom_item&gt

The allowed ports should be specified as 'value_data,' and 'value_data' can be an empty string, a single port, or multiple ports separated by a comma. Users can also specify which protocol they want to audit (TCP or UDP). Another interesting feature of this check is the ability to specify a regex in the allowed ports’ ‘value_data’ field:

&ltcustom_item&gt
type        : AUDIT_ALLOWED_OPEN_PORTS
description : "Audit TCP Open Ports"
value_type  : POLICY_PORTS
value_data  : "80,800[0-9]+"
port_type   : TCP
&lt/custom_item&gt

This is useful to audit applications using a range of ports. The example above would check for TCP ports 80 and 8001-8009. Below is a sample result for this check:

Audit allowed tcp ports

2. AUDIT_DENIED_OPEN_PORTS

Instead of checking against an "allowed" list of ports, "AUDIT_DENIED_OPEN_PORTS" checks whether there are any ports that should not be open. For example, if the organizational security policy dictates that Telnet and FTP ports should not be open, the check would look as follows:

&ltcustom_item&gt
type : AUDIT_DENIED_OPEN_PORTS
description : "Audit Denied TCP Open Ports"
value_type : POLICY_PORTS
value_data : "21,23"
port_type : TCP
&lt/custom_item&gt

Denied ports must be specified as 'value_data,' and 'value_data' can also be an empty string, a single port, or multiple ports separated by a comma and/or use a regex. Below is a sample result for this check:

Audit denied tcp

The two checks above rely on output of 'netstat -ano' or 'netstat -an' (depending on which one is available) to extract the list of open ports.

3. AUDIT_PROCESS_ON_PORT

With the checks we've described so far, you can audit which ports you want to see open and which ones should be closed. However, how do you know what services are running on open ports? For example, if port 80 is an authorized open port on target A, and it’s expected to run IIS server, how do you check to see that IIS is really the service listening on that port? An example of the new AUDIT_PROCESS_ON_PORT is below:

&ltcustom_item&gt
type        : AUDIT_PROCESS_ON_PORT
description : "Audit Process On Port 80"
value_type  : POLICY_TEXT
value_data  : "System" || "foo.exe"
port_type   : TCP
port_no     : "80"
port_option : CAN_BE_CLOSED
&lt/custom_item&gt

The allowed process name should be specified in ‘value_data,’ and multiple processes can be separated by the OR (||) operator. The check also supports the tag ‘port_option,’ which is useful during a scan when it is not certain whether the audited port is going to be open. If ‘port_option’ is not specified, and the port is closed on the target, then the check results in a ‘PID_ON_PORT_FAILURE’ error. The check also supports ‘check_type’, so users can use a ‘check_type’ such as ‘CHECK_NOT_EQUAL’ or ‘CHECK_REGEX’ (and more). Below is an example:

&ltcustom_item&gt
type        : AUDIT_PROCESS_ON_PORT
description : "Process on Port 80 should not be a System Process"
value_type  : POLICY_TEXT
value_data  : "System"
port_type   : TCP
port_no     : "80"
port_option : CAN_BE_CLOSED
check_type :  CHECK_NOT_EQUAL
&lt/custom_item&gt

The example below will check port 5900 and make sure the process listening on that port begins with "foo.":

&ltcustom_item&gt
type        : AUDIT_PROCESS_ON_PORT
description : "Process on Port 5900 can be foo.+"
value_type  : POLICY_TEXT
value_data  : "foo.+"
port_type   : TCP
port_no     : "5900"
port_option : CAN_BE_CLOSED
check_type :  CHECK_REGEX
&lt/custom_item&gt

Below is the sample result for this check:

Audit process on port

The auditing of open ports and processes relies on the output of 'netstat -ano' to extract the process ID (PID) associated with the open port, and then uses 'tasklist /svc' to determine the process associated with that PID.

Note: These three new configuration audit checks are available in Windows compliance check v2.0.40 and above.

Tying It All Together with SecurityCenter

This dashboard combines asset filtering and a port summary to display all open ports found by Nessus active scans and the Passive Vulnerability Scanner (PVS) network monitoring. 

External-Open-Ports

This dashboard displays the number of open ports for two different asset groups.

It is important to choose your assets and repositories carefully such that only open port data for Internet-facing devices are displayed.  For example, if you had a repository and performed a credentialed netstat port scan, it may report that a certain service was running on an open port. However, a firewall may be blocking that port from the Internet. 

This dashboard can use any vulnerability data. It could be customized to reflect only Nessus scans, PVS sniffs, and other types of combinations. 

Conclusion

Nessus and SecurityCenter provide you with several different ways in which to identify open ports and "exposed" services in your environment. This is a constantly changing variable, new ports and services can be opened as quickly as they are closed, underscoring the importance of continuous monitoring.

Related Articles

Cybersecurity News You Can Use

Enter your email and never miss timely alerts and security guidance from the experts at Tenable.

Tenable Vulnerability Management

Enjoy full access to a modern, cloud-based vulnerability management platform that enables you to see and track all of your assets with unmatched accuracy.

Your Tenable Vulnerability Management trial also includes Tenable Lumin and Tenable Web App Scanning.

Tenable Vulnerability Management

Enjoy full access to a modern, cloud-based vulnerability management platform that enables you to see and track all of your assets with unmatched accuracy. Purchase your annual subscription today.

100 assets

Choose Your Subscription Option:

Buy Now

Tenable Vulnerability Management

Enjoy full access to a modern, cloud-based vulnerability management platform that enables you to see and track all of your assets with unmatched accuracy.

Your Tenable Vulnerability Management trial also includes Tenable Lumin and Tenable Web App Scanning.

Tenable Vulnerability Management

Enjoy full access to a modern, cloud-based vulnerability management platform that enables you to see and track all of your assets with unmatched accuracy. Purchase your annual subscription today.

100 assets

Choose Your Subscription Option:

Buy Now

Tenable Vulnerability Management

Enjoy full access to a modern, cloud-based vulnerability management platform that enables you to see and track all of your assets with unmatched accuracy.

Your Tenable Vulnerability Management trial also includes Tenable Lumin and Tenable Web App Scanning.

Tenable Vulnerability Management

Enjoy full access to a modern, cloud-based vulnerability management platform that enables you to see and track all of your assets with unmatched accuracy. Purchase your annual subscription today.

100 assets

Choose Your Subscription Option:

Buy Now

Try Tenable Web App Scanning

Enjoy full access to our latest web application scanning offering designed for modern applications as part of the Tenable One Exposure Management platform. Safely scan your entire online portfolio for vulnerabilities with a high degree of accuracy without heavy manual effort or disruption to critical web applications. Sign up now.

Your Tenable Web App Scanning trial also includes Tenable Vulnerability Management and Tenable Lumin.

Buy Tenable Web App Scanning

Enjoy full access to a modern, cloud-based vulnerability management platform that enables you to see and track all of your assets with unmatched accuracy. Purchase your annual subscription today.

5 FQDNs

$3,578

Buy Now

Try Tenable Lumin

Visualize and explore your exposure management, track risk reduction over time and benchmark against your peers with Tenable Lumin.

Your Tenable Lumin trial also includes Tenable Vulnerability Management and Tenable Web App Scanning.

Buy Tenable Lumin

Contact a Sales Representative to see how Tenable Lumin can help you gain insight across your entire organization and manage cyber risk.

Try Tenable Nessus Professional Free

FREE FOR 7 DAYS

Tenable Nessus is the most comprehensive vulnerability scanner on the market today.

NEW - Tenable Nessus Expert
Now Available

Nessus Expert adds even more features, including external attack surface scanning, and the ability to add domains and scan cloud infrastructure. Click here to Try Nessus Expert.

Fill out the form below to continue with a Nessus Pro Trial.

Buy Tenable Nessus Professional

Tenable Nessus is the most comprehensive vulnerability scanner on the market today. Tenable Nessus Professional will help automate the vulnerability scanning process, save time in your compliance cycles and allow you to engage your IT team.

Buy a multi-year license and save. Add Advanced Support for access to phone, community and chat support 24 hours a day, 365 days a year.

Select Your License

Buy a multi-year license and save.

Add Support and Training

Try Tenable Nessus Expert Free

FREE FOR 7 DAYS

Built for the modern attack surface, Nessus Expert enables you to see more and protect your organization from vulnerabilities from IT to the cloud.

Already have Tenable Nessus Professional?
Upgrade to Nessus Expert free for 7 days.

Buy Tenable Nessus Expert

Built for the modern attack surface, Nessus Expert enables you to see more and protect your organization from vulnerabilities from IT to the cloud.

Select Your License

Buy a multi-year license and save more.

Add Support and Training