Q5-Deauth after assoc request

  • In this section, you are going to learn

  • How to send de-authentication packet on reception of association request packet from STA

#

Version

Ubuntu

Ubuntu 22.04 64 bit

Linux Kernel

6.9.2

Hostapd

hostapd 2.10

  • Send de-authentication packet on reception of authentication request packet from STA

  • Add a configuration parameter called “deauth_on_assoc_request_rx” in hostapd conf file

  • If “deauth_on_assoc_request_rx=0”, then this feature is disabled

  • If “deauth_on_assoc_request_rx=1”, then this feature is enabled

  • Call flow send de-authentication packet on reception of authentication request packet from STA

nl80211_global_init ()
   wpa_driver_nl80211_init_nl_global ()
      i802_init ()
	 wpa_driver_nl80211_drv_init ()
	    nl80211_init_bss ()
	       send_and_recv_msgs_connect_handle ()
		  process_global_event ()
		     do_process_drv_event ()
			 mlme_event ()
			    mlme_event_mgmt_tx_status ()        
			       wpa_supplicant_event ()                                                                  
				  process_bss_event () 
				     mlme_event () 
					mlme_event_mgmt ()     
					   wpa_supplicant_event ()
					       hostapd_mgmt_rx ()
						 ieee802_11_mgmt ()
						    handle_assoc ()
						       hostapd_drv_sta_deauth ()

  • Download the below patch file

send_deauth_after_assoc_req.patch

test:~$ pwd
/home/test
  • Make sure internet is available in laptop to download hostapd package

test:~$ sudo wget http://w1.fi/releases/hostapd-2.10.tar.gz
  • Create a directory

test:~$ mkdir hostapd
  • Change directory to hostapd

test:~$ cd hostapd
  • Note : Your present working directory should be hostapd

test:~$ pwd
/home/test/hostapd/
  • Extract hostapd

test:~$ sudo tar -xvf ~/hostapd-2.10.tar.gz
  • Run the below command to apply patch

test:~$ patch -p1 < send_deauth_after_assoc_req.patch
patching file hostapd-2.10/hostapd/config_file.c
patching file hostapd-2.10/src/ap/ap_config.h
patching file hostapd-2.10/src/ap/ieee802_11.c
  • Change directory to hostapd

test:~$ cd hostapd-2.10/hostapd/
  • Check the current working directory using pwd command

  • Make sure your current working directory is hostapd

test:~$ pwd
/home/test/hostapd/hostapd-2.10/hostapd/
  • Copy the contents of defconfig file to .config file

test:~$ sudo cp defconfig .config
  • Compile hostapd

test:~$ sudo make
  • Create run_hostapd.conf

test:~$ sudo vim ./run_hostapd.conf

ctrl_interface=/run/hostapd
interface=wlan0
driver=nl80211
ssid=test_open
hw_mode=g
channel=6
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
deauth_on_assoc_request_rx=1
  • Run hostapd

test:~$ sudo ./hostapd ./run_hostapd.conf
  • Download file to check wireshark output

deauth_after_assoc_req.pcapng

  • Check for de-authentication packet

  • Check packet No.112 and 113

  • Observe 112 is association request packet and 113 is deauthentication packet

Diagram