Analysis of WiFi Interaction Process

1.802.11 Standard Introduction

The 802.11 standard divides all packets into three types:

1. Data: The role of data packets is to carry higher-level data (such as IP packets, ISO7 layer protocol).

    It is responsible for transferring data between workstations

2. Management: Manage the management functions of the packet control network

    1) Beacon frame (Beacons): In wireless devices, regular wireless signals (similar to heartbeat packets) are regularly sent at specified intervals, mainly used for positioning and synchronization.

    2) Deauthentication packet

    3) Probe(request and response)

    4) Authenticate(request and response)

    5) Associate(request and response)

    6) Reassociate(request and response)

    7) Dissassociate(notify)

    Management frames are responsible for supervision and are mainly used to join or leave a wireless network and to handle the transfer of connections between access points

3. Control: Control packets get their name from the term "Media Access Control (MAC)" and are used to control access to shared media (ie, physical media, such as fiber optic cables).

    1) Request To Send (RTS) packet

    2) Clear To Send (CTS) packets

    3) ACK confirmation (RTS/CTS)  

    4) PS-Poll: When a mobile station wakes up from power saving mode, it will send a PS-Poll frame to the base station to obtain any temporary frame

The control frame is usually used in conjunction with the data frame, which is responsible for the clearing of the area, the acquisition of the channel and the maintenance of the carrier sense, and a positive response is given when the data is received, thereby promoting the reliability of data transmission between workstations

These different classes of packets are collectively referred to as "packet types".

Two types of 802.11 services:

1. Site service SS (a service that every STA must have)

    1) Authentication

    2) Deauthentication

    3) Encryption (Privacy)

    4) MSDU delivery

2. Distributed system service DSS (DS-specific service)

    1) Association

    2) Deassociation

    3) Distribution

    4) Integration

    5) Re-association (Ressociation)

2.802.11 protocol format

Management Frame Protocol Format

(Beacon frame)

(Probe Request frame)

(Probe Response frame)

(ATIM frame)

(Disassociation and Deauthentication frames)

(Association Request frame)

(Reassociation Request frame)

(Authentication frame)

1. 帧控制结构(Frame Control)
    1) Protocol Version: (协议版本)通常为0
    2) Type: 帧类型,管理帧: 00 
    3) Subtype: 进一步判断帧的子类型 
        3.1) Beacon(信标)帧
        3.2) Probe Request(探测请求)帧
        3.3) Probe Response(探测响应)帧
        3.4) ATIM帧
        3.5) Disassociation(解除关联)
        3.6) Deauthentication(解除认证)帧
        3.7) Association Request(关联请求)帧
        3.8) Reassociation Request(重新关联请求)帧
        3.9) Authentication(身份认证)帧
    4) To DS: 表明该帧是否是BSS向DS发送的帧 
    5) From DS: 表明该帧是否是DS向BSS发送的帧 
    6) More Fragment: 用于说明长帧被分段的情况,是否还有其它的帧,如果有则该值设置为1
    7) Retry(重传域): 表示该分段是先前传输分段的重发帧。 
    8) Power Management: 表示传输帧以后,站所采用的电源管理模式
        8.1) 为1: STA处于power_save模式
        8.2) 为0: STA处于active模式
    9) More Data: 表示有很多帧缓存到站中。即至少还有一个数据帧要发送给STA是设置为1。 
    10) Protected Frame: 表示根据WEP(Wired Equivalent Privacy)算法对帧主体进行加密。如果帧体部分包含被密钥套处理过的数据,则设置为1,否则设置为0 
    11) Order(序号域): 在长帧分段传送时,该域设置为1表示接受者应该严格按照顺序处理该帧,否则设置为0
2. Duration/ID(持续时间/标识)
表明该帧和它的确认帧将会占用信道多长时间,Duration 值用于网络分配向量(NAV)计算 
3. Address Fields(地址域): 
    1) Destination Address
    2) Source Address
    3) BSS ID 
4. Sequence Control(序列控制域): 用于过滤重复帧
    1) MSDU(MAC Server Data Unit), 12位序列号(Sequence Number)
    2) MMSDU(MAC Management Server Data Unit), 4位片段号(Fragment Number)组成 
5. Frame Body(Data): 发送或接收的信息。对于不同类型的数据帧来说,这个域的格式差别较大
    1) Beacon(信标)帧
        1.1) Timestamp(时戳)位: 可用来同步 BSS 中的工作站 BSS 的主计时器会定期发送目前已作用的微秒数。当计数器到达最大值时,便会从头开始计数
        1.2) Beacon interval位: AP点每隔一段时间就会发出的Beacon(信标)信号,用来宣布 802.11网络的存在。我们打开无线连接的时候之所以能看到很多Wi-Fi点就是因为它
        1.3) Capability information位: 发送Beacon信号的时候,它被用来通知各方,该网络具备哪种性能
        1.4) SSID服务集标识(Service Set Identity): 由字节所形成的字串,用来标示所属网络的BSSID,即我们在Wi-Fi连接前看到的接入点名称
        1.5) 跳频参数组合(PH Parameter Set): 包含了加入 802.11跳频(frequency-hopping)网络所需要的参数
        1.6) 直接序列参数集合(DS Parameter Set): 指明网络所使用的信道数
        1.7) 免竞争参数集合(CF Parameter Set): 出现在支持免竞争接入点所发送的 Beacon帧中,并非必须
        1.8) IBSS 参数集合(IBSS Parameter Set): 指明ATIM window (数据待传指示通知信息间隔期间)
        1.9) TIM数据待传信息(Traffic Indication Map): 指示有哪些工作站需要接收待传数据
        1.10) Country: 国家识别码
        1.11) 功率限制(Power Constraint): 让网络得以向工作站传达其所允许的最大传输功率
        1.12) 信道切换宣告(Channel Switch Announcement): 为了警告网络中的工作站即将变换信道
        1.13) 禁声(Quiet): 为了避免与特定的军事雷达技术彼此干扰
        1.14) 发射功率控制报告(TPC Report): 指明链路的衰减情况,可以帮助工作站了解该如何调整传输功率
        1.15) 扩展物理层(ERP)
        1.16) 支持速率(Supported Rates): 无线局域网络支持数种标准速率。当移动工作站试图加入网络,会先检视该网络所使用的数据速率。有些速率是强制性的,每部工作站都必须支持
     ,有些则是选择性的
        1.17) RSN强健安全网络(Robust Security Network)
    2) Probe Request(探测请求)帧
        2.1) SSID服务集标识(Service Set Identity): 由字节所形成的字串,用来标示所属网络的BSSID,即我们在Wi-Fi连接前看到的接入点名称
        2.2) Supported Rate(支持速率)
        2.3) 扩展支持速率(Extended Supported Rate)
    3) Probe Response(探测响应)帧
        3.1) Timestamp(时戳)位: 可用来同步 BSS 中的工作站 BSS 的主计时器会定期发送目前已作用的微秒数。当计数器到达最大值时,便会从头开始计数
        3.2) Beacon interval位: AP点每隔一段时间就会发出的Beacon(信标)信号,用来宣布 802.11网络的存在。我们打开无线连接的时候之所以能看到很多Wi-Fi点就是因为它
        3.3) Capability information位: 发送Beacon信号的时候,它被用来通知各方,该网络具备哪种性能
        3.4) SSID服务集标识(Service Set Identity): 由字节所形成的字串,用来标示所属网络的BSSID,即我们在Wi-Fi连接前看到的接入点名称
        3.5) 支持速率(Supported Rates): 无线局域网络支持数种标准速率。当移动工作站试图加入网络,会先检视该网络所使用的数据速率 
        3.6) 跳频参数组合(PH Parameter Set): 包含了加入 802.11跳频(frequency-hopping)网络所需要的参数
        3.7) 直接序列参数集合(DS Parameter Set): 指明网络所使用的信道数
        3.8) 免竞争参数集合(CF Parameter Set): 出现在支持免竞争接入点所发送的 Beacon帧中,并非必须
        3.9) IBSS 参数集合(IBSS Parameter Set): 指明ATIM window (数据待传指示通知信息间隔期间)
        3.10) Country: 国家识别码
        3.11) FH Hopping Parameters
        3.12) FH Pattern Table
        3.13) 功率限制(Power Constraint): 让网络得以向工作站传达其所允许的最大传输功率
        3.13) 信道切换宣告(Channel Switch Announcement): 为了警告网络中的工作站即将变换信道
        3.14) 禁声(Quiet): 为了避免与特定的军事雷达技术彼此干扰
        3.15) IBSS 动态选项(IBSS DFS):在 IBSS 中负责动态选频的工作站可以在管理帧中传递 IBSS DFS 信息元素
        3.16) 发射功率控制报告(TPC Report): 指明链路的衰减情况,可以帮助工作站了解该如何调整传输功率
        3.17) 扩展物理层(ERP)
        3.18) 扩展支持速率(Extended Supported Rate) 
        3.19) RSN强健安全网络(Robust Security Network)
    4) ATIM帧
    5) Disassociation(解除关联)
        5.1) Beacon Code
    6) Deauthentication(解除认证)帧
        6.1) Beacon Code
    7) Association Request(关联请求)帧
        7.1) Capability information位: 发送Beacon信号的时候,它被用来通知各方,该网络具备哪种性能
        7.2) Listen interval位: 为了节省电池的电力,工作站可以暂时关闭 802.11网络接口的天线。当工作站处于休眠状态,接入点必须为之暂存帧
        7.3) SSID服务集标识(Service Set Identity): 由字节所形成的字串,用来标示所属网络的BSSID,即我们在Wi-Fi连接前看到的接入点名称
        7.4) Supported Rate(支持速率)
    8) Reassociation Request(重新关联请求)帧
        8.1) Capability information位: 发送Beacon信号的时候,它被用来通知各方,该网络具备哪种性能
        8.2) Listen interval位: 为了节省电池的电力,工作站可以暂时关闭 802.11网络接口的天线。当工作站处于休眠状态,接入点必须为之暂存帧
        8.3) Current AP Address位: 使用Current AP Address(目前接入点的地址)位来表明目前所连接的接入点的 MAC地址
        8.4) SSID服务集标识(Service Set Identity): 由字节所形成的字串,用来标示所属网络的BSSID,即我们在Wi-Fi连接前看到的接入点名称
        8.5) Supported Rate(支持速率)
    9) Authentication(身份认证)帧
        9.1) Authentication Algorithm Number: 指明认证程序所使用的认证类型
        9.2) Authentication Transaction Sequence Number: 用以追踪身份认证的进度
        9.3) Status Code: 状态代码用来表示某项过程成功或失败
        9.4) 质询口令(Challenge Text): 802.11所定义的共享密钥身份认证系统。会要求移动工作站必须成功解码一段加密过的质询口令。这段质询口令的发送系通过 Challenge Text
    (质询口令)信息元素
6. FCS(CRC): 包括32位的循环冗余校验(CRC),用于检错,注意是检错不是纠错 

Data Frame Protocol Format

The form of the data frame depends on the form of the network. Exactly which type a frame belongs to depends entirely on the subtype bit, regardless of whether other bits appear in the frame.

(a type of IBSS data frame)

(The frame sent by the access point (From AP), a type of data frame)

(frame sent to access point (To AP), a type of data frame)

(WDS frame, a type of data frame)

1. 帧控制结构(Frame Control)
    1) Protocol Version: (协议版本)通常为0
    2) Type: 帧类型,数据帧: 10 
    3) Subtype: 进一步判断帧的子类型,不同类型的数据帧这个字段的格式是不同的
        3.1) IBSS帧
            3.1.1) 0000: Data
            3.1.2) 0010: Null
        3.2) From AP帧
            3.2.1) 0000: Data
            3.2.2) 1000: Data+CF+ASK
            3.2.3) 0100: Data+CF+Poll
            3.2.4) 1100: Data+CF+ACK+CF+Poll
            3.2.5) 1010: CF+ACK
            3.2.6) 0110: CF+Poll
            3.2.7) 1110: ACK+CF+Poll 
        3.3) To AP帧
            3.3.1) 0000: Data
            3.3.2) 1000: Data+CF+ACK
            3.3.3) 0010: Null
            3.3.4) 1010: CF+ACK(no data)
        3.4) WDS帧
            null
    4) To DS: 表明该帧是否是BSS向DS发送的帧时
        4.1) IBSS: 设置为0
        4.2) To AP: 设置为1
        4.3) From AP: 设置为0
        4.4) WDS: 设置为1
    5) From DS: 表明该帧是否是DS向BSS发送的帧时  
        5.1) IBSS: 设置为0
        5.2) To AP: 设置为0
        5.3) From AP: 设置为1
        5.4) WDS: 设置为1
    6) More Fragment: 用于说明长帧被分段的情况,是否还有其它的帧,如果有则该值设置为1
    7) Retry(重传域): 表示该分段是先前传输分段的重发帧。 
    8) Power Management: 表示传输帧以后,站所采用的电源管理模式
        8.1) 为1: STA处于power_save模式
        8.2) 为0: STA处于active模式
    9) More Data: 表示有很多帧缓存到站中。即至少还有一个数据帧要发送给STA是设置为1。 
    10) Protected Frame: 表示根据WEP(Wired Equivalent Privacy)算法对帧主体进行加密。如果帧体部分包含被密钥套处理过的数据,则设置为1,否则设置为0 
    11) Order(序号域): 在长帧分段传送时,该域设置为1表示接受者应该严格按照顺序处理该帧,否则设置为0
2. Duration/ID(持续时间/标识)
表明该帧和它的确认帧将会占用信道多长时间,Duration 值用于网络分配向量(NAV)计算 
3. Address Fields(地址域): 
这个域的具体格式和控制帧的子类型有关,不同的子类型会有一些微小的差别
    1) IBSS
        1.1) Destination Address
        1.2) Source Address
        1.3) BSSID 
        每个BSS都会被赋予一个BSSID,它是一个长度为48个bit的二进制识别码,用来辨识不同的BSS
    2) From AP
        2.1) Destination Address 
        2.2) BSSID
        2.3) Source Address
    3) To AP
        3.1) BSSID
        3.2) Source Address
        3.3) Destination Address  
    4) WDS 
        4.1) BSSID
        4.2) Source Address
        4.3) Destination Address
4. Sequence Control(序列控制域): 用于过滤重复帧
    1) MSDU(MAC Server Data Unit), 12位序列号(Sequence Number)
    2) MMSDU(MAC Management Server Data Unit), 4位片段号(Fragment Number)组成
[SA,只有WDS中的帧有这个字段]
5. Frame Body(Data): 发送或接收的信息。
6. FCS(CRC): 包括32位的循环冗余校验(CRC),用于检错,注意是检错不是纠错 

Control Frame Protocol Format

(RTS frame, a type of control frame)

(CTS frame, a type of control frame)

(ACK frame, a type of control frame)

(PS-Poll frame)

1. 帧控制结构(Frame Control)
    1) Protocol Version: (协议版本)通常为0
    2) Type: 帧类型,控制帧: 01 
    3) Subtype: 进一步判断帧的子类型:   
        控制帧
        3.1) 请求发送(Request To Send,RTS)数据包
        3.2) 清除发送(Clear To Send,CTS)数据包
        数据帧
        3.3) ACK确认(RTS/CTS) 
        3.4) PS-Poll: 当一部移动工作站从省电模式中苏醒,便会发送一个 PS-Poll 帧给基站,以取得任何暂存帧 
    4) To DS: 表明该帧是BSS向DS发送的帧时,该值设置为1
    5) From DS: 表明该帧是DS向BSS发送的帧时,该值设置为1
    控制帧负责处理无线介质的访问,因此只能够由无线工作站产生。传输系统并不会收送控制帧,因此这两个Bit必然为0 
    6) More Fragment: 用于说明长帧被分段的情况,是否还有其它的帧,如果有则该值设置为1。
    控制帧不可能被切割,这个Bit必然为0 
    7) Retry(重传域): 表示该分段是先前传输分段的重发帧。
    控制帧不像管理或数据帧那样,必须在序列中等候重送,因此这个 Bit必然为0 
    8) Power Management: 表示传输帧以后,站所采用的电源管理模式
        8.1) 为1: STA处于power_save模式
        8.2) 为0: STA处于active模式
    9) More Data: 表示有很多帧缓存到站中。即至少还有一个数据帧要发送给STA是设置为1。
    More Data bit只用于管理数据帧,在控制帧中此Bit必然为0
    10) Protected Frame: 表示根据WEP(Wired Equivalent Privacy)算法对帧主体进行加密。如果帧体部分包含被密钥套处理过的数据,则设置为1,否则设置为0。
    控制帧不会经过加密。因此对控制帧而言,Protected Frame bit必然为0。
    11) Order(序号域): 在长帧分段传送时,该域设置为1表示接受者应该严格按照顺序处理该帧,否则设置为0。
    控制帧是基本帧交换程序(atomic frame exchange operation)的组成要件,因此必须依序发送。所以这个Bit必然为0
2. Duration/ID(持续时间/标识)
表明该帧和它的确认帧将会占用信道多长时间,Duration 值用于网络分配向量(NAV)计算。
注意: 在PS-Poll帧中不包含Duration/ID这个字段
3. Address Fields(地址域): 
这个域的具体格式和控制帧的子类型有关,不同的子类型会有一些微小的差别
    3.1) RTS(请求发送帧)
        3.1.1) Receiver Address(接收端地址)
        接收大型帧的工作站的地址
        3.1.2) Transmitter Address(发送端地址)
        RTS帧的发送端的地址
    3.2) CTS(允许发送)
        3.2.1) Receiver Address(接收端地址)
    3.3) ACK(应答)
        3.3.1) Receiver Address(接收端地址)
    3.4) PS-Poll(省电模式一轮询) 
        3.4.1) AID(连接识别码 association ID)    
        连接识别码是接入点所指定的一个数值,用以区别各个连接。将此识别码置入帧,可让接入点找出为其(移动工作站)所暂存的帧
        3.4.2) BSSID
        此位包含发送端目前所在 BSS(AP)的BSSID ,此BSS 建立自目前所连接的AP
        3.4.3) Transmitter Address(发送端地址)
        此为PS-Poll帧之发送端的 MAC地址
4. FCS(CRC): 包括32位的循环冗余校验(CRC),用于检错,注意是检错不是纠错

3. Wi-Fi Certification Process

With the basic format of the 802.11 protocol, we can use wireshark to perform packet capture experiments to verify our theory

ifconfig -a
ifconfig wlan1 up
airmon-ng start wlan1
启动wireshark,选择mon0网卡(开启了Monotor模式的虚拟网卡

0x1: normal unencrypted connection process

1. The AP sends a Beacon broadcast management frame

Because the Beacon management frame data packet sent by the AP is a broadcast address, our PCMIA built-in network card or USB external network card will receive this data packet, and then display it in our "wireless connection list"

2. The client sends a Probe Request frame to the AP carrying the specified SSID

When we click "connect", the wireless network card will send a Prob data frame to request a connection to the AP

3. The AP access point responds to the client's SSID connection request

 

The AP responded to the client's connection and said it would not accept any form of "frame-payload-encryption"

4. The client authenticates the target AP request (Authentication)

5. The AP responds to the client's Authentication request

The AP responds, indicating that the authentication is received

6. The client sends an Association request to the AP

After the identity authentication is passed, all preparations are completed, and the client can initiate a formal connection request to the WLAN AP at this time, requesting access to the WLAN

7. The AP responds to the Association request

The AP responds to the client's connection request (Association) (including SSID, performance, encryption settings, etc.). At this point, the Wi-Fi connection authentication interaction is all over, and then data can be sent normally.

8. The client requests the AP to disconnect (Disassociation)

When we click "disconnect", the network card will send a disconnected management data frame to the AP, requesting to disconnect

From this, we can find that based on the understanding of the data frame format, hackers can launch some protocol-specific attacks.

1. Deanthentication攻击
2. Disassociation攻击

Hackers can use this to speed up attacks on WEP/WPS-PSK protected WLANs, force clients to reconnect and generate ARP traffic (WEP-based attacks), or capture the four-way handshake to reconnect with WPA, and then Password for offline dictionary or rainbow table cracking attacks

0x2: Connection process based on WEP encryption

0x3: Connection process based on WPA-PSK encryption

These two connection and interaction processes are in principle the same as the unencrypted method (open system method).

4. Data security encryption protocol in 802.11 standard

The encryption algorithms in the IEEE 802.11 protocol are as follows

1. WEP,Wired Equivalent Privacy: 802.11中最早期的加密标准
http://en.wikipedia.org/wiki/Wired_Equivalent_Privacy

2. CCMP(CTR with CBC-MAC Protocol): 基于AES的全新加密协议,在IEEE 802.11i中提出
http://en.wikipedia.org/wiki/CCMP

3. WPA(Wi-Fi Protected Access)
http://en.wikipedia.org/wiki/WPA

4. TKIP(Temporal Key Integrity Protocol)
http://en.wikipedia.org/wiki/Temporal_Key_Integrity_Protocol

5. WPA2(Wi-Fi Protected Access 2)
http://en.wikipedia.org/wiki/WPA2

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325343924&siteId=291194637