WO2021244449A1 - Data processing method and apparatus - Google Patents

Data processing method and apparatus Download PDF

Info

Publication number
WO2021244449A1
WO2021244449A1 PCT/CN2021/096986 CN2021096986W WO2021244449A1 WO 2021244449 A1 WO2021244449 A1 WO 2021244449A1 CN 2021096986 W CN2021096986 W CN 2021096986W WO 2021244449 A1 WO2021244449 A1 WO 2021244449A1
Authority
WO
WIPO (PCT)
Prior art keywords
data packet
port number
source
address
verification code
Prior art date
Application number
PCT/CN2021/096986
Other languages
French (fr)
Chinese (zh)
Inventor
江伟玉
刘冰洋
郑秀丽
王闯
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2021244449A1 publication Critical patent/WO2021244449A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/40Network security protocols
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/14Network architectures or network communication protocols for network security for detecting or protecting against malicious traffic
    • H04L63/1441Countermeasures against malicious traffic
    • H04L63/1458Denial of Service
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/02Network architectures or network communication protocols for network security for separating internal from external traffic, e.g. firewalls
    • H04L63/0227Filtering policies
    • H04L63/0236Filtering by address, protocol, port number or service, e.g. IP-address or URL
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/14Network architectures or network communication protocols for network security for detecting or protecting against malicious traffic
    • H04L63/1408Network architectures or network communication protocols for network security for detecting or protecting against malicious traffic by monitoring network traffic
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/16Implementing security features at a particular protocol layer
    • H04L63/166Implementing security features at a particular protocol layer at the transport layer

Definitions

  • This application relates to the field of communications, and in particular to a data processing method and device.
  • DRDoS Distributed Reflection Denial of Service
  • black hole technology or traffic cleaning technology is usually used to defend against DRDoS attacks.
  • network equipment uses black hole technology to direct both illegal traffic and legal traffic to black holes, and cannot distinguish between legal traffic and illegal traffic.
  • traffic cleaning technology it takes a long time to distinguish legal traffic from illegal traffic. Therefore, how to quickly distinguish legitimate traffic from illegal traffic when defending against DRDoS attacks is an urgent problem to be solved.
  • This application provides a data processing method and device, which solves the problem of how to quickly distinguish legitimate traffic from illegal traffic when defending against DRDoS attacks.
  • this application provides a data processing method, which can be applied to a network device, or the method can be applied to a communication device that can support the network device to implement the method, for example, the communication device includes a chip system, and the method includes: After the network device receives the first data packet, it determines that the first data packet is a traffic from the reflection device according to the transport layer protocol number and the first port number, extracts the first verification code from the destination port field, and then according to the key and waiting The authentication information generates a second verification code, and it is determined whether the first data packet is legal according to the first verification code and the second verification code. If the first data packet is legal, the network device forwards the first data packet to the protected device.
  • the network device replaces the destination port number with the second source port number to obtain the second data packet; and forwards the second data packet to the protected device.
  • the first data packet is illegal, it means that the first data packet is illegal, and the first data packet is discarded, so that a large amount of forged attack traffic can be filtered out.
  • the first data packet includes the transport layer protocol number, the first source port number and the destination port number.
  • the reflection device is the device that sends the DRDoS attack.
  • a reflection device is a device capable of being used by an attacker to send DRDoS attack traffic.
  • the reflection device can be a domain name system device, a network time protocol device, or a simple network management protocol device.
  • the information to be authenticated includes the source Internet Protocol (IP) address, and the source IP address is the IP address of the reflection device.
  • IP Internet Protocol
  • the network device may also generate a second verification code in advance based on the key and the information to be authenticated, and save the correspondence between the information to be authenticated and the second verification code. After the network device determines that the first data packet is a flow from the reflection device according to the transport layer protocol number and the first source port number, it can also look up the table according to the information to be authenticated to obtain the second verification code associated with the information to be authenticated.
  • the data processing method provided by the embodiment of the application uses the port field included in the header of the transmission layer in the data packet to carry the verification code. Packets are identified, and only legitimate data packets will be forwarded, which can deal with most reflection-type denial-of-service attacks. Compared with the black hole technology, the data processing method provided in the embodiments of the present application can ensure that legal traffic is forwarded, avoid legal traffic being discarded by the black hole, and the network device filters most of the DRDoS attack traffic. Compared with the traffic cleaning technology, the data processing method provided in the embodiments of the present application can reduce the delay in processing legal traffic caused by deep protocol analysis.
  • verifiable identifier can be embedded in the destination port field, network devices do not need to process application layer data, and can directly filter at the transport layer, reducing the cost of defending against DRDoS attacks, and does not rely on cross-domain cooperation.
  • determining that the first data packet is a traffic from the reflection device according to the transport layer protocol number and the first source port number includes: determining that the reflection type protocol port feature set includes the first source port number and the transport layer Protocol number, and the transport layer protocol number is a User Data Protocol (UDP) number or a Transmission Control Protocol (Transfer Control Protocol, TCP) number, then the first data packet is a flow from the reflection device.
  • UDP User Data Protocol
  • TCP Transmission Control Protocol
  • the information to be authenticated further includes at least one of the destination IP address, the first source port number, and the transport layer protocol number included in the first data packet.
  • the destination IP address is the IP address of the protected device, and the protected device is the device that is attacked by DRDoS.
  • the information to be authenticated further includes at least one of a port index and a time parameter, and the port index is used to identify an application.
  • the destination port number also includes a port index.
  • the method before replacing the destination port number with the second source port number, the method further includes: determining that the legal flow table includes the 5-tuple of the first data packet, and obtaining the first data packet from the legal flow table
  • the quintuple corresponds to the second source port number.
  • the quintuple of the first data packet is used to uniquely identify a piece of network traffic.
  • the quintuple of the first data packet includes the source IP address, destination IP address, transport layer protocol number, The first source port number and destination port number.
  • this application provides a data processing method, which can be applied to network equipment, or the method can be applied to a communication device that can support network equipment to implement the method.
  • the communication device includes a chip system, and the method includes: After the network device receives the first data packet, it determines that the first data packet is a traffic sent to the reflection device according to the transport layer protocol number and the destination port number, and then replaces the first source port number with the second source port number to obtain the second data Packet, send the second data packet.
  • the first data packet includes the transport layer protocol number, the first source port number and the destination port number.
  • the second source port number includes a verification code, the verification code is determined based on the key and the information to be authenticated, the information to be authenticated includes the destination IP address, and the destination IP address is the IP address of the reflection device.
  • the data processing method provided by the embodiments of the present application uses the port field included in the header of the transmission layer in the data packet to carry the verification code, so that after the network device receives the data packet from the reflection device, the verification code can verify the legal data packet and Illegal data packets are identified, and only legitimate data packets will be forwarded, which can deal with most reflection-type denial of service attacks.
  • determining that the first data packet is a traffic sent to the reflection device according to the transport layer protocol number and the destination port number includes: determining the reflection type protocol port feature set including the destination port number and the transport layer protocol number, And the transport layer protocol number is UDP number or TCP number, then the first data packet is a flow sent to the reflection device.
  • the information to be authenticated further includes at least one of the source IP address, the destination port number, and the transport layer protocol number contained in the first data packet, and/or at least one of the first port index and the time parameter ;
  • the source IP address is the IP address of the source device, and the source device is a protected device that suffers from a DRDoS attack.
  • the first port index is used to identify an application.
  • the second source port number also includes the first port index.
  • the method before replacing the first source port number with the second source port number, the method further includes: determining that the legal flow table includes the quintuple of the first data packet, and obtaining the first data packet from the legal flow table.
  • the quintuple of the data packet corresponds to the second source port number.
  • the quintuple of the first data packet is used to uniquely identify a piece of network traffic.
  • the quintuple of the first data packet includes the source IP address, the destination IP address, and the transport layer protocol. Number, first source port number and destination port number.
  • the method further includes: determining whether the legal flow table includes the four-tuple of the first data packet except for the first source port number; If the legal flow table does not include the four-tuple except the first source port number in the first data packet, the first port index is generated; if the legal flow table includes the four-tuple except the first source port number in the first data packet, update The second port index corresponding to the quadruple obtains the first port index.
  • this application provides a data processing method, which can be applied to network equipment, or the method can be applied to a communication device that can support network equipment to implement the method, for example, the communication device includes a chip system, and the method includes: After receiving the first data packet, the network device determines that the first data packet is a flow from the reflection device according to the transport layer protocol number and the first port number. Replace the destination port number contained in the first data packet with the second source port number to obtain the second data packet; forward the second data packet to the protected device.
  • the first data packet includes a transport layer protocol number, a first source port number and a destination port number
  • the destination port number includes a verification code.
  • this application provides a data processing method, which can be applied to network equipment, or the method can be applied to a communication device that can support network equipment to implement the method.
  • the communication device includes a chip system, and the method includes: After receiving the first data packet, the network device extracts the first verification code from the destination port field contained in the first data packet, and generates a second verification code according to the key and the information to be authenticated, and according to the first verification code and the second verification code The code determines whether the first data packet is legal. If the first data packet is legal, the network device forwards the first data packet to the protected device. Or, the network device replaces the destination port number with the second source port number to obtain the second data packet; and forwards the second data packet to the protected device.
  • the reflection device is a device that sends a DRDoS attack.
  • the information to be authenticated includes the source IP address included in the first data packet, and the source IP address is the IP address of the reflection device.
  • this application provides a data processing method, which can be applied to network equipment, or the method can be applied to a communication device that can support network equipment to implement the method, for example, the communication device includes a chip system, and the method includes: After receiving the first data packet, the network device replaces the first source port number included in the first data packet with the second source port number to obtain the second data packet, and then sends the second data packet.
  • the second source port number includes a verification code
  • the verification code is determined according to the key and the information to be authenticated
  • the information to be authenticated includes the destination IP address included in the first data packet
  • the destination IP address is the IP address of the reflection device.
  • this application provides a data processing method, which can be applied to network equipment, or the method can be applied to a communication device that can support network equipment to implement the method.
  • the communication device includes a chip system, and the method includes: After receiving the first data packet, the network device replaces the destination port number contained in the first data packet with the second source port number to obtain the second data packet; and forwards the second data packet to the protected device.
  • the first data packet includes a transport layer protocol number, a first source port number and a destination port number, and the destination port number includes a verification code.
  • the embodiments of the present application also provide a communication device, and the beneficial effects can be referred to the description of the first aspect and will not be repeated here.
  • the communication device has a function of realizing the behavior in the method example of the first aspect or the fourth aspect.
  • the functions can be realized by hardware, or by hardware executing corresponding software.
  • the hardware or software includes one or more modules corresponding to the above-mentioned functions.
  • the communication device includes: a receiving unit, a processing unit, and a sending unit.
  • the receiving unit is configured to receive a first data packet, where the first data packet includes a transport layer protocol number, a first source port number, and a destination port number, and the destination port number includes a first verification code.
  • the processing unit is configured to determine that the first data packet is a flow from the reflection device according to the transport layer protocol number and the first source port number.
  • the processing unit is further configured to generate a second verification code according to the key and the information to be authenticated.
  • the information to be authenticated includes the source IP address contained in the first data packet, and the source IP address is the IP address of the reflection device.
  • the processing unit is further configured to determine whether the first data packet is legal according to the first verification code and the second verification code.
  • the processing unit is further configured to replace the destination port number with the second source port number to obtain the second data packet.
  • the sending unit is configured to forward the first data packet or the second data packet to the protected device, where the second data packet includes the second source port number.
  • the embodiments of the present application also provide a communication device, and the beneficial effects can be referred to the description of the second aspect and will not be repeated here.
  • the communication device has the function of realizing the behavior in the method example of the second aspect or the fifth aspect described above.
  • the functions can be realized by hardware, or by hardware executing corresponding software.
  • the hardware or software includes one or more modules corresponding to the above-mentioned functions.
  • the communication device includes: a receiving unit, a processing unit, and a sending unit.
  • the receiving unit is configured to receive a first data packet, where the first data packet includes a transport layer protocol number, a first source port number, and a destination port number.
  • the processing unit is configured to determine that the first data packet is a flow sent to the reflection device according to the transport layer protocol number and the destination port number.
  • the processing unit is further configured to replace the first source port number with the second source port number to obtain a second data packet, the second source port number includes a verification code, the verification code is determined according to the key and the information to be authenticated, and the information to be authenticated
  • the destination IP address included in the first data packet is included, and the destination IP address is the IP address of the reflection device.
  • the sending unit is used to send the second data packet.
  • the embodiments of the present application also provide a communication device, and the beneficial effects can be referred to the description of the third aspect and will not be repeated here.
  • the communication device has the function of realizing the behavior in the method example of the third aspect or the sixth aspect.
  • the functions can be realized by hardware, or by hardware executing corresponding software.
  • the hardware or software includes one or more modules corresponding to the above-mentioned functions.
  • the communication device includes: a receiving unit, a processing unit, and a sending unit.
  • the receiving unit is used to receive the first data packet; the processing unit is used to determine that the first data packet is a flow from the reflection device according to the transport layer protocol number and the first port number; the processing unit is also used to use the second source The port number replaces the destination port number to obtain the second data packet.
  • the sending unit is used to forward the second data packet to the protected device.
  • the first data packet includes the transport layer protocol number, the first source port number, and the destination port number, and the destination port number includes the first verification code.
  • a communication device may be the network device in the foregoing method embodiment, or a chip set in the network device.
  • the communication device includes an interface circuit, a processor, and optionally, a memory.
  • the memory is used to store a computer program or instruction, and the processor is coupled with the memory and an interface circuit.
  • the processor executes the computer program or instruction
  • the communication device executes the method executed by the network device in the foregoing method embodiment.
  • a computer program product comprising: computer program code, when the computer program code is running, make the above-mentioned method of the first to sixth aspects executed by the network device Be executed.
  • the present application provides a chip system, which includes a processor, and is configured to implement the functions of the network device in the methods of the foregoing aspects.
  • the chip system further includes a memory for storing program instructions and/or data.
  • the chip system can be composed of chips, and can also include chips and other discrete devices.
  • the present application provides a computer-readable storage medium that stores a computer program, and when the computer program is run, it is executed by a network device in the first to sixth aspects above. Methods.
  • Figure 1 is an example diagram of a DRDoS attack provided by the prior art
  • FIG. 2 is an example diagram of the architecture of a communication system provided by an embodiment of this application.
  • FIG. 3 is a flowchart of a data processing method provided by an embodiment of the application.
  • FIG. 4 is a flowchart of a data processing method provided by an embodiment of the application.
  • FIG. 5 is a schematic diagram of the structure of an IPv4 data packet provided by an embodiment of this application.
  • FIG. 6 is a schematic structural diagram of a source port number provided by an embodiment of this application.
  • FIG. 7 is a flowchart of a data processing method provided by an embodiment of the application.
  • FIG. 8 is a flowchart of a data processing method provided by an embodiment of the application.
  • FIG. 9 is a flowchart of a data processing method provided by an embodiment of the application.
  • FIG. 10 is a flowchart of a data processing method provided by an embodiment of this application.
  • FIG. 11 is a flowchart of a data processing method provided by an embodiment of the application.
  • FIG. 12 is a schematic structural diagram of a data processing device provided by an embodiment of the application.
  • FIG. 13 is a schematic structural diagram of a data processing device provided by an embodiment of the application.
  • the difference between the Distributed Reflection Denial of Service (DRDoS) attack and the Distributed Denial of Service (DDoS) attack is that the attacker does not need to occupy a large number of controlled devices before the attack.
  • the user uses very few resources to send data packets whose source Internet Protocol (IP) address is the IP address of the protected device to the controlled device, and the controlled device makes a large number of responses to the protected device, thus successfully attacking the protected device. equipment.
  • IP Internet Protocol
  • FIG. 1 is a schematic diagram of the principle of a DRDoS attack provided by an embodiment of the application.
  • Controlled equipment refers to equipment directly controlled by the attacking equipment.
  • the attacking device knows the IP address of the protected device (such as the server), it can control multiple controlled devices to use the IP address of the protected device IP VIC as the source IP address, and the IP address of the reflecting device IP n as the destination address , Send the data packet with the forged source address to the reflection device, that is, send a service request to a large number of distributed deployment reflection devices.
  • each reflecting device receives the service request from the controlled device, it can send a data packet for attacking the protected device to the protected device.
  • the utilized reflection devices By sending a small amount of attack traffic requests to the distributed and available reflection devices, the utilized reflection devices amplify the traffic by dozens of times or even hundreds of thousands of times and return it to the protected device, and a large amount of amplified reflected traffic is aggregated to the protected device , Causing the resources of the protected equipment to be exhausted and unable to provide services to normal users, forming a DRDOS attack.
  • the data packets sent by the reflection device to the protected device include not only data packets used to attack the protected device, but may also include legitimate data that is not used to attack the protected device Packets, such as a response data packet sent by the reflection device in response to a service request from a protected device, and a request data packet actively sent by the reflection device to request the protected device to provide it with a specific service.
  • the so-called protected device can be understood as a device that may be attacked by an attacker.
  • the protected device can be an application server, a router, or a device in the Internet of Things (IoT).
  • IoT Internet of Things
  • the IoT device may be a fire alarm device or the like. If the fire alarm equipment is attacked, it will not be able to detect the fire and make an alarm, so that it will not be able to send out alarm messages, which will pose a serious security threat.
  • the protected device is an application server as an example.
  • the reflection device is the device that sends the DRDoS attack.
  • a reflection device is a device capable of being used by an attacker to send DRDoS attack traffic.
  • reflection devices include, but are not limited to, Domain Name System (DNS) servers, Network Time Protocol (NTP) servers, Simple Service Discovery Protocol (SSDP) servers, and simple network management Protocol (SNMP, simple network management protocol) server, lightweight directory access protocol (LDAP, lightweight directory access protocol) server, Charge server and Memcached server, etc.
  • DNS Domain Name System
  • NTP Network Time Protocol
  • SSDP Simple Service Discovery Protocol
  • SNMP simple network management Protocol
  • LDAP lightweight directory access protocol
  • Charge server and Memcached server etc.
  • DRDoS Due to the low cost of DRDos attacks and strong attack capabilities, for example, the Memcached server has a strong reflection amplification capability (amplified by hundreds of thousands of times, and the traffic of a single attack can reach 1.94Tbps [50 thousand times]), and both the DNS server and the NTP server can Amplification of traffic dozens of times makes the DRDoS attack method endow the attacker with the ability to make a lot of money. Therefore, DRDoS is the usual means for most DRDoS attacks on the booter service in the black market.
  • the current solution has no way to make the network device on the front side of the protected device have the ability to quickly distinguish between the reflected attack traffic and the legal traffic at the network layer or the transport layer.
  • FIG. 2 shows an example diagram of the architecture of a communication system that can be applied to the embodiments of the present application.
  • the communication system includes at least one terminal 201, an internet network, and a data center.
  • the Internet can be an Internet Service Provider (ISP) network.
  • An ISP can be a telecom operator that provides comprehensive Internet access services, information services, and value-added services to a large number of users.
  • the internet includes at least one network device (for example, network device 202 and network device 203).
  • network devices can be routers, switches, load balancers, or dedicated firewalls.
  • the network device 202 is a network device deployed on a telecommunication operator network close to a data center.
  • the network device 203 is a network device deployed at the exit of the data center.
  • the network device 203 is an egress router in a cloud data center, or it may be a network device on a link between the high defense center of the cloud data center and the operator's network.
  • the Internet also includes a reflection device 204, which is a device that can easily be used by hackers to send DRDoS attacks.
  • the data center includes at least one application server 205. Multiple application servers can be independent and different physical devices, or they can integrate the functions of multiple application servers on the same physical device (such as multiple application servers within the jurisdiction of a cloud service provider), or Some application server functions are integrated on a physical device.
  • Each application server can run one or more services (such as game services). Services can also be called applications.
  • the terminal 201 is connected to the network device in a wireless or wired manner.
  • the network devices will be connected wirelessly or wiredly.
  • the network device is connected to the application server 205 in a wireless or wired manner.
  • the terminal can be a fixed location, or it can be movable.
  • FIG. 2 is only a schematic diagram, and the communication system may also include other devices, such as wireless relay devices and wireless backhaul devices, which are not shown in FIG. 2.
  • the embodiments of the present application do not limit the number of terminals, network devices, and application servers included in the communication system.
  • the terminal (Terminal) 201 may also be referred to as a terminal device or a user equipment (user equipment,
  • the terminal 401 may be a mobile phone (mobile phone), a tablet computer (Pad), a computer with wireless transceiver function, a virtual reality (VR) terminal device, an augmented reality (Augmented Reality, AR) terminal device, an industrial control (industrial control) Wireless terminals in ), wireless terminals in self-driving, wireless terminals in remote medical surgery, wireless terminals in smart grid, and wireless terminals in transportation safety Terminals, wireless terminals in smart cities, wireless terminals in smart homes, etc.
  • the embodiment of the present application does not limit the specific technology and specific device form adopted by the terminal.
  • the terminal 201 and the application server 205 transmit data by sending data packets.
  • the data packet includes five-tuples.
  • the five-tuple can distinguish different sessions, and the corresponding session is unique.
  • the five-tuple includes source IP address, destination IP address, transport layer protocol number, source port number, and destination port number.
  • a device with an IP address of 192.168.1.1 uses TCP to connect to a device with an IP address of 121.14.88.76 and a port of 80 through port 10000 to transmit data.
  • the protocol number of TCP is 6.
  • the quintuple is 192.168.1.1 10000 6 121.14.88.76 80.
  • transport layer protocol number is the protocol number of TCP or the protocol number of UDP.
  • protocol number of UDP is 17.
  • a network device When a network device (such as network device 203 or network device 202) receives a data packet from the application server 205, it judges whether the data packet is sent to the reflection device 204 through the transport layer protocol and the destination port number, if it is sent to For the data packet of the reflection device 204, the second source port number is used to replace the first source port number contained in the data packet, that is, the second source port number is used to replace the port number indicating the application server 205 is running.
  • the second source port number is Embed verification code. In the generation algorithm of the verification code, the header information of the data packet is bound, for example, the source IP address and the destination IP address.
  • a network device such as the network device 203 or the network device 202 receives a data packet sent to the application server 205, it judges whether the data packet is a data packet from the reflection device 204 through the transport layer protocol and the first source port number . If it is a data packet from the reflection device 204, the information to be authenticated is extracted from the data packet, and the first verification code is extracted from the destination port number, and the second verification code is generated using the key and the information to be authenticated. The verification code and the first verification code determine whether the data packet is legal.
  • the information to be authenticated includes source IP address and destination IP address, etc.
  • the second source port Replace the port number with the port number of the application server 205.
  • the port number indicates the protocol of the application layer, and can also indicate a certain thread of the application program.
  • the port number is mainly used to indicate the process or thread that processes the data of the upper application.
  • the network device receives the first data packet sent to the reflection device, it replaces the first source port number contained in the first data packet with the second source port number, and the replaced second source port number does not indicate processing
  • the process or thread of the data of the upper-layer application indicates the information that carries the verification code.
  • the second source port number further includes a port index.
  • the port index is used to distinguish different services and specifically indicates a service, that is, a service supported by the application server 205 and the reflection device 204 to run.
  • the network device extracts the verification code from the destination port number contained in the second data packet to verify whether the second data packet is legal. If the second data packet is legal, forward the first data packet. Second data packet; if the second data packet is illegal, discard the second data packet. It should be understood that the second data packet is the response data packet of the first data packet, and the content filled in the destination port field in the second data packet is the content filled in the source port field in the first data packet, that is, the destination port contained in the second data packet The number is the same as the second source port number contained in the first data packet.
  • 3 is a flowchart of a data processing method provided by an embodiment of the application.
  • the network device 203 transmits the data of the first service between the reflection device 204 and the application server 205 as an example for description.
  • the method may include:
  • the application server 205 sends a first data packet to the network device 203, where the first data packet includes a transport layer protocol number, a first source port number, and a first destination port number.
  • the network device 203 receives the first data packet from the application server 205.
  • the transport layer protocol number is UDP number or TCP number.
  • the first source port number indicates the process or thread in the application server 205 that processes the data of the first service.
  • the first destination port number indicates the process or thread in the reflection device 204 that processes the data of the first service.
  • the network device 203 determines that the first data packet is a traffic sent to the reflection device 204 according to the transport layer protocol number and the first destination port number.
  • the network device 203 After receiving the first data packet, the network device 203 extracts the transport layer protocol number and the first destination port number from the header of the first data packet, and determines whether the reflective protocol port feature set includes the first destination port number and the transport layer protocol number , In order to determine whether the first data packet is a traffic sent to the reflection device 204.
  • S303 includes the following detailed steps.
  • the network device 203 judges whether the transport layer protocol number is a UDP number or a TCP number.
  • the network device 203 determines that the transport layer protocol number is a UDP number or a TCP number, execute S3032; if the network device 203 determines that the transport layer protocol number is not a UDP number or a TCP number, it means that the first data packet is not a traffic sent to the reflection device 204 , Go to S306.
  • the network device 203 determines whether the reflective protocol port feature set includes the first destination port number.
  • the network device 203 determines that the reflective protocol port feature set includes the first destination port number, it means that the first data packet is a traffic sent to the reflective device 204, and S304 is executed; if the network device 203 determines that the reflective protocol port feature set does not include The first destination port number indicates that the first data packet is not a traffic sent to the reflection device 204, and S306 is executed.
  • the device indicated by the transport layer protocol number and port number included in the reflection-type protocol port feature set is a device that can send DRDoS attacks.
  • the network device 203 may maintain a protocol port number relationship.
  • the so-called protocol port number relationship may refer to the corresponding relationship between the transport layer protocol and the port number.
  • the protocol port number relationship can be presented in the form of a table.
  • the network device 203 may store a protocol port number relationship table, and the protocol port number relationship table includes at least one correspondence relationship between a transport layer protocol and a port number. For example, as shown in Table 1, the corresponding relationship between the protocol port numbers is presented.
  • Table 1 only shows the storage form of the protocol port number relationship in the storage device in the form of a table, and does not limit the storage form of the protocol port number relationship in the storage device.
  • the protocol port number relationship is stored in the storage device.
  • the storage form in the device may also be stored in other forms, which is not limited in the embodiment of the present application.
  • the network device 203 replaces the first source port number with the second source port number to obtain the second data packet.
  • the second source port number includes the first verification code. It is understandable that the second source port number is set in the source port field in the first data packet.
  • the second source port number is set in the destination port field in the data packet.
  • the network device 203 it is convenient for the network device 203 to verify whether the data packet from the reflection device 204 is legal according to the first verification code included in the second source port number. Therefore, the second source port number can be regarded as a verifiable identification, and does not indicate a process or thread for processing the data of the upper-layer application.
  • FIG. 5 shows an example of the structure of an IPv4 data packet.
  • the IPv4 data packet includes a basic header and a data part.
  • the data part can be called payload (payload) or net load.
  • the basic header of IPv4 can also be referred to as the header of IPv4.
  • the IPV4 header can include the following fields in turn: version number, header length, service type, total length of data packet, reassembly identifier, flag, segment offset, time to live, protocol code, header checksum, source IP address , Destination IP address and optional options.
  • FIG. 5 (b) it is a diagram of an example of the structure of a TCP data packet.
  • the TCP data packet is contained in the data part of the IP data packet.
  • the TCP data packet includes the TCP header and the data part of the TCP data packet.
  • the TCP header includes source port (source port), destination port (destination port), sequence number (sequence number), acknowledgment number (acknowledgment number), data offset (header length), reservation (resv), emergency (UGR), confirmation (ACK), push (PSH), reset (RST), synchronization (SYN), termination (FIN), window (window size), checksum (checksum), urgent pointer (urgent pointer) and options (options).
  • the first source port number included in the first data packet is set in the source port field. After the network device 203 replaces the first source port number with the second source port number, the source port field includes the second source port number.
  • the second source port number also includes the first port index (portindex).
  • the first port index is used to identify the first service run by the application server 205.
  • the second source port number satisfies the following formula (1).
  • SrcLoc' represents the second source port number.
  • PID represents the first port index.
  • code represents the first verification code.
  • means a connector.
  • FIG. 6 it is a schematic diagram of the composition of the second source port number in the first data packet provided by this embodiment of the application.
  • the first port index occupies the first 4 bits (bit) in the source port field
  • the first verification code occupies the last 12 bits in the source port field.
  • the first verification code is determined according to the key and the information to be authenticated.
  • the information to be authenticated includes the first destination IP address included in the first data packet, and the first destination IP address is the IP address of the reflection device 204.
  • the information to be authenticated further includes at least one of the first source IP address, the first destination port number, and the transport layer protocol number included in the first data packet.
  • the first source IP address is the IP address of the application server 205, and the application server 205 is a device that suffers from a DRDoS attack.
  • the first verification code is determined based on the key, the first destination IP address, and the first source IP address. It is understandable that the network device 203 uses the key to encrypt the first destination IP address and the first source IP address to obtain the first verification code.
  • the first verification code satisfies the following formula (2).
  • code represents the first verification code.
  • IP R represents the first destination IP address.
  • IP S represents the first source IP address.
  • the first verification code is determined based on the key, the first destination IP address, the first source IP address, and the first destination port number. It is understandable that the network device 203 encrypts the first destination IP address, the first source IP address, and the first destination port number by using the key to obtain the first verification code.
  • the first verification code is determined based on the key, the first destination IP address, the first source IP address, the first destination port number, and the transport layer protocol number. It is understandable that the network device 203 uses a key to encrypt the first destination IP address, the first source IP address, the first destination port number, and the transport layer protocol number to obtain the first verification code.
  • the information to be authenticated further includes at least one of the first port index and the time parameter.
  • the time parameter may refer to the moment when the first data packet is received, and the time parameter may be a relatively coarse-grained time unit.
  • the information to be authenticated includes a time parameter
  • the time when the network device 203 receives the data packet from the application server 205 is the same as the time when the data packet from the reflection device 204 is received.
  • the first verification code is determined according to the key, the first destination IP address, the first source IP address, and the first port index. It is understandable that the network device 203 encrypts the first destination IP address, the first source IP address, and the first port index by using the key to obtain the first verification code.
  • the first verification code satisfies the following formula (3).
  • code represents the first verification code.
  • IP R represents the first destination IP address.
  • IP S represents the first source IP address.
  • F() represents a cryptographic algorithm.
  • the cryptographic algorithm uses a hash algorithm with a key, for example, a hash-based message authentication code (Hash-based Message Authentication Code, HMAC) related to the key.
  • HMAC hash-based message authentication code
  • the cryptographic algorithm is a hash algorithm based on symmetric block ciphers.
  • key is the key.
  • Code can be part of the output result of a cryptographic algorithm. For example, the 12-bit part of the output result of a cryptographic algorithm.
  • the network device 203 may generate the flow table according to the information to be authenticated and the first verification code. It is understandable that the flow table contains multiple entries. Each performance represents the corresponding relationship between a piece of information to be authenticated and a verification code. Therefore, after receiving the data packet, the network device 203 queries the flow table according to the information to be authenticated to obtain the verification code associated with the information to be authenticated, and verifies whether the verification code contained in the data packet is the same as the verification code obtained by querying the flow table, and then determines Whether the data packet is legal.
  • the network device 203 sends the second data packet to the reflection device 204.
  • the network device 203 forwards the first data packet.
  • the network device 203 before replacing the first source port number with the second source port number, that is, S304, the network device 203 first obtains the first port index, specifically the following detailed steps.
  • the network device 203 judges whether the legal flow table includes the quintuple of the first data packet.
  • the network device 203 maintains a service port correspondence for each service.
  • the so-called service port correspondence may refer to the correspondence between the port index, the quintuple corresponding to the port index, and the new source port number.
  • the service port correspondence can be presented in the form of a table.
  • the new source port is the number indicating the second source port including the first verification code.
  • the network device 203 may store a legal flow table, and the legal flow table includes at least one service port correspondence. For example, as shown in Table 2, the corresponding relationship between service ports is presented.
  • serial numbers represent traffic information of different services.
  • the serial number 1 represents the information of flow 1.
  • the serial number 3 represents the information of the flow rate 3.
  • the device with IP address 192.168.1.1 uses port 10000 and uses TCP to connect with the device with IP address 121.14.88.76 and port 80 to transmit data.
  • the protocol number of TCP is 6.
  • the quintuple is 192.168.1.1 10000 6 121.14.88.76 80.
  • the second record represented by sequence number 2 shows that the device with IP address 192.168.1.1 uses port 5000 to connect with the device with IP address 121.14.88.76 and port 80 through TCP. data.
  • the quintuple is 192.168.1.1 5000 6 121.14.88.76 80.
  • the third record represented by sequence number 3 shows that the device with IP address 192.168.1.1 uses port 3000 and uses TCP to connect with the device with IP address 121.14.88.76 and port 100, and transmit data.
  • the quintuple is 192.168.1.1 3000 6 121.14.88.76 100.
  • the information of flow 1 and the information of flow 2 include the same four-tuple, which means that flow 1 and flow 2 are from the same source device to the same destination device The traffic of different services sent.
  • the port index is used to distinguish the traffic of different services.
  • different port indexes can be used to distinguish different flows.
  • the initial value of the port index is 1, so as to prevent the new source port number from falling into the 0-4096 range of commonly used port numbers.
  • Table 2 only shows the storage form of the service port correspondence in the storage device in the form of a table, and does not limit the storage form of the service port correspondence in the storage device.
  • the service port correspondence is stored in the storage device.
  • the storage form in the device may also be stored in other forms, which is not limited in the embodiment of the present application.
  • the legal flow table includes the quintuple of the first data packet, it means that the network device 203 has sent data to the reflection device 204, and the network device 203 has stored the quintuple information of the first data packet, go to S308; if the legal flow table does not
  • the five-tuple including the first data packet indicates that the network device 203 has not sent data to the reflection device 204, and S309 is executed.
  • the five-tuple of the first data packet is used to uniquely identify the network traffic of the first service.
  • the five-tuple of the first data packet includes a first source IP address, a first destination IP address, a transport layer protocol number, a first source port number, and a first destination port number.
  • the network device 203 obtains the second source port number corresponding to the quintuple of the first data packet from the legal flow table.
  • the quintuple of the first data packet includes information about flow 1, and the second source port number is 23101.
  • the network device 203 judges whether the legal flow table includes the quadruple except the first source port number in the first data packet.
  • the legal flow table does not include the four-tuple except the first source port number in the first data packet, it means that the network device 203 has not sent data to the reflection device 204, and S310 is executed; if the legal flow table includes the first data packet except for the first data packet A four-tuple of a source port number indicates that the network device 203 has sent data to the reflection device 204, but the network device 203 has not sent the data of the first service to the reflection device 204, and S311 is executed.
  • the network device 203 generates a first port index.
  • the network device 203 adds a new record in the legal flow table, sets the quintuple of the first data packet, and sets the first port index to 1. Go to S312.
  • the network device 203 updates the second port index corresponding to the quadruple to obtain the first port index.
  • the second port index is used to indicate the data of the non-first service sent by the network device 203 to the reflection device 204.
  • the second port index may be updated to obtain the first port index. For example, the network device 203 adds a new record in the legal flow table, sets the quintuple of the first data packet, and sets the first port index to the second port index plus 1. Go to S312.
  • the network device 203 generates a first verification code according to the key and the information to be authenticated, and generates a second source port number according to the first verification code.
  • the network device 203 After the network device 203 receives the data packet from the reflection device 204, it can verify the legitimacy of the received data packet according to the first verification code, thereby filtering illegal traffic. As shown in FIG. 8, for details, refer to the detailed description of S313 to S318 below.
  • the network device 203 receives a third data packet, where the third data packet includes a transport layer protocol number, a third source port number, and a second destination port number.
  • the network device 203 determines that the third data packet is a flow from the reflection device 204 according to the transport layer protocol number and the third source port number.
  • the source port number indicates the process or thread in which the source device processes the data of the service.
  • the destination port number indicates the process or thread in which the destination device processes the data of the service.
  • the third source port number indicates the process or thread in the reflection device 204 that processes the data of the first service.
  • the network device 203 sends the second data packet to the reflection device 204, the first source port number is replaced with the second source port number.
  • the second source port number is set in the destination port field in the third data packet, that is, the second destination port number can be understood as the second source port number.
  • the second destination port number includes the first verification code.
  • the first verification code is a component of the destination port field included in the third data packet.
  • the second destination port number also includes the first port index.
  • the composition of the second destination port number can be referred to as shown in FIG. 6, where the first port index occupies the first 4 bits in the destination port field, and the first verification code occupies the last 12 bits in the destination port field.
  • the network device 203 After receiving the third data packet, the network device 203 extracts the transport layer protocol number and the third source port number from the header of the third data packet, and determines whether the reflective protocol port feature set includes the third source port number and the transport layer protocol number , In order to determine whether the third data packet is a flow from the reflection device 204.
  • step S314 includes the following detailed steps.
  • the network device 203 judges whether the transport layer protocol number is a UDP number or a TCP number.
  • the network device 203 determines that the transport layer protocol number is a UDP number or a TCP number, execute S3142; if the network device 203 determines that the transport layer protocol number is not a UDP number or a TCP number, it means that the third data packet is not a flow from the reflection device 204. Perform S319.
  • the network device 203 determines whether the reflective protocol port feature set includes the third source port number.
  • the network device 203 determines that the reflection-type protocol port feature set includes the third source port number, it means that the third data packet is a traffic from the reflection device 204, and the network device 203 obtains the second verification code according to the information to be authenticated, for example, the network device 203 executes S315, or obtains the second verification code associated with the information to be authenticated; if the network device 203 determines that the reflective protocol port feature set does not include the third source port number, it means that the third data packet is not a traffic from the reflective device 204 , Go to S319.
  • the reflection-type protocol port feature set please refer to the description of S302 above, and will not be repeated.
  • the second destination port number indicates the process or thread of the first service run by the application server 205, that is, the application server 205 indicates through the second destination port number
  • the port receives the data of the first service.
  • the second destination port number includes the first verification code.
  • the second destination port number does not indicate the process or thread of the first service run by the application server 205, but is a verifiable identification used to distinguish legitimate traffic from illegal traffic.
  • the network device 203 generates a second verification code according to the key and the information to be authenticated.
  • the information to be authenticated includes the second source IP address, and the second source IP address is the IP address of the reflection device 204.
  • the information to be authenticated further includes at least one of the second destination IP address, the third source port number, and the transport layer protocol number included in the third data packet.
  • the second destination IP address is the IP address of the application server 205.
  • the information to be authenticated further includes at least one of the first port index and the time parameter.
  • the network device 203 may obtain the first port index from the second destination port number, that is, obtain the first 4 bits of data in the second destination port number, that is, the first port index. Alternatively, the network device 203 may obtain the first port index corresponding to the quintuple of the third data packet from the legal flow table.
  • the method for generating the second verification code is the same as the method for generating the first verification code, so as to ensure that the first verification code and the second verification code are the same.
  • the specific method of generating the second verification code please refer to the description of generating the first verification code in S303, which will not be repeated.
  • the network device 203 generates the second verification code according to the key and the information to be authenticated. It can be understood that the network device 203 receives the third data packet and determines that the third data packet is a flow from the reflection device 204, and then generates the second verification in real time. code.
  • the sequence of the steps of the data processing method provided in the embodiments of the present application can be appropriately adjusted.
  • the network device 203 pre-generates the second verification code according to the key and the information to be authenticated, and saves the correspondence between the information to be authenticated and the second verification code.
  • the information to be authenticated is, for example, a five-tuple, and the network device 203 pre-stores the relationship between the five-tuple and the second verification code.
  • the network device 203 After the network device 203 receives the third data packet and determines that the third data packet is a flow from the reflection device 204, the network device 203 can obtain the second verification code associated with the information to be authenticated according to the information to be authenticated. For example, the network device 203 may store the association relationship between the information to be authenticated and the second verification code in the form of a table. After obtaining the information to be authenticated, the network device 203 checks the flow table according to the information to be authenticated, and obtains the second verification code associated with the information to be authenticated.
  • the network device 203 may not store the information to be authenticated, the flow table does not contain the entry of the information to be authenticated, and the network device 203 searches according to the information to be authenticated. Table, the second verification code associated with the information to be authenticated cannot be obtained. Therefore, the network device 203 considers that the third data packet is an illegal data packet from the reflection device 204, and discards the third data packet.
  • the storage form of the association relationship between the information to be authenticated and the second verification code in the storage device is indicated in the form of a table, not the storage form of the association relationship between the information to be authenticated and the second verification code in the storage device Limited, of course, the storage form of the association relationship between the information to be authenticated and the second verification code in the storage device may also be stored in other forms, which is not limited in the embodiment of the present application.
  • the network device 203 determines whether the third data packet is legal according to the first verification code and the second verification code.
  • the network device 203 may obtain the first verification code from the second destination port number, that is, obtain the last 12 bits of data in the second destination port number, that is, the first verification code.
  • the network device 203 may compare the first verification code and the second verification code, and if the first verification code and the second verification code are the same, determine that the third data packet is legal; if the first verification code and the second verification code are different, determine The third data packet is illegal.
  • the third data packet is an illegal data packet from the reflection device 204
  • the second destination port number does not include the first verification code, or the first verification code is not included. It is not obtained by the reflection device 204 by receiving the second data packet from the network device 203, and may be created by the attacker.
  • the second verification code generated by the network device 203 is different from the first verification code, so that most illegal traffic is filtered by verifying the value of the destination port field of the transport layer.
  • the network device 203 replaces the second destination port number with the first source port number to obtain the fourth data packet.
  • the network device 203 replaces the second source port number with the first source port number to obtain the fourth data packet.
  • the IP address of the reflection device 204 is 121.14.88.76
  • the IP address of the application server 205 is 192.168.1.1
  • the port for the application server 205 to send and receive the data of the first service is 10000
  • the reflection device 204 sends and receives the first service.
  • the port of the service data is 80.
  • the first source IP address is 192.168.1.1
  • the first destination IP address is 121.14.88.76
  • the transport layer protocol TCP and the first source port number Is 10000
  • the first destination port number is 80.
  • the source port field is set to 23101, and the second data packet is obtained.
  • the second source IP address is the IP address of the reflection device 204, which is 121.14.88.76
  • the second destination IP address is the IP address of the application server 205, which is 192.168 1.1
  • the transport layer protocol TCP the second source port number is 80 for the outgoing port of the reflection device 204 to send the data of the first service
  • the second destination port number is the second source port number, that is, 23101.
  • the network device 203 forwards the fourth data packet to the application server 205.
  • the network device 203 forwards the third data packet.
  • the network device 203 before replacing the second source port number with the first source port number, that is, S317, the network device 203 first obtains the first source port number, specifically the following detailed steps.
  • the network device 203 determines that the legal flow table includes the quintuple of the third data packet, and obtains the first source port number corresponding to the quintuple of the third data packet from the legal flow table.
  • the network device 203 sends the second data packet to the reflection device 204, the five-tuple information for the data exchange of the first service between the reflection device 204 and the application server 205 has been generated in the legal flow table.
  • the record also includes the first port index and the second source port number used to replace the first source port number. Therefore, the network device 203 can obtain the corresponding first source port according to the quintuple of the first data packet No.
  • the second source IP address in the third data packet is the first destination IP address in the first data packet, and the second source IP address corresponds to the destination IP recorded in the legal flow table.
  • the second destination IP address in the third data packet is the first source IP address in the first data packet, and the second destination IP address corresponds to the source IP recorded in the legal flow table.
  • the transport layer protocol number in the third data packet and the transport layer protocol number in the first data packet both correspond to the transport layer protocol number recorded in the legal flow table.
  • the third source port number in the third data packet is the first destination port number in the first data packet, and the third source port number corresponds to the destination port number recorded in the legal flow table.
  • the second destination port number in the third data packet is the second source port number after replacing the first source port number in the first data packet, and the second destination port number corresponds to the new source port number recorded in the legal flow table.
  • the network device 203 can use the five-tuple contained in the third data packet, that is, the second source IP address, the second destination IP address, the transport layer protocol number, the third source port number, and the second destination port number, from the legal flow table. Get the first source port number corresponding to the quintuple of the third data packet, that is, the new source port number corresponding to the quintuple of the third data packet in the legal flow table, and replace the third source port number with the new source port number in the legal flow table The second destination port number in the data packet obtains the fourth data packet.
  • FIG. 11 is a flowchart of a data processing method provided by an embodiment of the present application.
  • the data of the first service is transmitted between the reflection device 204 and the application server 205, and the network device 203 performs processing on the source port number in the data packet from the application server 205 Alternatively, the network device 202 verifies the data packet sent to the application server 205 as an example for description.
  • the method may include:
  • the application server 205 sends a first data packet to the network device 203, where the first data packet includes a transport layer protocol number, a first source port number, and a first destination port number.
  • the network device 203 receives the first data packet from the application server 205.
  • the network device 203 determines that the first data packet is a traffic sent to the reflection device 204 according to the transport layer protocol number and the first destination port number.
  • the network device 203 replaces the first source port number with the second source port number to obtain the second data packet.
  • the network device 203 sends a second data packet to the reflection device 204.
  • the network device 202 receives a third data packet.
  • the third data packet includes a transport layer protocol number, a third source port number, and a second destination port number, and the second destination port number includes the first verification code.
  • the network device 202 determines that the third data packet is a flow from the reflection device 204 according to the transport layer protocol number and the third source port number.
  • the network device 202 generates a second verification code according to the key and the information to be authenticated.
  • the network device 203 shares the key used to generate the first verification code with the network device 202, so that the network device 202 generates the second verification code according to the shared key and the information to be authenticated.
  • the network device 203 shares the correspondence between the information to be authenticated and the second verification code with the network device 202, so that the network device 202 obtains the second verification code associated with the information to be authenticated according to the shared information to be authenticated.
  • the network device 202 may look up a table according to the information to be authenticated, and obtain the second verification code associated with the information to be authenticated.
  • the network device 202 determines whether the third data packet is legal according to the first verification code and the second verification code.
  • the network device 202 forwards the third data packet.
  • the network device 203 receives the third data packet.
  • the network device 203 determines that the third data packet is a flow from the reflection device 204 according to the transport layer protocol number and the third source port number.
  • the network device 203 determines that the legal flow table includes the quintuple of the third data packet, and obtains the first source port number corresponding to the quintuple of the third data packet from the legal flow table.
  • the network device 203 replaces the second destination port number with the first source port number to obtain the fourth data packet.
  • the network device 203 forwards the fourth data packet to the application server 205.
  • the data processing method provided in the embodiments of the present application uses the port field included in the transport layer header in the data packet to carry the verifiable mark. After the network device receives the data packet from the reflection device, the verifiable mark is verified against the legitimate data packet and Illegal data packets are identified, and only legitimate data packets will be forwarded, which can deal with most reflection-type denial of service attacks.
  • the data processing method provided in the embodiments of the present application can ensure that legal traffic is forwarded, avoid legal traffic being discarded by the black hole, and the network device filters most of the DRDoS attack traffic.
  • the data processing method provided in the embodiments of the present application can reduce the delay in processing legal traffic caused by deep protocol analysis.
  • the network device since the verifiable identifier can be embedded in the destination port field, the network device does not need to process application layer data, and can directly filter at the transport layer, reducing the cost of defending against DRDoS attacks, and does not rely on cross-domain cooperation.
  • the network device includes hardware structures and/or software modules corresponding to each function.
  • the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed by hardware or computer software-driven hardware depends on the specific application scenarios and design constraints of the technical solution.
  • FIG. 12 and FIG. 13 are schematic structural diagrams of possible data processing apparatuses provided by embodiments of this application. These data processing apparatuses can be used to implement the functions of the network equipment in the foregoing method embodiments, and therefore can also achieve the beneficial effects of the foregoing method embodiments.
  • the data processing apparatus may be the network device 202 or the network device 203 as shown in FIG. 2, and may also be a module (such as a chip) applied to the network device.
  • the data processing device 1200 includes a receiving unit 1210, a processing unit 1220, and a sending unit 1230.
  • the data processing apparatus 1200 is used to implement the function of the network device in the method embodiment shown in FIG. 3, FIG. 4, FIG. 7, FIG. 8, FIG. 9, FIG. 10, or FIG. 11.
  • the receiving unit 1210 is used to perform S302; the processing unit 1220 is used to perform S303 and S304; and the sending unit 1230 is used to perform S305.
  • the receiving unit 1210 is used to perform S302; the processing unit 1220 is used to perform S3031, S3032, and S304; and the sending unit 1230 is used to perform S305 and S306.
  • the receiving unit 1210 is used to perform S302; the processing unit 1220 is used to perform S3031, S3032, and S304, and S307 to S312; Unit 1230 is used to execute S305 and S306.
  • the receiving unit 1210 is used to perform S302 and S313; the processing unit 1220 is used to perform S3031, S3032, and S304, and S307 to S312 , And S314 to S317; the sending unit 1230 is used to execute S305, S306, and S318.
  • the receiving unit 1210 is used to perform S302 and S313; the processing unit 1220 is used to perform S3031, S3032, and S304, and S307 to S312 , And S3141, S3142 to S317; the sending unit 1230 is used to execute S305, S306, S318, and S319.
  • the receiving unit 1210 is used to perform S302 and S313;
  • the processing unit 1220 is used to perform S3031, S3032, and S304, and S307 to S312 , And S3141, S3142 to S317, and S320;
  • the sending unit 1230 is used to execute S305, S306, S318, and S319.
  • the receiving unit 1210 is used to execute S1102 and S1111; the processing unit 1220 is used to execute S1103, S1104, S1112, S1113, and S1114;
  • the sending unit 1230 is used to execute S1105 and S1115.
  • the receiving unit 1210 is used to perform S1106; the processing unit 1220 is used to perform S1107 to S1109; and the sending unit 1230 is used to perform S1110.
  • the data processing device 1300 includes a processor 1310 and an interface circuit 1320.
  • the processor 1310 and the interface circuit 1320 are coupled with each other.
  • the interface circuit 1320 may be a transceiver or an input/output interface.
  • the data processing apparatus 1300 may further include a memory 1330 for storing instructions executed by the processor 1310 or storing input data required by the processor 1310 to run the instructions or storing data generated after the processor 1310 runs the instructions.
  • FIG. 3 When the data processing device 1300 is used to implement the method shown in FIG. 3, FIG. 4, FIG. 7, FIG. 8, FIG. 9, FIG. 10, or FIG. It is used to perform the functions of the receiving unit 1210 and the sending unit 1230 described above.
  • the processor in the embodiments of the present application may be a central processing unit (Central Processing Unit, CPU), or may be other general-purpose processors, digital signal processors (Digital Signal Processors, DSPs), or application specific integrated circuits. (Application Specific Integrated Circuit, ASIC), Field Programmable Gate Array (Field Programmable Gate Array, FPGA) or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof.
  • the general-purpose processor may be a microprocessor or any conventional processor.
  • the method steps in the embodiments of the present application can be implemented by hardware, and can also be implemented by a processor executing software instructions.
  • Software instructions can be composed of corresponding software modules, which can be stored in Random Access Memory (RAM), Flash memory, Read-Only Memory (ROM), Programmable ROM (Programmable ROM) , PROM), Erasable Programmable Read-Only Memory (Erasable PROM, EPROM), Electrically Erasable Programmable Read-Only Memory (Electrically EPROM, EEPROM), register, hard disk, mobile hard disk, CD-ROM or well-known in the art Any other form of storage medium.
  • An exemplary storage medium is coupled to the processor, so that the processor can read information from the storage medium and can write information to the storage medium.
  • the storage medium may also be an integral part of the processor.
  • the processor and the storage medium may be located in the ASIC.
  • the ASIC can be located in a network device or a terminal device.
  • the processor and the storage medium may also exist as discrete components in the network device or the terminal device.
  • the computer program product includes one or more computer programs or instructions.
  • the computer may be a general-purpose computer, a special-purpose computer, a computer network, network equipment, user equipment, or other programmable devices.
  • the computer program or instruction may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium.
  • the computer program or instruction may be downloaded from a website, computer, The server or data center transmits to another website site, computer, server or data center through wired or wireless means.
  • the computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server or a data center that integrates one or more available media.
  • the usable medium may be a magnetic medium, such as a floppy disk, a hard disk, and a magnetic tape; it may also be an optical medium, such as a digital video disc (digital video disc, DVD); and it may also be a semiconductor medium, such as a solid state drive (solid state drive). , SSD).
  • “at least one” refers to one or more, and “multiple” refers to two or more.
  • “And/or” describes the association relationship of the associated object, indicating that there can be three relationships, for example, A and/or B, which can mean: A alone exists, A and B exist at the same time, and B exists alone, where A, B can be singular or plural.
  • the character “/” generally indicates that the associated objects before and after are an “or” relationship; in the formula of this application, the character “/” indicates that the associated objects before and after are a kind of "division” Relationship.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Computer And Data Communications (AREA)

Abstract

Disclosed are a data processing method and apparatus, which relate to the field of communication, and solve the problem of how to quickly distinguish legitimate traffic from illegitimate traffic when defending against a DRDoS attack. The method comprises: after receiving a first data packet from a reflection device, a network device determining that the first data packet is traffic from the reflection device according to a transport layer protocol number and a first source port number, wherein the first data packet comprises a destination port number, and the destination port number is a third source port number after a second source port number is replaced when the network device sends a data packet to the reflection device; extracting a verification code from the destination port number, and verifying the verification code; if a third data packet passes verification, indicating that the third data packet is legitimate, replacing the destination port number with the second source port number, and forwarding a fourth data packet; and if the third data packet does not pass verification, indicating that the third data packet is illegitimate, and discarding the third data packet. Therefore, a large amount of forged attack traffic can be filtered out.

Description

一种数据处理方法及装置Data processing method and device
本申请要求于2020年05月30日提交国家知识产权局、申请号为202010480846.5、申请名称为“一种数据处理方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application filed with the State Intellectual Property Office on May 30, 2020, the application number is 202010480846.5, and the application name is "a data processing method and device", the entire content of which is incorporated into this application by reference middle.
技术领域Technical field
本申请涉及通信领域,尤其涉及一种数据处理方法及装置。This application relates to the field of communications, and in particular to a data processing method and device.
背景技术Background technique
目前,分布式反射拒绝服务(Distributed Reflection Denial of Service,DRDoS)攻击依然是破坏网络可用性,造成网络安全问题的一个主要因素。传统技术中,通常采用黑洞技术或流量清洗技术防御DRDoS攻击。但是,网络设备采用黑洞技术将非法流量和合法流量均导向黑洞,无法区分合法流量和非法流量。虽然,网络设备采用流量清洗技术可以区分合法流量和非法流量,但是区分合法流量和非法流量的时延较长。因此,如何在防御DRDoS攻击时,快速地区别合法流量和非法流量是一个亟待解决的问题。At present, Distributed Reflection Denial of Service (DRDoS) attacks are still a major factor that undermines network availability and causes network security problems. In traditional technologies, black hole technology or traffic cleaning technology is usually used to defend against DRDoS attacks. However, network equipment uses black hole technology to direct both illegal traffic and legal traffic to black holes, and cannot distinguish between legal traffic and illegal traffic. Although network equipment can distinguish legitimate traffic from illegal traffic using traffic cleaning technology, it takes a long time to distinguish legal traffic from illegal traffic. Therefore, how to quickly distinguish legitimate traffic from illegal traffic when defending against DRDoS attacks is an urgent problem to be solved.
发明内容Summary of the invention
本申请提供一种数据处理方法及装置,解决了如何在防御DRDoS攻击时,快速地区别合法流量和非法流量的问题。This application provides a data processing method and device, which solves the problem of how to quickly distinguish legitimate traffic from illegal traffic when defending against DRDoS attacks.
为达到上述目的,本申请采用如下技术方案:In order to achieve the above objectives, this application adopts the following technical solutions:
第一方面,本申请提供了一种数据处理方法,该方法可应用于网络设备,或者该方法可应用于可以支持网络设备实现该方法的通信装置,例如该通信装置包括芯片系统,方法包括:网络设备接收到第一数据包后,根据传输层协议号和第一端口号确定该第一数据包是一个来自反射设备的流量,从目的端口字段提取第一验证码,并根据密钥和待认证信息生成第二验证码,根据第一验证码和第二验证码确定第一数据包是否合法。若第一数据包合法,网络设备向受保护设备转发第一数据包。或者,网络设备用第二源端口号替换目的端口号,得到第二数据包;向受保护设备转发第二数据包。若第一数据包不合法,表示第一数据包不合法,丢弃第一数据包,从而可以过滤掉大量伪造的攻击流量。其中,第一数据包包括传输层协议号、第一源端口号和目的端口号。反射设备为发送DRDoS攻击的设备。例如,反射设备是一个具备被攻击者利用条件来发送DRDoS攻击流量的设备。反射设备可以为域名系统设备、网络时间协议设备或简单网络管理协议设备。待认证信息包括源互联网协议(Internet Protocol,IP)地址,源IP地址为反射设备的IP地址。可选地,网络设备也可以预先根据密钥和待认证信息生成第二验证码,保存待认证信息和第二验证码的对应关系。网络设备根据传输层协议号和第一源端口号确定第一数据包是一个来自反射设备的流量后,还可以根据待认证信息查表,获取与待认证信息关联的第二验证码。In the first aspect, this application provides a data processing method, which can be applied to a network device, or the method can be applied to a communication device that can support the network device to implement the method, for example, the communication device includes a chip system, and the method includes: After the network device receives the first data packet, it determines that the first data packet is a traffic from the reflection device according to the transport layer protocol number and the first port number, extracts the first verification code from the destination port field, and then according to the key and waiting The authentication information generates a second verification code, and it is determined whether the first data packet is legal according to the first verification code and the second verification code. If the first data packet is legal, the network device forwards the first data packet to the protected device. Or, the network device replaces the destination port number with the second source port number to obtain the second data packet; and forwards the second data packet to the protected device. If the first data packet is illegal, it means that the first data packet is illegal, and the first data packet is discarded, so that a large amount of forged attack traffic can be filtered out. Wherein, the first data packet includes the transport layer protocol number, the first source port number and the destination port number. The reflection device is the device that sends the DRDoS attack. For example, a reflection device is a device capable of being used by an attacker to send DRDoS attack traffic. The reflection device can be a domain name system device, a network time protocol device, or a simple network management protocol device. The information to be authenticated includes the source Internet Protocol (IP) address, and the source IP address is the IP address of the reflection device. Optionally, the network device may also generate a second verification code in advance based on the key and the information to be authenticated, and save the correspondence between the information to be authenticated and the second verification code. After the network device determines that the first data packet is a flow from the reflection device according to the transport layer protocol number and the first source port number, it can also look up the table according to the information to be authenticated to obtain the second verification code associated with the information to be authenticated.
本申请实施例提供的数据处理方法,利用数据包中传输层头部包括的端口字段携 带验证码,在网络设备接收到来自反射设备的数据包后,通过验证验证码对合法数据包和非法数据包进行识别,只有合法数据包才会被转发,能够应对大部分的反射类型的拒绝服务攻击。相对于黑洞技术,本申请实施例提供的数据处理方法能够确保合法流量被转发,避免合法流量被黑洞丢弃,网络设备过滤大部分的DRDoS攻击流量。相对于流量清洗技术,本申请实施例提供的数据处理方法能够降低深层协议解析带来的处理合法流量的延迟。另外,由于可验证标识可以内嵌在目的端口字段中,使得网络设备不需要处理应用层数据,可以直接在传输层进行过滤,降低防御DRDoS攻击的成本,不依赖于跨域协作。The data processing method provided by the embodiment of the application uses the port field included in the header of the transmission layer in the data packet to carry the verification code. Packets are identified, and only legitimate data packets will be forwarded, which can deal with most reflection-type denial-of-service attacks. Compared with the black hole technology, the data processing method provided in the embodiments of the present application can ensure that legal traffic is forwarded, avoid legal traffic being discarded by the black hole, and the network device filters most of the DRDoS attack traffic. Compared with the traffic cleaning technology, the data processing method provided in the embodiments of the present application can reduce the delay in processing legal traffic caused by deep protocol analysis. In addition, since the verifiable identifier can be embedded in the destination port field, network devices do not need to process application layer data, and can directly filter at the transport layer, reducing the cost of defending against DRDoS attacks, and does not rely on cross-domain cooperation.
在一种可能的设计中,根据传输层协议号和第一源端口号确定第一数据包是一个来自反射设备的流量,包括:确定反射型协议端口特征集合包括第一源端口号和传输层协议号,且传输层协议号是用户数据报协议(User Data Protocol,UDP)号或传输控制协议(Transfer Control Protocol,TCP)号,则第一数据包是一个来自反射设备的流量。In a possible design, determining that the first data packet is a traffic from the reflection device according to the transport layer protocol number and the first source port number includes: determining that the reflection type protocol port feature set includes the first source port number and the transport layer Protocol number, and the transport layer protocol number is a User Data Protocol (UDP) number or a Transmission Control Protocol (Transfer Control Protocol, TCP) number, then the first data packet is a flow from the reflection device.
在另一种可能的设计中,待认证信息还包括第一数据包包含的目的IP地址、第一源端口号和传输层协议号中至少一个。目的IP地址为受保护设备的IP地址,受保护设备为遭受DRDoS攻击的设备。In another possible design, the information to be authenticated further includes at least one of the destination IP address, the first source port number, and the transport layer protocol number included in the first data packet. The destination IP address is the IP address of the protected device, and the protected device is the device that is attacked by DRDoS.
可选的,待认证信息还包括端口索引和时间参数中至少一个,端口索引用于标识一个应用。Optionally, the information to be authenticated further includes at least one of a port index and a time parameter, and the port index is used to identify an application.
在另一种可能的设计中,目的端口号还包括端口索引。In another possible design, the destination port number also includes a port index.
在另一种可能的设计中,在用第二源端口号替换目的端口号之前,方法还包括:确定合法流表包括第一数据包的五元组,从合法流表中获取第一数据包的五元组对应的第二源端口号,第一数据包的五元组用于唯一标识一条网络流量,第一数据包的五元组包括源IP地址、目的IP地址、传输层协议号、第一源端口号和目的端口号。In another possible design, before replacing the destination port number with the second source port number, the method further includes: determining that the legal flow table includes the 5-tuple of the first data packet, and obtaining the first data packet from the legal flow table The quintuple corresponds to the second source port number. The quintuple of the first data packet is used to uniquely identify a piece of network traffic. The quintuple of the first data packet includes the source IP address, destination IP address, transport layer protocol number, The first source port number and destination port number.
第二方面,本申请提供了一种数据处理方法,该方法可应用于网络设备,或者该方法可应用于可以支持网络设备实现该方法的通信装置,例如该通信装置包括芯片系统,方法包括:网络设备接收第一数据包后,根据传输层协议号和目的端口号确定第一数据包是一个发往反射设备的流量,便用第二源端口号替换第一源端口号,得到第二数据包,发送第二数据包。其中,第一数据包包括传输层协议号、第一源端口号和目的端口号。第二源端口号包括验证码,验证码是根据密钥和待认证信息确定的,待认证信息包括目的IP地址,目的IP地址为反射设备的IP地址。In the second aspect, this application provides a data processing method, which can be applied to network equipment, or the method can be applied to a communication device that can support network equipment to implement the method. For example, the communication device includes a chip system, and the method includes: After the network device receives the first data packet, it determines that the first data packet is a traffic sent to the reflection device according to the transport layer protocol number and the destination port number, and then replaces the first source port number with the second source port number to obtain the second data Packet, send the second data packet. Wherein, the first data packet includes the transport layer protocol number, the first source port number and the destination port number. The second source port number includes a verification code, the verification code is determined based on the key and the information to be authenticated, the information to be authenticated includes the destination IP address, and the destination IP address is the IP address of the reflection device.
本申请实施例提供的数据处理方法,利用数据包中传输层头部包括的端口字段携带验证码,以便于在网络设备接收到来自反射设备的数据包后,通过验证验证码对合法数据包和非法数据包进行识别,只有合法数据包才会被转发,能够应对大部分的反射类型的拒绝服务攻击。The data processing method provided by the embodiments of the present application uses the port field included in the header of the transmission layer in the data packet to carry the verification code, so that after the network device receives the data packet from the reflection device, the verification code can verify the legal data packet and Illegal data packets are identified, and only legitimate data packets will be forwarded, which can deal with most reflection-type denial of service attacks.
在一种可能的设计中,根据传输层协议号和目的端口号确定第一数据包是一个发往反射设备的流量,包括:确定反射型协议端口特征集合包括目的端口号和传输层协议号,且传输层协议号是UDP号或TCP号,则第一数据包是一个发往反射设备的流量。In a possible design, determining that the first data packet is a traffic sent to the reflection device according to the transport layer protocol number and the destination port number includes: determining the reflection type protocol port feature set including the destination port number and the transport layer protocol number, And the transport layer protocol number is UDP number or TCP number, then the first data packet is a flow sent to the reflection device.
在另一种可能的设计中,待认证信息还包括第一数据包包含的源IP地址、目的端 口号和传输层协议号中至少一个,和/或,第一端口索引和时间参数中至少一个;源IP地址为源设备的IP地址,源设备为遭受DRDoS攻击的受保护设备,第一端口索引用于标识一个应用。In another possible design, the information to be authenticated further includes at least one of the source IP address, the destination port number, and the transport layer protocol number contained in the first data packet, and/or at least one of the first port index and the time parameter ; The source IP address is the IP address of the source device, and the source device is a protected device that suffers from a DRDoS attack. The first port index is used to identify an application.
在另一种可能的设计中,第二源端口号还包括第一端口索引。In another possible design, the second source port number also includes the first port index.
在另一种可能的设计中,在用第二源端口号替换第一源端口号之前,方法还包括:确定合法流表包括第一数据包的五元组,从合法流表中获取第一数据包的五元组对应的第二源端口号,第一数据包的五元组用于唯一标识一条网络流量,第一数据包的五元组包括源IP地址、目的IP地址、传输层协议号、第一源端口号和目的端口号。In another possible design, before replacing the first source port number with the second source port number, the method further includes: determining that the legal flow table includes the quintuple of the first data packet, and obtaining the first data packet from the legal flow table. The quintuple of the data packet corresponds to the second source port number. The quintuple of the first data packet is used to uniquely identify a piece of network traffic. The quintuple of the first data packet includes the source IP address, the destination IP address, and the transport layer protocol. Number, first source port number and destination port number.
在另一种可能的设计中,若合法流表不包括第一数据包的五元组,方法还包括:判断合法流表是否包括第一数据包中除第一源端口号的四元组;若合法流表不包括第一数据包中除第一源端口号的四元组,生成第一端口索引;若合法流表包括第一数据包的除第一源端口号的四元组,更新四元组对应的第二端口索引,得到第一端口索引。In another possible design, if the legal flow table does not include the five-tuple of the first data packet, the method further includes: determining whether the legal flow table includes the four-tuple of the first data packet except for the first source port number; If the legal flow table does not include the four-tuple except the first source port number in the first data packet, the first port index is generated; if the legal flow table includes the four-tuple except the first source port number in the first data packet, update The second port index corresponding to the quadruple obtains the first port index.
第三方面,本申请提供了一种数据处理方法,该方法可应用于网络设备,或者该方法可应用于可以支持网络设备实现该方法的通信装置,例如该通信装置包括芯片系统,方法包括:网络设备接收第一数据包后,根据传输层协议号和第一端口号确定该第一数据包是一个来自反射设备的流量。用第二源端口号替换第一数据包包含的目的端口号,得到第二数据包;向受保护设备转发第二数据包。其中,第一数据包包括传输层协议号、第一源端口号和目的端口号,目的端口号包括验证码。In a third aspect, this application provides a data processing method, which can be applied to network equipment, or the method can be applied to a communication device that can support network equipment to implement the method, for example, the communication device includes a chip system, and the method includes: After receiving the first data packet, the network device determines that the first data packet is a flow from the reflection device according to the transport layer protocol number and the first port number. Replace the destination port number contained in the first data packet with the second source port number to obtain the second data packet; forward the second data packet to the protected device. Wherein, the first data packet includes a transport layer protocol number, a first source port number and a destination port number, and the destination port number includes a verification code.
第四方面,本申请提供了一种数据处理方法,该方法可应用于网络设备,或者该方法可应用于可以支持网络设备实现该方法的通信装置,例如该通信装置包括芯片系统,方法包括:网络设备接收到第一数据包后,从第一数据包包含的目的端口字段中提取第一验证码,并根据密钥和待认证信息生成第二验证码,根据第一验证码和第二验证码确定第一数据包是否合法。若第一数据包合法,网络设备向受保护设备转发第一数据包。或者,网络设备用第二源端口号替换目的端口号,得到第二数据包;向受保护设备转发第二数据包。若第一数据包不合法,表示第一数据包不合法,丢弃第一数据包,从而可以过滤掉大量伪造的攻击流量。其中,反射设备为发送DRDoS攻击的设备。待认证信息包括第一数据包包含的源IP地址,源IP地址为反射设备的IP地址。In a fourth aspect, this application provides a data processing method, which can be applied to network equipment, or the method can be applied to a communication device that can support network equipment to implement the method. For example, the communication device includes a chip system, and the method includes: After receiving the first data packet, the network device extracts the first verification code from the destination port field contained in the first data packet, and generates a second verification code according to the key and the information to be authenticated, and according to the first verification code and the second verification code The code determines whether the first data packet is legal. If the first data packet is legal, the network device forwards the first data packet to the protected device. Or, the network device replaces the destination port number with the second source port number to obtain the second data packet; and forwards the second data packet to the protected device. If the first data packet is illegal, it means that the first data packet is illegal, and the first data packet is discarded, so that a large amount of forged attack traffic can be filtered out. Among them, the reflection device is a device that sends a DRDoS attack. The information to be authenticated includes the source IP address included in the first data packet, and the source IP address is the IP address of the reflection device.
第五方面,本申请提供了一种数据处理方法,该方法可应用于网络设备,或者该方法可应用于可以支持网络设备实现该方法的通信装置,例如该通信装置包括芯片系统,方法包括:网络设备接收第一数据包后,用第二源端口号替换第一数据包包含的第一源端口号,得到第二数据包,发送第二数据包。其中,第二源端口号包括验证码,验证码是根据密钥和待认证信息确定的,待认证信息包括第一数据包包含的目的IP地址,目的IP地址为反射设备的IP地址。In the fifth aspect, this application provides a data processing method, which can be applied to network equipment, or the method can be applied to a communication device that can support network equipment to implement the method, for example, the communication device includes a chip system, and the method includes: After receiving the first data packet, the network device replaces the first source port number included in the first data packet with the second source port number to obtain the second data packet, and then sends the second data packet. Wherein, the second source port number includes a verification code, the verification code is determined according to the key and the information to be authenticated, the information to be authenticated includes the destination IP address included in the first data packet, and the destination IP address is the IP address of the reflection device.
第六方面,本申请提供了一种数据处理方法,该方法可应用于网络设备,或者该方法可应用于可以支持网络设备实现该方法的通信装置,例如该通信装置包括芯片系统,方法包括:网络设备接收到第一数据包后,用第二源端口号替换第一数据包包含的目的端口号,得到第二数据包;向受保护设备转发第二数据包。其中,第一数据包包括传输层协议号、第一源端口号和目的端口号,目的端口号包括验证码。In a sixth aspect, this application provides a data processing method, which can be applied to network equipment, or the method can be applied to a communication device that can support network equipment to implement the method. For example, the communication device includes a chip system, and the method includes: After receiving the first data packet, the network device replaces the destination port number contained in the first data packet with the second source port number to obtain the second data packet; and forwards the second data packet to the protected device. Wherein, the first data packet includes a transport layer protocol number, a first source port number and a destination port number, and the destination port number includes a verification code.
第七方面,本申请实施例还提供了一种通信装置,有益效果可以参见第一方面的描述此处不再赘述。所述通信装置具有实现上述第一方面或第四方面的方法实例中行为的功能。所述功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。所述硬件或软件包括一个或多个与上述功能相对应的模块。在一个可能的设计中,所述通信装置包括:接收单元、处理单元和发送单元。接收单元,用于接收第一数据包,第一数据包包括传输层协议号、第一源端口号和目的端口号,目的端口号包括第一验证码。处理单元,用于根据传输层协议号和第一源端口号确定第一数据包是一个来自反射设备的流量。处理单元,还用于根据密钥和待认证信息生成第二验证码,待认证信息包括第一数据包包含的源IP地址,源IP地址为反射设备的IP地址。处理单元,还用于根据第一验证码和第二验证码确定第一数据包是否合法。处理单元,还用于用第二源端口号替换目的端口号,得到第二数据包。发送单元,用于向受保护设备转发第一数据包或第二数据包,第二数据包包括第二源端口号。这些单元可以执行上述第一方面或第四方面方法示例中的相应功能,具体参见方法示例中的详细描述,此处不做赘述。In the seventh aspect, the embodiments of the present application also provide a communication device, and the beneficial effects can be referred to the description of the first aspect and will not be repeated here. The communication device has a function of realizing the behavior in the method example of the first aspect or the fourth aspect. The functions can be realized by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above-mentioned functions. In a possible design, the communication device includes: a receiving unit, a processing unit, and a sending unit. The receiving unit is configured to receive a first data packet, where the first data packet includes a transport layer protocol number, a first source port number, and a destination port number, and the destination port number includes a first verification code. The processing unit is configured to determine that the first data packet is a flow from the reflection device according to the transport layer protocol number and the first source port number. The processing unit is further configured to generate a second verification code according to the key and the information to be authenticated. The information to be authenticated includes the source IP address contained in the first data packet, and the source IP address is the IP address of the reflection device. The processing unit is further configured to determine whether the first data packet is legal according to the first verification code and the second verification code. The processing unit is further configured to replace the destination port number with the second source port number to obtain the second data packet. The sending unit is configured to forward the first data packet or the second data packet to the protected device, where the second data packet includes the second source port number. These units can perform the corresponding functions in the method examples of the first aspect or the fourth aspect. For details, please refer to the detailed description in the method examples, which will not be repeated here.
第八方面,本申请实施例还提供了一种通信装置,有益效果可以参见第二方面的描述此处不再赘述。所述通信装置具有实现上述第二方面或第五方面的方法实例中行为的功能。所述功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。所述硬件或软件包括一个或多个与上述功能相对应的模块。在一个可能的设计中,该通信装置包括:接收单元、处理单元和发送单元。接收单元,用于接收第一数据包,第一数据包包括传输层协议号、第一源端口号和目的端口号。处理单元,用于根据传输层协议号和目的端口号确定第一数据包是一个发往反射设备的流量。处理单元,还用于用第二源端口号替换第一源端口号,得到第二数据包,第二源端口号包括验证码,验证码是根据密钥和待认证信息确定的,待认证信息包括第一数据包包含的目的IP地址,目的IP地址为反射设备的IP地址。发送单元,用于发送第二数据包。这些模块可以执行上述第二方面或第五方面方法示例中的相应功能,具体参见方法示例中的详细描述,此处不做赘述。In the eighth aspect, the embodiments of the present application also provide a communication device, and the beneficial effects can be referred to the description of the second aspect and will not be repeated here. The communication device has the function of realizing the behavior in the method example of the second aspect or the fifth aspect described above. The functions can be realized by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above-mentioned functions. In a possible design, the communication device includes: a receiving unit, a processing unit, and a sending unit. The receiving unit is configured to receive a first data packet, where the first data packet includes a transport layer protocol number, a first source port number, and a destination port number. The processing unit is configured to determine that the first data packet is a flow sent to the reflection device according to the transport layer protocol number and the destination port number. The processing unit is further configured to replace the first source port number with the second source port number to obtain a second data packet, the second source port number includes a verification code, the verification code is determined according to the key and the information to be authenticated, and the information to be authenticated The destination IP address included in the first data packet is included, and the destination IP address is the IP address of the reflection device. The sending unit is used to send the second data packet. These modules can perform the corresponding functions in the method examples of the second aspect or the fifth aspect. For details, please refer to the detailed description in the method examples, which will not be repeated here.
第九方面,本申请实施例还提供了一种通信装置,有益效果可以参见第三方面的描述此处不再赘述。所述通信装置具有实现上述第三方面或第六方面的方法实例中行为的功能。所述功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。所述硬件或软件包括一个或多个与上述功能相对应的模块。在一个可能的设计中,该通信装置包括:接收单元、处理单元和发送单元。接收单元,用于接收第一数据包;处理单元,用于根据传输层协议号和第一端口号确定该第一数据包是一个来自反射设备的流量;处理单元,还用于用第二源端口号替换目的端口号,得到第二数据包。发送单元,用于向受保护设备转发第二数据包。其中,第一数据包包括传输层协议号、第一源端口号和目的端口号,目的端口号包括第一验证码。这些模块可以执行上述第三方面或第六方面方法示例中的相应功能,具体参见方法示例中的详细描述,此处不做赘述。In the ninth aspect, the embodiments of the present application also provide a communication device, and the beneficial effects can be referred to the description of the third aspect and will not be repeated here. The communication device has the function of realizing the behavior in the method example of the third aspect or the sixth aspect. The functions can be realized by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above-mentioned functions. In a possible design, the communication device includes: a receiving unit, a processing unit, and a sending unit. The receiving unit is used to receive the first data packet; the processing unit is used to determine that the first data packet is a flow from the reflection device according to the transport layer protocol number and the first port number; the processing unit is also used to use the second source The port number replaces the destination port number to obtain the second data packet. The sending unit is used to forward the second data packet to the protected device. The first data packet includes the transport layer protocol number, the first source port number, and the destination port number, and the destination port number includes the first verification code. These modules can perform the corresponding functions in the method examples of the third aspect or the sixth aspect. For details, please refer to the detailed description in the method examples, which will not be repeated here.
第十方面,提供了一种通信装置,该通信装置可以为上述方法实施例中的网络设备,或者为设置在网络设备中的芯片。该通信装置包括接口电路以及处理器,可选的, 还包括存储器。其中,该存储器用于存储计算机程序或指令,处理器与存储器、接口电路耦合,当处理器执行所述计算机程序或指令时,使通信装置执行上述方法实施例中由网络设备所执行的方法。In a tenth aspect, a communication device is provided. The communication device may be the network device in the foregoing method embodiment, or a chip set in the network device. The communication device includes an interface circuit, a processor, and optionally, a memory. The memory is used to store a computer program or instruction, and the processor is coupled with the memory and an interface circuit. When the processor executes the computer program or instruction, the communication device executes the method executed by the network device in the foregoing method embodiment.
第十一方面,提供了一种计算机程序产品,所述计算机程序产品包括:计算机程序代码,当所述计算机程序代码并运行时,使得上述第一方面至第六方面中由网络设备执行的方法被执行。In an eleventh aspect, there is provided a computer program product, the computer program product comprising: computer program code, when the computer program code is running, make the above-mentioned method of the first to sixth aspects executed by the network device Be executed.
第十二方面,本申请提供了一种芯片系统,该芯片系统包括处理器,用于实现上述各方面的方法中网络设备的功能。在一种可能的设计中,所述芯片系统还包括存储器,用于保存程序指令和/或数据。该芯片系统,可以由芯片构成,也可以包括芯片和其他分立器件。In a twelfth aspect, the present application provides a chip system, which includes a processor, and is configured to implement the functions of the network device in the methods of the foregoing aspects. In a possible design, the chip system further includes a memory for storing program instructions and/or data. The chip system can be composed of chips, and can also include chips and other discrete devices.
第十三方面,本申请提供了一种计算机可读存储介质,该计算机可读存储介质存储有计算机程序,当该计算机程序被运行时,实现上述第一方面至第六方面中由网络设备执行的方法。In a thirteenth aspect, the present application provides a computer-readable storage medium that stores a computer program, and when the computer program is run, it is executed by a network device in the first to sixth aspects above. Methods.
本申请中,网络设备和数据处理装置的名字对设备本身不构成限定,在实际实现中,这些设备可以以其他名称出现。只要各个设备的功能和本申请类似,属于本申请权利要求及其等同技术的范围之内。In this application, the names of the network equipment and the data processing device do not constitute a limitation on the equipment itself. In actual implementation, these equipment may appear under other names. As long as the function of each device is similar to that of this application, it falls within the scope of the claims of this application and its equivalent technologies.
附图说明Description of the drawings
图1为现有技术提供的一种DRDoS攻击示例图;Figure 1 is an example diagram of a DRDoS attack provided by the prior art;
图2为本申请一实施例提供的通信系统的架构示例图;FIG. 2 is an example diagram of the architecture of a communication system provided by an embodiment of this application;
图3为本申请一实施例提供的数据处理方法的流程图;FIG. 3 is a flowchart of a data processing method provided by an embodiment of the application;
图4为本申请一实施例提供的数据处理方法的流程图;FIG. 4 is a flowchart of a data processing method provided by an embodiment of the application;
图5为本申请一实施例提供的IPv4数据包的结构示意图;FIG. 5 is a schematic diagram of the structure of an IPv4 data packet provided by an embodiment of this application;
图6为本申请一实施例提供的源端口号的结构示意图;FIG. 6 is a schematic structural diagram of a source port number provided by an embodiment of this application;
图7为本申请一实施例提供的数据处理方法的流程图;FIG. 7 is a flowchart of a data processing method provided by an embodiment of the application;
图8为本申请一实施例提供的数据处理方法的流程图;FIG. 8 is a flowchart of a data processing method provided by an embodiment of the application;
图9为本申请一实施例提供的数据处理方法的流程图;FIG. 9 is a flowchart of a data processing method provided by an embodiment of the application;
图10为本申请一实施例提供的数据处理方法的流程图;FIG. 10 is a flowchart of a data processing method provided by an embodiment of this application;
图11为本申请一实施例提供的数据处理方法的流程图;FIG. 11 is a flowchart of a data processing method provided by an embodiment of the application;
图12为本申请一实施例提供的数据处理装置的结构示意图;FIG. 12 is a schematic structural diagram of a data processing device provided by an embodiment of the application;
图13为本申请一实施例提供的数据处理装置的结构示意图。FIG. 13 is a schematic structural diagram of a data processing device provided by an embodiment of the application.
具体实施方式detailed description
本申请说明书和权利要求书及上述附图中的术语“第一”、“第二”和“第三”等是用于区别不同对象,而不是用于限定特定顺序。在本申请实施例中,“示例性的”或者“例如”等词用于表示作例子、例证或说明。本申请实施例中被描述为“示例性的”或者“例如”的任何实施例或设计方案不应被解释为比其它实施例或设计方案更优选或更具优势。确切而言,使用“示例性的”或者“例如”等词旨在以具体方式呈现相关概念。The terms "first", "second", and "third" in the specification and claims of this application and the above-mentioned drawings are used to distinguish different objects, rather than to limit a specific order. In the embodiments of the present application, words such as "exemplary" or "for example" are used as examples, illustrations, or illustrations. Any embodiment or design solution described as "exemplary" or "for example" in the embodiments of the present application should not be construed as being more preferable or advantageous than other embodiments or design solutions. To be precise, words such as "exemplary" or "for example" are used to present related concepts in a specific manner.
为了下述各实施例的描述清楚简洁,首先给出相关技术的简要介绍:In order to be clear and concise in the description of the following embodiments, first, a brief introduction of related technologies is given:
分布式反射拒绝服务(Distributed Reflection Denial of Service,DRDoS)攻击与分 布式拒绝服务(Distributed Denial of Service,DDoS)攻击的不同之处在于,在攻击之前攻击者不需要占领大量的受控设备,攻击者只用很少的资源向受控设备发送源互联网协议(Internet Protocol,IP)地址为受保护设备的IP地址的数据包,受控设备对受保护设备做出大量回应,从而成功攻击受保护设备。The difference between the Distributed Reflection Denial of Service (DRDoS) attack and the Distributed Denial of Service (DDoS) attack is that the attacker does not need to occupy a large number of controlled devices before the attack. The user uses very few resources to send data packets whose source Internet Protocol (IP) address is the IP address of the protected device to the controlled device, and the controlled device makes a large number of responses to the protected device, thus successfully attacking the protected device. equipment.
图1为本申请实施例提供的一种DRDoS攻击原理示意图。受控设备指由攻击设备直接控制的设备。攻击设备在得知受保护设备(比如服务器)的IP地址之后,即可控制多个受控设备以受保护设备的IP地址IP VIC作为源IP地址,将反射设备的IP地址IP n作为目的地址,将伪造了源地址的数据包发向反射设备,即向大量分布式部署的反射设备发送服务请求。每个反射设备在接收到来自受控设备的服务请求之后,即可向受保护设备发送用于攻击受保护设备的数据包。通过发送少量的攻击流量请求给分布式可利用的反射设备,被利用的反射设备将流量放大到几十倍甚至十几万倍返回给受保护设备,大量被放大的反射流量汇聚到受保护设备,致使受保护设备资源耗尽,不能向正常用户提供服务,形成DRDOS攻击。然而,受保护设备在受到DRDOS攻击的过程中,由反射设备向受保护设备发送的数据包,不仅包括用于攻击受保护设备的数据包,还可能包括并非用于攻击受保护设备的合法数据包,比如反射设备对来自受保护设备的服务请求进行响应以发出的响应数据包、反射设备主动发出的、用于请求受保护设备向其提供特定服务的请求数据包。 FIG. 1 is a schematic diagram of the principle of a DRDoS attack provided by an embodiment of the application. Controlled equipment refers to equipment directly controlled by the attacking equipment. After the attacking device knows the IP address of the protected device (such as the server), it can control multiple controlled devices to use the IP address of the protected device IP VIC as the source IP address, and the IP address of the reflecting device IP n as the destination address , Send the data packet with the forged source address to the reflection device, that is, send a service request to a large number of distributed deployment reflection devices. After each reflecting device receives the service request from the controlled device, it can send a data packet for attacking the protected device to the protected device. By sending a small amount of attack traffic requests to the distributed and available reflection devices, the utilized reflection devices amplify the traffic by dozens of times or even hundreds of thousands of times and return it to the protected device, and a large amount of amplified reflected traffic is aggregated to the protected device , Causing the resources of the protected equipment to be exhausted and unable to provide services to normal users, forming a DRDOS attack. However, when a protected device is under a DRDOS attack, the data packets sent by the reflection device to the protected device include not only data packets used to attack the protected device, but may also include legitimate data that is not used to attack the protected device Packets, such as a response data packet sent by the reflection device in response to a service request from a protected device, and a request data packet actively sent by the reflection device to request the protected device to provide it with a specific service.
所谓受保护设备可以理解为是攻击者可能攻击的设备,例如,在本申请的实施例中受保护设备可以是应用服务器、路由器或物联网(Internet of Things,IoT)中的设备等,本申请对此不作限定。例如,IoT设备可以是消防报警设备等。如果消防报警设备遭受攻击,使其不能感应火灾进行报警,从而使其无法往外发送报警消息,带来严重的安全威胁。在下文中,以受保护设备是应用服务器进行举例说明。The so-called protected device can be understood as a device that may be attacked by an attacker. For example, in the embodiment of this application, the protected device can be an application server, a router, or a device in the Internet of Things (IoT). There is no restriction on this. For example, the IoT device may be a fire alarm device or the like. If the fire alarm equipment is attacked, it will not be able to detect the fire and make an alarm, so that it will not be able to send out alarm messages, which will pose a serious security threat. In the following, the protected device is an application server as an example.
黑客往往会选择那些响应包远大于请求包的服务来利用,这样才可以以较小的流量换取更大的流量,获得几倍甚至几十倍的放大效果。反射设备为发送DRDoS攻击的设备。例如,反射设备是一个具备被攻击者利用条件来发送DRDoS攻击流量的设备。一般来说,反射设备包括但不限于域名系统(Domain Name System,DNS)服务器、网络时间协议(Network Time Protocol,NTP)服务器、简单服务发现协议(Simple Service Discovery Protocol,SSDP)服务器、简单网络管理协议(SNMP,simple network management protocol)服务器、轻量目录访问协议(LDAP,lightweight directory access protocol)服务器、Chargen服务器和Memcached服务器等。Hackers often choose those services whose response packets are much larger than the request packets to use, so that smaller traffic can be exchanged for larger traffic, and an amplification effect of several times or even tens of times can be obtained. The reflection device is the device that sends the DRDoS attack. For example, a reflection device is a device capable of being used by an attacker to send DRDoS attack traffic. Generally speaking, reflection devices include, but are not limited to, Domain Name System (DNS) servers, Network Time Protocol (NTP) servers, Simple Service Discovery Protocol (SSDP) servers, and simple network management Protocol (SNMP, simple network management protocol) server, lightweight directory access protocol (LDAP, lightweight directory access protocol) server, Charge server and Memcached server, etc.
由于DRDos攻击成本很低,攻击能力很强,如Memcached服务器的反射放大能力很强(放大十几万倍,单次攻击流量达到1.94Tbps[5万倍]),DNS服务器和NTP服务器均能将流量放大几十倍,使得DRDoS攻击手段赋予了攻击者四两拨千斤的能力,因此,DRDoS是大部分DRDoS攻击黑市中引导服务(booter service)惯用的手段。Due to the low cost of DRDos attacks and strong attack capabilities, for example, the Memcached server has a strong reflection amplification capability (amplified by hundreds of thousands of times, and the traffic of a single attack can reach 1.94Tbps [50 thousand times]), and both the DNS server and the NTP server can Amplification of traffic dozens of times makes the DRDoS attack method endow the attacker with the ability to make a lot of money. Therefore, DRDoS is the usual means for most DRDoS attacks on the booter service in the black market.
由于被反射的攻击流量中的源地址是真实的,当前解决方案没有办法使受保护设备前侧的网络设备具备在网络层或传输层快速区分反射型攻击流量和合法流量的能力。Since the source address in the reflected attack traffic is real, the current solution has no way to make the network device on the front side of the protected device have the ability to quickly distinguish between the reflected attack traffic and the legal traffic at the network layer or the transport layer.
下面将结合附图对本申请实施例的实施方式进行详细描述。The implementation of the embodiments of the present application will be described in detail below in conjunction with the accompanying drawings.
图2示出的是可以应用于本申请实施例的通信系统的架构示例图。如图2所示, 该通信系统包括至少一个终端201、互联网络和数据中心。互联网络可以是互联网服务提供商(Internet Service Provider,ISP)网络。ISP可以是指向广大用户综合提供互联网接入业务、信息业务和增值业务的电信运营商。互联网络包括至少一个网络设备(如:网络设备202和网络设备203)。在本文中,网络设备可以是路由器、交换机、负载均衡器或专用防火墙。例如,网络设备202是部署在电信运营商网络靠近数据中心的网络设备。网络设备203是部署在数据中心的出口处的网络设备。比如,网络设备203是云数据中心中的出口路由器,也可以是云数据中心的高防中心与运营商网络相连的链路上的网络设备。互联网络还包括反射设备204,反射设备204为容易被黑客利用发送DRDoS攻击的设备。所述数据中心包括至少一个应用服务器205。多个应用服务器可以是独立的不同的物理设备,也可以是将多个应用服务器的功能集成在同一个物理设备上(如:云服务提供商管辖范围内的多个应用服务器),还可以是一个物理设备上集成了部分应用服务器的功能。每个应用服务器上可以运行一个或多个服务(如:游戏服务)。服务也可称为应用。每个服务可以部署在多个应用服务器上,由多个应用服务器支持运行。终端201通过无线或有线的方式与网络设备相连。网络设备将通过无线或有线方式连接。网络设备通过无线或有线方式与应用服务器205连接。终端可以是固定位置的,也可以是可移动的。图2只是示意图,该通信系统中还可以包括其它设备,如还可以包括无线中继设备和无线回传设备,在图2中未画出。本申请的实施例对该通信系统中包括的终端、网络设备和应用服务器的数量不做限定。FIG. 2 shows an example diagram of the architecture of a communication system that can be applied to the embodiments of the present application. As shown in FIG. 2, the communication system includes at least one terminal 201, an internet network, and a data center. The Internet can be an Internet Service Provider (ISP) network. An ISP can be a telecom operator that provides comprehensive Internet access services, information services, and value-added services to a large number of users. The internet includes at least one network device (for example, network device 202 and network device 203). In this article, network devices can be routers, switches, load balancers, or dedicated firewalls. For example, the network device 202 is a network device deployed on a telecommunication operator network close to a data center. The network device 203 is a network device deployed at the exit of the data center. For example, the network device 203 is an egress router in a cloud data center, or it may be a network device on a link between the high defense center of the cloud data center and the operator's network. The Internet also includes a reflection device 204, which is a device that can easily be used by hackers to send DRDoS attacks. The data center includes at least one application server 205. Multiple application servers can be independent and different physical devices, or they can integrate the functions of multiple application servers on the same physical device (such as multiple application servers within the jurisdiction of a cloud service provider), or Some application server functions are integrated on a physical device. Each application server can run one or more services (such as game services). Services can also be called applications. Each service can be deployed on multiple application servers and supported by multiple application servers. The terminal 201 is connected to the network device in a wireless or wired manner. The network devices will be connected wirelessly or wiredly. The network device is connected to the application server 205 in a wireless or wired manner. The terminal can be a fixed location, or it can be movable. FIG. 2 is only a schematic diagram, and the communication system may also include other devices, such as wireless relay devices and wireless backhaul devices, which are not shown in FIG. 2. The embodiments of the present application do not limit the number of terminals, network devices, and application servers included in the communication system.
其中,终端(Terminal)201也可以称为终端设备、用户设备(user equipment,Among them, the terminal (Terminal) 201 may also be referred to as a terminal device or a user equipment (user equipment,
UE)、移动台(mobile station,MS)、移动终端(mobile terminal,MT)等。终端401可以是手机(mobile phone)、平板电脑(Pad)、带无线收发功能的电脑、虚拟现实(Virtual Reality,VR)终端设备、增强现实(Augmented Reality,AR)终端设备、工业控制(industrial control)中的无线终端、无人驾驶(self driving)中的无线终端、远程手术(remote medical surgery)中的无线终端、智能电网(smart grid)中的无线终端、运输安全(transportation safety)中的无线终端、智慧城市(smart city)中的无线终端、智慧家庭(smart home)中的无线终端等等。本申请的实施例对终端所采用的具体技术和具体设备形态不做限定。UE), mobile station (mobile station, MS), mobile terminal (mobile terminal, MT), etc. The terminal 401 may be a mobile phone (mobile phone), a tablet computer (Pad), a computer with wireless transceiver function, a virtual reality (VR) terminal device, an augmented reality (Augmented Reality, AR) terminal device, an industrial control (industrial control) Wireless terminals in ), wireless terminals in self-driving, wireless terminals in remote medical surgery, wireless terminals in smart grid, and wireless terminals in transportation safety Terminals, wireless terminals in smart cities, wireless terminals in smart homes, etc. The embodiment of the present application does not limit the specific technology and specific device form adopted by the terminal.
终端201与应用服务器205之间通过发送数据包传输数据。数据包包括五元组。五元组能够区分不同会话,并且对应的会话是唯一的。五元组包括源IP地址、目的IP地址、传输层协议号、源端口号和目的端口号。例如,IP地址为192.168.1.1的设备通过端口10000,利用TCP,与IP地址为121.14.88.76,且端口为80的设备进行连接,传输数据。TCP的协议号为6。五元组为192.168.1.1 10000 6 121.14.88.76 80。The terminal 201 and the application server 205 transmit data by sending data packets. The data packet includes five-tuples. The five-tuple can distinguish different sessions, and the corresponding session is unique. The five-tuple includes source IP address, destination IP address, transport layer protocol number, source port number, and destination port number. For example, a device with an IP address of 192.168.1.1 uses TCP to connect to a device with an IP address of 121.14.88.76 and a port of 80 through port 10000 to transmit data. The protocol number of TCP is 6. The quintuple is 192.168.1.1 10000 6 121.14.88.76 80.
应理解,传输层协议号为TCP的协议号或UDP的协议号。UDP的协议号为17。It should be understood that the transport layer protocol number is the protocol number of TCP or the protocol number of UDP. The protocol number of UDP is 17.
网络设备(如网络设备203或网络设备202)接收到来自应用服务器205的数据包时,通过传输层协议和目的端口号判断该数据包是否是发往反射设备204的数据包,如果是发往反射设备204的数据包,则用第二源端口号替换数据包包含的第一源端口号,即用第二源端口号替换指示应用服务器205运行的应用的端口号,第二源端口号中嵌入验证码。验证码的生成算法中,绑定了数据包的头部信息,例如,源IP地址和目的IP地址。When a network device (such as network device 203 or network device 202) receives a data packet from the application server 205, it judges whether the data packet is sent to the reflection device 204 through the transport layer protocol and the destination port number, if it is sent to For the data packet of the reflection device 204, the second source port number is used to replace the first source port number contained in the data packet, that is, the second source port number is used to replace the port number indicating the application server 205 is running. The second source port number is Embed verification code. In the generation algorithm of the verification code, the header information of the data packet is bound, for example, the source IP address and the destination IP address.
进而,网络设备(如网络设备203或网络设备202)接收到发往应用服务器205的数据包时,通过传输层协议和第一源端口号判断该数据包是否是一个来自反射设备204的数据包。如果是来自反射设备204的数据包,则从该数据包中提取出待认证信息,以及从目的端口号中提取第一验证码,利用密钥和待认证信息生成第二验证码,根据第二验证码和第一验证码确定该数据包是否合法。例如,若第二验证码与第一验证码相同,确定该数据包合法;若第二验证码与第一验证码不同,确定该数据包不合法,丢弃数据包。待认证信息包括源IP地址和目的IP地址等。Furthermore, when a network device (such as the network device 203 or the network device 202) receives a data packet sent to the application server 205, it judges whether the data packet is a data packet from the reflection device 204 through the transport layer protocol and the first source port number . If it is a data packet from the reflection device 204, the information to be authenticated is extracted from the data packet, and the first verification code is extracted from the destination port number, and the second verification code is generated using the key and the information to be authenticated. The verification code and the first verification code determine whether the data packet is legal. For example, if the second verification code is the same as the first verification code, it is determined that the data packet is legal; if the second verification code is different from the first verification code, it is determined that the data packet is illegal, and the data packet is discarded. The information to be authenticated includes source IP address and destination IP address, etc.
由于应用服务器205的端口号已替换为第二源端口号,在网络设备接收到发往应用服务器205的数据包时,为了避免网络设备无法将数据包传输至应用服务器205,将第二源端口号替换为应用服务器205的端口号。Since the port number of the application server 205 has been replaced with the second source port number, when the network device receives the data packet sent to the application server 205, in order to prevent the network device from being unable to transmit the data packet to the application server 205, the second source port Replace the port number with the port number of the application server 205.
需要说明的是,端口号指示应用层的协议,也可以指示应用程序的某个线程。端口号主要用于指示处理上层应用的数据的进程或者线程。在本申请中,网络设备接收到发往反射设备的第一数据包后,用第二源端口号替换第一数据包包含的第一源端口号,替换后的第二源端口号不指示处理上层应用的数据的进程或者线程,而是表示携带了验证码的信息。可选的,第二源端口号还包括端口索引,端口索引用于区分不同的服务,具体指示一个服务,即应用服务器205与反射设备204支持运行的服务。It should be noted that the port number indicates the protocol of the application layer, and can also indicate a certain thread of the application program. The port number is mainly used to indicate the process or thread that processes the data of the upper application. In this application, after the network device receives the first data packet sent to the reflection device, it replaces the first source port number contained in the first data packet with the second source port number, and the replaced second source port number does not indicate processing The process or thread of the data of the upper-layer application indicates the information that carries the verification code. Optionally, the second source port number further includes a port index. The port index is used to distinguish different services and specifically indicates a service, that is, a service supported by the application server 205 and the reflection device 204 to run.
进而,以便于网络设备接收到来自反射设备的第二数据包后,从第二数据包包含的目的端口号中提取验证码,验证第二数据包是否合法,若第二数据包合法,转发第二数据包;若第二数据包不合法,丢弃第二数据包。应理解,第二数据包为第一数据包的响应数据包,第二数据包中目的端口字段填充的内容就是第一数据包中源端口字段填充的内容,即第二数据包包含的目的端口号与第一数据包包含的第二源端口号相同。Furthermore, after receiving the second data packet from the reflection device, the network device extracts the verification code from the destination port number contained in the second data packet to verify whether the second data packet is legal. If the second data packet is legal, forward the first data packet. Second data packet; if the second data packet is illegal, discard the second data packet. It should be understood that the second data packet is the response data packet of the first data packet, and the content filled in the destination port field in the second data packet is the content filled in the source port field in the first data packet, that is, the destination port contained in the second data packet The number is the same as the second source port number contained in the first data packet.
接下来,对本申请提供的数据处理方法进行详细说明。图3为本申请一实施例提供的数据处理方法流程图,这里以网络设备203传输反射设备204与应用服务器205之间的第一服务的数据为例进行说明。如图3所示,该方法可以包括:Next, the data processing method provided by this application will be described in detail. 3 is a flowchart of a data processing method provided by an embodiment of the application. Here, the network device 203 transmits the data of the first service between the reflection device 204 and the application server 205 as an example for description. As shown in Figure 3, the method may include:
S301、应用服务器205向网络设备203发送第一数据包,第一数据包包括传输层协议号、第一源端口号和第一目的端口号。S301. The application server 205 sends a first data packet to the network device 203, where the first data packet includes a transport layer protocol number, a first source port number, and a first destination port number.
S302、网络设备203接收来自应用服务器205的第一数据包。S302. The network device 203 receives the first data packet from the application server 205.
在这里,传输层协议号为UDP号或TCP号。第一源端口号指示应用服务器205中处理第一服务的数据的进程或线程。第一目的端口号指示反射设备204中处理第一服务的数据的进程或线程。Here, the transport layer protocol number is UDP number or TCP number. The first source port number indicates the process or thread in the application server 205 that processes the data of the first service. The first destination port number indicates the process or thread in the reflection device 204 that processes the data of the first service.
S303、网络设备203根据传输层协议号和第一目的端口号确定第一数据包是一个发往反射设备204的流量。S303. The network device 203 determines that the first data packet is a traffic sent to the reflection device 204 according to the transport layer protocol number and the first destination port number.
网络设备203接收到第一数据包后,从第一数据包的包头中提取传输层协议号和第一目的端口号,判断反射型协议端口特征集合是否包括第一目的端口号和传输层协议号,以便确定第一数据包是否一个发往反射设备204的流量。After receiving the first data packet, the network device 203 extracts the transport layer protocol number and the first destination port number from the header of the first data packet, and determines whether the reflective protocol port feature set includes the first destination port number and the transport layer protocol number , In order to determine whether the first data packet is a traffic sent to the reflection device 204.
具体的,如图4所示,S303包括以下详细步骤。Specifically, as shown in FIG. 4, S303 includes the following detailed steps.
S3031、网络设备203判断传输层协议号是否是UDP号或TCP号。S3031. The network device 203 judges whether the transport layer protocol number is a UDP number or a TCP number.
若网络设备203确定传输层协议号是UDP号或TCP号,执行S3032;若网络设备 203确定传输层协议号不是UDP号或TCP号,则表示第一数据包不是一个发往反射设备204的流量,执行S306。If the network device 203 determines that the transport layer protocol number is a UDP number or a TCP number, execute S3032; if the network device 203 determines that the transport layer protocol number is not a UDP number or a TCP number, it means that the first data packet is not a traffic sent to the reflection device 204 , Go to S306.
S3032、网络设备203判断反射型协议端口特征集合是否包括第一目的端口号。S3032. The network device 203 determines whether the reflective protocol port feature set includes the first destination port number.
若网络设备203确定反射型协议端口特征集合包括第一目的端口号,则表示第一数据包是一个发往反射设备204的流量,执行S304;若网络设备203确定反射型协议端口特征集合不包括第一目的端口号,则表示第一数据包不是一个发往反射设备204的流量,执行S306。反射型协议端口特征集合包含的传输层协议号和端口号指示的设备是可发送DRDoS攻击的设备。If the network device 203 determines that the reflective protocol port feature set includes the first destination port number, it means that the first data packet is a traffic sent to the reflective device 204, and S304 is executed; if the network device 203 determines that the reflective protocol port feature set does not include The first destination port number indicates that the first data packet is not a traffic sent to the reflection device 204, and S306 is executed. The device indicated by the transport layer protocol number and port number included in the reflection-type protocol port feature set is a device that can send DRDoS attacks.
在一些实施例中,网络设备203可以维护一个协议端口号关系。所谓协议端口号关系可以是指传输层协议和端口号的对应关系。协议端口号关系可以以表格的形式呈现。网络设备203可以存储有协议端口号关系表,协议端口号关系表包括至少一个传输层协议和端口号的对应关系。示例的,如表1所示,呈现了协议端口号对应关系。In some embodiments, the network device 203 may maintain a protocol port number relationship. The so-called protocol port number relationship may refer to the corresponding relationship between the transport layer protocol and the port number. The protocol port number relationship can be presented in the form of a table. The network device 203 may store a protocol port number relationship table, and the protocol port number relationship table includes at least one correspondence relationship between a transport layer protocol and a port number. For example, as shown in Table 1, the corresponding relationship between the protocol port numbers is presented.
表1Table 1
传输层协议Transport layer protocol 端口号The port number
UDPUDP 5353
UDPUDP 123123
UDPUDP 19001900
需要说明的是,表1只是以表格的形式示意协议端口号关系在存储设备中的存储形式,并不是对协议端口号关系在存储设备中的存储形式的限定,当然,协议端口号关系在存储设备中的存储形式还可以以其他的形式存储,本申请实施例对此不做限定。It should be noted that Table 1 only shows the storage form of the protocol port number relationship in the storage device in the form of a table, and does not limit the storage form of the protocol port number relationship in the storage device. Of course, the protocol port number relationship is stored in the storage device. The storage form in the device may also be stored in other forms, which is not limited in the embodiment of the present application.
S304、网络设备203用第二源端口号替换第一源端口号,得到第二数据包。S304. The network device 203 replaces the first source port number with the second source port number to obtain the second data packet.
第二源端口号包括第一验证码。可理解的,第二源端口号设置于第一数据包中的源端口字段。对于网络设备203接收到来自反射设备204的数据包,该数据包是第一服务的流量时,第二源端口号设置于数据包中的目的端口字段。从而,以便于网络设备203根据第二源端口号包括的第一验证码验证来自反射设备204的数据包是否合法。因此,第二源端口号可以认为是一个可验证标识,并不是指示处理上层应用的数据的进程或者线程。The second source port number includes the first verification code. It is understandable that the second source port number is set in the source port field in the first data packet. When the network device 203 receives a data packet from the reflection device 204, and the data packet is the traffic of the first service, the second source port number is set in the destination port field in the data packet. Thus, it is convenient for the network device 203 to verify whether the data packet from the reflection device 204 is legal according to the first verification code included in the second source port number. Therefore, the second source port number can be regarded as a verifiable identification, and does not indicate a process or thread for processing the data of the upper-layer application.
示例的,图5示为IPv4数据包的结构示例图。如图5中的(a)所示,IPv4数据包包括基本首部和数据部分。数据部分可以称为有效载荷(payload)或净负荷。IPv4的基本首部也可以称为IPv4的头部。IPV4头部可以依次包括如下各个字段:版本号、头部长度、服务类型、数据包总长度、重组标识、标志、段偏移量、生存时间、协议代码、头部校验和、源IP地址、目的IP地址和可选项。For example, Figure 5 shows an example of the structure of an IPv4 data packet. As shown in (a) in Figure 5, the IPv4 data packet includes a basic header and a data part. The data part can be called payload (payload) or net load. The basic header of IPv4 can also be referred to as the header of IPv4. The IPV4 header can include the following fields in turn: version number, header length, service type, total length of data packet, reassembly identifier, flag, segment offset, time to live, protocol code, header checksum, source IP address , Destination IP address and optional options.
如图5中的(b)所示,为TCP数据包的结构示例图。TCP数据包包含于IP数据包的数据部分内。TCP数据包包括TCP首部和TCP数据包的数据部分。TCP首部包括源端口(source port)、目的端口(destination port)、序列号(sequence number)、确认号(acknowledgment number)、数据偏移(header length)、保留(resv)、紧急(UGR)、确认(ACK)、推送(PSH)、复位(RST)、同步(SYN)、终止(FIN)、窗口(window size)、检验和(checksum)、紧急指针(urgent pointer)和选项(options)。关于TCP数据包的各字段具体解释可以参考现有技术的阐述,不予赘述。As shown in Figure 5 (b), it is a diagram of an example of the structure of a TCP data packet. The TCP data packet is contained in the data part of the IP data packet. The TCP data packet includes the TCP header and the data part of the TCP data packet. The TCP header includes source port (source port), destination port (destination port), sequence number (sequence number), acknowledgment number (acknowledgment number), data offset (header length), reservation (resv), emergency (UGR), confirmation (ACK), push (PSH), reset (RST), synchronization (SYN), termination (FIN), window (window size), checksum (checksum), urgent pointer (urgent pointer) and options (options). Regarding the specific explanation of each field of the TCP data packet, reference may be made to the explanation of the prior art, and the details are not repeated.
第一数据包包括的第一源端口号设置于源端口字段,网络设备203用第二源端口号替换第一源端口号后,源端口字段包括第二源端口号。The first source port number included in the first data packet is set in the source port field. After the network device 203 replaces the first source port number with the second source port number, the source port field includes the second source port number.
在一种可能的设计中,第二源端口号还包括第一端口索引(portindex)。第一端口索引用于标识应用服务器205运行的第一服务。示例的,第二源端口号满足如下公式(1)。In a possible design, the second source port number also includes the first port index (portindex). The first port index is used to identify the first service run by the application server 205. For example, the second source port number satisfies the following formula (1).
SrcLoc′=PID||code    (1)SrcLoc′=PID||code (1)
其中,SrcLoc′表示第二源端口号。PID表示第一端口索引。code表示第一验证码。||表示连接符。Among them, SrcLoc' represents the second source port number. PID represents the first port index. code represents the first verification code. || means a connector.
如图6所示,为本申请实施例提供的第一数据包中第二源端口号的组成示意图。其中,第一端口索引占源端口字段中前4比特(bit),第一验证码占源端口字段后12bit。As shown in FIG. 6, it is a schematic diagram of the composition of the second source port number in the first data packet provided by this embodiment of the application. Among them, the first port index occupies the first 4 bits (bit) in the source port field, and the first verification code occupies the last 12 bits in the source port field.
其中,第一验证码是根据密钥和待认证信息确定的。待认证信息包括第一数据包包含的第一目的IP地址,第一目的IP地址为反射设备204的IP地址。Wherein, the first verification code is determined according to the key and the information to be authenticated. The information to be authenticated includes the first destination IP address included in the first data packet, and the first destination IP address is the IP address of the reflection device 204.
可选的,待认证信息还包括第一数据包包含的第一源IP地址、第一目的端口号和传输层协议号中至少一个。第一源IP地址为应用服务器205的IP地址,应用服务器205为遭受DRDoS攻击的设备。Optionally, the information to be authenticated further includes at least one of the first source IP address, the first destination port number, and the transport layer protocol number included in the first data packet. The first source IP address is the IP address of the application server 205, and the application server 205 is a device that suffers from a DRDoS attack.
例如,第一验证码是根据密钥、第一目的IP地址和第一源IP地址确定的。可理解的,网络设备203利用密钥对第一目的IP地址和第一源IP地址加密得到第一验证码。第一验证码满足如下公式(2)。For example, the first verification code is determined based on the key, the first destination IP address, and the first source IP address. It is understandable that the network device 203 uses the key to encrypt the first destination IP address and the first source IP address to obtain the first verification code. The first verification code satisfies the following formula (2).
code=F key(IP R,IP S)    (2) code=F key (IP R ,IP S ) (2)
其中,code表示第一验证码。IP R表示第一目的IP地址。IP S表示第一源IP地址。 Among them, code represents the first verification code. IP R represents the first destination IP address. IP S represents the first source IP address.
又如,第一验证码是根据密钥、第一目的IP地址、第一源IP地址和第一目的端口号确定的。可理解的,网络设备203利用密钥对第一目的IP地址、第一源IP地址和第一目的端口号加密得到第一验证码。For another example, the first verification code is determined based on the key, the first destination IP address, the first source IP address, and the first destination port number. It is understandable that the network device 203 encrypts the first destination IP address, the first source IP address, and the first destination port number by using the key to obtain the first verification code.
又如,第一验证码是根据密钥、第一目的IP地址、第一源IP地址、第一目的端口号和传输层协议号确定的。可理解的,网络设备203利用密钥对第一目的IP地址、第一源IP地址、第一目的端口号和传输层协议号加密得到第一验证码。For another example, the first verification code is determined based on the key, the first destination IP address, the first source IP address, the first destination port number, and the transport layer protocol number. It is understandable that the network device 203 uses a key to encrypt the first destination IP address, the first source IP address, the first destination port number, and the transport layer protocol number to obtain the first verification code.
可选的,待认证信息还包括第一端口索引和时间参数中至少一个。时间参数可以是指接收第一数据包的时刻,时间参数可以是一个较粗粒度的时间单位。Optionally, the information to be authenticated further includes at least one of the first port index and the time parameter. The time parameter may refer to the moment when the first data packet is received, and the time parameter may be a relatively coarse-grained time unit.
可理解的,如果待认证信息包括时间参数,网络设备203接收来自应用服务器205的数据包的时刻和接收来自反射设备204的数据包的时刻相同。It is understandable that if the information to be authenticated includes a time parameter, the time when the network device 203 receives the data packet from the application server 205 is the same as the time when the data packet from the reflection device 204 is received.
又如,第一验证码是根据密钥、第一目的IP地址、第一源IP地址和第一端口索引确定的。可理解的,网络设备203利用密钥对第一目的IP地址、第一源IP地址和第一端口索引加密得到第一验证码。For another example, the first verification code is determined according to the key, the first destination IP address, the first source IP address, and the first port index. It is understandable that the network device 203 encrypts the first destination IP address, the first source IP address, and the first port index by using the key to obtain the first verification code.
第一验证码满足如下公式(3)。The first verification code satisfies the following formula (3).
code=F key(IP R,IP S,PID)    (3) code=F key (IP R ,IP S ,PID) (3)
其中,code表示第一验证码。IP R表示第一目的IP地址。IP S表示第一源IP地址。 Among them, code represents the first verification code. IP R represents the first destination IP address. IP S represents the first source IP address.
F()表示一种密码算法。密码算法是使用带密钥的哈希算法,例如,与密钥相关的哈希运算消息认证码(Hash-based Message Authentication Code,HMAC)。密码算法是基于对称分组密码的杂凑算法。key是密钥。code可以是密码算法的输出结果的部 分。例如,密码算法输出结果的12bit的部分。F() represents a cryptographic algorithm. The cryptographic algorithm uses a hash algorithm with a key, for example, a hash-based message authentication code (Hash-based Message Authentication Code, HMAC) related to the key. The cryptographic algorithm is a hash algorithm based on symmetric block ciphers. key is the key. Code can be part of the output result of a cryptographic algorithm. For example, the 12-bit part of the output result of a cryptographic algorithm.
可选地,网络设备203根据密钥和待认证信息生成第一验证码后,可以根据待认证信息和第一验证码生成流表。可理解的,流表包含多个表项。每个表现表示一个待认证信息和一个验证码的对应关系。从而,以便于网络设备203接收到数据包后,根据待认证信息查询流表获取与待认证信息关联的验证码,验证数据包包含的验证码和查询流表获取的验证码是否相同,进而确定数据包是否合法。Optionally, after the network device 203 generates the first verification code according to the key and the information to be authenticated, it may generate the flow table according to the information to be authenticated and the first verification code. It is understandable that the flow table contains multiple entries. Each performance represents the corresponding relationship between a piece of information to be authenticated and a verification code. Therefore, after receiving the data packet, the network device 203 queries the flow table according to the information to be authenticated to obtain the verification code associated with the information to be authenticated, and verifies whether the verification code contained in the data packet is the same as the verification code obtained by querying the flow table, and then determines Whether the data packet is legal.
S305、网络设备203向反射设备204发送第二数据包。S305. The network device 203 sends the second data packet to the reflection device 204.
S306、网络设备203转发第一数据包。S306. The network device 203 forwards the first data packet.
在一些实施例中,如图7所示,在用第二源端口号替换第一源端口号,即S304之前,网络设备203先获取第一端口索引,具体的以下详细步骤。In some embodiments, as shown in FIG. 7, before replacing the first source port number with the second source port number, that is, S304, the network device 203 first obtains the first port index, specifically the following detailed steps.
S307、网络设备203判断合法流表是否包括第一数据包的五元组。S307. The network device 203 judges whether the legal flow table includes the quintuple of the first data packet.
网络设备203为每个服务维护一个服务端口对应关系。所谓服务端口对应关系可以是指端口索引、与该端口索引对应的五元组和新源端口号的对应关系。服务端口对应关系可以以表格的形式呈现。新源端口是指示上述包括第一验证码的第二源端口号。网络设备203可以存储有合法流表,合法流表包括至少一个服务端口对应关系。示例的,如表2所示,呈现了服务端口对应关系。The network device 203 maintains a service port correspondence for each service. The so-called service port correspondence may refer to the correspondence between the port index, the quintuple corresponding to the port index, and the new source port number. The service port correspondence can be presented in the form of a table. The new source port is the number indicating the second source port including the first verification code. The network device 203 may store a legal flow table, and the legal flow table includes at least one service port correspondence. For example, as shown in Table 2, the corresponding relationship between service ports is presented.
表2Table 2
Figure PCTCN2021096986-appb-000001
Figure PCTCN2021096986-appb-000001
由表2可知,不同的序号表示不同的服务的流量信息。例如,序号1表示的流量1的信息。序号2表示的流量2的信息。序号3表示的流量3的信息。It can be seen from Table 2 that different serial numbers represent traffic information of different services. For example, the information of flow 1 indicated by the serial number 1. The serial number 2 represents the information of flow 2. The serial number 3 represents the information of the flow rate 3.
由流量1的信息可知,IP地址为192.168.1.1的设备通过端口10000,利用TCP,与IP地址为121.14.88.76,且端口为80的设备进行连接,传输数据。TCP的协议号为6。五元组为192.168.1.1 10000 6 121.14.88.76 80。According to the information of flow 1, the device with IP address 192.168.1.1 uses port 10000 and uses TCP to connect with the device with IP address 121.14.88.76 and port 80 to transmit data. The protocol number of TCP is 6. The quintuple is 192.168.1.1 10000 6 121.14.88.76 80.
由流量2的信息可知,序号2表示的第二条记录可知,IP地址为192.168.1.1的设备通过端口5000,利用TCP,与IP地址为121.14.88.76,且端口为80的设备进行连接,传输数据。五元组为192.168.1.1 5000 6 121.14.88.76 80。According to the information of flow 2, the second record represented by sequence number 2 shows that the device with IP address 192.168.1.1 uses port 5000 to connect with the device with IP address 121.14.88.76 and port 80 through TCP. data. The quintuple is 192.168.1.1 5000 6 121.14.88.76 80.
由流量3的信息可知,序号3表示的第三条记录可知,IP地址为192.168.1.1的设备通过端口3000,利用TCP,与IP地址为121.14.88.76,且端口为100的设备进行连接,传输数据。五元组为192.168.1.1 3000 6 121.14.88.76 100。According to the information of flow 3, the third record represented by sequence number 3 shows that the device with IP address 192.168.1.1 uses port 3000 and uses TCP to connect with the device with IP address 121.14.88.76 and port 100, and transmit data. The quintuple is 192.168.1.1 3000 6 121.14.88.76 100.
由于流量1的信息和流量2的信息中仅源端口号不同,即流量1的信息和流量2的信息包括相同的四元组,表示流量1和流量2是同一个源设备向同一个目的设备发送的不同服务的流量。Since only the source port number is different between the information of flow 1 and the information of flow 2, that is, the information of flow 1 and the information of flow 2 include the same four-tuple, which means that flow 1 and flow 2 are from the same source device to the same destination device The traffic of different services sent.
端口索引用于区分不同的服务的流量。源IP地址、目的IP地址、传输层协议和目的端口号相同的情况下,可以使用不同的端口索引区分不同的流。端口索引的初始值为1,从而避免新源端口号落入常用端口号0-4096区间。The port index is used to distinguish the traffic of different services. When the source IP address, destination IP address, transport layer protocol, and destination port number are the same, different port indexes can be used to distinguish different flows. The initial value of the port index is 1, so as to prevent the new source port number from falling into the 0-4096 range of commonly used port numbers.
需要说明的是,表2只是以表格的形式示意服务端口对应关系在存储设备中的存储形式,并不是对服务端口对应关系在存储设备中的存储形式的限定,当然,服务端口对应关系在存储设备中的存储形式还可以以其他的形式存储,本申请实施例对此不做限定。It should be noted that Table 2 only shows the storage form of the service port correspondence in the storage device in the form of a table, and does not limit the storage form of the service port correspondence in the storage device. Of course, the service port correspondence is stored in the storage device. The storage form in the device may also be stored in other forms, which is not limited in the embodiment of the present application.
若合法流表包括第一数据包的五元组,表示网络设备203已向反射设备204发送过数据,网络设备203存储有第一数据包的五元组信息,执行S308;若合法流表不包括第一数据包的五元组,表示网络设备203未向反射设备204发送过数据,执行S309。所述第一数据包的五元组用于唯一标识第一服务的网络流量。所述第一数据包的五元组包括第一源IP地址、第一目的IP地址、传输层协议号、第一源端口号和第一目的端口号。If the legal flow table includes the quintuple of the first data packet, it means that the network device 203 has sent data to the reflection device 204, and the network device 203 has stored the quintuple information of the first data packet, go to S308; if the legal flow table does not The five-tuple including the first data packet indicates that the network device 203 has not sent data to the reflection device 204, and S309 is executed. The five-tuple of the first data packet is used to uniquely identify the network traffic of the first service. The five-tuple of the first data packet includes a first source IP address, a first destination IP address, a transport layer protocol number, a first source port number, and a first destination port number.
S308、网络设备203从合法流表中获取第一数据包的五元组对应的第二源端口号。S308. The network device 203 obtains the second source port number corresponding to the quintuple of the first data packet from the legal flow table.
例如,第一数据包的五元组包括流量1的信息,第二源端口号为23101。For example, the quintuple of the first data packet includes information about flow 1, and the second source port number is 23101.
S309、网络设备203判断合法流表是否包括第一数据包中除第一源端口号的四元组。S309. The network device 203 judges whether the legal flow table includes the quadruple except the first source port number in the first data packet.
若合法流表不包括第一数据包中除第一源端口号的四元组,表示网络设备203未向反射设备204发送过数据,执行S310;若合法流表包括第一数据包的除第一源端口号的四元组,表示网络设备203向反射设备204发送过数据,但是网络设备203未向反射设备204发送过第一服务的数据,执行S311。If the legal flow table does not include the four-tuple except the first source port number in the first data packet, it means that the network device 203 has not sent data to the reflection device 204, and S310 is executed; if the legal flow table includes the first data packet except for the first data packet A four-tuple of a source port number indicates that the network device 203 has sent data to the reflection device 204, but the network device 203 has not sent the data of the first service to the reflection device 204, and S311 is executed.
S310、网络设备203生成第一端口索引。S310. The network device 203 generates a first port index.
可理解的,网络设备203在合法流表新增一条记录,设置第一数据包的五元组,并设置第一端口索引为1。执行S312。It is understandable that the network device 203 adds a new record in the legal flow table, sets the quintuple of the first data packet, and sets the first port index to 1. Go to S312.
S311、网络设备203更新四元组对应的第二端口索引,得到第一端口索引。S311. The network device 203 updates the second port index corresponding to the quadruple to obtain the first port index.
可理解的,第二端口索引用于指示网络设备203向反射设备204发送的非第一服务的数据,为了区分第一服务和其他服务,可以更新第二端口索引得到第一端口索引。例如,网络设备203在合法流表新增一条记录,设置第一数据包的五元组,并设置第一端口索引为第二端口索引加1。执行S312。It is understandable that the second port index is used to indicate the data of the non-first service sent by the network device 203 to the reflection device 204. In order to distinguish the first service from other services, the second port index may be updated to obtain the first port index. For example, the network device 203 adds a new record in the legal flow table, sets the quintuple of the first data packet, and sets the first port index to the second port index plus 1. Go to S312.
S312、网络设备203根据密钥和待认证信息生成第一验证码,以及根据第一验证码生成第二源端口号。S312. The network device 203 generates a first verification code according to the key and the information to be authenticated, and generates a second source port number according to the first verification code.
关于生成第一验证码和第二源端口号具体方法可以参考上述S304的阐述,不予赘述。For the specific method for generating the first verification code and the second source port number, reference may be made to the description of S304 above, which will not be repeated.
进一步的,网络设备203接收到来自反射设备204的数据包后,可以根据第一验证码验证接收到的数据包的合法性,从而过滤非法流量。如图8所示,具体的参考以下S313至S318的详述。Further, after the network device 203 receives the data packet from the reflection device 204, it can verify the legitimacy of the received data packet according to the first verification code, thereby filtering illegal traffic. As shown in FIG. 8, for details, refer to the detailed description of S313 to S318 below.
S313、网络设备203接收第三数据包,第三数据包包括传输层协议号、第三源端口号和第二目的端口号。S313. The network device 203 receives a third data packet, where the third data packet includes a transport layer protocol number, a third source port number, and a second destination port number.
S314、网络设备203根据传输层协议号和第三源端口号确定第三数据包是一个来自反射设备204的流量。S314. The network device 203 determines that the third data packet is a flow from the reflection device 204 according to the transport layer protocol number and the third source port number.
通常,源端口号指示源设备处理服务的数据的进程或线程。目的端口号指示目的设备处理服务的数据的进程或线程。在这里,第三源端口号指示反射设备204中处理 第一服务的数据的进程或线程。Generally, the source port number indicates the process or thread in which the source device processes the data of the service. The destination port number indicates the process or thread in which the destination device processes the data of the service. Here, the third source port number indicates the process or thread in the reflection device 204 that processes the data of the first service.
应理解,由于网络设备203向反射设备204发送第二数据包时,用第二源端口号替换第一源端口号。此时,第二源端口号设置于第三数据包中的目的端口字段,即第二目的端口号可以理解为第二源端口号。第二目的端口号包括第一验证码。It should be understood that when the network device 203 sends the second data packet to the reflection device 204, the first source port number is replaced with the second source port number. At this time, the second source port number is set in the destination port field in the third data packet, that is, the second destination port number can be understood as the second source port number. The second destination port number includes the first verification code.
可选的,第一验证码为该第三数据包包括的目的端口字段中的一个组成部分。例如,第二目的端口号还包括第一端口索引。第二目的端口号的组成可参考图6所示,其中,第一端口索引占目的端口字段中前4bit,第一验证码占目的端口字段后12bit。Optionally, the first verification code is a component of the destination port field included in the third data packet. For example, the second destination port number also includes the first port index. The composition of the second destination port number can be referred to as shown in FIG. 6, where the first port index occupies the first 4 bits in the destination port field, and the first verification code occupies the last 12 bits in the destination port field.
网络设备203接收到第三数据包后,从第三数据包的包头中提取传输层协议号和第三源端口号,判断反射型协议端口特征集合是否包括第三源端口号和传输层协议号,以便确定第三数据包是否一个来自反射设备204的流量。After receiving the third data packet, the network device 203 extracts the transport layer protocol number and the third source port number from the header of the third data packet, and determines whether the reflective protocol port feature set includes the third source port number and the transport layer protocol number , In order to determine whether the third data packet is a flow from the reflection device 204.
具体的,如图9所示,步骤S314包括以下详细步骤。Specifically, as shown in FIG. 9, step S314 includes the following detailed steps.
S3141、网络设备203判断传输层协议号是否是UDP号或TCP号。S3141. The network device 203 judges whether the transport layer protocol number is a UDP number or a TCP number.
若网络设备203确定传输层协议号是UDP号或TCP号,执行S3142;若网络设备203确定传输层协议号不是UDP号或TCP号,则表示第三数据包不是一个来自反射设备204的流量,执行S319。If the network device 203 determines that the transport layer protocol number is a UDP number or a TCP number, execute S3142; if the network device 203 determines that the transport layer protocol number is not a UDP number or a TCP number, it means that the third data packet is not a flow from the reflection device 204. Perform S319.
S3142、网络设备203判断反射型协议端口特征集合是否包括第三源端口号。S3142. The network device 203 determines whether the reflective protocol port feature set includes the third source port number.
若网络设备203确定反射型协议端口特征集合包括第三源端口号,则表示第三数据包是一个来自反射设备204的流量,网络设备203根据待认证信息获取第二验证码,例如,网络设备203执行S315,或者获取与待认证信息关联的第二验证码;若网络设备203确定反射型协议端口特征集合不包括第三源端口号,则表示第三数据包不是一个来自反射设备204的流量,执行S319。关于反射型协议端口特征集合的解释可以参考上述S302的阐述,不予赘述。If the network device 203 determines that the reflection-type protocol port feature set includes the third source port number, it means that the third data packet is a traffic from the reflection device 204, and the network device 203 obtains the second verification code according to the information to be authenticated, for example, the network device 203 executes S315, or obtains the second verification code associated with the information to be authenticated; if the network device 203 determines that the reflective protocol port feature set does not include the third source port number, it means that the third data packet is not a traffic from the reflective device 204 , Go to S319. For the explanation of the reflection-type protocol port feature set, please refer to the description of S302 above, and will not be repeated.
需要说明的是,若第三数据包不是一个来自反射设备204的流量,第二目的端口号指示应用服务器205运行的第一服务的进程或线程,即应用服务器205通过该第二目的端口号指示的端口接收第一服务的数据。It should be noted that if the third data packet is not a flow from the reflection device 204, the second destination port number indicates the process or thread of the first service run by the application server 205, that is, the application server 205 indicates through the second destination port number The port receives the data of the first service.
若第三数据包是一个来自反射设备204的流量,第二目的端口号包括第一验证码。第二目的端口号并非指示应用服务器205运行的第一服务的进程或线程,而是一个可验证的标识,用于区分合法流量和非法流量。If the third data packet is a flow from the reflection device 204, the second destination port number includes the first verification code. The second destination port number does not indicate the process or thread of the first service run by the application server 205, but is a verifiable identification used to distinguish legitimate traffic from illegal traffic.
S315、网络设备203根据密钥和待认证信息生成第二验证码。S315. The network device 203 generates a second verification code according to the key and the information to be authenticated.
待认证信息包括第二源IP地址,第二源IP地址为反射设备204的IP地址。The information to be authenticated includes the second source IP address, and the second source IP address is the IP address of the reflection device 204.
可选的,待认证信息还包括第三数据包包含的第二目的IP地址、第三源端口号和传输层协议号中至少一个。第二目的IP地址为应用服务器205的IP地址。Optionally, the information to be authenticated further includes at least one of the second destination IP address, the third source port number, and the transport layer protocol number included in the third data packet. The second destination IP address is the IP address of the application server 205.
可选的,待认证信息还包括第一端口索引和时间参数中至少一个。Optionally, the information to be authenticated further includes at least one of the first port index and the time parameter.
网络设备203可以从第二目的端口号中获取第一端口索引,即获取第二目的端口号中前4比特的数据,即第一端口索引。或者,网络设备203可以从合法流表中获取第三数据包的五元组对应的第一端口索引。The network device 203 may obtain the first port index from the second destination port number, that is, obtain the first 4 bits of data in the second destination port number, that is, the first port index. Alternatively, the network device 203 may obtain the first port index corresponding to the quintuple of the third data packet from the legal flow table.
需要说明的是,生成第二验证码的方法与生成第一验证码的方法相同,这样才能保证第一验证码和第二验证码相同。生成第二验证码的具体方式可以参考上述S303中生成第一验证码的阐述,不予赘述。It should be noted that the method for generating the second verification code is the same as the method for generating the first verification code, so as to ensure that the first verification code and the second verification code are the same. For the specific method of generating the second verification code, please refer to the description of generating the first verification code in S303, which will not be repeated.
另外,网络设备203根据密钥和待认证信息生成第二验证码可以理解为网络设备203接收到第三数据包,确定第三数据包是一个来自反射设备204的流量后,实时生成第二验证码。In addition, the network device 203 generates the second verification code according to the key and the information to be authenticated. It can be understood that the network device 203 receives the third data packet and determines that the third data packet is a flow from the reflection device 204, and then generates the second verification in real time. code.
在另一种情形下,本申请实施例提供的数据处理方法步骤的先后顺序可以进行适当调整。示例地,网络设备203接收到第三数据包之前,网络设备203根据密钥和待认证信息预先生成了第二验证码,并保存了待认证信息和第二验证码的对应关系。待认证信息例如是五元组,网络设备203预先保存了五元组与第二验证码的关系。关于待认证信息,以及生成第二验证码的方法的解释参考S315的阐述。In another situation, the sequence of the steps of the data processing method provided in the embodiments of the present application can be appropriately adjusted. For example, before the network device 203 receives the third data packet, the network device 203 pre-generates the second verification code according to the key and the information to be authenticated, and saves the correspondence between the information to be authenticated and the second verification code. The information to be authenticated is, for example, a five-tuple, and the network device 203 pre-stores the relationship between the five-tuple and the second verification code. For the explanation of the information to be authenticated and the method of generating the second verification code, refer to the description of S315.
网络设备203接收到第三数据包,确定第三数据包是一个来自反射设备204的流量后,网络设备203可以根据待认证信息获取与待认证信息关联的第二验证码。例如,网络设备203可以以表格的形式存储待认证信息与第二验证码的关联关系。网络设备203获取到待认证信息后,根据待认证信息查流表,获取与待认证信息关联的第二验证码。After the network device 203 receives the third data packet and determines that the third data packet is a flow from the reflection device 204, the network device 203 can obtain the second verification code associated with the information to be authenticated according to the information to be authenticated. For example, the network device 203 may store the association relationship between the information to be authenticated and the second verification code in the form of a table. After obtaining the information to be authenticated, the network device 203 checks the flow table according to the information to be authenticated, and obtains the second verification code associated with the information to be authenticated.
可选地,如果第三数据包是来自反射设备204的非法数据包,网络设备203可能未存储待认证信息,则流表中不包含待认证信息的表项,网络设备203根据待认证信息查表,无法获取与待认证信息关联的第二验证码,因此,网络设备203认为第三数据包是来自反射设备204的非法数据包,丢弃第三数据包。Optionally, if the third data packet is an illegal data packet from the reflection device 204, and the network device 203 may not store the information to be authenticated, the flow table does not contain the entry of the information to be authenticated, and the network device 203 searches according to the information to be authenticated. Table, the second verification code associated with the information to be authenticated cannot be obtained. Therefore, the network device 203 considers that the third data packet is an illegal data packet from the reflection device 204, and discards the third data packet.
需要说明的是,以表格的形式示意待认证信息与第二验证码的关联关系在存储设备中的存储形式,并不是对待认证信息与第二验证码的关联关系在存储设备中的存储形式的限定,当然,待认证信息与第二验证码的关联关系在存储设备中的存储形式还可以以其他的形式存储,本申请实施例对此不做限定。It should be noted that the storage form of the association relationship between the information to be authenticated and the second verification code in the storage device is indicated in the form of a table, not the storage form of the association relationship between the information to be authenticated and the second verification code in the storage device Limited, of course, the storage form of the association relationship between the information to be authenticated and the second verification code in the storage device may also be stored in other forms, which is not limited in the embodiment of the present application.
S316、网络设备203根据第一验证码和第二验证码确定第三数据包是否合法。S316. The network device 203 determines whether the third data packet is legal according to the first verification code and the second verification code.
网络设备203可以从第二目的端口号中获取第一验证码,即获取第二目的端口号中后12比特的数据,即第一验证码。The network device 203 may obtain the first verification code from the second destination port number, that is, obtain the last 12 bits of data in the second destination port number, that is, the first verification code.
具体的,网络设备203可以比较第一验证码和第二验证码,如果第一验证码和第二验证码相同,确定第三数据包合法;如果第一验证码和第二验证码不同,确定第三数据包不合法。Specifically, the network device 203 may compare the first verification code and the second verification code, and if the first verification code and the second verification code are the same, determine that the third data packet is legal; if the first verification code and the second verification code are different, determine The third data packet is illegal.
若第三数据包合法,执行S317;若第三数据包不合法,丢弃第三数据包。If the third data packet is legal, perform S317; if the third data packet is illegal, discard the third data packet.
可理解的,如果第三数据包是来自反射设备204的非法数据包,由于攻击者无法获取到第一验证码,第二目的端口号并不包括第一验证码,或者,第一验证码并不是反射设备204通过接收来自网络设备203的第二数据包得到的,可能是攻击者自创的。此时,网络设备203生成的第二验证码与第一验证码不同,从而通过验证传输层的目的端口字段的值,过滤大部分非法流量。It is understandable that if the third data packet is an illegal data packet from the reflection device 204, since the attacker cannot obtain the first verification code, the second destination port number does not include the first verification code, or the first verification code is not included. It is not obtained by the reflection device 204 by receiving the second data packet from the network device 203, and may be created by the attacker. At this time, the second verification code generated by the network device 203 is different from the first verification code, so that most illegal traffic is filtered by verifying the value of the destination port field of the transport layer.
S317、网络设备203用第一源端口号替换第二目的端口号,得到第四数据包。S317. The network device 203 replaces the second destination port number with the first source port number to obtain the fourth data packet.
可理解的,网络设备203用第一源端口号替换第二源端口号,得到第四数据包。It is understandable that the network device 203 replaces the second source port number with the first source port number to obtain the fourth data packet.
示例的,假设反射设备204的IP地址为121.14.88.76,应用服务器205的IP地址为192.168.1.1,应用服务器205发送并接收第一服务的数据的端口为10000,反射设备204发送并接收第一服务的数据的端口为80。应用服务器205向反射设备204发送的第一数据包包括的五元组中,第一源IP地址为192.168.1.1,第一目的IP地址为 121.14.88.76,传输层协议TCP,第一源端口号为10000,第一目的端口号为80。网络设备203用第二源端口号替换第一源端口号后,源端口字段设置为23101,得到第二数据包。For example, suppose the IP address of the reflection device 204 is 121.14.88.76, the IP address of the application server 205 is 192.168.1.1, the port for the application server 205 to send and receive the data of the first service is 10000, and the reflection device 204 sends and receives the first service. The port of the service data is 80. In the five-tuple included in the first data packet sent by the application server 205 to the reflection device 204, the first source IP address is 192.168.1.1, the first destination IP address is 121.14.88.76, the transport layer protocol TCP, and the first source port number Is 10000, and the first destination port number is 80. After the network device 203 replaces the first source port number with the second source port number, the source port field is set to 23101, and the second data packet is obtained.
网络设备203接收到的第三数据包包括的五元组中,第二源IP地址为反射设备204的IP地址,即121.14.88.76,第二目的IP地址为应用服务器205的IP地址,即192.168.1.1,传输层协议TCP,第二源端口号为反射设备204发送第一服务的数据的出端口为80,第二目的端口号为第二源端口号,即23101。网络设备203用第一源端口号替换第二目的端口号后,目的端口字段设置为10000,得到第四数据包。In the quintuple included in the third data packet received by the network device 203, the second source IP address is the IP address of the reflection device 204, which is 121.14.88.76, and the second destination IP address is the IP address of the application server 205, which is 192.168 1.1, the transport layer protocol TCP, the second source port number is 80 for the outgoing port of the reflection device 204 to send the data of the first service, and the second destination port number is the second source port number, that is, 23101. After the network device 203 replaces the second destination port number with the first source port number, the destination port field is set to 10000, and the fourth data packet is obtained.
S318、网络设备203向应用服务器205转发第四数据包。S318: The network device 203 forwards the fourth data packet to the application server 205.
S319、网络设备203转发第三数据包。S319. The network device 203 forwards the third data packet.
在一些实施例中,如图10所示,在用第一源端口号替换第二源端口号,即S317之前,网络设备203先获取第一源端口号,具体的以下详细步骤。In some embodiments, as shown in FIG. 10, before replacing the second source port number with the first source port number, that is, S317, the network device 203 first obtains the first source port number, specifically the following detailed steps.
S320、网络设备203确定合法流表包括第三数据包的五元组,从合法流表中获取第三数据包的五元组对应的第一源端口号。S320. The network device 203 determines that the legal flow table includes the quintuple of the third data packet, and obtains the first source port number corresponding to the quintuple of the third data packet from the legal flow table.
可理解的,网络设备203在向反射设备204发送第二数据包前,已经在合法流表中生成了反射设备204与应用服务器205之间进行第一服务的数据交互的五元组信息。其中,该条记录还包括第一端口索引,以及用于替换第一源端口号的第二源端口号,因此,网络设备203可以根据第一数据包的五元组获取对应的第一源端口号。It is understandable that before the network device 203 sends the second data packet to the reflection device 204, the five-tuple information for the data exchange of the first service between the reflection device 204 and the application server 205 has been generated in the legal flow table. Wherein, the record also includes the first port index and the second source port number used to replace the first source port number. Therefore, the network device 203 can obtain the corresponding first source port according to the quintuple of the first data packet No.
需要说明的是,第三数据包中的第二源IP地址为第一数据包中的第一目的IP地址,第二源IP地址对应合法流表中记录的目的IP。It should be noted that the second source IP address in the third data packet is the first destination IP address in the first data packet, and the second source IP address corresponds to the destination IP recorded in the legal flow table.
第三数据包中的第二目的IP地址为第一数据包中的第一源IP地址,第二目的IP地址对应合法流表中记录的源IP。The second destination IP address in the third data packet is the first source IP address in the first data packet, and the second destination IP address corresponds to the source IP recorded in the legal flow table.
第三数据包中的传输层协议号和第一数据包中的传输层协议号均对应合法流表中记录的传输层协议号。The transport layer protocol number in the third data packet and the transport layer protocol number in the first data packet both correspond to the transport layer protocol number recorded in the legal flow table.
第三数据包中的第三源端口号为第一数据包中的第一目的端口号,第三源端口号对应合法流表中记录的目的端口号。The third source port number in the third data packet is the first destination port number in the first data packet, and the third source port number corresponds to the destination port number recorded in the legal flow table.
第三数据包中的第二目的端口号为替换第一数据包中的第一源端口号后的第二源端口号,第二目的端口号对应合法流表中记录的新源端口号。The second destination port number in the third data packet is the second source port number after replacing the first source port number in the first data packet, and the second destination port number corresponds to the new source port number recorded in the legal flow table.
网络设备203可以根据第三数据包包含的五元组,即第二源IP地址、第二目的IP地址、传输层协议号、第三源端口号和第二目的端口号,从合法流表中获取第三数据包的五元组对应的第一源端口号,即合法流表中第三数据包的五元组对应的新源端口号,用合法流表中的新源端口号替换第三数据包中的第二目的端口号,得到第四数据包。The network device 203 can use the five-tuple contained in the third data packet, that is, the second source IP address, the second destination IP address, the transport layer protocol number, the third source port number, and the second destination port number, from the legal flow table. Get the first source port number corresponding to the quintuple of the third data packet, that is, the new source port number corresponding to the quintuple of the third data packet in the legal flow table, and replace the third source port number with the new source port number in the legal flow table The second destination port number in the data packet obtains the fourth data packet.
此时,若第三数据包合法,执行S320,再执行S317。At this time, if the third data packet is valid, execute S320, and then execute S317.
上述在源端口号中嵌入验证码的功能,以及利用在端口字段中的内容验证数据包是否合法的功能,可以在一个网络设备(如:网络设备202或网络设备203)中实现,也可以在不同的网络设备中实现。图11本申请一实施例提供的数据处理方法流程图,这里以反射设备204与应用服务器205之间传输第一服务的数据,网络设备203对来自应用服务器205的数据包中的源端口号进行替换,网络设备202对发往应用服务器 205的数据包进行验证为例进行说明。如图11所示,该方法可以包括:The function of embedding the verification code in the source port number and the function of verifying whether the data packet is legal by using the content in the port field can be implemented in a network device (such as network device 202 or network device 203), or in Implemented in different network devices. FIG. 11 is a flowchart of a data processing method provided by an embodiment of the present application. Here, the data of the first service is transmitted between the reflection device 204 and the application server 205, and the network device 203 performs processing on the source port number in the data packet from the application server 205 Alternatively, the network device 202 verifies the data packet sent to the application server 205 as an example for description. As shown in Figure 11, the method may include:
S1101、应用服务器205向网络设备203发送第一数据包,第一数据包包括传输层协议号、第一源端口号和第一目的端口号。S1101. The application server 205 sends a first data packet to the network device 203, where the first data packet includes a transport layer protocol number, a first source port number, and a first destination port number.
S1102、网络设备203接收来自应用服务器205的第一数据包。S1102. The network device 203 receives the first data packet from the application server 205.
S1103、网络设备203根据传输层协议号和第一目的端口号确定第一数据包是一个发往反射设备204的流量。S1103. The network device 203 determines that the first data packet is a traffic sent to the reflection device 204 according to the transport layer protocol number and the first destination port number.
S1104、网络设备203用第二源端口号替换第一源端口号,得到第二数据包。S1104. The network device 203 replaces the first source port number with the second source port number to obtain the second data packet.
S1105、网络设备203向反射设备204发送第二数据包。S1105. The network device 203 sends a second data packet to the reflection device 204.
S1101至S1105的具体解释可以参考上述S301至S305的阐述,不予赘述。For specific explanations of S1101 to S1105, please refer to the explanations of S301 to S305 above, and will not be repeated.
S1106、网络设备202接收第三数据包,第三数据包包括传输层协议号、第三源端口号和第二目的端口号,第二目的端口号包括第一验证码。S1106. The network device 202 receives a third data packet. The third data packet includes a transport layer protocol number, a third source port number, and a second destination port number, and the second destination port number includes the first verification code.
S1107、网络设备202根据传输层协议号和第三源端口号确定第三数据包是一个来自反射设备204的流量。S1107. The network device 202 determines that the third data packet is a flow from the reflection device 204 according to the transport layer protocol number and the third source port number.
S1108、网络设备202根据密钥和待认证信息生成第二验证码。S1108. The network device 202 generates a second verification code according to the key and the information to be authenticated.
网络设备203将用于生成第一验证码的密钥共享给网络设备202,以便于网络设备202根据共享的密钥和待认证信息生成第二验证码。The network device 203 shares the key used to generate the first verification code with the network device 202, so that the network device 202 generates the second verification code according to the shared key and the information to be authenticated.
可选地,网络设备203将待认证信息和第二验证码的对应关系共享给网络设备202,以便于网络设备202根据共享的待认证信息获取与待认证信息关联的第二验证码。例如,网络设备202可以根据待认证信息查表,获取与待认证信息关联的第二验证码。具体解释参考S315的阐述。Optionally, the network device 203 shares the correspondence between the information to be authenticated and the second verification code with the network device 202, so that the network device 202 obtains the second verification code associated with the information to be authenticated according to the shared information to be authenticated. For example, the network device 202 may look up a table according to the information to be authenticated, and obtain the second verification code associated with the information to be authenticated. For specific explanation, please refer to the explanation of S315.
S1109、网络设备202根据第一验证码和第二验证码确定第三数据包是否合法。S1109. The network device 202 determines whether the third data packet is legal according to the first verification code and the second verification code.
若第三数据包合法,执行S1110;若第三数据包不合法,丢弃第三数据包。If the third data packet is legal, perform S1110; if the third data packet is illegal, discard the third data packet.
S1106至S1109的具体解释可以参考上述S313至S316的阐述,不予赘述。For specific explanations of S1106 to S1109, please refer to the explanations of S313 to S316 above, and will not be repeated.
S1110、网络设备202转发第三数据包。S1110. The network device 202 forwards the third data packet.
S1111、网络设备203接收第三数据包。S1111, the network device 203 receives the third data packet.
S1112、网络设备203根据传输层协议号和第三源端口号确定第三数据包是一个来自反射设备204的流量。S1112, the network device 203 determines that the third data packet is a flow from the reflection device 204 according to the transport layer protocol number and the third source port number.
S1113、网络设备203确定合法流表包括第三数据包的五元组,从合法流表中获取第三数据包的五元组对应的第一源端口号。S1113. The network device 203 determines that the legal flow table includes the quintuple of the third data packet, and obtains the first source port number corresponding to the quintuple of the third data packet from the legal flow table.
S1114、网络设备203用第一源端口号替换第二目的端口号,得到第四数据包。S1114. The network device 203 replaces the second destination port number with the first source port number to obtain the fourth data packet.
S1112至S1114的具体解释可以参考上述S314、S320和S317的阐述,不予赘述。For specific explanations of S1112 to S1114, please refer to the explanations of S314, S320, and S317, and will not be repeated.
S1115、网络设备203向应用服务器205转发第四数据包。S1115. The network device 203 forwards the fourth data packet to the application server 205.
本申请实施例提供的数据处理方法,利用数据包中传输层头部包括的端口字段携带可验证标记,在网络设备接收到来自反射设备的数据包后,通过验证可验证标记对合法数据包和非法数据包进行识别,只有合法数据包才会被转发,能够应对大部分的反射类型的拒绝服务攻击。相对于黑洞技术,本申请实施例提供的数据处理方法能够确保合法流量被转发,避免合法流量被黑洞丢弃,网络设备过滤大部分的DRDoS攻击流量。相对于流量清洗技术,本申请实施例提供的数据处理方法能够降低深层协议解析带来的处理合法流量的延迟。另外,由于可验证标识可以内嵌在目的端口字段中, 使得网络设备不需要处理应用层数据,可以直接在传输层进行过滤,降低防御DRDoS攻击的成本,不依赖于跨域协作。The data processing method provided in the embodiments of the present application uses the port field included in the transport layer header in the data packet to carry the verifiable mark. After the network device receives the data packet from the reflection device, the verifiable mark is verified against the legitimate data packet and Illegal data packets are identified, and only legitimate data packets will be forwarded, which can deal with most reflection-type denial of service attacks. Compared with the black hole technology, the data processing method provided in the embodiments of the present application can ensure that legal traffic is forwarded, avoid legal traffic being discarded by the black hole, and the network device filters most of the DRDoS attack traffic. Compared with the traffic cleaning technology, the data processing method provided in the embodiments of the present application can reduce the delay in processing legal traffic caused by deep protocol analysis. In addition, since the verifiable identifier can be embedded in the destination port field, the network device does not need to process application layer data, and can directly filter at the transport layer, reducing the cost of defending against DRDoS attacks, and does not rely on cross-domain cooperation.
可以理解的是,为了实现上述实施例中功能,网络设备包括了执行各个功能相应的硬件结构和/或软件模块。本领域技术人员应该很容易意识到,结合本申请中所公开的实施例描述的各示例的单元及方法步骤,本申请能够以硬件或硬件和计算机软件相结合的形式来实现。某个功能究竟以硬件还是计算机软件驱动硬件的方式来执行,取决于技术方案的特定应用场景和设计约束条件。It can be understood that, in order to implement the functions in the foregoing embodiments, the network device includes hardware structures and/or software modules corresponding to each function. Those skilled in the art should easily realize that, in combination with the units and method steps of the examples described in the embodiments disclosed in the present application, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed by hardware or computer software-driven hardware depends on the specific application scenarios and design constraints of the technical solution.
图12和图13为本申请的实施例提供的可能的数据处理装置的结构示意图。这些数据处理装置可以用于实现上述方法实施例中网络设备的功能,因此也能实现上述方法实施例所具备的有益效果。在本申请的实施例中,该数据处理装置可以是如图2所示的网络设备202或网络设备203,还可以是应用于网络设备的模块(如芯片)。FIG. 12 and FIG. 13 are schematic structural diagrams of possible data processing apparatuses provided by embodiments of this application. These data processing apparatuses can be used to implement the functions of the network equipment in the foregoing method embodiments, and therefore can also achieve the beneficial effects of the foregoing method embodiments. In the embodiment of the present application, the data processing apparatus may be the network device 202 or the network device 203 as shown in FIG. 2, and may also be a module (such as a chip) applied to the network device.
如图12所示,数据处理装置1200包括接收单元1210、处理单元1220和发送单元1230。数据处理装置1200用于实现上述图3、图4、图7、图8、图9、图10或图11中所示的方法实施例中网络设备的功能。As shown in FIG. 12, the data processing device 1200 includes a receiving unit 1210, a processing unit 1220, and a sending unit 1230. The data processing apparatus 1200 is used to implement the function of the network device in the method embodiment shown in FIG. 3, FIG. 4, FIG. 7, FIG. 8, FIG. 9, FIG. 10, or FIG. 11.
当数据处理装置1200用于实现图3所示的方法实施例中网络设备203的功能时:接收单元1210用于执行S302;处理单元1220用于执行S303和S304;发送单元1230用于执行S305。When the data processing apparatus 1200 is used to implement the function of the network device 203 in the method embodiment shown in FIG. 3: the receiving unit 1210 is used to perform S302; the processing unit 1220 is used to perform S303 and S304; and the sending unit 1230 is used to perform S305.
当数据处理装置1200用于实现图4所示的方法实施例中网络设备203的功能时:接收单元1210用于执行S302;处理单元1220用于执行S3031、S3032和S304;发送单元1230用于执行S305和S306。When the data processing apparatus 1200 is used to implement the functions of the network device 203 in the method embodiment shown in FIG. 4: the receiving unit 1210 is used to perform S302; the processing unit 1220 is used to perform S3031, S3032, and S304; and the sending unit 1230 is used to perform S305 and S306.
当数据处理装置1200用于实现图7所示的方法实施例中网络设备203的功能时:接收单元1210用于执行S302;处理单元1220用于执行S3031、S3032和S304,以及S307至S312;发送单元1230用于执行S305和S306。When the data processing apparatus 1200 is used to implement the function of the network device 203 in the method embodiment shown in FIG. 7: the receiving unit 1210 is used to perform S302; the processing unit 1220 is used to perform S3031, S3032, and S304, and S307 to S312; Unit 1230 is used to execute S305 and S306.
当数据处理装置1200用于实现图8所示的方法实施例中网络设备203的功能时:接收单元1210用于执行S302和S313;处理单元1220用于执行S3031、S3032和S304,以及S307至S312,以及S314至S317;发送单元1230用于执行S305、S306和S318。When the data processing apparatus 1200 is used to implement the function of the network device 203 in the method embodiment shown in FIG. 8: the receiving unit 1210 is used to perform S302 and S313; the processing unit 1220 is used to perform S3031, S3032, and S304, and S307 to S312 , And S314 to S317; the sending unit 1230 is used to execute S305, S306, and S318.
当数据处理装置1200用于实现图9所示的方法实施例中网络设备203的功能时:接收单元1210用于执行S302和S313;处理单元1220用于执行S3031、S3032和S304,以及S307至S312,以及S3141、S3142至S317;发送单元1230用于执行S305、S306、S318和S319。When the data processing apparatus 1200 is used to implement the function of the network device 203 in the method embodiment shown in FIG. 9: the receiving unit 1210 is used to perform S302 and S313; the processing unit 1220 is used to perform S3031, S3032, and S304, and S307 to S312 , And S3141, S3142 to S317; the sending unit 1230 is used to execute S305, S306, S318, and S319.
当数据处理装置1200用于实现图10所示的方法实施例中网络设备203的功能时:接收单元1210用于执行S302和S313;处理单元1220用于执行S3031、S3032和S304,以及S307至S312,以及S3141、S3142至S317,以及S320;发送单元1230用于执行S305、S306、S318和S319。When the data processing apparatus 1200 is used to implement the function of the network device 203 in the method embodiment shown in FIG. 10: the receiving unit 1210 is used to perform S302 and S313; the processing unit 1220 is used to perform S3031, S3032, and S304, and S307 to S312 , And S3141, S3142 to S317, and S320; the sending unit 1230 is used to execute S305, S306, S318, and S319.
当数据处理装置1200用于实现图11所示的方法实施例中网络设备203的功能时:接收单元1210用于执行S1102和S1111;处理单元1220用于执行S1103、S1104、S1112、S1113和S1114;发送单元1230用于执行S1105和S1115。When the data processing apparatus 1200 is used to implement the function of the network device 203 in the method embodiment shown in FIG. 11: the receiving unit 1210 is used to execute S1102 and S1111; the processing unit 1220 is used to execute S1103, S1104, S1112, S1113, and S1114; The sending unit 1230 is used to execute S1105 and S1115.
当数据处理装置1200用于实现图11所示的方法实施例中网络设备202的功能时:接收单元1210用于执行S1106;处理单元1220用于执行S1107至S1109;发送单元 1230用于执行S1110。When the data processing apparatus 1200 is used to implement the function of the network device 202 in the method embodiment shown in FIG. 11: the receiving unit 1210 is used to perform S1106; the processing unit 1220 is used to perform S1107 to S1109; and the sending unit 1230 is used to perform S1110.
有关上述接收单元1210、处理单元1220和发送单元1230更详细的描述可以直接参考图3、图4、图7、图8、图9、图10或图11所示的方法实施例中相关描述直接得到,这里不加赘述。For more detailed descriptions of the above-mentioned receiving unit 1210, processing unit 1220, and sending unit 1230, you can directly refer to the relevant description in the method embodiment shown in FIG. 3, FIG. 4, FIG. 7, FIG. 8, FIG. 9, FIG. 10, or FIG. 11. Get it, I won’t repeat it here.
如图13所示,数据处理装置1300包括处理器1310和接口电路1320。处理器1310和接口电路1320之间相互耦合。可以理解的是,接口电路1320可以为收发器或输入输出接口。可选的,数据处理装置1300还可以包括存储器1330,用于存储处理器1310执行的指令或存储处理器1310运行指令所需要的输入数据或存储处理器1310运行指令后产生的数据。As shown in FIG. 13, the data processing device 1300 includes a processor 1310 and an interface circuit 1320. The processor 1310 and the interface circuit 1320 are coupled with each other. It can be understood that the interface circuit 1320 may be a transceiver or an input/output interface. Optionally, the data processing apparatus 1300 may further include a memory 1330 for storing instructions executed by the processor 1310 or storing input data required by the processor 1310 to run the instructions or storing data generated after the processor 1310 runs the instructions.
当数据处理装置1300用于实现图3、图4、图7、图8、图9、图10或图11所示的方法时,处理器1310用于执行上述处理单元1220的功能,接口电路1320用于执行上述接收单元1210和发送单元1230的功能。When the data processing device 1300 is used to implement the method shown in FIG. 3, FIG. 4, FIG. 7, FIG. 8, FIG. 9, FIG. 10, or FIG. It is used to perform the functions of the receiving unit 1210 and the sending unit 1230 described above.
可以理解的是,本申请的实施例中的处理器可以是中央处理单元(Central Processing Unit,CPU),还可以是其它通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field Programmable Gate Array,FPGA)或者其它可编程逻辑器件、晶体管逻辑器件,硬件部件或者其任意组合。通用处理器可以是微处理器,也可以是任何常规的处理器。It is understandable that the processor in the embodiments of the present application may be a central processing unit (Central Processing Unit, CPU), or may be other general-purpose processors, digital signal processors (Digital Signal Processors, DSPs), or application specific integrated circuits. (Application Specific Integrated Circuit, ASIC), Field Programmable Gate Array (Field Programmable Gate Array, FPGA) or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. The general-purpose processor may be a microprocessor or any conventional processor.
本申请的实施例中的方法步骤可以通过硬件的方式来实现,也可以由处理器执行软件指令的方式来实现。软件指令可以由相应的软件模块组成,软件模块可以被存放于随机存取存储器(Random Access Memory,RAM)、闪存、只读存储器(Read-Only Memory,ROM)、可编程只读存储器(Programmable ROM,PROM)、可擦除可编程只读存储器(Erasable PROM,EPROM)、电可擦除可编程只读存储器(Electrically EPROM,EEPROM)、寄存器、硬盘、移动硬盘、CD-ROM或者本领域熟知的任何其它形式的存储介质中。一种示例性的存储介质耦合至处理器,从而使处理器能够从该存储介质读取信息,且可向该存储介质写入信息。当然,存储介质也可以是处理器的组成部分。处理器和存储介质可以位于ASIC中。另外,该ASIC可以位于网络设备或终端设备中。当然,处理器和存储介质也可以作为分立组件存在于网络设备或终端设备中。The method steps in the embodiments of the present application can be implemented by hardware, and can also be implemented by a processor executing software instructions. Software instructions can be composed of corresponding software modules, which can be stored in Random Access Memory (RAM), Flash memory, Read-Only Memory (ROM), Programmable ROM (Programmable ROM) , PROM), Erasable Programmable Read-Only Memory (Erasable PROM, EPROM), Electrically Erasable Programmable Read-Only Memory (Electrically EPROM, EEPROM), register, hard disk, mobile hard disk, CD-ROM or well-known in the art Any other form of storage medium. An exemplary storage medium is coupled to the processor, so that the processor can read information from the storage medium and can write information to the storage medium. Of course, the storage medium may also be an integral part of the processor. The processor and the storage medium may be located in the ASIC. In addition, the ASIC can be located in a network device or a terminal device. Of course, the processor and the storage medium may also exist as discrete components in the network device or the terminal device.
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机程序或指令。在计算机上加载和执行所述计算机程序或指令时,全部或部分地执行本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、网络设备、用户设备或者其它可编程装置。所述计算机程序或指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机程序或指令可以从一个网站站点、计算机、服务器或数据中心通过有线或无线方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是集成一个或多个可用介质的服务器、数据中心等数据存储设备。 所述可用介质可以是磁性介质,例如,软盘、硬盘、磁带;也可以是光介质,例如,数字视频光盘(digital video disc,DVD);还可以是半导体介质,例如,固态硬盘(solid state drive,SSD)。In the foregoing embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented by software, it can be implemented in the form of a computer program product in whole or in part. The computer program product includes one or more computer programs or instructions. When the computer program or instruction is loaded and executed on the computer, the process or function described in the embodiment of the present application is executed in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, network equipment, user equipment, or other programmable devices. The computer program or instruction may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer program or instruction may be downloaded from a website, computer, The server or data center transmits to another website site, computer, server or data center through wired or wireless means. The computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server or a data center that integrates one or more available media. The usable medium may be a magnetic medium, such as a floppy disk, a hard disk, and a magnetic tape; it may also be an optical medium, such as a digital video disc (digital video disc, DVD); and it may also be a semiconductor medium, such as a solid state drive (solid state drive). , SSD).
在本申请的各个实施例中,如果没有特殊说明以及逻辑冲突,不同的实施例之间的术语和/或描述具有一致性、且可以相互引用,不同的实施例中的技术特征根据其内在的逻辑关系可以组合形成新的实施例。In each embodiment of this application, if there is no special description and logical conflict, the terms and/or descriptions between different embodiments are consistent and can be mutually cited. The technical features in different embodiments are based on their inherent Logical relationships can be combined to form new embodiments.
本申请中,“至少一个”是指一个或者多个,“多个”是指两个或两个以上。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B的情况,其中A,B可以是单数或者复数。在本申请的文字描述中,字符“/”,一般表示前后关联对象是一种“或”的关系;在本申请的公式中,字符“/”,表示前后关联对象是一种“相除”的关系。In this application, "at least one" refers to one or more, and "multiple" refers to two or more. "And/or" describes the association relationship of the associated object, indicating that there can be three relationships, for example, A and/or B, which can mean: A alone exists, A and B exist at the same time, and B exists alone, where A, B can be singular or plural. In the text description of this application, the character "/" generally indicates that the associated objects before and after are an "or" relationship; in the formula of this application, the character "/" indicates that the associated objects before and after are a kind of "division" Relationship.
可以理解的是,在本申请的实施例中涉及的各种数字编号仅为描述方便进行的区分,并不用来限制本申请的实施例的范围。上述各过程的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定。It is understandable that the various numerical numbers involved in the embodiments of the present application are only for easy distinction for description, and are not used to limit the scope of the embodiments of the present application. The size of the sequence number of the above processes does not mean the order of execution, and the execution order of each process should be determined by its function and internal logic.

Claims (35)

  1. 一种数据处理方法,其特征在于,包括:A data processing method, characterized in that it comprises:
    接收第一数据包,所述第一数据包包括传输层协议号、第一源端口号和目的端口号,所述目的端口号包括第一验证码;Receiving a first data packet, where the first data packet includes a transport layer protocol number, a first source port number, and a destination port number, and the destination port number includes a first verification code;
    根据所述传输层协议号和所述第一源端口号确定所述第一数据包是一个来自反射设备的流量,所述反射设备为发送分布式反射拒绝服务DRDoS攻击的设备;Determining, according to the transport layer protocol number and the first source port number, that the first data packet is a flow from a reflection device, and the reflection device is a device that sends a distributed reflection denial of service DRDoS attack;
    根据待认证信息获取第二验证码,所述待认证信息包括所述第一数据包包含的源互联网协议IP地址,所述源IP地址为所述反射设备的IP地址;Acquiring a second verification code according to the information to be authenticated, where the information to be authenticated includes a source Internet Protocol IP address included in the first data packet, and the source IP address is the IP address of the reflection device;
    根据所述第一验证码和所述第二验证码确定所述第一数据包是否合法。Determine whether the first data packet is legal according to the first verification code and the second verification code.
  2. 根据权利要求1所述的方法,其特征在于,所述根据待认证信息获取第二验证码包括:The method according to claim 1, wherein the obtaining the second verification code according to the information to be authenticated comprises:
    根据密钥和所述待认证信息生成所述第二验证码。The second verification code is generated according to the key and the information to be authenticated.
  3. 根据权利要求1所述的方法,其特征在于,所述根据待认证信息获取第二验证码包括:The method according to claim 1, wherein the obtaining the second verification code according to the information to be authenticated comprises:
    获取与所述待认证信息关联的所述第二验证码。Obtain the second verification code associated with the information to be authenticated.
  4. 根据权利要求3所述的方法,其特征在于,在所述获取与所述待认证信息关联的所述第二验证码之前,所述方法还包括:The method according to claim 3, characterized in that, before the obtaining the second verification code associated with the information to be authenticated, the method further comprises:
    根据密钥和所述待认证信息生成所述第二验证码;Generating the second verification code according to the key and the information to be authenticated;
    根据所述待认证信息和所述第二验证码生成流表;Generating a flow table according to the information to be authenticated and the second verification code;
    所述获取与所述待认证信息关联的所述第二验证码包括:根据所述待认证信息查询所述流表获取与所述待认证信息关联的所述第二验证码。The obtaining the second verification code associated with the information to be authenticated includes: querying the flow table according to the information to be authenticated to obtain the second verification code associated with the information to be authenticated.
  5. 根据权利要求1-4中任一项所述的方法,其特征在于,根据所述传输层协议号和所述第一源端口号确定所述第一数据包是一个来自反射设备的流量,包括:The method according to any one of claims 1 to 4, wherein the determining that the first data packet is a flow from a reflection device according to the transport layer protocol number and the first source port number includes :
    确定反射型协议端口特征集合包括所述第一源端口号和所述传输层协议号,且所述传输层协议号是用户数据报协议UDP号或传输控制协议TCP号,则所述第一数据包是一个来自所述反射设备的流量。It is determined that the reflection type protocol port feature set includes the first source port number and the transport layer protocol number, and the transport layer protocol number is a User Datagram Protocol UDP number or a Transmission Control Protocol TCP number, then the first data A packet is a flow from the reflection device.
  6. 根据权利要求1-5中任一项所述的方法,其特征在于,所述待认证信息还包括所述第一数据包包含的目的IP地址、所述第一源端口号和所述传输层协议号中至少一个,和/或,端口索引和时间参数中至少一个;所述目的IP地址为受保护设备的IP地址,所述受保护设备为遭受DRDoS攻击的设备,所述端口索引用于标识一个应用。The method according to any one of claims 1-5, wherein the information to be authenticated further includes the destination IP address contained in the first data packet, the first source port number, and the transport layer At least one of the protocol number, and/or, at least one of the port index and the time parameter; the destination IP address is the IP address of the protected device, the protected device is a device that is attacked by DRDoS, and the port index is used for Identify an application.
  7. 根据权利要求1-6中任一项所述的方法,其特征在于,所述目的端口号还包括端口索引。The method according to any one of claims 1-6, wherein the destination port number further comprises a port index.
  8. 根据权利要求1-7中任一项所述的方法,其特征在于,若所述第一数据包合法,所述方法还包括:The method according to any one of claims 1-7, wherein if the first data packet is valid, the method further comprises:
    向受保护设备转发所述第一数据包。Forward the first data packet to the protected device.
  9. 根据权利要求1-7中任一项所述的方法,其特征在于,若所述第一数据包合法,所述方法还包括:The method according to any one of claims 1-7, wherein if the first data packet is valid, the method further comprises:
    用第二源端口号替换所述目的端口号,得到第二数据包;Replace the destination port number with the second source port number to obtain the second data packet;
    向受保护设备转发所述第二数据包。Forward the second data packet to the protected device.
  10. 根据权利要求9所述的方法,其特征在于,在所述用第二源端口号替换所述目的端口号之前,所述方法还包括:The method according to claim 9, characterized in that, before the replacing the destination port number with the second source port number, the method further comprises:
    确定合法流表包括所述第一数据包的五元组,从所述合法流表中获取所述第一数据包的五元组对应的所述第二源端口号,所述第一数据包的五元组用于唯一标识一条网络流量,所述第一数据包的五元组包括所述源IP地址、目的IP地址、所述传输层协议号、所述第一源端口号和所述目的端口号。It is determined that the legal flow table includes the quintuple of the first data packet, and the second source port number corresponding to the quintuple of the first data packet is obtained from the legal flow table, and the first data packet The quintuple of is used to uniquely identify a piece of network traffic, and the quintuple of the first data packet includes the source IP address, the destination IP address, the transport layer protocol number, the first source port number, and the Destination port number.
  11. 一种数据处理方法,其特征在于,包括:A data processing method, characterized in that it comprises:
    接收第一数据包,所述第一数据包包括传输层协议号、第一源端口号和目的端口号;Receiving a first data packet, where the first data packet includes a transport layer protocol number, a first source port number, and a destination port number;
    根据所述传输层协议号和所述目的端口号确定所述第一数据包是一个发往反射设备的流量,所述反射设备为发送分布式反射拒绝服务DRDoS攻击的设备;Determining, according to the transport layer protocol number and the destination port number, that the first data packet is a traffic sent to a reflection device, and the reflection device is a device that sends a distributed reflection denial of service DRDoS attack;
    用第二源端口号替换所述第一源端口号,得到第二数据包,所述第二源端口号包括验证码,所述验证码是根据密钥和待认证信息确定的,所述待认证信息包括所述第一数据包包含的目的互联网协议IP地址,所述目的IP地址为所述反射设备的IP地址;Replace the first source port number with a second source port number to obtain a second data packet. The second source port number includes a verification code. The verification code is determined based on the key and the information to be authenticated. The authentication information includes a destination Internet Protocol IP address included in the first data packet, and the destination IP address is the IP address of the reflection device;
    发送所述第二数据包。Sending the second data packet.
  12. 根据权利要求11所述的方法,其特征在于,根据所述传输层协议号和所述目的端口号确定所述第一数据包是一个发往反射设备的流量,包括:The method according to claim 11, wherein the determining that the first data packet is a traffic sent to a reflection device according to the transport layer protocol number and the destination port number comprises:
    确定反射型协议端口特征集合包括所述目的端口号和所述传输层协议号,且所述传输层协议号是用户数据报协议UDP号或传输控制协议TCP号,则所述第一数据包是一个发往所述反射设备的流量。It is determined that the reflection type protocol port feature set includes the destination port number and the transport layer protocol number, and the transport layer protocol number is the User Datagram Protocol UDP number or the Transmission Control Protocol TCP number, then the first data packet is A traffic sent to the reflecting device.
  13. 根据权利要求11或12所述的方法,其特征在于,所述待认证信息还包括所述第一数据包包含的源IP地址、所述目的端口号和所述传输层协议号中至少一个,和/或,第一端口索引和时间参数中至少一个;所述源IP地址为源设备的IP地址,所述源设备为遭受DRDoS攻击的受保护设备,所述第一端口索引用于标识一个应用。The method according to claim 11 or 12, wherein the information to be authenticated further includes at least one of the source IP address, the destination port number, and the transport layer protocol number contained in the first data packet, And/or, at least one of a first port index and a time parameter; the source IP address is the IP address of the source device, the source device is a protected device suffering from a DRDoS attack, and the first port index is used to identify one application.
  14. 根据权利要求11-13中任一项所述的方法,其特征在于,所述第二源端口号还包括第一端口索引。The method according to any one of claims 11-13, wherein the second source port number further comprises a first port index.
  15. 根据权利要求11-14中任一项所述的方法,其特征在于,在所述用第二源端口号替换所述第一源端口号之前,所述方法还包括:The method according to any one of claims 11-14, wherein before the replacing the first source port number with a second source port number, the method further comprises:
    确定合法流表包括所述第一数据包的五元组,从所述合法流表中获取所述第一数据包的五元组对应的所述第二源端口号,所述第一数据包的五元组用于唯一标识一条网络流量,所述第一数据包的五元组包括源IP地址、所述目的IP地址、所述传输层协议号、所述第一源端口号和所述目的端口号。It is determined that the legal flow table includes the quintuple of the first data packet, and the second source port number corresponding to the quintuple of the first data packet is obtained from the legal flow table, and the first data packet The quintuple of is used to uniquely identify a piece of network traffic, and the quintuple of the first data packet includes the source IP address, the destination IP address, the transport layer protocol number, the first source port number, and the Destination port number.
  16. 根据权利要求15所述的方法,其特征在于,若所述合法流表不包括所述第一数据包的五元组,所述方法还包括:The method according to claim 15, wherein if the legal flow table does not include the 5-tuple of the first data packet, the method further comprises:
    判断所述合法流表是否包括所述第一数据包中除所述第一源端口号的四元组;Judging whether the legal flow table includes a four-tuple other than the first source port number in the first data packet;
    若所述合法流表不包括所述第一数据包中除所述第一源端口号的四元组,生成第一端口索引;If the legal flow table does not include a four-tuple other than the first source port number in the first data packet, generate a first port index;
    若所述合法流表包括所述第一数据包的除所述第一源端口号的四元组,更新所述四元组对应的第二端口索引,得到第一端口索引。If the legal flow table includes a quadruple of the first data packet excluding the first source port number, update the second port index corresponding to the quadruple to obtain the first port index.
  17. 根据权利要求1-16中任一项所述的方法,其特征在于,所述反射设备为域名系统设备、网络时间协议设备或简单网络管理协议设备。The method according to any one of claims 1-16, wherein the reflection device is a domain name system device, a network time protocol device, or a simple network management protocol device.
  18. 一种数据处理装置,其特征在于,包括:A data processing device, characterized in that it comprises:
    接收单元,用于接收第一数据包,所述第一数据包包括传输层协议号、第一源端口号和目的端口号,所述目的端口号包括第一验证码;A receiving unit, configured to receive a first data packet, the first data packet including a transport layer protocol number, a first source port number, and a destination port number, and the destination port number includes a first verification code;
    处理单元,用于根据所述传输层协议号和所述第一源端口号确定所述第一数据包是一个来自反射设备的流量,所述反射设备为发送分布式反射拒绝服务DRDoS攻击的设备;The processing unit is configured to determine, according to the transport layer protocol number and the first source port number, that the first data packet is a flow from a reflection device, and the reflection device is a device that sends a distributed reflection denial of service DRDoS attack ;
    所述处理单元,还用于根据待认证信息获取第二验证码,所述待认证信息包括所述第一数据包包含的源互联网协议IP地址,所述源IP地址为所述反射设备的IP地址;The processing unit is further configured to obtain a second verification code according to the information to be authenticated, the information to be authenticated includes the source Internet Protocol IP address contained in the first data packet, and the source IP address is the IP of the reflection device address;
    所述处理单元,还用于根据所述第一验证码和所述第二验证码确定所述第一数据包是否合法。The processing unit is further configured to determine whether the first data packet is legal according to the first verification code and the second verification code.
  19. 根据权利要求18所述的装置,其特征在于,所述处理单元根据待认证信息获取第二验证码时,具体用于:The device according to claim 18, wherein when the processing unit obtains the second verification code according to the information to be authenticated, it is specifically configured to:
    根据密钥和所述待认证信息生成所述第二验证码。The second verification code is generated according to the key and the information to be authenticated.
  20. 根据权利要求18所述的装置,其特征在于,所述处理单元根据待认证信息获取第二验证码时,具体用于:The device according to claim 18, wherein when the processing unit obtains the second verification code according to the information to be authenticated, it is specifically configured to:
    获取与所述待认证信息关联的所述第二验证码。Obtain the second verification code associated with the information to be authenticated.
  21. 根据权利要求20所述的装置,其特征在于,所述处理单元还用于:The device according to claim 20, wherein the processing unit is further configured to:
    根据密钥和所述待认证信息生成所述第二验证码;Generating the second verification code according to the key and the information to be authenticated;
    根据所述待认证信息和所述第二验证码生成流表;Generating a flow table according to the information to be authenticated and the second verification code;
    所述处理单元获取与所述待认证信息关联的所述第二验证码包括:根据所述待认证信息查询所述流表获取与所述待认证信息关联的所述第二验证码。Obtaining the second verification code associated with the information to be authenticated by the processing unit includes: querying the flow table according to the information to be authenticated to obtain the second verification code associated with the information to be authenticated.
  22. 根据权利要求18-21中任一项所述的装置,其特征在于,所述处理单元具体用于:The device according to any one of claims 18-21, wherein the processing unit is specifically configured to:
    确定反射型协议端口特征集合包括所述第一源端口号和所述传输层协议号,且所述传输层协议号是用户数据报协议UDP号或传输控制协议TCP号,则所述第一数据包是一个来自所述反射设备的流量。It is determined that the reflection type protocol port feature set includes the first source port number and the transport layer protocol number, and the transport layer protocol number is a User Datagram Protocol UDP number or a Transmission Control Protocol TCP number, then the first data A packet is a flow from the reflection device.
  23. 根据权利要求18-22中任一项所述的装置,其特征在于,所述待认证信息还包括所述第一数据包包含的目的IP地址、所述第一源端口号和所述传输层协议号中至少一个,和/或,端口索引和时间参数中至少一个;所述目的IP地址为受保护设备的IP地址,所述受保护设备为遭受DRDoS攻击的设备,所述端口索引用于标识一个应用。The device according to any one of claims 18-22, wherein the information to be authenticated further includes the destination IP address contained in the first data packet, the first source port number, and the transport layer At least one of the protocol number, and/or, at least one of the port index and the time parameter; the destination IP address is the IP address of the protected device, the protected device is a device that is attacked by DRDoS, and the port index is used for Identify an application.
  24. 根据权利要求18-23中任一项所述的装置,其特征在于,所述目的端口号还包括端口索引。The device according to any one of claims 18-23, wherein the destination port number further comprises a port index.
  25. 根据权利要求18-24中任一项所述的装置,其特征在于,所述装置还包括发送单元,其中,若所述第一数据包合法,The device according to any one of claims 18-24, wherein the device further comprises a sending unit, wherein, if the first data packet is valid,
    所述发送单元,用于向受保护设备转发所述第一数据包。The sending unit is configured to forward the first data packet to a protected device.
  26. 根据权利要求18-24中任一项所述的装置,其特征在于,The device according to any one of claims 18-24, wherein:
    所述处理单元,还用于用第二源端口号替换所述目的端口号,得到第二数据包;The processing unit is further configured to replace the destination port number with a second source port number to obtain a second data packet;
    所述装置还包括发送单元,其中,若所述第一数据包合法,The device further includes a sending unit, wherein, if the first data packet is legal,
    所述发送单元,用于向受保护设备转发所述第二数据包。The sending unit is configured to forward the second data packet to the protected device.
  27. 根据权利要求26所述的装置,其特征在于,The device of claim 26, wherein:
    所述处理单元,还用于确定合法流表包括所述第一数据包的五元组,从所述合法流表中获取所述第一数据包的五元组对应的所述第二源端口号,所述第一数据包的五元组用于唯一标识一条网络流量,所述第一数据包的五元组包括所述源IP地址、目的IP地址、所述传输层协议号、所述第一源端口号和所述目的端口号。The processing unit is further configured to determine that the legal flow table includes the quintuple of the first data packet, and obtain the second source port corresponding to the quintuple of the first data packet from the legal flow table Number, the five-tuple of the first data packet is used to uniquely identify a piece of network traffic, and the five-tuple of the first data packet includes the source IP address, the destination IP address, the transport layer protocol number, and the The first source port number and the destination port number.
  28. 一种数据处理装置,其特征在于,包括:A data processing device, characterized in that it comprises:
    接收单元,用于接收第一数据包,所述第一数据包包括传输层协议号、第一源端口号和目的端口号;A receiving unit, configured to receive a first data packet, the first data packet including a transport layer protocol number, a first source port number, and a destination port number;
    处理单元,用于根据所述传输层协议号和所述目的端口号确定所述第一数据包是一个发往反射设备的流量,所述反射设备为发送分布式反射拒绝服务DRDoS攻击的设备;A processing unit, configured to determine, according to the transport layer protocol number and the destination port number, that the first data packet is a traffic sent to a reflection device, and the reflection device is a device that sends a distributed reflection denial of service DRDoS attack;
    所述处理单元,还用于用第二源端口号替换所述第一源端口号,得到第二数据包,所述第二源端口号包括验证码,所述验证码是根据密钥和待认证信息确定的,所述待认证信息包括所述第一数据包包含的目的互联网协议IP地址,所述目的IP地址为所述反射设备的IP地址;The processing unit is further configured to replace the first source port number with a second source port number to obtain a second data packet, where the second source port number includes a verification code, and the verification code is based on a key and a waiting code. If the authentication information is determined, the information to be authenticated includes a destination Internet Protocol IP address included in the first data packet, and the destination IP address is the IP address of the reflection device;
    发送单元,用于发送所述第二数据包。The sending unit is configured to send the second data packet.
  29. 根据权利要求28所述的装置,其特征在于,所述处理单元具体用于:The device according to claim 28, wherein the processing unit is specifically configured to:
    确定反射型协议端口特征集合包括所述目的端口号和所述传输层协议号,且所述传输层协议号是用户数据报协议UDP号或传输控制协议TCP号,则所述第一数据包是一个发往所述反射设备的流量。It is determined that the reflection type protocol port feature set includes the destination port number and the transport layer protocol number, and the transport layer protocol number is the User Datagram Protocol UDP number or the Transmission Control Protocol TCP number, then the first data packet is A traffic sent to the reflecting device.
  30. 根据权利要求28或29所述的装置,其特征在于,所述待认证信息还包括所述第一数据包包含的源IP地址、所述目的端口号和所述传输层协议号中至少一个,和/或,第一端口索引和时间参数中至少一个;所述源IP地址为源设备的IP地址,所述源设备为遭受DRDoS攻击的受保护设备,所述第一端口索引用于标识一个应用。The device according to claim 28 or 29, wherein the information to be authenticated further includes at least one of the source IP address, the destination port number, and the transport layer protocol number contained in the first data packet, And/or, at least one of a first port index and a time parameter; the source IP address is the IP address of the source device, the source device is a protected device suffering from a DRDoS attack, and the first port index is used to identify one application.
  31. 根据权利要求28-30中任一项所述的装置,其特征在于,所述第二源端口号还包括第一端口索引。The device according to any one of claims 28-30, wherein the second source port number further comprises a first port index.
  32. 根据权利要求28-31中任一项所述的装置,其特征在于,The device according to any one of claims 28-31, wherein:
    所述处理单元,还用于确定合法流表包括所述第一数据包的五元组,从所述合法流表中获取所述第一数据包的五元组对应的所述第二源端口号,所述第一数据包的五元组用于唯一标识一条网络流量,所述第一数据包的五元组包括源IP地址、所述目的IP地址、所述传输层协议号、所述第一源端口号和所述目的端口号。The processing unit is further configured to determine that the legal flow table includes the quintuple of the first data packet, and obtain the second source port corresponding to the quintuple of the first data packet from the legal flow table The quintuple of the first data packet is used to uniquely identify a piece of network traffic, and the quintuple of the first data packet includes the source IP address, the destination IP address, the transport layer protocol number, and the The first source port number and the destination port number.
  33. 根据权利要求32所述的装置,其特征在于,若所述合法流表不包括所述第一数据包的五元组,所述处理单元,还用于:The device according to claim 32, wherein if the legal flow table does not include the 5-tuple of the first data packet, the processing unit is further configured to:
    判断所述合法流表是否包括所述第一数据包中除所述第一源端口号的四元组;Judging whether the legal flow table includes a four-tuple other than the first source port number in the first data packet;
    若所述合法流表不包括所述第一数据包中除所述第一源端口号的四元组,生成第一端口索引;If the legal flow table does not include a four-tuple other than the first source port number in the first data packet, generate a first port index;
    若所述合法流表包括所述第一数据包的除所述第一源端口号的四元组,更新所述四元组对应的第二端口索引,得到第一端口索引。If the legal flow table includes a quadruple of the first data packet excluding the first source port number, update the second port index corresponding to the quadruple to obtain the first port index.
  34. 一种数据处理装置,其特征在于,包括:至少一个处理器、存储器和总线,其中,所述存储器用于存储计算机程序,使得所述计算机程序被所述至少一个处理器执行时实现如权利要求1-10中任一项所述的数据处理方法,或者如权利要求11-17中任一项所述的数据处理方法。A data processing device, characterized by comprising: at least one processor, a memory, and a bus, wherein the memory is used to store a computer program, so that when the computer program is executed by the at least one processor, the implementation is as claimed in the claims The data processing method according to any one of 1-10, or the data processing method according to any one of claims 11-17.
  35. 一种计算机可读存储介质,其特征在于,包括:计算机软件指令;A computer-readable storage medium, characterized by comprising: computer software instructions;
    当所述计算机软件指令在计算机设备或内置在计算机设备的芯片中运行时,使得所述计算机设备执行如权利要求1-10中任一项所述的数据处理方法,或者如权利要求11-17中任一项所述的数据处理方法。When the computer software instruction runs in a computer device or a chip built into the computer device, the computer device is caused to execute the data processing method according to any one of claims 1-10, or as claimed in claims 11-17 The data processing method described in any one of.
PCT/CN2021/096986 2020-05-30 2021-05-28 Data processing method and apparatus WO2021244449A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010480846.5A CN113746788A (en) 2020-05-30 2020-05-30 Data processing method and device
CN202010480846.5 2020-05-30

Publications (1)

Publication Number Publication Date
WO2021244449A1 true WO2021244449A1 (en) 2021-12-09

Family

ID=78727760

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/096986 WO2021244449A1 (en) 2020-05-30 2021-05-28 Data processing method and apparatus

Country Status (2)

Country Link
CN (1) CN113746788A (en)
WO (1) WO2021244449A1 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114726930A (en) * 2022-03-30 2022-07-08 深信服科技股份有限公司 Data packet tracking method, system, device and readable storage medium
CN116866055A (en) * 2023-07-26 2023-10-10 中科驭数(北京)科技有限公司 Method, device, equipment and medium for defending data flooding attack
CN117240599A (en) * 2023-11-07 2023-12-15 国家工业信息安全发展研究中心 Security protection method, device, equipment, network and storage medium

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115379027B (en) * 2022-04-27 2023-08-01 国家计算机网络与信息安全管理中心 DNS message resolution improvement method, device, improvement equipment and storage medium
CN115175177B (en) * 2022-06-16 2024-04-16 烽火通信科技股份有限公司 Message transmission method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103281336A (en) * 2013-06-19 2013-09-04 上海众恒信息产业股份有限公司 Network intrusion detection method
CN104883362A (en) * 2015-05-11 2015-09-02 北京交通大学 Method and device for controlling abnormal access behaviors
US20170257386A1 (en) * 2016-03-02 2017-09-07 Electronics And Telecommunications Research Institute Apparatus and method of detecting distributed reflection denial of service attack based on flow information
CN107786521A (en) * 2016-08-30 2018-03-09 中兴通讯股份有限公司 The method, apparatus and interchanger of defending distributed reflection denial service attack

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103281336A (en) * 2013-06-19 2013-09-04 上海众恒信息产业股份有限公司 Network intrusion detection method
CN104883362A (en) * 2015-05-11 2015-09-02 北京交通大学 Method and device for controlling abnormal access behaviors
US20170257386A1 (en) * 2016-03-02 2017-09-07 Electronics And Telecommunications Research Institute Apparatus and method of detecting distributed reflection denial of service attack based on flow information
CN107786521A (en) * 2016-08-30 2018-03-09 中兴通讯股份有限公司 The method, apparatus and interchanger of defending distributed reflection denial service attack

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114726930A (en) * 2022-03-30 2022-07-08 深信服科技股份有限公司 Data packet tracking method, system, device and readable storage medium
CN116866055A (en) * 2023-07-26 2023-10-10 中科驭数(北京)科技有限公司 Method, device, equipment and medium for defending data flooding attack
CN116866055B (en) * 2023-07-26 2024-02-27 中科驭数(北京)科技有限公司 Method, device, equipment and medium for defending data flooding attack
CN117240599A (en) * 2023-11-07 2023-12-15 国家工业信息安全发展研究中心 Security protection method, device, equipment, network and storage medium
CN117240599B (en) * 2023-11-07 2024-02-20 国家工业信息安全发展研究中心 Security protection method, device, equipment, network and storage medium

Also Published As

Publication number Publication date
CN113746788A (en) 2021-12-03

Similar Documents

Publication Publication Date Title
WO2021244449A1 (en) Data processing method and apparatus
US11570098B2 (en) Systems, apparatuses and methods for cooperating routers
US8224976B2 (en) Using a server's capability profile to establish a connection
CN107409125B (en) Efficient policy enforcement using network tokens for service-user plane approaches
US8499146B2 (en) Method and device for preventing network attacks
US8745723B2 (en) System and method for providing unified transport and security protocols
US8879388B2 (en) Method and system for intrusion detection and prevention based on packet type recognition in a network
US7653938B1 (en) Efficient cookie generator
CN109005175B (en) Network protection method, device, server and storage medium
EP3720100A1 (en) Service request processing method and device
CN108173812A (en) Prevent method, apparatus, storage medium and the equipment of network attack
Cao et al. 0-rtt attack and defense of quic protocol
CN110213224B (en) Data packet asynchronous forwarding method and system, data processing system and consensus node terminal
WO2021032126A1 (en) Data processing method and apparatus
CN113114649B (en) Method, device, equipment and medium for solving denial of service attack
CN111245858A (en) Network flow interception method, system, device, computer equipment and storage medium
US11863535B2 (en) Methods, devices, and systems for secure communications over a network
TW201132055A (en) Routing device and related packet processing circuit
US11218449B2 (en) Communications methods, systems and apparatus for packet policing
EP3073701B1 (en) Network protection entity and method for protecting a communication network against fraud messages
EP2953311B1 (en) Packet identification method and protective device
Malekzadeh et al. Protected control packets to prevent denial of services attacks in IEEE 802.11 wireless networks
US11044197B2 (en) System and method for protecting resources using network devices
WO2023060881A1 (en) Method and apparatus for identifying source address of message
Liu Mitigating Denial-of-Service Flooding Attacks with Source Authentication

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21818679

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21818679

Country of ref document: EP

Kind code of ref document: A1