CPU attack detection method and device, network equipment and readable storage medium

By gradually identifying the risk queue and risk protocol types and using the hardware IPFIX function to perform data flow statistics, the problems of accuracy and load increase in traditional CPU attack detection methods are solved, and the effects of accurate detection and load reduction are achieved.

CN119051965APending Publication Date: 2024-11-29MAIPU COMM TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411272648.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-11
Publication Date
2024-11-29

AI Technical Summary

Technical Problem

When traditional CPU attack detection methods process protocol packets, it is difficult to accurately distinguish attack packets from normal packets, resulting in increased CPU load and the total hardware speed limit limit leads to inaccurate statistics.

Method used

By obtaining the total number of packets collected by the CPU queue in the preset period, we will determine whether it is a risk queue, and determine the risk protocol type, use the hardware IPFIX function to perform data flow statistics, gradually identify the risk queue and risk protocol type, and transfer to the preset queue , reduce CPU load.

Benefits of technology

The accuracy and load reduction of CPU attack detection are achieved. Through hardware ACL and IPFIX functions, the CPU's depackaging overhead and incomplete protection problems are reduced, and the targetedness and efficiency of detection are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119051965A_ABST
    Figure CN119051965A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of data communication, and provides a CPU attack detection method and device, network equipment and a readable storage medium, and the method comprises the steps: obtaining the total number of received packets of each CPU queue in a preset period time; judging whether the CPU queue is a risk queue or not according to the total packet receiving quantity; if the CPU queue is a risk queue, determining a risk protocol type from protocol types of all received data packets of the risk queue in a preset period time; transferring the data packets of the risk protocol type in the risk queue from the CPU queue to a preset queue; acquiring a data flow statistical result of the risk protocol type by adopting a hardware IPFIX function; and determining a risk data flow generating the CPU attack according to a data flow statistical result. According to the method, the accuracy of CPU attack detection is ensured, and meanwhile, the load of the CPU is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data communication technology, and in particular to a CPU attack detection method, device, network equipment and readable storage medium. Background Art

[0002] Network attacks are everywhere, especially when there are loops in the network. For ordinary forwarding messages, storm suppression can be used to avoid more serious impact on the network. For protocol messages, since normal protocols still need to work, the CPU still needs to send and receive protocol messages normally. Therefore, if the attack message is a protocol message, it is necessary to distinguish the attack message from the normal message, suppress the attack message, and process the normal message normally.

[0003] The traditional processing method is that the CPU classifies and counts the key fields of the message, and splits the attack message (single message attack, scanning, etc.) for the classified and counted data. However, due to the need to protect the CPU, the messages reported to the CPU are subject to the total hardware speed limit, which will lead to inaccurate statistics. At the same time, when an attack is occurring, the CPU itself is relatively busy. At this time, attack detection classification statistics will further increase the CPU load. Summary of the invention

[0004] The object of the present invention is to provide a CPU attack detection method, device, network equipment and readable storage medium, which can ensure the accuracy of CPU attack detection while reducing the load of the CPU.

[0005] The embodiments of the present invention can be implemented as follows:

[0006] In a first aspect, the present invention provides a CPU attack detection method, the method comprising:

[0007] Get the total number of packets received by each CPU queue within the preset cycle time;

[0008] Determine whether the CPU queue is a risk queue according to the total number of received packets;

[0009] If the CPU queue is a risk queue, determining a risk protocol type from the protocol types of all received data packets of the risk queue within the preset period time;

[0010] Transferring the data packets of the risky protocol type in the risky queue from the CPU queue to a preset queue;

[0011] Using hardware IPFIX function to obtain data flow statistics of the risky protocol type;

[0012] The risk data flow that generates a CPU attack is determined according to the data flow statistics result.

[0013] In an optional implementation manner, the CPU queue is pre-set with a packet receiving rate limit value, and the step of judging whether the CPU queue is a risk queue according to the total number of received packets includes:

[0014] If the difference between the total number of received packets and the packet receiving rate limit value is less than or equal to a first preset threshold, the CPU queue is determined to be a risk queue; otherwise, the CPU queue is determined not to be a risk queue.

[0015] In an optional implementation, the step of determining the risky protocol type from the protocol types of all data packets in the risky queue includes:

[0016] Obtaining the number of data packets of each protocol type in the risk queue;

[0017] A protocol type whose number of data packets is greater than or equal to a second preset threshold is determined as the risky protocol type, where the second preset threshold is calculated by multiplying a packet receiving speed limit value preset by the risk queue by a first preset ratio.

[0018] In an optional implementation, the all received data packets include data packets of at least one protocol type, each protocol type is configured with a corresponding hardware ACL table entry, the hardware ACL table entry is allocated with a counter for counting data packets of the protocol type matching the hardware ACL table entry, and the step of obtaining the number of data packets of each protocol type in the risk queue includes:

[0019] Read the count value of the counter corresponding to the hardware ACL table entry matching each protocol type;

[0020] The count value of the counter corresponding to the hardware ACL table entry matched by each protocol type is used as the number of data packets of each protocol type.

[0021] In an optional implementation, the adopting the hardware IPFIX function to obtain the data flow statistics of the risky protocol type includes:

[0022] Configure the port for IPFIX traffic statistics to be the port of the risky protocol type;

[0023] Periodically obtain IPFIX data flow statistics for the risky protocol type.

[0024] In an optional implementation manner, the data flow statistics result includes entries of data flows and a flow value corresponding to each data flow, and the step of determining the risk data flow that generates a CPU attack according to the data flow statistics result includes:

[0025] If the flow value of any data flow in the data flow statistics is greater than the total flow of the risky protocol type multiplied by the value of the second preset ratio, the data flow is determined to be a risky data flow in which a CPU attack occurs; otherwise, the data flow is considered to be a non-risky data flow.

[0026] In an optional implementation manner, after the step of determining the risk data flow that generates a CPU attack according to the data flow statistics result, the method further includes:

[0027] The risky data flow in the preset queue is transferred to a degraded queue, and the priority of the degraded queue is lower than that of the preset queue.

[0028] In a second aspect, the present invention provides a CPU attack detection device, the device comprising:

[0029] The acquisition module is used to obtain the total number of received packets of each CPU queue within a preset cycle time;

[0030] A judging module, used for judging whether the CPU queue is a risk queue according to the total number of received packets;

[0031] a determination module, configured to determine a risk protocol type from protocol types of all received data packets of the risk queue within the preset period if the CPU queue is a risk queue;

[0032] A transfer module, used for transferring the data packets of the risky protocol type in the risky queue from the CPU queue to a preset queue;

[0033] The acquisition module is further used to obtain the data flow statistics of the risk protocol type using the hardware IPFIX function;

[0034] The determination module is further used to determine the risk data flow that generates CPU attack according to the data flow statistics result.

[0035] In a third aspect, the present invention provides a network device, comprising a processor and a memory, wherein the memory is used to store a program, and the processor is used to implement the CPU attack detection method described in any one of the aforementioned implementation modes when executing the program.

[0036] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the CPU attack detection method described in any one of the aforementioned embodiments.

[0037] Compared with the prior art, the present invention first determines whether the CPU queue is a risk queue according to the total number of packets received by the CPU queue within a preset cycle time. If it is determined to be a risk queue, the risk protocol type therein is further determined, and the risk data flow that generates the CPU attack is determined according to the data flow statistics of the risk protocol type. By gradually identifying the risk queue and the risk protocol type in the risk queue, the data flow statistics are made more targeted, which not only ensures the accuracy of CPU attack detection, but also reduces the load on the CPU. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0039] Figure 1 Example of the CPU attack detection method provided in this embodiment Figure 1 .

[0040] Figure 2 Example of the CPU attack detection method provided in this embodiment Figure 2 .

[0041] Figure 3 This is a block diagram of an example of a CPU attack detection device provided in this embodiment.

[0042] Figure 4 This is a block diagram of an example network device provided in this embodiment.

[0043] Icons: 10 - network device; 11 - processor; 12 - memory; 13 - bus; 100 - CPU attack detection device; 110 - acquisition module; 120 - judgment module; 130 - determination module; 140 - transfer module. DETAILED DESCRIPTION

[0044] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.

[0045] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0046] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.

[0047] In the description of the present invention, it should be noted that if the terms "upper", "lower", "inside", "outside", etc. appear to indicate an orientation or position relationship, they are based on the orientation or position relationship shown in the accompanying drawings, or are the orientation or position relationship in which the product of the invention is usually placed when used. They are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention.

[0048] In addition, the terms “first”, “second”, etc., if used, are merely used to distinguish between the descriptions and should not be understood as indicating or implying relative importance.

[0049] It should be noted that, in the absence of conflict, the features in the embodiments of the present invention may be combined with each other.

[0050] Please refer to Figure 1 , Figure 1 Example of the CPU attack detection method provided in this embodiment Figure 1 , the method comprises the following steps:

[0051] Step S101, obtaining the total number of packets received by each CPU queue within a preset cycle time.

[0052] In this embodiment, the total number of packets received by the CPU queue within a preset cycle time can also be expressed by the PPS (Packets Per Second) of the CPU queue. PPS represents the number of packets that can be processed within one second, which is very important for evaluating the performance of network equipment.

[0053] In this embodiment, the data packets received by each CPU queue may include one or more protocol types, and the protocol types include, but are not limited to, MAC, IPV4, IPV6, and the like.

[0054] In this embodiment, the total number of data packets received by the CPU queue may be periodically obtained according to a preset period, and the preset period may be set according to actual needs.

[0055] Step S102: determine whether the CPU queue is a risk queue according to the total number of received packets.

[0056] In this embodiment, the risk queue is only a suspicious queue that may have an attack risk. Generally, when a CPU attack occurs, the number of packets received by the CPU queue will surge, approaching the number of packets that the CPU queue can process. Of course, it is not ruled out that the current network business surges, resulting in a bottleneck in the processing capacity of the network device, so that the number of packets received is close to the maximum number of packets that the CPU queue can process.

[0057] Step S103: if the CPU queue is a risk queue, determine the risk protocol type from the protocol types of all received data packets of the risk queue within a preset period of time.

[0058] In this embodiment, the risky protocol type is a protocol type in which the number of received data packets is abnormal, including the situation where the number of received data packets of a certain protocol type accounts for a very large proportion of all received data packets per unit time of the CPU queue, or a certain protocol type that should not or cannot appear in normal business processing.

[0059] It should be noted that when there are multiple protocol types in the risk queue, a periodic polling method can be used to judge each protocol type to determine all risk protocol types in the risk queue, and step S104 and step S105 are processed for each risk protocol type.

[0060] Step S104: transferring the data packets of the risky protocol type in the risky queue from the CPU queue to the preset queue.

[0061] In this embodiment, in order to reduce the impact of risky protocol type packets on other normal packets in the CPU queue, after the risky protocol type is identified, the risky protocol type packets in the risky queue can be transferred from the CPU queue to the preset queue, so that only risky protocol type packets exist in the preset queue, which will not affect other packets in the original CPU queue to which the risky protocol type packets belong. As an implementation method, the priority of the preset queue is lower than the priority of the original CPU queue.

[0062] Step S105: Use the hardware IPFIX function to obtain data flow statistics of risky protocol types.

[0063] In this embodiment, the data flow statistics result is the result of counting the data packets whose protocol type is the risk protocol type in the risk queue. When counting, the data packets can be counted by flow direction, that is, the data packets with the same flow direction are counted together. As an implementation method, the flow direction can be represented by source IP, destination IP, source port, and destination port, that is, if the source IP, destination IP, source port, and destination port of the data packets are the same, these data packets are counted together.

[0064] Step S106, determining risk data flows that may cause CPU attacks based on the data flow statistics results.

[0065] In this embodiment, CPU attack mainly refers to impacting the CPU of the network device through a large number of malicious messages or requests, resulting in excessive CPU resource usage, thereby affecting the normal operation and business processing of the network device. The malicious messages sent include, but are not limited to, ARP (Address Resolution Protocol) messages, DHCP (Dynamic Host Configuration Protocol) messages, ICMP (Internet Control Message Protocol) messages, TCP SYN (Transmission Control Protocol Synchronize Sequence Numbers) messages, UDP (User Datagram Protocol) messages, etc.

[0066] The method provided in this embodiment makes data flow statistics more targeted by gradually identifying risk queues and risk protocol types in risk queues, thereby ensuring the accuracy of CPU attack detection and reducing the CPU load.

[0067] In an optional implementation manner, when the total number of received packets is very close to the maximum number of packets that the CPU queue can process, it means that the CPU queue is a risk queue. In order to determine whether the two are close, this embodiment provides an implementation method:

[0068] If the difference between the total number of received packets and the packet receiving rate limit value is less than or equal to the first preset threshold, the CPU queue is determined to be a risk queue; otherwise, the CPU queue is determined not to be a risk queue.

[0069] In this embodiment, the CPU queue is pre-set with a packet receiving speed limit value, which represents the maximum capacity of the CPU queue to receive data packets per unit time. The total number of received packets cannot be greater than the packet receiving speed limit value, and in extreme cases, it is only equal to the packet receiving speed limit value. The first preset threshold is used to control the maximum degree of proximity between the total number of received packets and the packet receiving speed limit value under normal circumstances, and can be set according to actual needs. For example, if the first preset threshold is set to 10 and the packet receiving speed limit value is 100, when the total number of received packets is 90, the difference between the two is 100-90=10, which meets the condition that the CPU queue is a risk queue.

[0070] It should be noted that, when there are multiple CPU queues, each CPU queue may be set with its own packet receiving rate limit value, so as to determine whether the CPU queue is a risk queue according to its own packet receiving rate limit value and the total number of received packets.

[0071] In an optional implementation, the data packets in the risk queue may include multiple protocol types, but not every protocol type is strongly correlated with the CPU attack. In order to more accurately lock the CPU attack, the risk protocol type with the greatest correlation with the CPU attack among the multiple protocol types in the risk queue may be determined first. Therefore, this embodiment further provides an implementation method for determining the risk protocol type:

[0072] First, obtain the number of packets of each protocol type in the risk queue;

[0073] Secondly, the protocol type whose number of data packets is greater than or equal to a second preset threshold is determined as a risky protocol type, where the second preset threshold is calculated by multiplying a packet receiving speed limit value preset by the risk queue by a first preset ratio.

[0074] In this embodiment, the first preset ratio can be set according to actual needs, for example, the first preset ratio is set to 60%. As an implementation, when there are multiple protocol types, a first preset ratio can be preset for each protocol type, and the second preset threshold corresponding to each protocol type can be calculated according to the first preset ratio of each protocol type. The first preset ratio of each protocol type can be set according to the protocol mechanism of the network device or the product capability of the network device. For example, the first preset ratio of a high-end network device is higher than the first preset ratio of a low-end network device.

[0075] In this embodiment, taking the protocol types including A, B, and C, whose first preset ratios are 50%, 60%, and 70% respectively, and the packet receiving speed limit is 100 as an example, the second preset thresholds corresponding to the three protocol types are 50, 60, and 70 respectively. If in the risk queue, the numbers of data packets of the three protocol types A, B, and C are 60, 20, and 20 respectively, the number of data packets of A, 60, is greater than its second preset threshold 50, and A is a risky protocol.

[0076] In this embodiment, since the message encapsulation of different protocol types is different, if each protocol type needs to be parsed and processed by the CPU separately, it will cause a waste of CPU capacity and it is difficult to achieve comprehensive protection. For this reason, in this embodiment, in the hardware ACL (Access Control List) of the network device, the hardware ACL usually contains a series of entries, each of which specifies a specific permission or restriction and can be applied to network traffic based on attributes such as IP address, MAC address, protocol type, etc. For example, an entry in the hardware ACL can specify a protocol type so that the network device only processes packets of the specified protocol type. The hardware ACL entry is allocated with a counter for counting packets of the protocol type that matches the hardware ACL entry. Based on this, a specific implementation method for obtaining the number of packets of each protocol type is as follows:

[0077] First, read the count value of the counter corresponding to the hardware ACL table entry matching each protocol type;

[0078] Secondly, the count value of the counter corresponding to the hardware ACL table entry matching each protocol type is used as the number of data packets of each protocol type.

[0079] In this embodiment, the count value of the counter corresponding to each protocol type can be read periodically according to a preset period, so as to determine the risk queue and the risk protocol type according to the preset period, and finally realize the periodic detection of CPU attacks.

[0080] The above method provided in this embodiment, the hardware ACL and the counters allocated to each protocol type are all implemented in hardware, which does not require the participation of the CPU, nor does it require the CPU to parse and process the data packets of each protocol separately before performing statistics, which greatly reduces the burden on the CPU and also realizes comprehensive protection for multiple protocol types.

[0081] It should also be noted that in addition to using counters to count the number of data packets of each protocol type, a counter can also be set for the CPU queue to count the number of data packets received by the CPU queue. This is also implemented using hardware and does not require the participation of the CPU, reducing the burden on the CPU.

[0082] In this embodiment, after determining the risk queue and the risk protocol type in the risk queue, the data flow statistics result is obtained by counting the data flow of the risk protocol type, thereby determining the risk data flow that generates the CPU attack, and the data flow statistics result includes the data flow entries and the flow value corresponding to each data flow, each entry represents a flow direction feature of the data packet, and the flow value corresponding to each data flow represents the number of data packets matching each entry. This embodiment takes the source IP and destination IP as an example to illustrate the data packet flow statistics result, as shown in Table 1.

[0083] Table 1

[0084]

[0085]

[0086] Based on the data flow statistics results, this embodiment provides two detection methods.

[0087] Method 1:

[0088] If the flow value of any data flow in the data flow statistics is greater than the total flow of the risky protocol type multiplied by the second preset ratio, the data flow is determined to be a risky data flow for CPU attack; otherwise, the data flow is considered to be a non-risky data flow.

[0089] In this embodiment, each protocol type corresponds to a second preset ratio, which is related to the rules and conventions of the protocol type, the product capabilities of the network device, and the function of the network device in the network. For example, when the network device acts as a switch and as a router in the network, the second preset ratio corresponding to the protocol type it processes is different.

[0090] In an optional implementation, in order to reduce the impact of risky protocol type packets on other normal packets in the CPU queue, after the risky protocol type is identified, the risky protocol type packets in the risky queue can be transferred from the CPU queue to a dedicated preset queue in multiple CPU queues, so that only risky protocol type packets exist in the preset queue, which will not affect other packets in the original CPU queue to which the risky protocol type packets belong. As an implementation method, the priority of the preset queue is lower than the priority of the original CPU queue.

[0091] Based on this, after further generating risk data flows of CPU attacks, in order to isolate data packets more specifically to minimize the impact caused by them, this embodiment further provides an isolation processing method for risk data flows:

[0092] The risky data flow in the preset queue is transferred to the downgraded queue, and the priority of the downgraded queue is lower than that of the preset queue.

[0093] In this embodiment, only data flows with flow values ​​greater than the total flow of the risky protocol type multiplied by the value of the second preset ratio exist in the downgraded queue, and the priority of the downgraded queue is lower than the priority of the preset queue, thereby achieving accurate isolation of risky data flows.

[0094] Method 2:

[0095] If the number of entries of the data flow is greater than a preset number, an alarm is issued and the entries of the data flow are recorded.

[0096] In this embodiment, when the number of data flow entries is greater than the preset number, there are two possibilities: (1) scanning attack; (2) the processing capacity of the network device has reached a bottleneck and needs to be expanded. In order to further identify which situation it is, the data flow entries can be recorded to facilitate further analysis of the data flow entries so as to take countermeasures according to the specific situation. As a recording method, the data flow entries can be written into a memory file or into a preset database.

[0097] In this embodiment, in order to reduce the CPU burden as much as possible when obtaining the statistical results of the data flow of the risky protocol type, this embodiment also provides a hardware implementation method using IPFIX. In order to filter out the traffic of the risky protocol type by hardware through IPFIX, please refer to Figure 2 , Figure 2 Example of the CPU attack detection method provided in this embodiment Figure 2 , step S105 comprises the following steps:

[0098] Step S1051, configuring the port for traffic statistics of IPFIX to be a port of risky protocol type.

[0099] Step S1052: Periodically obtain IPFIX data flow statistics for risky protocol types.

[0100] In this embodiment, as an implementation method of configuring a port for IPFIX traffic statistics, a keyword representing a risky protocol type and an entry for each data flow of each flow direction characteristic of a data packet of the risky protocol type can be mapped to an IPFIX statistical template so that IPFIX can perform statistics on each data flow of the risky protocol type.

[0101] In this embodiment, the keyword characterizing the risky protocol type can be set according to the keyword of the risky protocol type in the hardware ACL, or the keyword of the risky protocol type in the hardware ACL can be directly used as the keyword characterizing the risky protocol type in IPFIX.

[0102] The above method provided in this embodiment uses IPFIX to filter out traffic of risky protocol types in hardware, thereby reducing the burden on the CPU. By utilizing the uniformity of IPFIX reporting information, the CPU overhead for decapsulating messages can be reduced.

[0103] In this embodiment, in view of the problem that in the prior art, in the non-attack situation, it is still necessary to continuously classify and count CPU messages for attack identification, which also wastes CPU capacity, this embodiment also provides a solution, and one implementation method is:

[0104] First, the current total number of packets of the risky protocol type in the preset queue and the downgraded queue is obtained according to the preset cycle time;

[0105] Secondly, if the current total number is less than the second preset threshold, the risk protocol type is determined to be a normal protocol type.

[0106] When the risk protocol type is changed to a normal protocol type, in order to avoid continuing to consume the CPU resources of the hardware resources of the network device and causing unnecessary waste of CPU resources, the isolation of the risk protocol type data packets can be stopped and IPFIX can be stopped from counting the data flows of the risk protocol type. Furthermore, after the risk protocol type is changed to a normal protocol type, it is further determined whether there are other risk protocol types in the risk queue. If not, the data in the preset queue and the downgraded queue are restored to the original CPU queue (the original risk queue).

[0107] In order to execute the corresponding steps in the above embodiment and each possible implementation method, a method for implementing the CPU attack detection device 100 is given below. Figure 3 , Figure 3 The block diagram of the CPU attack detection device provided in the embodiment of the present invention. It should be noted that the basic principle and technical effect of the CPU attack detection device 100 provided in this embodiment are the same as those of the corresponding above-mentioned embodiments, which are not mentioned in this embodiment for the sake of brief description.

[0108] The CPU attack detection device 100 includes an acquisition module 110 , a judgment module 120 , a determination module 130 and a transfer module 140 .

[0109] An acquisition module 110 is used to acquire the total number of received packets of each CPU queue within a preset cycle time;

[0110] A judging module 120 is used to judge whether the CPU queue is a risk queue according to the total number of received packets;

[0111] The determination module 130 is used to determine the risk protocol type from the protocol types of all received data packets of the risk queue within a preset period time if the CPU queue is a risk queue;

[0112] A transfer module 140, configured to transfer data packets of a risky protocol type in a risky queue from a CPU queue to a preset queue;

[0113] The acquisition module 110 is further used to obtain data flow statistics of risky protocol types using the hardware IPFIX function;

[0114] The determination module 130 is further configured to determine risky data flows that may generate CPU attacks based on the data flow statistics results.

[0115] In an optional implementation manner, the CPU queue is pre-set with a packet receiving speed limit value, and the determination module 120 is specifically used to:

[0116] If the difference between the total number of received packets and the packet receiving rate limit value is less than or equal to the first preset threshold, the CPU queue is determined to be a risk queue; otherwise, the CPU queue is determined not to be a risk queue.

[0117] In an optional implementation manner, the determination module 130 is specifically configured to:

[0118] Get the number of packets of each protocol type in the risk queue;

[0119] A protocol type whose number of data packets is greater than or equal to a second preset threshold is determined as a risky protocol type, where the second preset threshold is calculated by multiplying a packet receiving speed limit value preset by the risk queue by a first preset ratio.

[0120] In an optional implementation, all received data packets include data packets of at least one protocol type, each protocol type is configured with a corresponding hardware ACL table entry, the hardware ACL table entry is allocated with a counter for counting data packets of the protocol type matching the hardware ACL table entry, and the acquisition module 110 is specifically used to:

[0121] Read the count value of the counter corresponding to the hardware ACL table entry matching each protocol type;

[0122] The count value of the counter corresponding to the hardware ACL entry matching each protocol type is used as the number of data packets of each protocol type.

[0123] In an optional implementation manner, the acquisition module 110 is further specifically configured to:

[0124] Configure the port for IPFIX traffic statistics as a risky protocol port;

[0125] Periodically obtain IPFIX data flow statistics for risky protocol types.

[0126] In an optional implementation manner, the data flow statistics result includes data flow entries and a flow value corresponding to each data flow, and the determination module 130 is specifically used to:

[0127] If the flow value of any data flow in the data flow statistics is greater than the total flow of the risky protocol type multiplied by the second preset ratio, the data flow is determined to be a risky data flow for CPU attack, otherwise the data flow is considered to be a non-risky data flow.

[0128] In an optional embodiment, the transfer module 140 is further configured to:

[0129] The risky data flow in the preset queue is transferred to the downgraded queue, and the priority of the downgraded queue is lower than that of the preset queue.

[0130] This embodiment also provides a block diagram of a network device 10. The network device 10 implements the CPU attack detection method of this embodiment. Figure 4 , Figure 4 A block diagram of a network device 10 provided in an embodiment of the present invention is shown. The network device 10 includes a processor 11 , a memory 12 and a bus 13 . The processor 11 and the memory 12 are connected via the bus 13 .

[0131] The processor 11 may be an integrated circuit chip having the ability to process signals. In the implementation process, each step of the CPU attack detection method of the above embodiment may be completed by an integrated logic circuit of hardware in the processor 11 or by instructions in the form of software. The above processor 11 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.

[0132] The memory 12 is used to store a program for implementing the CPU attack detection method of the above embodiment, and the program may be a software function module stored in the memory 12 in the form of software or firmware or fixed in the operating system (OS) of the network device 10. After receiving the execution instruction, the processor 11 executes the program to implement the CPU attack detection method disclosed in the above embodiment.

[0133] An embodiment of the present invention provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the CPU attack detection method of any one of the aforementioned implementation modes is implemented.

[0134] In summary, an embodiment of the present invention provides a CPU attack detection method, apparatus, network device and readable storage medium, the method comprising: obtaining the total number of received packets of each CPU queue within a preset cycle time; judging whether the CPU queue is a risk queue according to the total number of received packets; if the CPU queue is a risk queue, determining the risk protocol type from the protocol types of all received data packets of the risk queue within the preset cycle time; transferring the data packets of the risk protocol type in the risk queue from the CPU queue to the preset queue; obtaining the data flow statistics results of the risk protocol type by using the hardware IPFIX function; and determining the risk data flow that generates the CPU attack according to the data flow statistics results. Compared with the prior art, this embodiment has at least the following advantages: (1) by gradually identifying the risk queue and the risk protocol type in the risk queue, the data flow statistics are made more targeted, which not only ensures the accuracy of CPU attack detection, but also reduces the CPU load; (2) by using the hardware ACL, a counter for counting the data packets matching the corresponding protocol type in the ACL is allocated to each protocol type in the ACL, and the statistical results of the data packets of each protocol type can be obtained without consuming CPU resources; (3) after the risk protocol type is identified, the data packets of the risk protocol type in the risk queue are transferred from the CPU queue to a preset queue among multiple CPU queues, so that only the data packets of the risk protocol type exist in the preset queue , which will not affect other data packets in the original CPU queue to which the data packets of the risky protocol type belong. Furthermore, when a single-packet attack is identified, the data packets carrying the single-packet attack are placed in a low-priority queue to minimize their impact on other data packets; (4) The risky protocol type traffic is filtered out by hardware through IPFIX, which reduces the CPU burden. By utilizing the uniformity of IPFIX reporting information, the CPU overhead for packet decapsulation can be reduced; (5) The statistical results of the data packets of each protocol type are obtained by using hardware ACL. The risky protocol type traffic is filtered out by hardware through IPFIX, which avoids the problem of incomplete protection after adding protocol types and effectively reduces CPU overhead.

[0135] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims

1. A CPU attack detection method, characterized in that: The method comprises: Get the total number of packets received by each CPU queue within the preset cycle time; Determine whether the CPU queue is a risk queue according to the total number of received packets; If the CPU queue is a risk queue, determining a risk protocol type from the protocol types of all received data packets of the risk queue within the preset period time; Transferring the data packets of the risky protocol type in the risky queue from the CPU queue to a preset queue; Using hardware IPFIX function to obtain data flow statistics of the risky protocol type; The risk data flow that generates a CPU attack is determined according to the data flow statistics result.

2. The CPU attack detection method according to claim 1, characterized in that: The CPU queue is pre-set with a packet receiving speed limit value, and the step of judging whether the CPU queue is a risk queue according to the total number of received packets includes: If the difference between the total number of received packets and the packet receiving rate limit value is less than or equal to a first preset threshold, the CPU queue is determined to be a risk queue; otherwise, the CPU queue is determined not to be a risk queue.

3. The CPU attack detection method according to claim 1, characterized in that: The step of determining the risk protocol type from the protocol types of all data packets in the risk queue comprises: Obtaining the number of data packets of each protocol type in the risk queue; A protocol type whose number of data packets is greater than or equal to a second preset threshold is determined as the risky protocol type, and the second preset threshold is calculated by multiplying a packet receiving speed limit value preset by the risk queue by a first preset ratio.

4. The CPU attack detection method according to claim 3, characterized in that: The all received data packets include data packets of at least one protocol type, each protocol type is configured with a corresponding hardware ACL table entry, the hardware ACL table entry is allocated with a counter for counting data packets of the protocol type matching the hardware ACL table entry, and the step of obtaining the number of data packets of each protocol type in the risk queue includes: Read the count value of the counter corresponding to the hardware ACL table entry matching each protocol type; The count value of the counter corresponding to the hardware ACL table entry matched by each protocol type is used as the number of data packets of each protocol type.

5. The CPU attack detection method according to claim 1, characterized in that: The method of using the hardware IPFIX function to obtain the data flow statistics of the risky protocol type includes: Configure the port for IPFIX traffic statistics to be the port of the risky protocol type; Periodically obtain IPFIX data flow statistics for the risky protocol type.

6. The CPU attack detection method according to claim 5, characterized in that: The data flow statistics result includes data flow entries and a flow value corresponding to each data flow, and the step of determining the risk data flow that generates a CPU attack according to the data flow statistics result includes: If the flow value of any data flow in the data flow statistics is greater than the total flow of the risky protocol type multiplied by the value of the second preset ratio, the data flow is determined to be a risky data flow in which a CPU attack occurs; otherwise, the data flow is considered to be a non-risky data flow.

7. The CPU attack detection method according to claim 6, characterized in that: After the step of determining the risk data flow that generates a CPU attack according to the data flow statistics result, the method further includes: The risky data flow in the preset queue is transferred to a degraded queue, and the priority of the degraded queue is lower than that of the preset queue.

8. A CPU attack detection device, characterized in that: The device comprises: The acquisition module is used to obtain the total number of received packets of each CPU queue within a preset cycle time; A judging module, used for judging whether the CPU queue is a risk queue according to the total number of received packets; a determination module, configured to determine a risk protocol type from protocol types of all received data packets of the risk queue within the preset period if the CPU queue is a risk queue; A transfer module, used for transferring the data packets of the risky protocol type in the risky queue from the CPU queue to a preset queue; The acquisition module is further used to obtain the data flow statistics of the risk protocol type using the hardware IPFIX function; The determination module is further used to determine the risk data flow that generates CPU attack according to the data flow statistics result.

9. A network device, characterized in that: The invention comprises a processor and a memory, wherein the memory is used to store a program, and the processor is used to implement the CPU attack detection method according to any one of claims 1 to 7 when executing the program.

10. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed by a processor, the CPU attack detection method according to any one of claims 1 to 7 is implemented.