Skip to content

Application unable to retrieve redirect data after WFP Connect Redirect with nmap or wireshark. #363

@keithdg

Description

@keithdg

Application unable to retrieve redirect data after WFP Connect Redirect with nmap or wireshark.
The issue occurs when npcap is configured by nmap or wireshark data.

WFP Connect Redirect “SIO_QUERY_WFP_CONNECTION_REDIRECT_CONTEXT” fails to retrieve redirect data when using nmap or wireshark with npcap loopback

Steps to Reproduce using MS WFP Sampler

  1. Get a copy of Windows Driver Kit (WDK) 8.1 Samples
    https://code.msdn.microsoft.com/windowsapps/Windows-Driver-Kit-WDK-81-cf35e953/view/SourceCode

  2. Make sure the 8.1 DDK is installed on the machine

  3. Compile the Windows Filtering Platform Sample

  4. Create a program "testprogram.exe"
    a. Listens to 127.0.0.1:4443
    b. Upon connect accept
    status = WSAIoctl(originalSocket,
    SIO_QUERY_WFP_CONNECTION_REDIRECT_CONTEXT,
    0,
    0,
    (BYTE*)ppRedirectContext,
    REDIRECT_CONTEXT_SIZE,
    (LPDWORD)&redirectContextSize,
    0,
    0);
    if(status != NO_ERROR)
    {
    status = WSAGetLastError();
    print the "status
    }
    else
    {
    print the redirectContext data //you will see the IP address the browser attempts to go to.
    }

  5. Download nmap and make sure it is using npcap loopback driver

  6. On your test system install the WFP Sample driver following the steps in
    the "description.html" in the Windows Filtering Platform Sample directory.

  7. Start your testprogram.exe, get pid of the "testprogram.exe" from task manager.

  8. Configure the WFP Sampler to redirect to your Proxy Program.

    WFPSampler.Exe -s PROXY -l FWPM_LAYER_ALE_CONNECT_REDIRECT_V4 -p TCP -pra 127.0.0.1 -prp 4443 -v -plspid

  9. Run nmap -sV 3128 localhost

Open chrome browser and go to an address 10.10.10.1:520 for example

Expectation:
The testprogram should not receive and error and be able to retrieve redirectContext data.

Actual:
The testprogram receives an error that an invalid arguement error.

Note:
If you do net stop npcap the testprogram will retrieve the redirectContext with out error and the IP Address used in the browser will
be in the redirectContext data

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