nmap / nmap/npcap

PcapOpenAdapter() appears to return ERROR_BAD_UNIT, not ERROR_ACCESS_DENIED, if the user says "No" to the UAC prompt

Open
#587 1 comment 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

If the fix for issue #586 is applied to libpcap, so that pcap_create() doesn't fail if the user says "No" to the UAC prompt if Administrator privileges are required, the call to PcapOpenAdapter() in pcap_activate() appears to fail with ERROR_BAD_UNIT, which it interprets as "No such device", rather than with ERROR_ACCESS_DENIED, which it would interpret as "that device exists but you don't have permission to capture on it".

This, for example, causes tcpdump to report

tcpdump: \Device\NPF_{9080DB6C-2C39-480B-895F-49715A318BA0}: No such device exists

rather than reporting

tcpdump: \Device\NPF_{9080DB6C-2C39-480B-895F-49715A318BA0}: You don't have permission to capture on that device

which is more accurate.

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 in libpcap at pcap_activate() and the PcapOpenAdapter() call described in the issue, then review issue #586 for the related UAC behavior. Reproduce the declined UAC case and trace the returned error; done means the failure is interpreted as ERROR_ACCESS_DENIED so tcpdump reports a permissions error rather than "No such device exists."

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.