nmap / nmap/npcap

Npcap installer terminates processes using DLLs which are not part of Npcap install

Open
#551 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
3.6k
Forks
592
PR merge metrics
No merged PRs in 30d

Description

NPFInstall.exe is used by the Npcap installer to terminate processes which are using Npcap DLLs so that those DLLs can be replaced. We currently do this by using EnumProcessModulesEx and comparing the filename to "wpcap.dll" and "packet.dll" and further restricting to those with "Npcap" or "WinPcap" in the product name. This has a few problems:

  1. It kills processes using WinPcap even if we're not installing in WinPcap-compatible mode (though that is the default now)
  2. It kills processes that may be using their own copies of the DLLs. Those programs will likely have problems anyway because of possible incompatibilities, especially between Packet.dll and the driver.
  3. It kills processes that may have our DLLs loaded but no capture handles open. This may not be necessary if we can replace those DLLs while the processes are running. We attempt to do that with a rename-replace-delete sequence, but I don't think we've tested that. And the processes would probably need to restart anyway to get our new DLLs, so this may be moot.

We need to investigate solutions. One idea is not attempting to kill these processes unless they are likely to have a handle open to a driver we intend to replace. We already rename existing DLLs if they cannot be deleted, so we may be able to do the upgrade without impacting them. Downside: running processes will be using old copy of the DLLs and will have to restart to get the new ones. Also, we still need a way to find out if any processes are holding handles open. Newer Npcap can be queried for this info, but older installs and WinPcap we have to rely on the DLL thing.

Another compatible change might be to avoid checking for such processes until after we've attempted to stop the driver. This would prevent new processes from obtaining handles, and would allow us to skip the check altogether if the driver successfully stops (presuming that our rename-replace method actually works), unless we decide that we need to kill processes using our DLLs for continuity purposes (ensuring they load the new ones instead).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing NPFInstall.exe and its EnumProcessModulesEx-based DLL checks, then examine the existing rename-replace-delete sequence and driver-stop flow. Investigate when processes actually need termination and how older Npcap or WinPcap installations can be handled. Done means defining and validating an installer path that avoids terminating unrelated processes while still replacing the required DLLs and drivers.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
networking, operating-systems
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.