Join our Newsletter — 33% off our NHI Course
Home› Guides› How to Investigate an Unexpected Listening Port: Trace…
Guide Incident Response & Forensics

How to Investigate an Unexpected Listening Port: Trace It to a Process, Owner and Decision

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 27 November 2026 12 min read
On this page

An unexpected listening port is either a service nobody documented or something that should not be there, and until you trace it to a process, a binary and an owner you cannot tell which. Scanners, vulnerability tools and EDR consoles raise these findings every day, and too many are closed as "probably fine" or left open indefinitely. This guide gives system administrators and SOC analysts a repeatable method: confirm the listener, map it to a process and verified binary on Linux, Windows and macOS, find the owner through the CMDB, assess the risk and record a keep, restrict or remove decision. It ends with how to baseline listeners so the next surprise is caught automatically. All steps are read-only until the decision stage, and nothing here involves probing systems you do not own.

Key takeaways

  • Confirm on the host before you act. A scanner result says something answered; only the host's own socket table tells you which process holds the port and on which address.
  • The bind address matters as much as the port. A listener on 127.0.0.1 is reachable only locally; one on 0.0.0.0 or :: answers on every interface, including any that face the internet.
  • Verify the binary, not the process name. Check path, signature or package ownership and hash; a familiar name in an unusual folder is a classic warning sign.
  • Every listener needs an owner and a reason. Use the CMDB and change records to find who runs it; no owner after a set period means restrict or remove.
  • Baseline listeners and alert on drift. A per-role allow list of expected ports and binaries turns a manual hunt into an automated detection.

Confirm the listener

Start from the finding (a scan result, a vulnerability scanner plugin, an EDR alert or an audit) and record exactly what was observed: target IP, port, protocol, time and the scanning source. Then confirm it on the host.

  1. Check you are on the right host. Match the IP to the asset record. DHCP changes, NAT, load balancers and container hosts often mean the scanned IP is not the machine you think it is.
  2. Check the socket table. Use the commands below. A listener present in the table confirms the finding; if it is absent, check whether a port forward, load balancer, hypervisor or container runtime answered on the host's behalf.
  3. Note the bind address. 0.0.0.0 or :: means all interfaces; a specific interface address means only that network; 127.0.0.1 or ::1 means localhost only, so an external scanner should not have reached it.
  4. Check TCP and UDP. UDP listeners do not show a "LISTEN" state and are easy to miss.
  5. Preserve evidence if anything looks wrong. Save the command output with timestamps before changing anything. If the process looks malicious, stop and follow your incident process rather than killing it.
OSCommandWhat it shows
Linuxsudo ss -tulnpTCP and UDP listening sockets, numeric, with owning process and PID (-e adds owning UID and inode)
Linuxsudo ss -ltnp 'sport = :8443'Listeners on one port, using the ss filter syntax
Linux and macOSsudo lsof -nP -iTCP -sTCP:LISTENListening TCP sockets with command, PID and user; root is needed to see other users' processes
Linux and macOSsudo lsof -nP -i :8443Any process using port 8443
Windows (PowerShell)Get-NetTCPConnection -State Listen | Select-Object LocalAddress, LocalPort, OwningProcessListening TCP sockets with the owning PID
Windows (PowerShell)Get-NetUDPEndpoint | Select-Object LocalAddress, LocalPort, OwningProcessUDP endpoints with the owning PID
Windows (cmd, elevated)netstat -anobAll connections and listening ports, numeric, with PID and the executable that opened each one (-b needs elevation and can be slow)

Running these commands on your own hosts is normal administration, but note that ATT&CK lists the same activity as T1049 System Network Connections Discovery when an intruder does it, so expect EDR tools to log it.

Map port to process and binary

A PID and a process name are a starting point, not an identification. Work from the PID to the executable on disk, then prove what that executable is.

Linux

  • Executable path: sudo ls -l /proc/<PID>/exe shows the binary the process is running, even if it was renamed. A target marked "(deleted)" means the file on disk was removed after start, which needs explaining.
  • Command line and parent: ps -o pid,ppid,user,lstart,args -p <PID> gives the user, start time and full arguments; follow the parent PID to see what launched it.
  • Service unit: systemctl status <PID> shows the systemd unit, if any, that owns the process, and the unit file location.
  • Package ownership: rpm -qf <path> or dpkg -S <path> shows which package installed the file; rpm -Vf <path> or dpkg --verify <package> reports whether its files differ from the package database.
  • Containers: if the process runs in a container, identify the container and image and investigate at that level; the host binary will be the container runtime.

Windows

  • Process and path: Get-Process -Id <PID> | Select-Object Name, Path, StartTime.
  • Hosted services: many Windows services share svchost.exe. tasklist /svc /fi "PID eq <PID>" or Get-CimInstance Win32_Service -Filter "ProcessId=<PID>" lists the services in that process.
  • Signature: Get-AuthenticodeSignature -FilePath <path> returns the signature status and signer certificate; where a file is both embedded-signed and catalog-signed, the catalog signature is used. Sysinternals Sigcheck shows version, signature, certificate chain and hashes, and can check a hash against VirusTotal; it uploads the file only if the upload option is chosen, so avoid that for internal or sensitive binaries.
  • Kernel listeners: PID 4 (System) owning a port usually means a kernel-mode service such as HTTP.sys or SMB; use netsh http show servicestate to see which applications registered HTTP.sys URLs.

Checks on every OS

CheckExpected for a legitimate serviceWarning sign
PathStandard install location (Program Files, System32, /usr/bin, /usr/sbin, /opt/<vendor>)Temp, Downloads, user profile, /tmp, /dev/shm, hidden directories
Signature or packageValid signature from the expected publisher, or owned by an installed package with no verify differencesUnsigned, invalid or unexpected signer; file not owned by any package; verify differences
HashMatches the vendor's published hash or other hosts with the same buildUnique to this host
Parent and launchService manager (systemd, services.exe) or a known schedulerOffice apps, browsers, script hosts or a shell spawned by a web server
UserDedicated service account with least privilegeroot, SYSTEM or an interactive user for a network service that does not need it
PortDocumented port for that productCommon product name on an unusual high port (see ATT&CK T1571 Non-Standard Port)

Identify the owner and purpose

Once you know the software, find who is accountable for it.

  1. Query the CMDB for the host's owner, application service and support group. Many CMDBs record installed software and expected ports per application; compare.
  2. Search change records for recent installs or configuration changes on the host or the application.
  3. Check deployment sources: configuration management code, golden images, container manifests and software distribution logs show whether the listener was deployed deliberately.
  4. Ask the named owner to confirm the purpose, the clients that need to connect and whether the listener needs to be reachable beyond the host.
  5. Record the answer against the asset, including the expected port, bind address and binary, so the next finding resolves itself.

Common outcomes include a vendor agent that opened a management port, a developer tool or database left running on a server, a debugging or profiling endpoint enabled in production, a remote support tool and a forgotten pilot. Where no owner is found within an agreed period (for example two working days), escalate to the system owner's manager and treat the listener as unauthorised. See the Asset Inventory and CMDB Security Guide for keeping these records trustworthy.

Assess risk

Score the listener on a few factors rather than on the port number alone. Port numbers are conventions; what matters is what answers and who can reach it.

FactorLower riskHigher risk
ReachabilityLocalhost only, or a management network with filteringAll interfaces on an internet-facing or flat network
AuthenticationStrong authentication and encryption (for example mutual TLS or SSH keys)No authentication, default credentials or a shared static API key
PrivilegeDedicated low-privilege service accountroot or SYSTEM
Software stateSupported version, patchedEnd of life, unpatched or unknown version
FunctionRead-only status or metricsRemote administration, code execution, database or file transfer
ProvenanceSigned, package-owned, deployed by changeUnsigned, unknown origin, no change record

A listener that combines high-risk reachability with remote administration and no owner should be treated as a possible incident. Indicators such as an unknown binary, a deleted executable, unusual parent processes, or a service account credential found in its configuration all point the same way. The Network Ports and Protocols Security Guide lists ports that should never face the internet. Port knocking (ATT&CK T1205.001) can hide a listener until a trigger sequence arrives, so a host-side check is more reliable than an external scan alone.

Decide: keep, restrict or remove

SituationDecisionActions
Owned, needed, verified binary, appropriate exposureKeepRecord in the CMDB and the listener baseline; set a review date
Owned and needed, but wider exposure than necessaryRestrictBind to localhost or a specific interface; add host and network firewall rules limiting sources; require authentication and TLS
Owned, but not needed (feature enabled by default, finished pilot)RemoveDisable or uninstall the service through change management; confirm the port is closed
No owner after the agreed period, binary verified as legitimateRestrict, then removeBlock with the host firewall and notify; remove at the next change window if still unclaimed
Binary unverified or indicators of compromiseIncidentIsolate the host through EDR or network controls, preserve memory and disk evidence, follow the incident response plan; do not just kill the process

For changes, use the normal change process: test in a non-production environment where one exists, notify the owner, make the change in a window, verify with the same socket command and an external scan, and keep a rollback (the previous service configuration or firewall rule) ready. Where an application turns out to rely on the listener, roll back, then restrict instead of remove. See Host Firewall vs Network Firewall for where to enforce restrictions.

Prevent surprises

  • Baseline per role: keep an allow list of expected listeners per server role and image (port, protocol, bind address, binary path and signer). Build it from configuration management rather than from what is currently running.
  • Collect listener inventory: schedule the socket queries above through your endpoint management or EDR tooling, or an endpoint query agent, and compare against the baseline.
  • Windows audit events: enable the Audit Filtering Platform Connection subcategory (for example auditpol /set /subcategory:"Filtering Platform Connection" /success:enable). Event 5154 records each time the Windows Filtering Platform permits an application to listen, with process ID (in hexadecimal), application path, local address, port and protocol. Microsoft recommends alerting on listeners not on an allow list and on applications outside standard folders. The volume can be high, so filter to servers or forward selectively, and correlate with process creation event 4688.
  • External view: scan your own internet-facing ranges on a schedule and reconcile every open port with a CMDB record. See the Attack Surface Management Guide.
  • Default deny: host firewalls with inbound default deny on servers and endpoints mean a new listener is unreachable until someone opens it deliberately.
  • Remove unneeded services: build images with only required services enabled, in line with CIS Controls v8.1 Safeguard 4.8 (Uninstall or Disable Unnecessary Services on Enterprise Assets and Software) and NIST SP 800-53 CM-7 Least Functionality.
  • Credentials on listeners: services that accept connections often authenticate clients with API keys, tokens or service account passwords. Record those non-human credentials against the service owner so they are rotated or revoked when the listener is retired. See the NHI Ownership Guide.

Measuring it

MetricWhat it shows
Listeners not in the baseline, per weekDrift and control effectiveness
Median time from finding to decisionInvestigation speed
Share of listeners with a recorded ownerAsset record quality
Internet-reachable listeners without a CMDB recordHighest-risk exposure
Findings that became incidentsTrue positive rate and threat level

Framework mapping

ActivityNIST SP 800-53 Rev. 5NIST CSF 2.0ATT&CK / D3FEND
Inventory of services and ownersCM-8 System Component InventoryID.AM-01None mapped
Baseline of expected listenersCM-2 Baseline Configuration; CM-6 Configuration SettingsPR.PS-01D3-NTPM Network Traffic Policy Mapping
Disable unneeded servicesCM-7 Least FunctionalityPR.PS-01None mapped
Restrict exposureSC-7 Boundary ProtectionNone mappedNone mapped
Monitor for new listenersSI-4 System MonitoringDE.CM-01, DE.CM-09T1571 Non-Standard Port; T1205.001 Port Knocking; T1543 Create or Modify System Process

Practitioner checklist

  • Record the original finding: IP, port, protocol, time and scan source.
  • Confirm the listener and bind address on the host for both TCP and UDP.
  • Map the PID to the executable path, parent, user and service unit or Windows service.
  • Verify the binary by signature or package ownership and by hash.
  • Find the owner through the CMDB and change records and confirm the purpose.
  • Score the risk on reachability, authentication, privilege, software state, function and provenance.
  • Record a keep, restrict, remove or incident decision with a review date.
  • Add kept listeners to the per-role baseline and alert on anything outside it.
  • Enable Windows event 5154 auditing on servers and correlate with 4688.

Standards and references

Related NHI Mgmt Group resources: Network Ports and Protocols Security Guide · Asset Inventory and CMDB Security Guide · Host Firewall vs Network Firewall · Attack Surface Management Guide

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick both boxes to continue.