# US 2023/0275874 A1 · Network security protection method and protection device

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2023/0275874 A1
- Document ID: US20230275874A1
- Status: Published application
- Kind: A1
- Application number: 18/315,199
- Filed: 2023-05-10
- Published: 2023-08-31
- Earliest claimed: 2020-11-10
- Assignees: Huawei Technologies Co., Ltd.
- Applicants: Huawei Technologies Co., Ltd.
- Inventors: Xinqian He; Kan Zhou
- Web page: https://patentgrep.com/patent/US20230275874A1

## CPC

- H04L 63/0236: {Filtering by address, protocol, port number or service, e.g. IP-address or URL}
- H04L 69/163: In-band adaptation of TCP data exchange; In-band control procedures
- H04L 63/0227: {Filtering policies (mail message filtering H04L51/212)}
- H04L 63/0281: {Proxies}
- H04L 63/029: {Firewall traversal, e.g. tunnelling or, creating pinholes}
- H04L 63/1408: {by monitoring network traffic (monitoring network traffic per se H04L43/00)}
- H04L 63/168: {above the transport layer}
- H04L: TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION (arrangements common to telegraphic and telephonic communication H04M)

## Abstract

This application provides a network security protection method and a protection device, and pertains to the field of communication technologies. The protection device implements adaptive switching between different detection modes based on application layer data of a data packet exchanged between a client device and a server in a session. This avoids a case in which a threat is missed when only a flow mode is used, and avoids a case in which a large quantity of unnecessary resources are occupied when only a proxy mode is used. Therefore, protection effect is improved.

## Claims

### Claim 1

A network security protection method, the method comprising:
obtaining, by a protection device, a first data packet in a transmission control protocol (TCP) session in a process of performing security detection in the TCP session using a first mode, the TCP session being between a client device and a server, the protection device is deployed between the client device and the server, and the first mode is in a set of detection modes supported by the protection device;
determining, by the protection device and based on an application layer data of the first data packet, to switch to a second mode, the second mode is other than the first mode in the set of detection modes; and
switching, by the protection device, to the second mode and performing security detection on a subsequent packet in the TCP session using the second mode.

### Claim 2 (depends on 1)

The method according to claim 1, wherein the set of detection modes comprises a packet filtering mode, a flow mode, or a proxy mode.

### Claim 3 (depends on 1)

The method according to claim 1, wherein the first mode is a flow mode, the second mode is a proxy mode, and the determining, by the protection device based on the application layer data of the first data packet, to switch to the second mode comprises:
identifying, by the protection device, an application layer protocol type of the first data packet based on the application layer data;
determining, by the protection device based on a correspondence between the application layer protocol type and a detection mode, that the application layer protocol type of the first data packet corresponds to the proxy mode; and
determining, by the protection device, that the second mode to be switched to is the proxy mode corresponding to the application layer protocol type of the first data packet.

### Claim 4 (depends on 1)

The method according to claim 1, wherein the first mode is a proxy mode, the second mode is a flow mode, the security detection is an anti-virus (AV) detection, and the determining, by the protection device based on the application layer data of the first data packet, to switch to the second mode comprises:
determining, by the protection device, that the second mode is the flow mode if the AV detection performed by the protection device on the application layer data of the first data packet determines there is no virus.

### Claim 5 (depends on 1)

The method according to claim 1, wherein the first mode is a proxy mode, the second mode is a flow mode, and the determining, by the protection device based on the application layer data of the first data packet, to switch to the second mode comprises:
determining, by the protection device, that the second mode is the flow mode if the application layer data of the first data packet indicates that the client device and the server are to perform encrypted communication in the TCP session.

### Claim 6 (depends on 1)

The method according to claim 1, wherein before the obtaining, by the protection device, the first data packet in the TCP session, the method further comprises:
obtaining, by the protection device, a first handshake packet transmitted between the client device and the server, wherein the first handshake packet is used to create the TCP session, the first handshake packet comprising a first option and a second option, the first option is supported by the protection device and the second option is not supported by the protection device;
deleting, by the protection device, the second option from the first handshake packet to obtain a second handshake packet; and
sending, by the protection device, the second handshake packet to a destination device of the first handshake packet.

### Claim 7 (depends on 6)

The method according to claim 6, wherein the first mode is a flow mode, the second mode is a proxy mode, and the switching, by the protection device, to the second mode comprises:
resending, by the protection device, a third data packet to a destination device of the third data packet based on the first option if the third data packet in the TCP session meets a retransmission condition, wherein the third data packet has been sent by the protection device using the first mode, and the destination device of the third data packet is the client device or the server.

### Claim 8 (depends on 6)

The method according to claim 6, wherein the first mode is a proxy mode, the second mode is a flow mode, and the switching, by the protection device, to the second mode comprises:
resending, by the protection device, a fourth data packet to a destination device of the fourth data packet based on the first option if the fourth data packet in the TCP session meets a retransmission condition, wherein the fourth data packet has been sent by the protection device using the first mode, and the destination device of the fourth data packet is the client device or the server.

### Claim 9 (depends on 7)

The method according to claim 7, wherein the retransmission condition comprises:
the protection device has not received an acknowledgement packet for the third data packet; or
the first option is a selective acknowledgement (SACK) option, and the retransmission condition comprises the protection device determines that a packet loss occurred in the third data packet, based on information in a SACK option from a destination device of a third data packet.

### Claim 10 (depends on 6)

The method according to claim 6, wherein the first handshake packet is a synchronize sequence number (SYN) packet from the client device and the destination device of the first handshake packet is the server; or
the first handshake packet is a synchronize sequence number acknowledgement (SYN ACK) packet from the server and the destination device of the first handshake packet is the client device.

### Claim 11

A protection device, the protection device comprising:
a memory storing instructions; and
at least one processor in communication with the memory, the at least one processor configured, upon execution of the instructions, to perform the following steps:
perform security detection on a data packet in a transmission control protocol TCP session using a first mode, the TCP session being a session between the client device and the server, the first mode is in a set of detection modes supported by the protection device; and
obtain a first data packet in the TCP session in a process in which the at least one processor performs security detection using the first mode;
determine, based on an application layer data of the first data packet, to switch to a second mode, the second mode is other than the first mode in the set of detection modes; and
switch to the second mode and perform security detection on a subsequent packet in the TCP session using the second mode.

### Claim 12 (depends on 11)

The protection device according to claim 11, wherein the first mode is a flow mode, the second mode is a proxy mode, and the instructions when executed by the processor further cause the protection device to:
identify an application layer protocol type of the first data packet based on the application layer data;
determine that the application layer protocol type of the first data packet corresponds to the proxy mode, based on a correspondence between an application layer protocol type and a detection mode; and
determine that the second mode to be switched to is the proxy mode corresponding to the application layer protocol type of the first data packet.

### Claim 13 (depends on 11)

The protection device according to claim 11, wherein the first mode is a proxy mode, the second mode is a flow mode, the security detection is an anti-virus (AV) detection, wherein the instructions when executed by the processor further cause the protection device to determine that the second mode to be switched to is the flow mode if a result of the AV detection performed on the application layer data of the first data packet is that there is no virus.

### Claim 14 (depends on 11)

The protection device according to claim 11, wherein the first mode is a proxy mode, the second mode is a flow mode, and instructions when executed by the processor further cause the protection device to determine that the second mode is the flow mode if the application layer data of the first data packet indicates that the client device and the server are to perform encrypted communication in the TCP session.

### Claim 15 (depends on 11)

The protection device according to claim 11, the protection device further comprises an obtaining unit configured to obtain the first handshake packet transmitted between the client device and the server, wherein the first handshake packet is used to create the TCP session, the first handshake packet comprising a first option and a second option, the first option is supported by the protection device, and the second option is not supported by the protection device;
the processing unit is further configured to delete the second option from the first handshake packet to obtain a second handshake packet; and
the protection device further comprises a sending unit configured to send the second handshake packet to a destination device of the first handshake packet.

### Claim 16 (depends on 15)

The protection device according to claim 15, wherein the first mode is a flow mode, the second mode is a proxy mode;
the processing unit is configured to generate an acknowledgement packet for a second data packet in the TCP session based on the first option, wherein the second data packet has been received and buffered by the protection device using the first mode; and
the sending unit is configured to send the acknowledgement packet for the second data packet to a source device of the second data packet, wherein the source device of the second data packet is the client device or the server.

### Claim 17 (depends on 15)

The protection device according to claim 15, wherein the first mode is a flow mode, the second mode is a proxy mode; and
the sending unit is configured to resend the third data packet to a destination device of the third data packet based on the first option if a third data packet in the TCP session meets a retransmission condition, wherein the third data packet has been sent by the protection device using the first mode, and the destination device of the third data packet is the client device or the server.

### Claim 18 (depends on 15)

The protection device according to claim 15, wherein the first mode is a proxy mode, the second mode is a flow mode; and
the sending unit is configured to resend the fourth data packet to a destination device of the fourth data packet based on the first option if a fourth data packet in the TCP session meets a retransmission condition, wherein the fourth data packet has been sent by the protection device using the first mode, and the destination device of the fourth data packet is the client device or the server.

### Claim 19 (depends on 15)

The protection device according to claim 15, wherein the first mode is a proxy mode, the second mode is a flow mode, and the processing unit is configured to detect a fifth data packet in the TCP session to obtain a sixth data packet, wherein the fifth data packet has been received by the protection device using the first mode, the protection device has sent an acknowledgement packet for the fifth data packet to a source device of the fifth data packet after parsing the fifth data packet based on the first option, and the source device of the fifth data packet is the client device or the server; and
the sending unit is configured to send the sixth data packet to a destination device of the fifth data packet based on the first option, wherein the destination device of the fifth data packet is the server when the source device of the fifth data packet is the client device, or the destination device of the fifth data packet is the client device when the source device of the fifth data packet is the server.

### Claim 20 (depends on 19)

The protection device according to claim 19, wherein
the sending unit is configured to resend the sixth data packet to the destination device of the fifth data packet, based on the first option, if the sixth data packet meets a retransmission condition.
