-
Notifications
You must be signed in to change notification settings - Fork 544
NMap iflist returns WINDEVICE <None> for a Virtual Wireguard Interface #173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
So the only occurrences of "WireGuard" in the Diag Report are in:
Can you try to capture with TShark (tshark.exe should be in the same directory as Wireshark.exe), passing it the command-line argument What does the command |
I have the same problem, attached info.
|
The device in question appears in the DiagReport:
but does not appear in the ipconfig/all output. The Hyper-V virtual adapter appears in both:
and
|
Well I change the description in my code when setting up the device, so the device you are looking for is the one with in diag txt "NetConnectionID : AppGateSDP" - which matches the "Unknown adapter AppGateSDP" in ipconfig. Apart from that description change the setup code is the same that the normal Wireguard client uses. |
Yes. that's the entry I mentioned.
OK, so that's
So what's the difference between the two? |
Sorry don't follow - difference between the two what? |
The difference between the AppGate SDP VPN Tunnel/Wintun Userspace Tunnel device and the Hyper-V Virtual Ethernet Adapter device. If capturing on the latter doesn't work, there may not be a difference. If capturing on the latter does work, then the first one gets That means that either:
"Not exported" appears to happen only for FireWire devices, which the device almost certainly isn't. Perhaps there is no entry for it in the Registry, or the open attempt on it failed for some reason while constructing the list of devices? |
Ah. Capturing on the the Hyper-V Virtual Ethernet Adapter is fine, at least wireshark/tshark/etc finds and connects fine to it. Yeah, so maybe there is something funny going on in how the Wintun device gets registered / set up - that's more than I know - I only reuse the WG code for setting it up. |
These are the logs for testing directly with the official WireGuard client - I attached the WG profile I used as well (dummy keys ofc) - you could test this by yourself by just installing the WireGuard client and giving it that profile and activate it - there is no need for an actual WG server - the Wintun device gets set up anyway. You can find the WG client here: https://www.wireguard.com/install/ tshark.txt |
I have a similar issue on Windows 10. |
So I started to see if I could figure out something more and found the iflist example in the npcap source code - it also fails to list the Wintun Virtual NIC as expected, but together with a debug version of packet.lib/dll I could at least get out some more logs that might shed some more light for those more familiar with the inner workings of npcap. So the diagreport on this machine shows the Wintun NIC nic:
while the Packet.log shows this when it tries to grab hold of the device npcap path thing:
The adapter properties for the Wintun adapter does show the "Npcap Packet Driver (NPCAP)" and "Npcap Packet Driver (NPCAP) (Wi-Fi)" as enabled. Using npcap 0.9997 - and the debug build of packet.lib/dll built from latest git sources when running the iflist.exe |
Is there any easy way we can talk to the WireGuard people about this problem? They don't use GitHub issues, and the WireGuard mailing list doesn't look particularly hospitable. |
Hi, Wintun developer here. I noticed the same issue a few weeks ago actually. I assume that npcap only binds to ethernet interfaces and doesn't know about layer 3 interfaces on Windows. Wintun uses these specification in its inf:
I assume that npcap doesn't know about either Looking at npcap's inf, we see this:
This suggests that it's left out whatever is needed to match on Wintun. I don't know if |
Now when WinTun is a part of OpenVPN 2.5 installation this became much more important to support WinTun in npcap. |
This appears to be a npcap issue, rather than a Wintun one. |
I have another virtual adapter on the system with the below properties in the .inf: Characteristics = 0x1 ; NCF_VIRTUAL (0x1) ; NCF_NOT_USER_REMOVEABLE (0x20); NCF_HIDDEN (0x8); NCF_HAS_UI (0x80) Which is detected just fine. If the problem was with filtering of MediaType as you suggest above, I suppose it was excluded as well. So, IfType seems to be more relevant. |
NCF_VIRTUAL != IF_TYPE_PROP_VIRTUAL. That adapter is Ethernet+802.3, so of course it's covered by npcap. The issue with wintun concerns IF_TYPE_PROP_VIRTUAL+NdisMediumIP. |
@fghzxm It's actually a pretty hospitable place, so if you'd like to discuss there instead of here, that's fine too. Either way, I remain at your disposal for helping to fix this. |
@zx2c4 I have tried to join it twice through wintun site, didn't get any reply. |
I don't see anything from you, in the spam box or otherwise. |
@zx2c4 I had that same issue recently and you fixed it for me somehow so that i was subbed to the mailing list. I'm following this thread with interest as we use wintun as well |
Thanks folks. I was talking to @dmiller-nmap about this issue and he noted that Npcap currently doesn't bind to NdisMediumIP virtual adapters. We specifically check for a set of known values when a binding request comes in, and reject it if it's not known. NdisMediumIP is not in the list. So it is possible that all we need to do is add this to the list (or even remove the list checking). It may not really matter what the value is, since we don't create layer-2 headers within the driver anyway. As long as we can map the value to something that a user can understand via Packet.dll -> libpcap, we should probably allow the bind to continue. Of course, once we allow the binding, it's possible there's something we've overlooked and it ends up interfering with the connection. So we will probably make this new change for the next release and then hopefully you folks who have experienced the issue can test whether this resolves it. Or maybe we can test with Wireguard/Wintun ourselves. The next release will probably be sometime in May since we're currently in the middle of WHQL (Windows Hardware Qualification Labs) certification process which involves setting up a bunch of new hardware, virtual machines, testing, etc. We're hoping to make a new release after that. |
We don't really use these in the driver. Kernel Dump mode used to do so, but that's not supported. We have probably been missing adapters we could support otherwise, e.g. #173
I see npcap 1.31 was released, i see the commit was pushed but I don't quite know how to verify if this fix is in 1.31 or not.
I am happy to try to test this in some way. Is there a preferred mechanism you'd like to test? When I run:
I also tried to use a hostname which resolves for me that is assigned to this adapter:
If you can help me with the proper command to use to test - I'm happy to try it out |
@dovholuknf Thanks for offering to test. This change did not make it into 1.31, so we will have to wait for the next release to test it. |
Seems fixed now in latest :)
|
I dl'ed the 1.4 installer yesterday to test it out but it failed to install. I see it's no longer on the download page. I'll be happy to test it out once I can get my hands on it :) and now i see you filed #513 :) |
1.50 is out now at https://npcap.org and hopefully resolves the issue. Please let us know how it goes! -Gordon |
@fyodor Thanks for your work on this issue, and my apologies for my previous judgmental comment. However, it seems like with the newest version of npcap Wireshark does not correctly identify the packets inside Wintun as IP, instead decoding them as Ethernet. Is it a bug in npcap, Wireshark, or one related to the Wintun project? |
The current version of Npcap doesn't correctly identify NdisMediumIP, which is what the Wintun device provides as its link-layer type, as DLT_RAW, which is the pcap (libpcap, WinPcap, Npcap) way of saying "the packets begin with an IPv4 or IPv6 header... ...and that's the fault of the libpcap code, not of the Npcap code that's combined with the libpcap code to make Npcap, so please file a bug on the libpcap issues list, not on the Npcap issues list. Wireshark trusts pcap (libpcap/WinPcap/Npcap) to provide the right link-layer type, and libpcap defaults to DLT_EN10MB (meaning Ethernet - the "10MB" is a historical artifact, dating back to the days where there were the Xerox 3Mb experimental Ethernet and the DEC/Intel/Xerox 10Mb standard Ethernet, with all subsequent versions of Ethernet having the same link-layer header) for Windows link-layer types it doesn't understand, so it tells Wireshark that it's Ethernet. What Wireshark is doing wrong is not reporting the warning that Npcap is returning for that case, and thus not telling you that there's a bug that needs to be reported. That's a separate bug, which I'll work on. |
When encountering the NDIS medium type `NdisMediumIP`, treat the interface as an IP interface. Related to nmap/npcap#173. Signed-off-by: fghzxm <fghzxm@outlook.com>
@fghzxm's fix doesn't compile with VS 2015, probably because the Windows SDK that comes with VS 2015 is too old to have What's the oldest version of VS that can be used to build Npcap? If it's newer than VS 2015, I'll remove them from the AppVeyor CI builds and note that libpcap requires that version or later. |
I've checked that in, although, on most platforms, the capture mechanism providing an unknown link-layer type should probably be a fatal error. Linux is the only platform where it's not, because we can do the capture in "cooked mode" with a link type of DLT_LINUX_SLL as a workaround, so, for that, we can issue a warning (so the user knows they're not getting the link-layer header). |
@guyharris I'm not sure what the oldest VS that can be used to build Npcap is. We do use VS 2019 currently. Our primary intent is to be able to build it ourselves, so we don't have any particular requirement to support older build environments. Of course we want to make it easy for others to link with and use Npcap, but the intent is that they would use our builds under license. |
OK, I went with doing a check in CMake, so it should still build with pre-8.1 Windows SDKs, albeit without NdisMediumIP support. You can grab change 74be794fe7b3540999149f976e4a829289ad43ef from the main branch or ef0e7b15fe871d79e678a3482b0c5a02171dacfe from the libpcap-1.10 branch; we recently released 1.10.1, so it probably won't show up in a release soon. |
@dmiller-nmap any expectation setting you can do for when this might be able to incorporated and tested? I'm eager to be able to capture wintun traffic. :) I gave a shot at building locally but hit some compilation bumps and didn't end up getting it working. Thanks for pushing this issue along everyone ! |
The NDIS medium type NdisMediumIP transports raw IP packets. If we encounter such an interface, say it's DLT_RAW. Related to nmap/npcap#173. Signed-off-by: fghzxm <fghzxm@outlook.com>
The NDIS medium type NdisMediumIP transports raw IP packets. If we encounter such an interface, say it's DLT_RAW. Related to nmap/npcap#173. Signed-off-by: fghzxm <fghzxm@outlook.com> (cherry picked from commit c1a7c08)
Putting a comment here since searches about Wireshark + Wintun support eventually end up in this ticket - to get Wireshark working it needs to pull in the fixed npcap build (which it does now I think), but also an updated build of libpcap - which it pulls from vcpkg - and which does not have a recent build of libpcap at the moment. So if anyone want this to happen sooner than later, please make a PR to https://github.com/microsoft/vcpkg to update libpcap to 1.10 - I might try do it when I have caught up on 100 other things that have more prio - but that is likely to qualify as "later". |
Confirmed that wireshark 3.5.0rc0 includes npcap 1.5.0 and sees the wintun device. There is a popup message "Unknown NdisMedium value 19, defaulting to DLT_EN10MB", and it is trying to decode the IP header bytes as an Ethernet header. (from tailscale/tailscale#1660) I think we need the NdisMediumIP handling added in https://github.com/the-tcpdump-group/libpcap/blob/728f4339fac6bddb0350e69cb62a862b917ad3e3/pcap-npf.c#L1112 which should be included in libpcap 1.10.2, but 1.10.2 isn't quite out yet. |
Thanks everyone for commenting. We will be using the latest from the head of upstream's libpcap-1.10 branch to ensure this change is incorporated in the next release, even if libpcap 1.10.2 is not yet released. |
Hi @DentonGentry , @dmiller-nmap! Is there somewhere an unofficial build of WireShark built as you describe, that could be used in order to support Wintun, while waiting for official releases? |
A very easy workaround is to capture the packets with Wireshark, save them as normal pcap (not pcapng) file, and then change the pcap file header so it says the link format is Raw IP (0x65) and not Ethernet (0x01). Simple python script for this is:
|
Thank you @dmiller-nmap, looks good now when capturing from Wireshark |
Fixed in Npcap 1.55 release. |
The NDIS medium type NdisMediumIP transports raw IP packets. If we encounter such an interface, say it's DLT_RAW. Related to nmap/npcap#173. Signed-off-by: fghzxm <fghzxm@outlook.com>
Hello everyone,

I faced a problem regarding a missing/inaccessible adapter with Wireshark/Scapy created by Wireguard.
nmap --iflist returning:
eth0 is the Virtual Adapter from Wireguard. The adapter working correctly, but I am unable to sniff data with npcap/scapy/Wirteshark.
NMap -> 7.80
Scapy -> 2.4.3
Wireshark -> 3.2.4
Wireguard -> 0.1.0
NPcap -> 0.9991
Diag Report:
DiagReport-20200524-155041.txt
I tried mutliple releases and the bug is reproducable on a second device.
I would be really glad if you could help regarding this problem.
The text was updated successfully, but these errors were encountered: