A multi-scale fast attack traffic screening method with white fast and black slow
Through the multi-scale white fast, black and slow fast attack traffic screening method, the metadata information of data packets is used for screening, which reduces the scope of detection and analysis, improves the performance and efficiency of security equipment, and solves the problem of traffic filtering performance in the existing technology. Insufficient problem.
Patent Information
- Application Number
- CN202410850482.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-27
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2044-06-27
AI Technical Summary
The performance of existing security equipment in traffic filtering is insufficient, resulting in the same level of detection and analysis for all traffic, resulting in a large number of inefficient and useless calculations, affecting performance and efficiency.
A multi-scale fast attack traffic screening method of white, fast, black and slow is used to perform first-level filtering based on the metadata information of the data packet to determine whether the data packet is suspicious or non-suspicious, and perform second-level filtering based on the matching degree between the filter string and the attack string. Filtering prioritizes the extraction of metadata information for preliminary screening, reducing detection and analysis of all traffic loads.
It improves the performance and efficiency of security equipment, avoids a large number of inefficient calculations, ensures the effect of data packet filtering, and achieves both performance and efficiency.
Smart Images

Figure CN118400199B
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of traffic filtering, and in particular to a multi-scale fast attack traffic screening method. Background Art
[0002] In recent years, with the continuous increase and evolution of network attacks, security devices and systems are facing huge challenges. However, with the increasing feature set of network attacks and the rapid growth of network traffic, the insufficient performance of security devices in traffic filtering has gradually become a bottleneck for the entire traffic transmission system.
[0003] In the related art, security devices usually need to perform the same level of detection and analysis on all traffic loads, which will lead to a large number of inefficient and useless calculations. These problems seriously affect the performance and efficiency of security devices and systems. Summary of the invention
[0004] In order to overcome the problems existing in the related art, the present disclosure provides a multi-scale fast attack traffic screening method of white fast and black slow.
[0005] A first aspect of the present disclosure provides a multi-scale fast attack traffic screening method of white fast and black slow, the method comprising:
[0006] Based on the metadata information of the received data packet, determine the primary filtering result of the data packet, wherein the primary filtering result includes that the data packet is a suspicious data packet and that the data packet is a non-suspicious data packet, and the non-suspicious data packet is a trusted data packet or an attack data packet;
[0007] In response to the data packet being a suspicious data packet, a secondary filtering result of the data packet is determined based on a match between a filter string and at least one attack string, wherein the filter string includes part or all of the data in the payload of the data packet, and the secondary filtering result includes whether the data packet is an attack data packet.
[0008] Optionally, the method further includes:
[0009] For each attack string in the at least one attack string, write the offset of each super character contained in the attack string into the corresponding super character offset record string in the filter table, wherein the super character represents at least one continuous bit, and the offset represents the position of the corresponding super character in the attack string;
[0010] The step of determining the secondary filtering result of the data packet according to the matching degree between the filter string and at least one attack string includes:
[0011] The matching degree between the filter string and at least one attack string is determined based on the filter table, and the secondary filtering result of the data packet is determined according to the matching degree.
[0012] Optionally, the at least one attack string is W super characters, and the offset record string of the super characters includes W bits, where W is a positive integer;
[0013] The step of writing the offset of each super character contained in the attack string into the corresponding super character offset record string in the filter table includes:
[0014] The bit position corresponding to the offset of each super character included in the attack string is set to 1.
[0015] Optionally, the data structure type of the filter table includes bytes;
[0016] The step of recording the offset corresponding to each super character included in the attack string and setting the bit position corresponding to the offset of the super character to 1 in the string includes:
[0017] Based on the shift operation and the bitwise OR operation, the bit position corresponding to the offset of each super character contained in the attack string is set to 1.
[0018] Optionally, determining the degree of match between the filter string and at least one attack string based on the filter table, and determining the secondary filtering result of the data packet according to the degree of match, includes:
[0019] Super characters are read into the filter string one by one, and each time a super character is read, a right shift operation is performed on the state value S, and a bitwise AND operation is performed between the offset record string corresponding to the read super character in the filter table and S, and S is updated to the result of the bitwise AND operation. When the number of super characters read reaches W, in response to the least significant bit of the updated S being 1, the secondary filtering result is determined to be that the data packet is an attack data packet, wherein all bits of S are 1 in the initial state, and the right shift operation sets the most significant bit of S to 1.
[0020] Optionally, the at least one attack string is determined based on at least one attack feature;
[0021] In response to the least significant bit of the updated S being 1, determining that the secondary filtering result is that the data packet is an attack data packet includes:
[0022] In response to the least significant bit of the updated S being 1, and any attack feature matching the filter string exists in the at least one attack feature, it is determined that the secondary filtering result is that the data packet is an attack data packet.
[0023] Optionally, the method further includes:
[0024] Sampling each attack feature of at least one attack feature based on a preset sampling interval to obtain at least one attack string corresponding to each attack feature;
[0025] The step of determining the secondary filtering result of the data packet according to the matching degree between the filter string and at least one attack string includes:
[0026] The filter string is sampled based on the sampling interval to obtain at least one filter substring, and a secondary filtering result of the data packet is determined according to a matching degree between the at least one filter substring and at least one attack string.
[0027] Optionally, the method further includes:
[0028] For each attack string in the at least one attack string, write the offset of each super character contained in the attack string into the corresponding super character offset record string in the filter table, wherein the super character represents at least one continuous bit, and the offset represents the position of the corresponding super character in the attack string;
[0029] The step of determining the secondary filtering result of the data packet according to the matching degree between the filtering substring and at least one attack string includes:
[0030] The secondary filtering result of the data packet is determined based on the filtering table according to the matching degree between the filtering substring and at least one attack string.
[0031] Optionally, determining the secondary filtering result of the data packet according to the matching degree between the at least one filtering substring and the at least one attack string includes:
[0032] In response to any filter substring in at least one filter substring matching any attack string in the at least one attack string, determining an attack string to be matched corresponding to the other filter substring in the at least one attack string according to a relative position of the any filter substring and the other filter substring in the filter string, and a position of the any attack string in the any filter substring;
[0033] The secondary filtering result of the data packet is determined according to the matching degree between the another filtering substring and the attack string to be matched.
[0034] Optionally, the method further includes:
[0035] According to the hash value of the residual sequence corresponding to each attack string of each attack feature in the at least one attack feature, construct at least one hash bucket and add the at least one attack feature to the at least one hash bucket, wherein the residual sequence corresponding to the attack string is the difference between the attack feature and the attack string;
[0036] The determining, according to the relative positions of any one of the filter substrings and another filter substring in the filter string, and the position of any one of the attack strings in the filter substring, the attack string to be matched corresponding to the another filter substring in the at least one attack string comprises:
[0037] Determine the hash value of the residual sequence corresponding to any attack string according to the position of any attack string in the filter string, wherein the residual sequence corresponding to any attack string is the difference between the suspicious feature sequence in the filter string and corresponding to any attack string and any attack string;
[0038] For each attack feature in the hash bucket corresponding to the hash value, determine the attack string to be matched corresponding to the other filter substring in the at least one attack string according to the relative position of any filter substring and the other filter substring in the filter string, and the position of any attack string in any filter substring.
[0039] A second aspect of the present disclosure provides a multi-scale fast attack traffic screening device with white fast and black slow, the device comprising:
[0040] A primary filtering module, used to determine a primary filtering result of a data packet based on metadata information of the received data packet, wherein the primary filtering result includes that the data packet is a suspicious data packet and that the data packet is a non-suspicious data packet, and the non-suspicious data packet is a trusted data packet or an attack data packet;
[0041] A secondary filtering module is used to determine the secondary filtering result of the data packet in response to the data packet being a suspicious data packet based on the matching degree between the filter string and at least one attack string, wherein the filter string includes part or all of the data in the payload of the data packet, and the secondary filtering result includes whether the data packet is an attack data packet.
[0042] Optionally, the device further comprises:
[0043] A first filter table generating module is used for writing the offset of each super character contained in the at least one attack string into the offset record string of the corresponding super character in the filter table, wherein the super character represents at least one continuous bit, and the offset represents the position of the corresponding super character in the attack string;
[0044] The secondary filtering module is used to determine the secondary filtering result of the data packet according to the matching degree between the filtering string and at least one attack string, and is used to:
[0045] The matching degree between the filter string and at least one attack string is determined based on the filter table, and the secondary filtering result of the data packet is determined according to the matching degree.
[0046] Optionally, the at least one attack string is W super characters, and the offset record string of the super characters includes W bits, where W is a positive integer;
[0047] The first filter table generating module is used to write the offset of each super character contained in the attack string into the corresponding super character offset record string in the filter table, and is used to:
[0048] The bit position corresponding to the offset of each super character included in the attack string is set to 1.
[0049] Optionally, the data structure type of the filter table includes bytes;
[0050] The first filter table generating module is used for recording the offset corresponding to each super character contained in the attack string and setting the bit position corresponding to the offset of the super character to 1:
[0051] Based on the shift operation and the bitwise OR operation, the bit position corresponding to the offset of each super character contained in the attack string is set to 1.
[0052] Optionally, when the secondary filtering module is used to determine the degree of match between the filter string and at least one attack string based on the filter table and determine the secondary filtering result of the data packet according to the degree of match, it is used to:
[0053] Super characters are read into the filter string one by one, and each time a super character is read, a right shift operation is performed on the state value S, and a bitwise AND operation is performed between the offset record string corresponding to the read super character in the filter table and S, and S is updated to the result of the bitwise AND operation. When the number of super characters read reaches W, in response to the least significant bit of the updated S being 1, the secondary filtering result is determined to be that the data packet is an attack data packet, wherein all bits of S are 1 in the initial state, and the right shift operation sets the most significant bit of S to 1.
[0054] Optionally, the at least one attack string is determined based on at least one attack feature;
[0055] The secondary filtering module is used for, in response to the least significant bit of the updated S being 1, when determining that the secondary filtering result is that the data packet is an attack data packet, to:
[0056] In response to the least significant bit of the updated S being 1, and any attack feature matching the filter string exists in the at least one attack feature, it is determined that the secondary filtering result is that the data packet is an attack data packet.
[0057] Optionally, the device further comprises:
[0058] A sampling module, configured to sample each attack feature of at least one attack feature based on a preset sampling interval to obtain at least one attack string corresponding to each attack feature;
[0059] The secondary filtering module is used to determine the secondary filtering result of the data packet according to the matching degree between the filtering string and at least one attack string, and is used to:
[0060] The filter string is sampled based on the sampling interval to obtain at least one filter substring, and a secondary filtering result of the data packet is determined according to a matching degree between the at least one filter substring and at least one attack string.
[0061] Optionally, the device further comprises:
[0062] The second filter table generation module is used for writing the offset of each super character contained in the attack string into the corresponding super character offset record string in the filter table for each attack string in the at least one attack string, wherein the super character represents at least one continuous bit, and the offset represents the position of the corresponding super character in the attack string;
[0063] The secondary filtering module is used to determine the secondary filtering result of the data packet according to the matching degree between the filtering substring and at least one attack string, and is used to:
[0064] The secondary filtering result of the data packet is determined based on the filtering table according to the matching degree between the filtering substring and at least one attack string.
[0065] Optionally, when determining the secondary filtering result of the data packet according to the matching degree between the at least one filtering substring and the at least one attack string, the secondary filtering module is used to:
[0066] In response to any filter substring in at least one filter substring matching any attack string in the at least one attack string, determining an attack string to be matched corresponding to the other filter substring in the at least one attack string according to a relative position of the any filter substring and the other filter substring in the filter string, and a position of the any attack string in the any filter substring;
[0067] The secondary filtering result of the data packet is determined according to the matching degree between the another filtering substring and the attack string to be matched.
[0068] Optionally, the device further comprises:
[0069] A hash bucket adding module, configured to construct at least one hash bucket according to a hash value of a residual sequence corresponding to each attack string of each attack feature in the at least one attack feature, and add the at least one attack feature to the at least one hash bucket, wherein the residual sequence corresponding to the attack string is a difference between the attack feature and the attack string;
[0070] The secondary filtering module is used to determine, when determining the attack string to be matched corresponding to the other filter substring in the at least one attack string according to the relative positions of the any filter substring and the other filter substring in the filter string and the position of the any attack string in the any filter substring:
[0071] Determine the hash value of the residual sequence corresponding to any attack string according to the position of any attack string in the filter string, wherein the residual sequence corresponding to any attack string is the difference between the suspicious feature sequence in the filter string and corresponding to any attack string and any attack string;
[0072] For each attack feature in the hash bucket corresponding to the hash value, determine the attack string to be matched corresponding to the other filter substring in the at least one attack string according to the relative position of any filter substring and the other filter substring in the filter string, and the position of any attack string in any filter substring.
[0073] A third aspect of the present disclosure provides a computer program product, including a computer program / instruction, which implements the method described in the first aspect when executed by a processor.
[0074] A fourth aspect of the present disclosure provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method described in the first aspect is implemented.
[0075] A fifth aspect of the present disclosure provides a computer-readable storage medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the method described in the first aspect.
[0076] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects:
[0077] In the embodiment of the present disclosure, based on the metadata information of the received data packet, the primary filtering result of the data packet is determined, and in response to the data packet being a suspicious data packet, the secondary filtering result of the data packet is determined according to the matching degree between the filter string and at least one attack string, and the filter string includes part or all of the data in the load of the data packet. It can be seen that in the embodiment provided by the present disclosure, it is not necessary to perform the same level of detection and analysis on all traffic loads, but a multi-level filtering method is adopted to preferentially extract part or all of the metadata information of the data packet, and the data packet is preliminarily screened based on the extracted metadata information. After determining that the data packet is a suspicious data packet, part or all of the load content of the data packet is extracted and further judged. In actual applications, common judgment conditions such as trusted ports, trusted IP addresses, trusted protocols, blacklisted IP addresses, etc. can be filtered by parsing the metadata contained in the data packet, thereby avoiding a large number of inefficient and useless calculations, and improving the performance and efficiency of security devices and systems; at the same time, further screening of suspicious data packets can ensure the data packet screening effect, and complete the performance of security devices and the screening effect of data packets.
[0078] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0079] The accompanying drawings, which are incorporated in and constitute a part of this disclosure, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0080] Figure 1 This is an application scenario diagram of a multi-scale white fast and black slow fast attack traffic screening method shown in some exemplary embodiments.
[0081] Figure 2 The present invention is a flowchart of a multi-scale fast attack traffic screening method of white fast and black slow, shown in some exemplary embodiments.
[0082] Figure 3 It is a schematic diagram of the architecture of a multi-scale white fast and black slow fast attack traffic screening method shown in some exemplary embodiments.
[0083] Figure 4 It is a block diagram of a multi-scale white fast and black slow fast attack traffic screening device shown in some exemplary embodiments.
[0084] Figure 5 The figure is a hardware structure diagram of a computer device shown in some exemplary embodiments. DETAILED DESCRIPTION
[0085] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0086] The terms used in this disclosure are for the purpose of describing specific embodiments only and are not intended to limit the disclosure. The singular forms of "a", "said" and "the" used in this disclosure and the appended claims are also intended to include plural forms unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0087] It should be understood that although the terms first, second, third, etc. may be used in the present disclosure to describe various information, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present disclosure, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0088] In recent years, with the continuous increase and evolution of network attacks, security devices and systems are facing huge challenges. However, with the increasing feature set of network attacks and the rapid growth of network traffic, the insufficient performance of security devices in traffic filtering has gradually become a bottleneck for the entire traffic transmission system. Figure 1, wherein the terminal sends a data packet to the security device through a network connection, and the data packet reaches the server after passing through the security device (this process can also be understood as the process of the terminal sending traffic to the server, or the process of the terminal uploading a message to the server. In this disclosure, no strict distinction is made between concepts such as data packets, traffic, and messages. In other words, the above concepts can be understood as the same or similar meanings, all representing the transmitted data), so that the server provides the terminal with the service required by the terminal; in this process, the terminal may send data packets with attack intentions to the server, and these data packets may cause damage to the normal process of the server providing services. Therefore, the security device (the security device can be a router, switch, gateway, network card and other components) needs to filter the data packets sent by the terminal to intercept data packets that may cause damage to the normal process of the server providing services. In actual applications, this process is usually achieved by detecting the content carried in the data packet.
[0089] The so-called detection can usually be achieved by identifying whether the data packet contains a preset attack feature. Among them, the attack feature can be a string of data, which can represent a malicious instruction or super-authority behavior, or represent a malicious intention in other ways. When the attack feature exists in the data contained in the data packet, the data packet can be considered as an attack data packet, and the data packet can be intercepted. In related technologies, security devices usually need to perform the same level of detection and analysis on all traffic loads, which will result in a large number of inefficient and useless calculations. These problems seriously affect the performance and efficiency of security devices and systems.
[0090] Specifically, most security devices currently still rely on feature matching engines to screen attack traffic, and most use matching models based on the AC (Aho-Corasick) algorithm. This type of matching model will become a performance bottleneck for the system when faced with large-scale feature sets and high-traffic network environments, especially in the following two aspects:
[0091] (1) A large-scale feature set will cause the AC algorithm to generate a huge state transition table. When matching, it will jump back and forth in the state transition table according to the message data. The huge state transition table will inevitably lead to a large number of cache misses, which will lead to a decrease in memory access efficiency and thus drag down the performance of the algorithm.
[0092] (2) Give nearly equal computing resources to all payload data in all messages. According to analysis, generally speaking, the proportion of attack payload in traffic data is very low, and usually more than 99.9% of the content in traffic data is irrelevant to attack behavior. However, in general, in order not to miss possible attack payloads, all traffic payloads need to be detected and analyzed, and a considerable portion of the calculations are inefficient.
[0093] In view of this, the present disclosure provides a multi-scale fast attack traffic screening method of white fast and black slow. Next, the embodiments of the present disclosure are described in detail.
[0094] The first aspect of the present disclosure provides a multi-scale fast attack traffic screening method. Figure 2 , which may include step S201 to step S202.
[0095] Step S201, based on the metadata information of the received data packet, determine the primary filtering result of the data packet, wherein the primary filtering result includes that the data packet is a suspicious data packet and the data packet is a non-suspicious data packet, and the non-suspicious data packet is a trusted data packet or an attack data packet.
[0096] Among them, the metadata information can also be understood as header information, which can refer to descriptive information attached to the data packet, such as source address and destination address (indicating the network address of the sender and receiver of the data packet, such as IP address, MAC address or other network identifier), protocol type (indicating the network protocol used by the data packet, such as TCP, UDP, ICMP, etc.), source port and destination port (indicating the communication port number between the data packet and the application), etc.
[0097] In practical applications, common information such as trusted ports (i.e., trusting all data packets originating from the port, such as the internal port of a company or home), trusted IP addresses (i.e., trusting all data packets originating from the IP address, such as the internal IP address of a company or home, LAN IP address, etc.), trusted protocols (e.g., private protocols), blacklist IP addresses (i.e., intercepting all data packets originating from the IP address), etc. can be directly obtained by parsing the metadata contained in the data packet to obtain the filtering result. Therefore, based on the metadata information of the received data packet, the primary filtering result of the data packet is determined, such as filtering by a whitelist or filtering by a blacklist. In the case where the metadata information contained in the current data packet has fallen into the whitelist or blacklist, it can be directly confirmed that the data packet is a trusted data packet (i.e., the metadata information carried by the data packet falls into the whitelist, and the trusted data packet is hereinafter referred to as "white traffic") or the data packet is an attack data packet (i.e., the metadata information carried by the data packet falls into the blacklist, and the attack data packet is hereinafter referred to as "black traffic"), and the data packet is "no longer suspicious", that is, no further judgment is required to directly determine the filtering result. Based on this, the workload of the security device can be greatly reduced, thereby improving the filtering efficiency of the security device for data packets without affecting its filtering effect, thereby achieving the effect of "white is fast and black is slow" (that is, only black traffic may fall into the range of suspicious data packets, and in other embodiments of the present disclosure, specific optional methods for screening black traffic at multiple scales from coarse to fine granularity are also provided).
[0098] Step S202, in response to the data packet being a suspicious data packet, determining a secondary filtering result of the data packet based on a match between a filter string and at least one attack string, wherein the filter string includes part or all of the data in the payload of the data packet, and the secondary filtering result includes whether the data packet is an attack data packet.
[0099] Among them, "string" can refer to a data string, which contains at least one bit; the security device can sample the payload of the data packet (i.e., the part of the data packet other than the header information) based on a preset algorithm or sampling interval to obtain a filter string; and at least one attack string can be determined by at least one attack feature, for example, at least one attack feature can be used as at least one attack string (i.e., the attack string and the above-mentioned attack feature are the same concept), or each attack feature in at least one attack feature can be sampled based on a preset algorithm or sampling interval to obtain at least one attack string for each attack feature.
[0100] See also Figure 3, the network traffic contains data packets, and the packet filtering module is used to perform primary filtering on the data packets, that is, the content described in step S201; after the data packet hits the whitelist or blacklist, the filtering result can be directly determined and delivered to the post-processing module (for example, sent to the server or handed over to the processor module for execution), and if it does not hit, the data packet may be a suspicious data packet. Next, the data packet needs to be screened for content (i.e., secondary filtering) and the secondary filtering result is determined, and then the data packet is intercepted or delivered to the post-processing module for corresponding processing based on the secondary filtering result. In the secondary filtering stage, the matching between the filter string and the attack feature can be achieved based on the AC algorithm, etc., or the filter string and the attack feature can be matched based on the string matching model. In the present disclosure, a variety of string matching models are designed to provide more efficient and applicable string matching operations for actual situations, including CaEPF (Cache Efficient Payload Filter) model, CoEPF (Compute Efficient Payload Filter) model, and CCEPF (Cache and Compute Efficient Payload Filter) model. Three optional string matching models are used to perform string matching (in the string matching process, at least one of the above three optional string matching models can be used for string matching). Details about this will be explained later.
[0101] As can be seen from the above embodiments, in the implementation provided by the present disclosure, it is not necessary to perform the same level of detection and analysis on all traffic loads. Instead, a multi-level filtering method is adopted to preferentially extract part or all of the metadata information of the data packet, and the data packet is preliminarily screened based on the extracted metadata information. After determining that the data packet is a suspicious data packet, part or all of the load content of the data packet is extracted and further judged. In actual applications, common judgment conditions such as trusted ports, trusted IP addresses, trusted protocols, blacklisted IP addresses, etc. can be filtered by parsing the metadata contained in the data packet, thereby avoiding a large number of inefficient and useless calculations, and improving the performance and efficiency of security devices and systems; at the same time, further screening of suspicious data packets can ensure the effect of data packet screening, and complete the performance of security devices and the effect of data packet screening.
[0102] The CaEPF model, CoEPF model and CCEPF model are introduced below.
[0103] In the CaEPF model, the method may further include: for each attack string in the at least one attack string, writing the offset of each super character contained in the attack string into the offset record string of the corresponding super character in the filter table, wherein the super character represents at least one continuous bit, and the offset represents the position of the corresponding super character in the attack string;
[0104] Determining the secondary filtering result of the data packet according to the matching degree between the filter string and at least one attack string includes: determining the matching degree between the filter string and at least one attack string based on the filter table, and determining the secondary filtering result of the data packet according to the matching degree.
[0105] Among them, a super character is a set of n bits (n is a positive integer). For example, a super character is defined as containing 8 bits. In this case, the concept of a super character can be equivalent to the concept of a byte. In some cases, defining a super character as a smaller value or a larger value may achieve better memory utilization efficiency (for example, making more effective use of the principle of spatial locality). The specific situation can be comprehensively considered and determined based on multiple dimensions such as the length of the attack string, the possibility of the server being attacked, and the specific operation logic of the memory. In some parts of the following text, the concept of "super characters" may not be specifically emphasized, but "characters" are generally used. However, it should be understood that where "characters" are used as units in this disclosure, "super characters" can also be used as units.
[0106] The filter table can be simply understood as a table structure (two-dimensional array structure), which has one axis for referring to the super character and another axis (offset record string) for indicating whether the super character appears at different positions.
[0107] Specifically, assuming that at least one of the attack strings is W super characters, the offset record string of the super characters includes W bits, where W is a positive integer; when W = 4, n = 8 (in this case, the super character is a single-byte character in the ordinary sense, and it is set to 8 here only for the convenience of description), and there are three attack features of "search", "filter", and "algorithm" (that is, if a data packet contains any of these three words, then the data packet is an attack data packet), then the attack string can be first determined based on the three attack features; for example, the three pattern character strings can be tail-aligned (of course, they can also be head-aligned or aligned at any position), and then W bits are taken as the attack string corresponding to each attack feature, specifically:
[0108] ;
[0109] ;
[0110] .
[0111] The characters in the black box are the attack strings. In each attack string, each character corresponds to a bit array of length W. Specifically, in this example, the super character "a" may appear in any of the 1st, 2nd, 3rd, and 4th positions in the attack string (it may appear multiple times or not at all). In some cases, if a character appears in the ith position after W characters in a pattern string, the ith bit in the offset record string corresponding to the character can be set to 1, and the other positions can be set to 0 (all positions in the filter table can also be initialized to 0 during initialization. In this case, only the set 1 operation needs to be performed). Based on the above three attack strings (i.e., "arch", "lter", and "ithm"), the following filter table can be obtained:
[0112] a: 1000
[0113] c:0010
[0114] e: 0010
[0115] h: 0011
[0116] i: 1000
[0117] l: 1000
[0118] m: 0001
[0119] r: 0101
[0120] t: 0100
[0121] The complete filter table has rows, 4 valid columns (because when n = 8, there may be different super characters, the above letters are just for the convenience of description, in fact the number of super characters is not limited to 26); in addition, except for the above few lines, the bits of the remaining lines are all 0, so they are not shown. In the above table, the offset record string corresponding to the super character "a" is "1000", indicating that in the above three attack strings, "a" appears in and only in the first position, and the offset record string corresponding to the super character "h" is "0011", indicating that in the above three attack strings, "h" appears in the third and fourth positions. In other words, if the filter string has never appeared anywhere in the filter string that satisfies "'a' appears in the first position and 'h' appears in the third or fourth position", then the filter string must not match any of the above three attack strings. Even if the above three attack strings are not matched one by one, it can be determined that the data packet is a trusted data packet.
[0122] Based on the above principle and the fact that the number of trusted data packets is usually much larger than that of attack data packets, the above implementation method can greatly improve the matching efficiency. At the same time, based on super characters and offsets to record the features carried by different attack strings (the "features" here refer to the characteristics of the string itself), multiple attack strings can be merged into the same filter table for recording. When the filter string fails to match the filter table, it can be determined that the filter string must not match any attack feature involved in establishing the table. The size of the filter table is much smaller than the state transition set corresponding to the same attack string, which makes it possible to concentrate the memory involved in most operations of content screening in a small part of memory (such as Cache, i.e., the dedicated caches such as the first-level cache, second-level cache, and third-level cache equipped by the central processing unit). In summary, the CaEPF model takes advantage of the fact that the speed of CPU accessing Cache is much higher than the speed of accessing main memory, and tries to improve the cache hit rate when accessing memory, reduce the number of accesses to main memory (i.e., "memory" in general), and thus improve the performance of the method.
[0123] In other words, at least one of the attack strings is W super-characters, and the offset record string of the super-character includes W bits, where W is a positive integer; writing the offset of each super-character included in the attack string into the corresponding super-character offset record string in the filter table may include: setting the bit position corresponding to the offset of the super-character in the offset record string corresponding to each super-character included in the attack string to 1.
[0124] Furthermore, the data structure type of the filter table includes bytes; the step of recording the bit position 1 in the offset record string corresponding to each super character contained in the attack string and corresponding to the offset of the super character may include: based on a shift operation and a bitwise OR operation, recording the bit position 1 in the offset record string corresponding to each super character contained in the attack string and corresponding to the offset of the super character.
[0125] Specifically, in a computer system, the memory is divided into continuous storage units, each storage unit has a unique address, and memory addressing refers to accessing and operating the data in a specific storage unit according to the address. In most computer systems, the smallest addressable unit of memory is a byte. Therefore, at the application level, the data type that occupies the smallest memory space is the byte. In the above optional implementation, only one bit is actually required to refer to a location. For example, in the above example, the offset record string only requires 4 bits. Therefore, in order to save memory space as much as possible, to increase the possibility of storing the filter table in the dedicated cache of the central processing unit, and to maximize the use of the principle of spatial locality, when declaring the filter table, you can use bytes as the data type and take As the number of columns in the filter table (that is, at least bytes to accommodate w bits; each row in the declared filter table corresponds to bits, but only w bits correspond to different positions where the super character may appear in the attack string, and the remaining bits can be given no meaning and remain at 0). Next, based on the shift operation and the "bitwise OR" operation, the bit position corresponding to the position where each super character appears in the filter table can be set to 1. Continuing with the above example, this process can be written as the following code (using C language as an example):
[0126] ;
[0127] Among them, Filter_Table is the filter table; SC is the super character currently obtained; Represents the decimal number corresponding to the binary string contained in the super character (this is done because in common high-level programming languages, data subscripts are usually decimal numbers); offset is the offset. In this example, the offset represents the offset of an element (super character) relative to the starting position of the array (string). The offset can be expressed by calculating the offset of the element relative to the first address of the array. The unit of the offset can be a super character; " " can also be replaced by " ", which represents the same meaning, but the relationship between the bits is slightly different.
[0128] After the filter table is established according to the above steps, the filter string and the filter table can be quickly matched based on the shift operation and the "bitwise AND" operation. Specifically, the determination of the matching degree between the filter string and at least one attack string based on the filter table, and the determination of the secondary filtering result of the data packet according to the matching degree may include:
[0129] Super characters are read into the filter string one by one, and each time a super character is read, a right shift operation is performed on the state value S, and a bitwise AND operation is performed between the offset record string corresponding to the read super character in the filter table and S, and S is updated to the result of the bitwise AND operation. When the number of super characters read reaches W, in response to the least significant bit of the updated S being 1, the secondary filtering result is determined to be that the data packet is an attack data packet, wherein all bits of S are 1 in the initial state, and the right shift operation sets the most significant bit of S to 1.
[0130] When matching, you can first initialize a state value S of D bytes (D can be w or ), all bits in S are initialized to 1, and then continuous supercharacters are constructed from the traffic data (filter string) , and then update the State according to the following code (using C language as an example):
[0131]
[0132] After performing the above operations W times, if there are still bits in State that are 1, it means that there is a potential matching feature string, and further confirmation can be performed at this time. The corresponding matching position can be calculated according to the position of the bit with a value of 1 in S, and its offset in the filter string, so that the starting position or the ending position of the original feature string in the traffic data can be obtained, so that it can be confirmed twice. That is, the at least one attack string is determined based on at least one attack feature; the response to the least significant bit of the updated S being 1, determining that the secondary filtering result is that the data packet is an attack data packet, can include: responding to the least significant bit of the updated S being 1, and there is any attack feature that matches the filter string in the at least one attack feature, determining that the secondary filtering result is that the data packet is an attack data packet. There are many methods for performing secondary confirmation (it should be understood that the secondary confirmation in the present disclosure is not the same concept as the secondary filtering), and the hash value of the filter string can be calculated and matched with the hash value of at least one attack string, or using a character matching algorithm such as the AC algorithm to determine whether there is an attack string that matches the filter string, which will not be repeated here.
[0133] Continuing with the previous example, we can initialize a state S when matching: 1 k(represents k consecutive 1s, here k = w, i.e. k = 4) Then read the characters one by one, and at the same time get the offset record string S corresponding to the character c (You can only take the valid bits), use S c Perform a "bitwise AND" operation with S. After reading in w characters, it is necessary to check whether the wth bit of the operation result is 1. If it is 1, it indicates that a candidate match has appeared and needs to enter the confirmation stage for confirmation. After processing a character, the result of the "AND" operation needs to be shifted right by 1 bit as the new state S. It should be noted that the newly shifted bit after the right shift is 1, for example, 1010 becomes 1101 after shifting right by 1 bit. During the second confirmation, all candidate pattern strings can be determined first based on the most recently read k characters, and then the tail of each candidate pattern string is aligned with the current position of the data to be matched and confirmed from back to front. If the confirmation is successful, the candidate pattern string is matched, otherwise it is not matched.
[0134] Assuming the filter string is "architecture", the above matching process is as follows:
[0135] Set the initial state S to: 1111.
[0136] Read in the super character a, and perform an "AND" operation on the state corresponding to a and S. The result is: 1111&1000=1000. Shift right 1 bit to get the new S: 1100.
[0137] After reading in r, the result of the “AND” operation is: 1100&0101=0100. Shifting right 1 bit gets the new S: 1010.
[0138] After reading in c, the result of the “AND” operation is: 1010&0010=0010. Shifting right 1 bit gets the new S: 1001.
[0139] After reading h, the result of the "AND" operation is: 1001&0011=0001. Since 4 characters have been read at this time, it is necessary to check whether the 4th bit of the operation result is 1. Since the 4th bit of the operation result is 1, it means that the 4 super characters at the end of a pattern string may be matched at this time (this bit has undergone 4 "bitwise AND" operations and is still 1, which means that the offsets of the past 4 super characters are all 1 in the corresponding positions in the filter table), so it is necessary to enter the confirmation stage for confirmation. According to the 4 characters "arch" read recently, the candidate pattern string is determined to be "search", and then the tail of "search" is aligned with the tail of "arch" to confirm from back to front. Obviously, there is no match here. Shift the operation result right by 1 bit to get a new S: 1000. Next, read the remaining characters in turn, and the matching process is the same as above. In some cases, only when the number of characters read in reaches M for the first time, the least significant bit being 1 indicates a potential hit (i.e., there may be an attack feature that matches the current filter string, in which case the secondary filtering result can be determined to be that the data packet is an attack data packet, and a secondary confirmation can be performed; after a successful match in the secondary confirmation stage, the data packet can be determined to be an attack data packet, and after a failed match in the secondary confirmation stage, the remaining characters can be read in and the method can be executed). In the subsequent matching process, as long as there is a bit that is 1 in S after S is updated, it can be indicated that there is a potential hit, because S can be rolling, and the least significant bit may not be discarded at each shift, but moved to the most significant bit.
[0140] In the CoEPF model, the method may further include: sampling each attack feature of the at least one attack feature based on a preset sampling interval to obtain at least one attack string corresponding to each attack feature;
[0141] Determining the secondary filtering result of the data packet based on the matching degree between the filter string and at least one attack string may include: sampling the filter string based on the sampling interval to obtain at least one filter substring, and determining the secondary filtering result of the data packet based on the matching degree between the at least one filter substring and at least one attack string.
[0142] The CoEPF model improves the efficiency of content review from the perspective of reducing the amount of calculation for white traffic data. Since white traffic data almost never contains attack features, it almost never contains subsequences of attack features. If the traffic data does not contain any subsequences of attack features, then the traffic data will definitely not contain attack features. Based on this idea, there is no need to analyze it byte by byte, but it can be analyzed by subsequences, so that some characters can be skipped and further confirmation can be performed when a matching subsequence is encountered. Similarly, since the proportion of subsequences contained in white traffic data is also very low, although some data may require secondary confirmation matching time, the overall matching speed has still been significantly improved.
[0143] Here, the n-order subsequence is defined as a sequence formed by every n-1 characters in the original sequence. An original sequence has a total of n n-order subsequences. Assume there is an attack feature: abcdefg. If n is 2, its corresponding 2-order subsequences are: aceg and bdf. If n is 3, the corresponding 3-order subsequences are: adg, be, cf. Each subsequence has an offset, which is the position of the starting character of the subsequence in the original sequence.
[0144] The CoEPF model will extract n-order subsequences from all attack features, and then use these n-order subsequences to build an AC state machine. When matching traffic data (filter string), the traffic data is no longer matched character by character, but is matched once every n-1 characters. When a subsequence is matched, it is necessary to infer the position offset of the original feature in the traffic data based on the offset position of the current subsequence (which can be understood as the process of determining the suspicious feature sequence described in this disclosure), and then match the characters that have not been matched to confirm whether an attack feature is matched. It should be understood that although on the surface, the larger n is, the more characters can be skipped during the matching process, and the matching speed will be faster. But in fact, when n is larger, the length of each subsequence is shorter, and the probability that the traffic data contains a subsequence is also greater, which leads to a greater number of secondary confirmations. Therefore, the value of n needs to be weighed according to the length of the attack feature and the distribution of the traffic data.
[0145] The CCEPF model can be regarded as a model obtained by fusing the CaEPF model with the CoEPF model. Based on the above CoEPF model, the method may further include: for each attack string in the at least one attack string, writing the offset of each super character contained in the attack string into the offset record string of the corresponding super character in the filter table, wherein the super character represents at least one continuous bit, and the offset represents the position of the corresponding super character in the attack string;
[0146] Determining the secondary filtering result of the data packet according to the matching degree between the filter substring and at least one attack string may include: determining the secondary filtering result of the data packet according to the matching degree between the filter substring and at least one attack string based on the filter table.
[0147] In other words, the step of "using these n-order subsequences to build an AC state machine" in the CoEPF model above is also applicable to the same principle as described in the relevant part of the CaEPF model, and can be implemented based on a filter table rather than matching one by one based on a hash algorithm or an AC algorithm. It is worth noting that after the CoEPF model extracts a substring (i.e., a subsequence) from a string, the substring has two attributes in addition to the bit data it carries. One is the offset of the substring (characterizing the position of the substring in the original string), and the other is the order of the substring. For example, the corresponding 2nd-order subsequences of the attack feature "abcdefg" are "aceg" and "bdf", and the order of these two substrings is 2 (i.e., it means taking one character every other character), while the offset of "aceg" is 0 and the offset of "bdf" is 1.
[0148] When establishing a filter table based on a subsequence, a filter table can be established based on part or all of the substrings contained in each attack feature in at least one attack feature (at this time, each substring can be regarded as an attack string, for example, if the length of "aceg" is 4 and the length of "bdf" is 3, the length of the attack string can be unified to 3, and "aceg" can be truncated to "ceg") (at this time, the substrings can be aligned using the method as exemplified above), and when extracting characters in the filter string one by one, characters are also extracted every n-1 characters to form a filter substring, and then the filter substring is matched based on the filter table determined by the n-order subsequence. Specifically, determining the secondary filtering result of the data packet based on the matching degree between the at least one filter substring and at least one attack string may include:
[0149] In response to any filter substring in at least one filter substring matching any attack string in the at least one attack string, determining an attack string to be matched corresponding to the other filter substring in the at least one attack string according to a relative position of the any filter substring and the other filter substring in the filter string, and a position of the any attack string in the any filter substring;
[0150] The secondary filtering result of the data packet is determined according to the matching degree between the another filtering substring and the attack string to be matched.
[0151] In other words, for example, continuing with the above example of the attack feature being "abcdefg" and the attack strings being "ceg" and "bdf", if the filter string is "atbcdefg", the extracted substring may be "abdf", which substring can obviously match the filter table (i.e., it satisfies the condition that "any filter substring in at least one filter substring matches any attack string in the at least one attack string"), and thus a secondary match can be performed. At this time, it is known that the combination of the three characters "bdf" exists in the filter table (that is, "bdf" is "any attack string" and "abdf" is "any filter substring"), so another filter substring can be selected, such as "tceg". The position of "tceg" relative to "abdf" is "one position backward". Therefore, "tceg" should be matched with the attack string to be matched "ceg" obtained by shifting any attack string "bdf" one position backward. If the match is still successful, it is considered that there is still a potential hit (and the hit probability is increasing), and the above steps can be repeated, or it can be determined based on the hash algorithm or AC algorithm whether there is indeed an attack feature that matches the filter string; if the match fails, it proves that although the combination of the three characters "bdf" exists in the filter table, the combination of "bcdefg" does not actually exist, so the match is invalid, it is considered that there is no potential hit temporarily, and the characters in the filter string continue to be read.
[0152] Furthermore, the method further comprises:
[0153] According to the hash value of the residual sequence corresponding to each attack string of each attack feature in the at least one attack feature, construct at least one hash bucket and add the at least one attack feature to the at least one hash bucket, wherein the residual sequence corresponding to the attack string is the difference between the attack feature and the attack string;
[0154] Determining the attack string to be matched corresponding to the other filter substring in the at least one attack string according to the relative position of the any filter substring and the other filter substring in the filter string, and the position of the any attack string in the any filter substring, may include:
[0155] Determine the hash value of the residual sequence corresponding to any attack string according to the position of any attack string in the filter string, wherein the residual sequence corresponding to any attack string is the difference between the suspicious feature sequence in the filter string and corresponding to any attack string and any attack string;
[0156] For each attack feature in the hash bucket corresponding to the hash value, determine the attack string to be matched corresponding to the other filter substring in the at least one attack string according to the relative position of any filter substring and the other filter substring in the filter string, and the position of any attack string in any filter substring.
[0157] In other words, before the step is executed, in addition to establishing a filter table based on at least one substring of each attack feature in at least one attack feature, a residual sequence is obtained based on these substrings (i.e., the difference between the original string and the substring, if the attack feature is "abcdefg" and the substring is "aceg", then its residual sequence is "bdf"), a hash value of each residual sequence is calculated, and the attack feature corresponding to the residual sequence is placed in a hash bucket corresponding to the hash value of the residual sequence (for example, the hash value starting with "e5" can be regarded as a hash value in the same hash bucket, and the hash value starting with "e6" can be regarded as a hash value in another hash bucket).
[0158] In the above steps, the "suspicious feature sequence" represents the string in the filter string that may constitute a complete attack feature. For example, in the filter string "atbcdefg", when the filter substring "abdf" is matched, it is found that the three characters "bdf" are matched successfully (because each match can actually be performed when a character is read in each time, when it is found that the match is successful and there is a potential hit after reading f, it can be determined that the three characters "bdf" are matched successfully). At this time, the order of the subsequence (or the sampling interval) can be known, so that the string that may constitute a complete attack feature in the filter string "atbcdefg" can be determined to be "b_d_f_" ("_" represents any character), and further combined with the offset of the filter substring "bdf" in the filter string, it can be determined that the current suspicious feature sequence is "bcdefg". That is, if the current filter string does contain a certain attack feature, then the attack feature should include the string "bcdefg". Since "bdf" has been matched in the suspicious feature sequence, then next, it is only necessary to match the unmatched part of the suspicious feature sequence. At this time, based on the suspicious feature sequence "bcdefg" and any of the attack strings "bdf", the residual sequence "ceg" corresponding to any of the attack strings and the hash value of the residual sequence can be determined. Next, according to the hash bucket corresponding to the hash value of the residual sequence, all residual sequences or attack features that may match the residual sequence can be found, and then the attack string to be matched can be found. The concept of the attack string to be matched has been introduced above and will not be repeated here. Based on the above implementation, the computing pressure of the security equipment can be further reduced, and the beneficial effects of the method can be enhanced.
[0159] In summary, the CCEPF model can be explained as follows. First, extract n-order subsequences from the original attack feature set (i.e., at least one attack feature), and use these n-order subsequences to construct a CaEPF filter table (i.e., the filter table establishment method corresponding to the CaEPF model). When creating the CaEPF table, the offset of each subsequence in its corresponding original sequence also needs to be encoded into the filter table, so that when there is a potential match in the CaEPF filter table, the position of the potential attack feature in the filter string can be calculated based on the position of the currently matched character and the offset position of the subsequence (i.e., the process of determining the "ceg" substring described above; this position can also be understood as, if there is indeed a hit total feature, then where the attack feature should be located in the filter string).
[0160] In addition to creating the CaEPF filter table, a hash table must also be set up. The construction process of this hash table is as follows:
[0161] (1) For each subsequence, a new sequence is formed by subtracting the characters of the subsequence from the original sequence, which is called the residual sequence;
[0162] (2) Calculate the length of the shortest residual sequence, denoted as AL;
[0163] (3) All residual sequences start from the tail and cut off the sequence of length AL from back to front to calculate the hash value;
[0164] (4) For the residual sequence falling into the same hash bucket, use the CoEPF model corresponding to its n-1 order subsequence.
[0165] When matching, first match the CaEPF table in the traffic data with a step of skipping n-1 characters each time. When matching a potential attack feature sequence, calculate the position of the potential matching attack feature sequence in the traffic data based on the current position and the offset position of the subsequence, then obtain a residual sequence of length AL, calculate the hash value of this sequence, locate the corresponding hash bucket based on the hash value, and then obtain the CoEPF model (i.e., subsequence) corresponding to the hash bucket. Offset one position forward or backward from the starting position of the current matching subsequence, and also match on the CoEPF model with an interval (step length) of skipping n-1 characters each time.
[0166] Corresponding to the embodiments of the aforementioned method, the present disclosure also provides embodiments of a device and a terminal to which the device is applied.
[0167] The second aspect of the present disclosure provides a multi-scale fast attack traffic screening device, see Figure 4 , the device comprises:
[0168] A primary filtering module 401, configured to determine a primary filtering result of a data packet based on metadata information of the received data packet, wherein the primary filtering result includes that the data packet is a suspicious data packet and that the data packet is a non-suspicious data packet, and the non-suspicious data packet is a trusted data packet or an attack data packet;
[0169] The secondary filtering module 402 is used to determine the secondary filtering result of the data packet in response to the data packet being a suspicious data packet based on the matching degree between the filter string and at least one attack string, wherein the filter string includes part or all of the data in the payload of the data packet, and the secondary filtering result includes whether the data packet is an attack data packet.
[0170] Optionally, the device further comprises:
[0171] A first filter table generating module is used for writing the offset of each super character contained in the at least one attack string into the offset record string of the corresponding super character in the filter table, wherein the super character represents at least one continuous bit, and the offset represents the position of the corresponding super character in the attack string;
[0172] The secondary filtering module is used to determine the secondary filtering result of the data packet according to the matching degree between the filtering string and at least one attack string, and is used to:
[0173] The matching degree between the filter string and at least one attack string is determined based on the filter table, and the secondary filtering result of the data packet is determined according to the matching degree.
[0174] Optionally, the at least one attack string is W super characters, and the offset record string of the super characters includes W bits, where W is a positive integer;
[0175] The first filter table generating module is used to write the offset of each super character contained in the attack string into the corresponding super character offset record string in the filter table, and is used to:
[0176] The bit position corresponding to the offset of each super character included in the attack string is set to 1.
[0177] Optionally, the data structure type of the filter table includes bytes;
[0178] The first filter table generating module is used for recording the offset corresponding to each super character contained in the attack string and setting the bit position corresponding to the offset of the super character to 1:
[0179] Based on the shift operation and the bitwise OR operation, the bit position corresponding to the offset of each super character contained in the attack string is set to 1.
[0180] Optionally, when the secondary filtering module is used to determine the degree of match between the filter string and at least one attack string based on the filter table and determine the secondary filtering result of the data packet according to the degree of match, it is used to:
[0181] Super characters are read into the filter string one by one, and each time a super character is read, a right shift operation is performed on the state value S, and a bitwise AND operation is performed between the offset record string corresponding to the read super character in the filter table and S, and S is updated to the result of the bitwise AND operation. When the number of super characters read reaches W, in response to the least significant bit of the updated S being 1, the secondary filtering result is determined to be that the data packet is an attack data packet, wherein all bits of S are 1 in the initial state, and the right shift operation sets the most significant bit of S to 1.
[0182] Optionally, the at least one attack string is determined based on at least one attack feature;
[0183] The secondary filtering module is used for, in response to the least significant bit of the updated S being 1, when determining that the secondary filtering result is that the data packet is an attack data packet, to:
[0184] In response to the least significant bit of the updated S being 1, and any attack feature matching the filter string exists in the at least one attack feature, it is determined that the secondary filtering result is that the data packet is an attack data packet.
[0185] Optionally, the device further comprises:
[0186] A sampling module, configured to sample each attack feature of at least one attack feature based on a preset sampling interval to obtain at least one attack string corresponding to each attack feature;
[0187] The secondary filtering module is used to determine the secondary filtering result of the data packet according to the matching degree between the filtering string and at least one attack string, and is used to:
[0188] The filter string is sampled based on the sampling interval to obtain at least one filter substring, and a secondary filtering result of the data packet is determined according to a matching degree between the at least one filter substring and at least one attack string.
[0189] Optionally, the device further comprises:
[0190] The second filter table generation module is used for writing the offset of each super character contained in the attack string into the corresponding super character offset record string in the filter table for each attack string in the at least one attack string, wherein the super character represents at least one continuous bit, and the offset represents the position of the corresponding super character in the attack string;
[0191] The secondary filtering module is used to determine the secondary filtering result of the data packet according to the matching degree between the filtering substring and at least one attack string, and is used to:
[0192] The secondary filtering result of the data packet is determined based on the filtering table according to the matching degree between the filtering substring and at least one attack string.
[0193] Optionally, when determining the secondary filtering result of the data packet according to the matching degree between the at least one filtering substring and the at least one attack string, the secondary filtering module is used to:
[0194] In response to any filter substring in at least one filter substring matching any attack string in the at least one attack string, determining an attack string to be matched corresponding to the other filter substring in the at least one attack string according to a relative position of the any filter substring and the other filter substring in the filter string, and a position of the any attack string in the any filter substring;
[0195] The secondary filtering result of the data packet is determined according to the matching degree between the another filtering substring and the attack string to be matched.
[0196] Optionally, the device further comprises:
[0197] A hash bucket adding module, configured to construct at least one hash bucket according to a hash value of a residual sequence corresponding to each attack string of each attack feature in the at least one attack feature, and add the at least one attack feature to the at least one hash bucket, wherein the residual sequence corresponding to the attack string is a difference between the attack feature and the attack string;
[0198] The secondary filtering module is used to determine, when determining the attack string to be matched corresponding to the other filter substring in the at least one attack string according to the relative positions of the any filter substring and the other filter substring in the filter string and the position of the any attack string in the any filter substring:
[0199] Determine the hash value of the residual sequence corresponding to any attack string according to the position of any attack string in the filter string, wherein the residual sequence corresponding to any attack string is the difference between the suspicious feature sequence in the filter string and corresponding to any attack string and any attack string;
[0200] For each attack feature in the hash bucket corresponding to the hash value, determine the attack string to be matched corresponding to the other filter substring in the at least one attack string according to the relative position of any filter substring and the other filter substring in the filter string, and the position of any attack string in any filter substring.
[0201] The implementation process of the functions and effects of each module in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, which will not be repeated here.
[0202] A third aspect of the present disclosure provides a computer program product, including a computer program / instruction, which implements the method described in the first aspect when executed by a processor.
[0203] For the device embodiments and computer program product embodiments, since they basically correspond to the method embodiments, the relevant parts can refer to the partial description of the method embodiments. In addition, the device embodiments described above are merely schematic, wherein the modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the disclosed solution. Those of ordinary skill in the art can understand and implement it without paying creative labor.
[0204] In a fourth aspect, the embodiments of the multi-scale fast attack traffic screening device provided by the present disclosure can be applied to computer devices. Figure 5 , which exemplarily shows a hardware schematic diagram of a computer device. For example, device 500 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0205] Device 500 may include one or more of the following components: a processing component 501 , a memory 502 , a power component 503 , a multimedia component 504 , an audio component 505 , an input / output (I / O) interface 506 , a sensor component 507 , and a communication component 508 .
[0206] The processing component 501 generally controls the overall operation of the device 500, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 501 may include one or more processors 509 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 501 may include one or more modules to facilitate the interaction between the processing component 501 and other components. For example, the processing component 501 may include a multimedia module to facilitate the interaction between the multimedia component 504 and the processing component 501.
[0207] The memory 502 is configured to store various types of data to support operations on the device 500. Examples of such data include instructions for any application or method operating on the device 500, contact data, phone book data, messages, pictures, videos, etc. The memory 502 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0208] The power supply component 503 provides power to the various components of the device 500. The power supply component 503 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device 500.
[0209] The multimedia component 504 includes a screen that provides an output interface between the device 500 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 504 includes a front camera and / or a rear camera. When the device 500 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0210] The audio component 505 is configured to output and / or input audio signals. For example, the audio component 505 includes a microphone (MIC), and when the device 500 is in an operation mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 502 or sent via the communication component 508. In some embodiments, the audio component 505 also includes a speaker for outputting audio signals.
[0211] I / O interface 506 provides an interface between processing component 501 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button, and lock button.
[0212] The sensor assembly 507 includes one or more sensors for providing various aspects of status assessment for the device 500. For example, the sensor assembly 507 can detect the open / closed state of the device 500, the relative positioning of components, such as the display and keypad of the device 500, and the sensor assembly 507 can also detect the position change of the device 500 or a component of the device 500, the presence or absence of user contact with the device 500, the orientation or acceleration / deceleration of the device 500, and the temperature change of the device 500. The sensor assembly 507 can also include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 507 can also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 507 can also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0213] The communication component 508 is configured to facilitate wired or wireless communication between the device 500 and other devices. The device 500 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, 4G or 5G, or a combination thereof. In an exemplary embodiment, the communication component 508 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 508 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
[0214] In an exemplary embodiment, the device 500 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to execute the multi-scale white-fast, black-slow, and fast attack traffic screening method of the above-mentioned computer device.
[0215] In a fifth aspect, the present disclosure, in an exemplary embodiment, further provides a non-temporary computer-readable storage medium including instructions, such as a memory 502 including instructions, and the above instructions can be executed by a processor 509 of a device 500 to complete the multi-scale white fast black slow fast attack traffic screening method of the above computer device. For example, the non-temporary computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a tape, a floppy disk, an optical data storage device, etc.
[0216] The above describes specific embodiments of the present disclosure. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0217] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the inventions claimed herein. The present disclosure is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not claimed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0218] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
[0219] The above description is only a preferred embodiment of the present disclosure and is not intended to limit the present disclosure. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present disclosure shall be included in the scope of protection of the present disclosure.
Claims
1. A multi-scale fast attack traffic screening method with white fast and black slow, characterized in that: The method comprises: Based on the metadata information of the received data packet, determine the primary filtering result of the data packet, wherein the primary filtering result includes that the data packet is a suspicious data packet and that the data packet is a non-suspicious data packet, and the non-suspicious data packet is a trusted data packet or an attack data packet; In response to the data packet being a suspicious data packet, determining a secondary filtering result of the data packet according to a matching degree between a filter string and at least one attack string, wherein the filter string includes part or all of the data in the payload of the data packet, and the secondary filtering result includes whether the data packet is an attack data packet; The method further comprises: For each attack string in the at least one attack string, write the offset of each super character contained in the attack string into the corresponding super character offset record string in the filter table, wherein the super character represents at least one continuous bit, and the offset represents the position of the corresponding super character in the attack string; The step of determining the secondary filtering result of the data packet according to the matching degree between the filter string and at least one attack string includes: The matching degree between the filter string and at least one attack string is determined based on the filter table, and the secondary filtering result of the data packet is determined according to the matching degree.
2. The multi-scale fast attack traffic screening method of claim 1 is characterized in that: The at least one attack string is W super characters, and the offset record string of the super characters includes W bits, where W is a positive integer; The step of writing the offset of each super character contained in the attack string into the corresponding super character offset record string in the filter table includes: The bit position corresponding to the offset of each super character included in the attack string is set to 1.
3. The multi-scale fast attack traffic screening method of claim 2 is characterized in that: The data structure type of the filter table includes bytes; The step of recording the offset corresponding to each super character included in the attack string and setting the bit position corresponding to the offset of the super character to 1 in the string includes: Based on the shift operation and the bitwise OR operation, the bit position corresponding to the offset of each super character contained in the attack string is set to 1.
4. The multi-scale fast attack traffic screening method of claim 3 is characterized in that: The determining, based on the filter table, a degree of match between the filter string and at least one attack string, and determining a secondary filtering result of the data packet according to the degree of match, includes: Super characters are read into the filter string one by one, and each time a super character is read, a right shift operation is performed on the state value S, and a bitwise AND operation is performed between the offset record string corresponding to the read super character in the filter table and S, and S is updated to the result of the bitwise AND operation. When the number of super characters read reaches W, in response to the least significant bit of the updated S being 1, the secondary filtering result is determined to be that the data packet is an attack data packet, wherein all bits of S are 1 in the initial state, and the right shift operation sets the most significant bit of S to 1.
5. The multi-scale fast attack traffic screening method of claim 4 is characterized in that: The at least one attack string is determined based on at least one attack feature; In response to the least significant bit of the updated S being 1, determining that the secondary filtering result is that the data packet is an attack data packet includes: In response to the least significant bit of the updated S being 1, and any attack feature matching the filter string exists in the at least one attack feature, it is determined that the secondary filtering result is that the data packet is an attack data packet.
6. The multi-scale fast attack traffic screening method of claim 1 is characterized in that: The method further comprises: Sampling each attack feature of at least one attack feature based on a preset sampling interval to obtain at least one attack string corresponding to each attack feature; The step of determining the secondary filtering result of the data packet according to the matching degree between the filter string and at least one attack string includes: The filter string is sampled based on the sampling interval to obtain at least one filter substring, and a secondary filtering result of the data packet is determined according to a matching degree between the at least one filter substring and at least one attack string.
7. The multi-scale fast attack traffic screening method of claim 6 is characterized in that: The method further comprises: For each attack string in the at least one attack string, write the offset of each super character contained in the attack string into the corresponding super character offset record string in the filter table, wherein the super character represents at least one continuous bit, and the offset represents the position of the corresponding super character in the attack string; The step of determining the secondary filtering result of the data packet according to the matching degree between the filtering substring and at least one attack string includes: The secondary filtering result of the data packet is determined based on the filtering table according to the matching degree between the filtering substring and at least one attack string.
8. The multi-scale fast attack traffic screening method of claim 6 is characterized in that: The step of determining the secondary filtering result of the data packet according to the matching degree between the at least one filtering substring and the at least one attack string comprises: In response to any filter substring in at least one filter substring matching any attack string in the at least one attack string, determining an attack string to be matched corresponding to the other filter substring in the at least one attack string according to a relative position of the any filter substring and the other filter substring in the filter string, and a position of the any attack string in the any filter substring; The secondary filtering result of the data packet is determined according to the matching degree between the another filtering substring and the attack string to be matched.
9. The multi-scale fast attack traffic screening method of claim 8 is characterized in that: The method further comprises: According to the hash value of the residual sequence corresponding to each attack string of each attack feature in the at least one attack feature, construct at least one hash bucket and add the at least one attack feature to the at least one hash bucket, wherein the residual sequence corresponding to the attack string is the difference between the attack feature and the attack string; The determining, according to the relative positions of any one of the filter substrings and another filter substring in the filter string, and the position of any one of the attack strings in the filter substring, the attack string to be matched corresponding to the another filter substring in the at least one attack string comprises: Determine the hash value of the residual sequence corresponding to any attack string according to the position of any attack string in the filter string, wherein the residual sequence corresponding to any attack string is the difference between the suspicious feature sequence in the filter string and corresponding to any attack string and any attack string; For each attack feature in the hash bucket corresponding to the hash value, determine the attack string to be matched corresponding to the other filter substring in the at least one attack string according to the relative position of any filter substring and the other filter substring in the filter string, and the position of any attack string in any filter substring.
10. A multi-scale fast attack traffic screening device with white fast and black slow, characterized in that: The device comprises: A primary filtering module, used to determine a primary filtering result of a data packet based on metadata information of the received data packet, wherein the primary filtering result includes that the data packet is a suspicious data packet and that the data packet is a non-suspicious data packet, and the non-suspicious data packet is a trusted data packet or an attack data packet; a secondary filtering module, configured to determine, in response to the data packet being a suspicious data packet, a secondary filtering result of the data packet according to a matching degree between a filter string and at least one attack string, wherein the filter string includes part or all of the data in the payload of the data packet, and the secondary filtering result includes whether the data packet is an attack data packet; The device also includes: A first filter table generating module is used for writing the offset of each super character contained in the at least one attack string into the offset record string of the corresponding super character in the filter table, wherein the super character represents at least one continuous bit, and the offset represents the position of the corresponding super character in the attack string; The secondary filtering module is used to determine the secondary filtering result of the data packet according to the matching degree between the filtering string and at least one attack string, and is used to: The matching degree between the filter string and at least one attack string is determined based on the filter table, and the secondary filtering result of the data packet is determined according to the matching degree.
11. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the method according to any one of claims 1 to 9 is implemented.
12. A computer device, characterized in that: The method comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method according to any one of claims 1 to 9 is implemented.
13. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.
Citation Information
Patent Citations
Network intrusion detection method
CN104023000A
Message processing method and device
CN105939320A
A network application layer security protection system
CN109167754A
A website intrusion detection method based on big data log analysis
CN109831465A
Attack detection method and device and computer readable storage medium
CN112003824A
