Skip to content

memory leak when sending packets on Windows10 (since npcap v1.76) #688

@omgtehlion

Description

@omgtehlion

Describe the bug
Npcap leaks kernel memory when sending packets via pcap_sendqueue_transmit or PacketSendPackets.
Affected: v1.76 on windows 10.
v1.75 does not leak memory

To Reproduce
Steps to reproduce the behavior:

  1. install npcap v1.76
  2. compile and run Examples/sendcap/sendcap.c
  3. open TaskManager and see memory leaking
  4. memory not accounted to any user-mode process, nor to System
  5. leaked memory not reclaimed on either process restart, nor on driver stop/start/uninstall, only on full reboot

Expected behavior
Kernel memory should not leak when sending packets. npcap v1.75 works fine

Screenshots
image

Diagnostic information

         Operating System: Windows 10 Enterprise LTSC 64-bit (10.0, Build 19044) (19041.vb_release.191206-1406)

*************************************************
DiagReport for Npcap ( https://npcap.com )
*************************************************
Script Architecture:		64-bit
Script Path:			C:\Program Files\Npcap\DiagReport.ps1
Current Time:			08/10/2023 04:10:45
Npcap install path:		C:\Program Files\Npcap
Npcap Version:			1.76
PowerShell Version:		5.1.19041.3031


*************************************************
OS Info:
*************************************************


Caption                 : Microsoft Windows 10 Enterprise LTSC
BuildNumber             : 19044
Locale                  : 0419
MUILanguages            : {en-US}
OSArchitecture          : 64-bit
ServicePackMajorVersion : 0
ServicePackMinorVersion : 0
SystemDirectory         : C:\Windows\system32
Version                 : 10.0.19044





*************************************************
CPU Info:
*************************************************


Name                      : 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
Manufacturer              : GenuineIntel
DeviceID                  : CPU0
NumberOfCores             : 4
NumberOfEnabledCore       : 4
NumberOfLogicalProcessors : 4
Addresswidth              : 64





*************************************************
Memory Info:
*************************************************
Size:				32487 MB (34065145856 Bytes)


*************************************************
Network Adapter(s) Info:
*************************************************


Caption             : [00000001] Intel(R) Wi-Fi 6 AX201 160MHz
GUID                : {AE2D673E-9EF1-4B1D-B276-2ED4AE72394B}
Index               : 1
InterfaceIndex      : 22
Manufacturer        : Intel Corporation
MACAddress          : 10:3D:1C:EA:67:AD
Speed               : 554850000
NetConnectionID     : Wi-Fi
NetConnectionStatus : 2
PNPDeviceID         : PCI\VEN_8086&DEV_A0F0&SUBSYS_00708086&REV_20\3&11583659&0&A3
ServiceName         : Netwtw10
AdapterType         : Ethernet 802.3

Caption             : [00000002] WireGuard Tunnel
GUID                : {6B77769F-3847-E57D-409A-3E6CEC8DC1AB}
Index               : 2
InterfaceIndex      : 52
Manufacturer        : WireGuard LLC
MACAddress          : 
Speed               : 100000000000
NetConnectionID     : <censored>
NetConnectionStatus : 2
PNPDeviceID         : SWD\WIREGUARD\{6B77769F-3847-E57D-409A-3E6CEC8DC1AB}
ServiceName         : WireGuard
AdapterType         : 

Caption             : [00000012] WireGuard Tunnel
GUID                : {A92A1B10-8C8A-CC60-2B60-2C18E53913B1}
Index               : 12
InterfaceIndex      : 56
Manufacturer        : WireGuard LLC
MACAddress          : 
Speed               : 100000000000
NetConnectionID     : <censored>
NetConnectionStatus : 2
PNPDeviceID         : SWD\WIREGUARD\{A92A1B10-8C8A-CC60-2B60-2C18E53913B1}
ServiceName         : WireGuard
AdapterType         : 

Caption             : [00000015] TAP-Windows Adapter V9
GUID                : {53D23F9F-AA98-4B3D-9AE1-250AA36B157D}
Index               : 15
InterfaceIndex      : 14
Manufacturer        : TAP-Windows Provider V9
MACAddress          : 00:FF:53:D2:3F:9F
Speed               : 1000000000
NetConnectionID     : OpenVPN TAP-Windows6
NetConnectionStatus : 7
PNPDeviceID         : ROOT\NET\0001
ServiceName         : tap0901
AdapterType         : Ethernet 802.3

Caption             : [00000018] ASIX AX88179 USB 3.0 to Gigabit Ethernet Adapter
GUID                : {3110282B-2252-430D-8BF0-BB19AB8945D0}
Index               : 18
InterfaceIndex      : 13
Manufacturer        : ASIX
MACAddress          : F0:1E:34:11:AB:30
Speed               : 1000000000
NetConnectionID     : Ethernet 6
NetConnectionStatus : 2
PNPDeviceID         : USB\VID_0B95&PID_1790\000000000000?A
ServiceName         : AX88179
AdapterType         : Ethernet 802.3

Caption             : [00000020] VirtualBox Host-Only Ethernet Adapter
GUID                : {0E92C1C8-52B0-45BC-AFC6-2F316E1944AC}
Index               : 20
InterfaceIndex      : 6
Manufacturer        : Oracle Corporation
MACAddress          : 0A:00:27:00:00:06
Speed               : 1000000000
NetConnectionID     : VirtualBox Host-Only Network
NetConnectionStatus : 2
PNPDeviceID         : ROOT\NET\0002
ServiceName         : VBoxNetAdp
AdapterType         : Ethernet 802.3





*************************************************
NDIS Light-Weight Filter (LWF) Info:
*************************************************
HKLM:\SYSTEM\CurrentControlSet\Control\Network\{4d36e974-e325-11ce-bfc1-08002be10318}\*:


InstallTimeStamp : {221, 7, 12, 0...}
Characteristics  : 262144
ComponentId      : ms_bridge
Description      : @%SystemRoot%\system32\bridgeres.dll,-2
InfPath          : netbrdg.inf
InfSection       : Install
LocDescription   : @%SystemRoot%\system32\bridgeres.dll,-2

InstallTimeStamp : {221, 7, 12, 0...}
Characteristics  : 262184
ComponentId      : ms_wfplwf_lower
Description      : @%windir%\System32\drivers\wfplwfs.sys,-6006
InfPath          : wfplwfs.inf
InfSection       : WfpLwf_Lower_Install
LocDescription   : @%windir%\System32\drivers\wfplwfs.sys,-6006

InstallTimeStamp : {221, 7, 12, 0...}
Characteristics  : 40
ComponentId      : ms_netbios
Description      : @%windir%\system32\drivers\netbios.sys,-501
InfPath          : netnb.inf
InfSection       : NetBIOS.ndi
LocDescription   : @%windir%\system32\drivers\netbios.sys,-501

InstallTimeStamp : {221, 7, 12, 0...}
Characteristics  : 262200
ComponentId      : ms_ndiscap
Description      : @%windir%\System32\drivers\ndiscap.sys,-5000
InfPath          : ndiscap.inf
InfSection       : Install
LocDescription   : @%windir%\System32\drivers\ndiscap.sys,-5000

InstallTimeStamp : {221, 7, 12, 0...}
ComponentId      : ms_server
Description      : @%systemroot%\system32\srvsvc.dll,-109
InfPath          : Netserv.inf
InfSection       : Install.ndi
LocDescription   : @%systemroot%\system32\srvsvc.dll,-109

InstallTimeStamp : {221, 7, 12, 0...}
Characteristics  : 262184
ComponentId      : ms_vwifi
Description      : @%windir%\System32\drivers\vwififlt.sys,-105
InfPath          : netvwififlt.inf
InfSection       : Install
LocDescription   : @%windir%\System32\drivers\vwififlt.sys,-105

InstallTimeStamp : {230, 7, 5, 0...}
Characteristics  : 262144
ComponentId      : oracle_VBoxNetLwf
Description      : @oem102.inf,%vboxnetlwf_desc%;VirtualBox NDIS6 Bridged Networking Driver
InfPath          : oem102.inf
InfSection       : VBoxNetLwf.ndi
LocDescription   : @oem102.inf,%vboxnetlwf_desc%;VirtualBox NDIS6 Bridged Networking Driver

InstallTimeStamp : {231, 7, 8, 0...}
Characteristics  : 262144
ComponentId      : INSECURE_NPCAP
Description      : @oem107.inf,%npf_desc_standard%;Npcap Packet Driver (NPCAP)
InfPath          : oem107.inf
InfSection       : FilterStandard
LocDescription   : @oem107.inf,%npf_desc_standard%;Npcap Packet Driver (NPCAP)

InstallTimeStamp : {221, 7, 12, 0...}
Characteristics  : 262144
ComponentId      : ms_pacer
Description      : @%windir%\System32\drivers\pacer.sys,-101
InfPath          : netpacer.inf
InfSection       : Install
LocDescription   : @%windir%\System32\drivers\pacer.sys,-101

InstallTimeStamp : {221, 7, 12, 0...}
Characteristics  : 262184
ComponentId      : ms_wfplwf_upper
Description      : @%windir%\System32\drivers\wfplwfs.sys,-6005
InfPath          : wfplwfs.inf
InfSection       : WfpLwf_Upper_Install
LocDescription   : @%windir%\System32\drivers\wfplwfs.sys,-6005

InstallTimeStamp : {221, 7, 12, 0...}
Characteristics  : 262184
ComponentId      : ms_nativewifip
Description      : @%windir%\System32\drivers\nwifi.sys,-101
InfPath          : netnwifi.inf
InfSection       : MS_NWIFI.Install
LocDescription   : @%windir%\System32\drivers\nwifi.sys,-101

InstallTimeStamp : {221, 7, 12, 0...}
Characteristics  : 262144
ComponentId      : ms_wfplwf_vswitch
Description      : @%windir%\System32\drivers\wfplwfs.sys,-6004
InfPath          : wfplwfs.inf
InfSection       : WfpLwf_vSwitch_Install
LocDescription   : @%windir%\System32\drivers\wfplwfs.sys,-6004




Name                           DisplayName                                        ComponentID          Enabled     
----                           -----------                                        -----------          -------     
Wi-Fi                          Npcap Packet Driver (NPCAP)                        INSECURE_NPCAP       True        
<censored>                  Npcap Packet Driver (NPCAP)                        INSECURE_NPCAP       True        
<censored>                    Npcap Packet Driver (NPCAP)                        INSECURE_NPCAP       True        
OpenVPN TAP-Windows6           Npcap Packet Driver (NPCAP)                        INSECURE_NPCAP       True        
Ethernet 6                     Npcap Packet Driver (NPCAP)                        INSECURE_NPCAP       True        
VirtualBox Host-Only Network   Npcap Packet Driver (NPCAP)                        INSECURE_NPCAP       True        


*************************************************
File Info:
*************************************************

LastWriteTime : 11/22/2022 10:25:50 PM
Length        : 815
Name          : CheckStatus.bat


LastWriteTime : 8/10/2023 4:10:45 AM
Length        : 0
Name          : DiagReport-20230810-041045.txt


LastWriteTime : 11/22/2022 10:25:50 PM
Length        : 1073
Name          : DiagReport.bat


LastWriteTime : 11/22/2022 10:25:50 PM
Length        : 18078
Name          : DiagReport.ps1


LastWriteTime : 11/22/2022 10:25:50 PM
Length        : 2513
Name          : FixInstall.bat


LastWriteTime : 8/10/2023 4:06:43 AM
Length        : 58514
Name          : install.log


LastWriteTime : 7/18/2023 8:08:52 PM
Length        : 11784
Name          : LICENSE


LastWriteTime : 7/19/2023 7:42:12 PM
Length        : 12676
Name          : npcap.cat


LastWriteTime : 7/19/2023 7:42:12 PM
Length        : 9002
Name          : npcap.inf


LastWriteTime : 7/19/2023 7:42:12 PM
Length        : 77736
Name          : npcap.sys


LastWriteTime : 7/19/2023 7:42:12 PM
Length        : 2435
Name          : npcap_wfp.inf


LastWriteTime : 7/19/2023 7:03:24 PM
Length        : 308096
Name          : NPFInstall.exe


LastWriteTime : 8/10/2023 4:05:10 AM
Length        : 322026
Name          : NPFInstall.log


LastWriteTime : 7/19/2023 7:44:04 PM
Length        : 1081032
Name          : Uninstall.exe


Path          : C:\Program Files\Npcap\npcap.cat
Status        : Valid
StatusMessage : Signature verified.
Thumbprint    : FAC666005546D6BE881A31C1267717879401A950


Path          : C:\Program Files\Npcap\npcap.inf
Status        : Valid
StatusMessage : Signature verified.
Thumbprint    : FAC666005546D6BE881A31C1267717879401A950


Path          : C:\Program Files\Npcap\npcap.sys
Status        : Valid
StatusMessage : Signature verified.
Thumbprint    : FAC666005546D6BE881A31C1267717879401A950


Path          : C:\Program Files\Npcap\NPFInstall.exe
Status        : Valid
StatusMessage : Signature verified.
Thumbprint    : 7EB563C57DEB8DA3166A35F265BAB1A1C0A088D2


Path          : C:\Program Files\Npcap\Uninstall.exe
Status        : Valid
StatusMessage : Signature verified.
Thumbprint    : 7EB563C57DEB8DA3166A35F265BAB1A1C0A088D2


LastWriteTime : 7/19/2023 7:03:30 PM
Length        : 156544
Name          : NpcapHelper.exe


LastWriteTime : 7/19/2023 7:03:22 PM
Length        : 220032
Name          : Packet.dll


LastWriteTime : 7/19/2023 7:03:32 PM
Length        : 266624
Name          : WlanHelper.exe


LastWriteTime : 7/19/2023 7:03:26 PM
Length        : 491392
Name          : wpcap.dll


LastWriteTime : 7/19/2023 7:03:30 PM
Length        : 156544
Name          : NpcapHelper.exe


LastWriteTime : 7/19/2023 7:03:22 PM
Length        : 220032
Name          : Packet.dll


LastWriteTime : 7/19/2023 7:03:32 PM
Length        : 266624
Name          : WlanHelper.exe


LastWriteTime : 7/19/2023 7:03:26 PM
Length        : 491392
Name          : wpcap.dll


LastWriteTime : 7/19/2023 7:03:14 PM
Length        : 129920
Name          : NpcapHelper.exe


LastWriteTime : 7/19/2023 7:03:06 PM
Length        : 174464
Name          : Packet.dll


LastWriteTime : 7/19/2023 7:03:16 PM
Length        : 216448
Name          : WlanHelper.exe


LastWriteTime : 7/19/2023 7:03:12 PM
Length        : 420224
Name          : wpcap.dll


LastWriteTime : 7/19/2023 7:03:14 PM
Length        : 129920
Name          : NpcapHelper.exe


LastWriteTime : 7/19/2023 7:03:06 PM
Length        : 174464
Name          : Packet.dll


LastWriteTime : 7/19/2023 7:03:16 PM
Length        : 216448
Name          : WlanHelper.exe


LastWriteTime : 7/19/2023 7:03:12 PM
Length        : 420224
Name          : wpcap.dll



*************************************************
WinPcap Info:
*************************************************
HKLM:\SOFTWARE\WOW6432Node\WinPcap:
Not present.


*************************************************
Registry Info:
*************************************************
HKLM:\SOFTWARE\WOW6432Node\Npcap:


AdminOnly         : 0
WinPcapCompatible : 1
(default)         : C:\Program Files\Npcap



HKLM:\SYSTEM\CurrentControlSet\Services\npcap:


Type               : 1
Start              : 1
ErrorControl       : 1
Tag                : 38
ImagePath          : \SystemRoot\system32\DRIVERS\npcap.sys
DisplayName        : @oem107.inf,%NPF_Desc_Standard%;Npcap Packet Driver (NPCAP)
Group              : NDIS
Description        : @oem107.inf,%NPF_Desc_Standard%;Npcap Packet Driver (NPCAP)
NdisMajorVersion   : 6
NdisMinorVersion   : 50
DriverMajorVersion : 1
DriverMinorVersion : 76



HKLM:\SYSTEM\CurrentControlSet\Services\npcap\Parameters:


LoopbackSupport              : 1
DltNull                      : 1
Edition                      : Npcap
AdminOnly                    : 0
Dot11Support                 : 0
NdisImPlatformBindingOptions : 2
DefaultFilterSettings        : 1
VlanSupport                  : 0
WinPcapCompatible            : 1



HKLM:\SYSTEM\CurrentControlSet\Services\npcap_wifi:


Start        : 4



HKLM:\SYSTEM\CurrentControlSet\Services\npf:
Not present.
HKLM:\SYSTEM\CurrentControlSet\Services\npf\Parameters:
Not present.
HKLM:\SYSTEM\CurrentControlSet\Services\npf_wifi:
Not present.


*************************************************
Service Info:
*************************************************

Status      : Running
Name        : npcap
DisplayName : Npcap Packet Driver (NPCAP)

Get-Service : Cannot find any service with service name 'npf'.
At C:\Program Files\Npcap\DiagReport.ps1:214 char:1
+ Get-Service npf
+ ~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (npf:String) [Get-Service], ServiceCommandException
    + FullyQualifiedErrorId : NoServiceFoundForGivenName,Microsoft.PowerShell.Commands.GetServiceCommand
 


*************************************************
Install Info:
*************************************************
Please refer to: C:\Program Files\Npcap\install.log

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions