Traffic detection method, device, server and storage medium
By extracting the characteristics of traffic data and calculating the degree of access confusion, combined with traffic detection, the problem of insufficient adaptability and accuracy of malicious traffic detection in the existing technology is solved, and more efficient malicious traffic identification is achieved.
Patent Information
- Application Number
- CN202080094718.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-04-15
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2040-04-15
AI Technical Summary
Existing traffic detection methods are insufficient in adaptability and accuracy in detecting malicious traffic, making it difficult to effectively identify port scanning behaviors, resulting in false positives and missed negatives.
By obtaining traffic data within a preset time, extract data features, and compare the matching degree with the target features. If the matching degree does not meet the conditions, the degree of access chaos is calculated. If the threshold is reached, it is determined to be malicious traffic.
The accuracy and robustness of malicious traffic detection are improved, making the detection process more adaptive and able to identify malicious traffic more effectively.
Smart Images

Figure CN115023926B
Abstract
Description
Technical Field
[0001] The present application relates to the field of network technology, and more specifically, to a flow detection method, device, server and storage medium. Background Art
[0002] With the development of network technology, network attackers have taken advantage of some vulnerabilities in the network to launch network attacks. In the relevant methods of preventing network attacks, early warning of network attacks can be carried out by detecting malicious traffic. However, the adaptability and accuracy of the relevant malicious traffic detection process need to be improved. Summary of the invention
[0003] In view of the above problems, the present application proposes a flow detection method, device, server and storage medium to improve the above problems.
[0004] In the first aspect, the present application provides a traffic detection method, which includes: obtaining traffic data corresponding to a target to be detected within a preset time; extracting features from the traffic data to obtain data features corresponding to the target to be detected; obtaining the degree of matching between the data features and the target features; if the matching degree does not meet the target matching condition, calculating the access confusion degree corresponding to the target to be detected; if the access confusion degree meets the threshold condition, determining that the traffic corresponding to the target to be detected is malicious traffic.
[0005] In the second aspect, the present application provides a flow detection device, which includes: a flow acquisition unit, used to obtain flow data corresponding to a target to be detected within a preset time; a feature acquisition unit, used to extract features from the flow data to obtain data features corresponding to the target to be detected; a feature matching unit, used to obtain the degree of matching between the data features and the target features; a chaos acquisition unit, used to calculate the access chaos degree corresponding to the target to be detected if the matching degree does not meet the target matching condition; a flow detection unit, used to determine that the flow corresponding to the target to be detected is malicious flow if the access chaos degree meets the threshold condition.
[0006] In a third aspect, the present application provides a server comprising one or more processors and a memory; one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute the above-mentioned method.
[0007] In a fourth aspect, the present application provides a computer-readable storage medium having a program code executable by a processor, wherein the program code enables the processor to perform the above method.
[0008] The present application provides a flow detection method, device, server and storage medium, which first obtains the flow data corresponding to the target to be detected within a preset time, then extracts features from the flow data to obtain the data features corresponding to the target to be detected, and then obtains the matching degree between the data features and the target features, and then if the matching degree does not meet the target matching condition, calculates the access confusion degree corresponding to the target to be detected, and if the access confusion degree meets the threshold condition, determines that the flow corresponding to the target to be detected is malicious flow. Thus, through the above-mentioned method, it is realized to determine whether the flow corresponding to the target to be detected is malicious flow by combining the data features of the target to be detected extracted from the data flow with the access confusion degree of the detection target, so that the detection process of malicious flow has better adaptability, accuracy and robustness. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0010] Figure 1 A flow chart of a flow detection method proposed in the present application is shown;
[0011] Figure 2 A schematic diagram of an application scenario of a flow detection method proposed in this application is shown;
[0012] Figure 3 A flow chart of another flow detection method proposed in the present application is shown;
[0013] Figure 4 A flow chart of another flow detection method proposed in the present application is shown;
[0014] Figure 5 A flow chart of another flow detection method proposed in the present application is shown;
[0015] Figure 6 A flow chart of another flow detection method proposed in the present application is shown;
[0016] Figure 7 A structural block diagram of a flow detection device proposed in the present application is shown;
[0017] Figure 8 A structural block diagram of another flow detection device proposed in the present application is shown;
[0018] Fig. 9A structural block diagram of an electronic device proposed in this application is shown.
[0019] Fig.10 It is a storage unit of an embodiment of the present application for storing or carrying program codes for implementing the flow detection method according to an embodiment of the present application. DETAILED DESCRIPTION
[0020] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0021] Cyber attacks (also known as cyber attacks) refer to offensive actions against computer information systems, infrastructure, computer networks or personal computer devices. For computers and computer networks, destroying, revealing, modifying, making software or services nonfunctional, stealing or accessing data from any computer without authorization are all considered attacks on computers and computer networks.
[0022] The inventor discovered in his research on network attacks that there may be some port scanning before a network attack. Port scanning, as the name implies, is to scan a section of ports or specified ports one by one. Through the scanning results, we can know which services are provided on a computer, and then we can attack through the known vulnerabilities of these services. Through port scanning, attackers can know where to find attack weaknesses.
[0023] In order to deal with port scanning behavior, the inventors have found that it is possible to identify whether there is malicious port scanning behavior by means of traffic detection. However, the inventors have also found that in the relevant traffic detection method, it is achieved by counting the number of visits to a fixed port within a certain period of time. In this relevant method, a threshold is pre-specified, and then when the number of visits to the fixed port within a certain period of time is greater than the threshold, it is determined that there is a port scanning behavior. However, in this method, the height of the threshold will have a great impact on the omission and false alarm of the port scanning behavior, and the service traffic corresponding to the ports carrying different services will be different, which will then make it impossible to directly determine whether there is a port scanning behavior based on a certain threshold, resulting in the adaptive degree and accuracy of the detection process of the relevant malicious traffic need to be improved.
[0024] Therefore, in order to improve the above problems, the inventors proposed the traffic detection method, device, server and storage medium in the present application. The method provided by the present application can at least first obtain the traffic data corresponding to the target to be detected within a preset time, and then extract features from the traffic data to obtain the data features corresponding to the target to be detected, and then obtain the matching degree between the data features and the target features, and then if the matching degree does not meet the target matching condition, calculate the access confusion degree corresponding to the target to be detected, and if the access confusion degree meets the threshold condition, determine that the traffic corresponding to the target to be detected is malicious traffic. Thus, through the above method, it is realized to determine whether the traffic corresponding to the target to be detected is malicious traffic by combining the data features of the target to be detected extracted from the data traffic with the access confusion degree of the detection target, so that the detection process of malicious traffic has better accuracy and robustness.
[0025] The embodiments of the present application will be described in detail below with reference to the accompanying drawings.
[0026] See also Figure 1 , the present application provides a flow detection method, the method comprising:
[0027] S110: Obtaining flow data corresponding to the target to be detected within a preset time.
[0028] It should be noted that in the embodiments of the present application, the device (e.g., server) providing network services can be understood as a host device. Among them, network services can be information query, information forwarding, and data storage, etc. In this case, the source end that initiates the access can access the port of the device providing network services through the network to achieve information interaction, so as to achieve the functions of information query, information forwarding, and data storage mentioned above. In the present embodiment, the flow data corresponding to the target to be detected can be understood as the data generated during the interaction between the target to be detected and the device providing network services, wherein the interaction process may include a request process and a corresponding process. Optionally, in the present embodiment, the target to be detected can be selected from the source end that initiates the access, and in the present embodiment, there can be a variety of ways to select the target to be detected.
[0029] As a method, all traffic data are obtained, and all source ends included in all traffic data are used as targets to be detected. In this method, the traffic data of all source ends are detected, and then all source ends are used as targets to be detected.
[0030] As another method, all traffic data is obtained, and the source end corresponding to the abnormal access behavior detected among all the source ends included in the all traffic data is used as the target to be detected. In this method, some source ends can be screened out from all the source ends as the target to be detected. In addition, in this method, the abnormal access behavior includes at least one of the following behaviors: sending the same message content more than a specified number of times; and sending messages more than a specified number of times in the same time period.
[0031] It should be noted that for an attacker who performs a port scan, there may be a greater probability that the source end is controlled to initiate a port scan at night. In addition, the inventor has also found in the research that the messages sent by the source end that initiates the port scan during the scanning process have certain regularities. For example, the messages sent by the source end controlled by the attacker usually do not carry information about the business, and some private identifiers will be added to some specific fields of the messages sent by the source end controlled by the attacker. In this case, if it is detected that the source end sends the same message that does not carry business information for multiple times within a certain period of time, then it can be determined that the source end has abnormal access behavior, and then the source end is determined as a target to be detected.
[0032] As a way, in order to identify the business needs of legitimate visitors, the message sent by the legitimate visitor will carry a certain business identifier (the aforementioned business information can be understood). In this way, the device providing network services can determine the business that the legitimate visitor expects to perform by detecting the business identifier in the message. Exemplarily, the business identifier "storage" can be configured to correspond to the business of storing data, and the business identifier "infor_query" can be configured to correspond to the business of information query. Then, when the device providing network services detects that the message carries the business identifier "storage", it can be determined that the business data carried in the message needs to be stored, and if the device providing network services detects that the message carries the business identifier "infor_query", it can be identified that it is necessary to perform information query based on the keywords carried in the message. Therefore, when the device providing network services detects that the message identified from the traffic data corresponding to the source end does not carry the business identifier, and the source end also sends the message without the business identifier multiple times, the source end is identified as the target to be detected.
[0033] It should be noted that if all the source ends included in all the traffic data are directly used as the target to be detected, each source end can be detected in turn, and then a more comprehensive scanning and detection of malicious traffic can be performed. However, if the number of all the source ends identified from all the traffic data is large, each source end is still detected in turn, which may cause a large computational burden. As a way, in the embodiment of the present application, it can be determined which source ends are currently determined as the target to be detected according to the real-time situation.
[0034] Optionally, if it is detected that the business carried by the device currently providing network services is in the peak period of business data interaction, then the source end corresponding to the abnormal access behavior detected from all the source ends included in all the traffic data can be used as the target to be detected, or the source end identified in the traffic data in the most recent time period can be determined as the target to be detected. Among them, the most recent time period can be within a week or within a day. Optionally, if it is detected that the business carried by the device currently providing network services is in the trough period of business data interaction, then all the source ends included in all the traffic data can be used as the target to be detected. Among them, it can be determined based on the data throughput per second whether it is currently the peak period or the trough period of business data. If the data throughput per second is greater than the first threshold, it is determined that the business carried by the device currently providing network services is in the peak period of business data interaction. If it is detected that the data throughput per second is less than the second threshold, it is determined that the business carried by the device currently providing network services is in the trough period of business data interaction, wherein the second threshold is less than the first threshold.
[0035] S120: Extracting features from the traffic data to obtain data features corresponding to the target to be detected.
[0036] Optionally, in this embodiment, the data feature may be a unique identifier in the message sent by the corresponding target to be detected. The unique identifier may be an identifier in at least one of the multiple network layers corresponding to the message. Optionally, if the target to be detected communicates with the device providing network services based on the TCP / IP protocol, the corresponding multiple network layers may include an application layer, a transport layer, a network layer, and a link layer.
[0037] S130: Obtaining the matching degree between the data feature and the target feature.
[0038] Optionally, the messages sent by the source end corresponding to the identified malicious traffic can be detected to find out the differences in message structure or the values of protocol-agreed parameters between the messages sent by the source end corresponding to the identified malicious traffic and the messages sent by the legitimate source end, so as to use the difference as a data feature corresponding to the messages sent by the source end that will trigger the malicious traffic, and then use the data features corresponding to all the detected messages sent by the source end that will trigger the malicious traffic as target features.
[0039] It should be noted that the difference is about the difference in the structure of the message or the difference in the value of the protocol agreed parameters of the message, rather than just the difference in the information transmitted by the message. Optionally, the two parties in communication can first negotiate the communication protocol used in the communication process, and then generate the message according to the negotiated communication protocol. In the process of generating the message, the message will be generated according to the format defined by the protocol.
[0040] Exemplarily, if the communication protocol definition adopted needs to generate a header part, a data part and an end part, then when generating a message, it is necessary to generate the header part of the message, the data part of the message and the end part of the message respectively. In this case, if it is detected that the message sent by the source end corresponding to the identified malicious traffic has only the header part of the message and the data part of the message, but no end part of the message, then the message lacking the end part can be identified as having a message structure different from the message sent by the legitimate source end (which will include the header part of the message, the data part of the message and the end part of the message). Similarly, if it is detected that the message sent by the source end corresponding to the identified malicious traffic has only the header part of the message and the end part of the message, but no data part of the message, then the message lacking the data part can be identified as having a message structure different from the message sent by the legitimate source end (which will include the header part of the message, the data part of the message and the end part of the message).
[0041] Furthermore, each part defined by the communication protocol will specifically include multiple fields (i.e., protocol agreed parameters), and for some source ends that may trigger malicious traffic, the triggered message may lack some fields or the values of some fields may be different from the values usually agreed. For example, in the case where the header part of the message stipulates the first field, the second field, and the third field, if the header part of the message sent by the source end corresponding to the identified malicious traffic has only the first field and the second field, but no third field, then the lack of the third field in the header part can be used as a difference in the value of the protocol agreed parameters. For another example, in the case where the header part of the message stipulates the first field, the second field, and the third field, if the header part of the message sent by the source end corresponding to the identified malicious traffic has only the first field and the third field, but no second field, then the lack of the second field in the header part can be used as a difference in the value of the protocol agreed parameters.
[0042] Based on the above method, the characteristic items specifically included in the defined target characteristics can be statistically obtained, and then after obtaining the data flow corresponding to the target to be detected, the data characteristics of the data flow corresponding to the target to be detected can be obtained based on the characteristic items specifically included in the target characteristics. Exemplarily, if the characteristic items specifically included in the target characteristics include the structure of the message lacking an ending part, the header part lacking a first field, and the value of the first parameter of the header part being a specified value, then after obtaining the data flow corresponding to the target to be detected, the degree of satisfaction of these three items can be determined therefrom, thereby obtaining the data characteristics corresponding to the target to be detected. In this case, the degree of matching represents the number of characteristic items specifically included in the target characteristics that are satisfied by the data characteristics corresponding to the target to be detected. The more the corresponding number of satisfied items is, the higher the degree of matching between the data characteristics of the data flow corresponding to the target to be detected and the target characteristics.
[0043] S140: If the matching degree does not satisfy the target matching condition, the access confusion degree corresponding to the target to be detected is calculated.
[0044] It should be noted that, in the case where the degree of matching represents the number of feature items specifically included in the target feature matched by the data feature corresponding to the target to be detected, the target matching condition may be a threshold. Optionally, still taking the three items that the target feature specifically includes the structure of the message lacking the ending part, the header part lacking the first field, and the value of the first parameter of the header part being a specified value as an example, when it is detected that the data flow corresponding to the target to be detected satisfies the lack of the first field in the header part and the value of the first parameter in the header part being a specified value, it can be obtained that the data feature corresponding to the target to be detected includes the lack of the first field in the header part and the value of the first parameter in the header part being a specified value, and then it can be determined that the degree of matching between the data feature of the target to be detected and the target feature is 2. If the target threshold is 3, it can be determined that the degree of matching between the data feature of the target to be detected and the target feature does not meet the target matching condition, and if the target threshold is 2, it can be determined that the degree of matching between the data feature of the target to be detected and the target feature meets the target matching condition.
[0045] Then, when the matching degree determined based on the above method does not meet the target matching conditions, the characterization cannot directly determine whether the data traffic corresponding to the target to be detected is malicious traffic, and then the access confusion degree corresponding to the target to be detected can be obtained, so as to further determine whether the data traffic corresponding to the target to be detected is malicious traffic based on the access confusion degree corresponding to the target to be detected.
[0046] It should be noted that the inventors found in their research on malicious traffic and non-malicious traffic that there are differences in data access rules between malicious traffic and non-malicious traffic. As a way, in the embodiment of the present application, the access disorder degree corresponding to the target to be detected can be determined by calculating the entropy of the data traffic corresponding to the target to be detected.
[0047] S150: If the access disorder degree meets the threshold condition, determine that the traffic corresponding to the target to be detected is malicious traffic.
[0048] S160: If the matching degree meets the target condition, determine that the traffic corresponding to the target to be detected is malicious traffic.
[0049] It should be noted that the device that executes the traffic detection method provided in this embodiment may be the device that provides network services itself, or may be executed by a device independent of the device that provides network services. Figure 2 The network environment shown includes a source end 110, a device 120 providing network services, and a detection device 130 communicating with each other through a network 140. In this case, the flow detection method provided in this embodiment can be executed by the device 120 providing network services or by the detection device 130.
[0050] The present application provides a flow detection method, which first obtains the flow data corresponding to the target to be detected within a preset time, then extracts features from the flow data to obtain the data features corresponding to the target to be detected, and then obtains the matching degree between the data features and the target features, and then if the matching degree does not meet the target matching condition, calculates the access confusion degree corresponding to the target to be detected, and if the access confusion degree meets the threshold condition, determines that the flow corresponding to the target to be detected is malicious flow. Thus, the aforementioned method realizes the combination of the data features of the target to be detected extracted from the data flow and the access confusion degree of the detection target to determine whether the flow corresponding to the target to be detected is malicious flow, so that the detection process of malicious flow has better accuracy and robustness.
[0051] See also Figure 3 , the present application provides a flow detection method, the method comprising:
[0052] S210: Obtaining flow data corresponding to the target to be detected within a preset time.
[0053] S220: Extract features from the traffic data to obtain data features corresponding to the target to be detected.
[0054] S230: Obtaining the matching degree between the data feature and the target feature.
[0055] S240: If the matching degree does not satisfy the target matching condition, obtain the ports accessed by the target to be detected.
[0056] It should be noted that in some communication protocols, certain virtual ports are defined as communication channels. For example, in the TCP / IP protocol, an IP address and a port are used together to determine a communication channel. In this case, the target end corresponding to the attacker will detect which ports can be used to carry out network attacks by means of port scanning. Therefore, in this embodiment, the access disorder degree corresponding to the target to be detected can be determined by the access situation of the target to be detected to the port. In this embodiment, there can be multiple ways to determine the port with the access disorder degree corresponding to the target to be detected.
[0057] As a method, the method of obtaining the ports visited by the target to be detected includes: obtaining the ports visited by the target to be detected within a specified time window. In this method, the method further includes: adjusting the length of the specified time window based on the size of the traffic data corresponding to the target to be detected; wherein, if it is detected that the traffic data decreases within the specified time window, the length of the specified time window is increased. It should be noted that the client corresponding to the attacker does not always perform port scanning on the device providing network services. Therefore, in order to more comprehensively detect the traffic data corresponding to the target to be detected, the ports visited by the target to be detected can be periodically obtained, thereby realizing periodic detection of the traffic data corresponding to the target to be detected. Optionally, the specified time window is the time window corresponding to a cycle in the detection cycle. Optionally, the traffic data can be detected once a day, and in this case, the length of the specified time window is 24 hours corresponding to a day.
[0058] It should be noted that, in order to evade traffic detection, some attackers may reduce the traffic generated during each port scan, making it difficult to identify the access chaos of the source end where the attacker is located. In order to improve this problem, when it is detected that the traffic data decreases within the specified time window, the length of the specified time window can be increased. In this case, even if the attacker reduces the traffic generated during the port scan, by increasing the length of the specified time window, enough traffic data corresponding to the target to be detected can still be collected, so that the access chaos corresponding to the target to be detected can be accurately identified.
[0059] Optionally, if the flow data is detected to decrease within the specified time window, increasing the length of the specified time window includes: if the flow data is detected to decrease within the specified time interval within the specified time window, increasing the length of the specified time window; if the flow data is detected to decrease outside the specified time interval within the specified time window, keeping the length of the specified time window unchanged. It can be understood that if the target to be detected (source end) corresponding to the attacker reduces the flow generated during the port scanning process at the end of the specified time window, the total flow data in the specified time window corresponding to the current cycle will not be affected too much, but if the target to be detected (source end) corresponding to the attacker reduces the flow generated during the port scanning process at the beginning of the specified time window, it will be more obvious that the total flow number in the specified time window corresponding to the current cycle is reduced, so by reducing and increasing the length of the specified time window within the specified time interval within the specified time window, the length of the specified time window can be more effectively controlled. Among them, as a way, the starting time of the specified time interval is the starting time of the specified time window, and the ending time of the specified time interval is the middle time of the specified time window.
[0060] As a method of calling a specified time window length, if it is detected that the traffic data decreases within the specified time window, increasing the length of the specified time window includes: if it is detected that the traffic data decreases within the specified time window, obtaining the reduction amplitude of the data traffic within the specified time window; based on the reduction amplitude, obtaining the corresponding window increase duration, wherein the greater the reduction amplitude, the longer the corresponding window increase duration; and increasing the length of the specified time window by the window increase duration.
[0061] S241: Obtain the activity corresponding to each of the visited ports.
[0062] As a method, the activity corresponding to each of the visited ports is obtained, including: comparing the amount of access data corresponding to each of the visited ports with the total amount of data corresponding to the visited ports, to obtain the activity corresponding to each of the visited ports; wherein the total amount of data corresponding to the visited ports is the sum of the amount of access data corresponding to each of the visited ports.
[0063] S242: Calculate the access disorder degree corresponding to the target to be detected based on the activity corresponding to each of the visited ports.
[0064] As a method, the access chaos degree corresponding to the target to be detected is calculated based on the activity corresponding to each of the visited ports, including: taking the product of the activity corresponding to each of the visited ports and the logarithm of the activity as the designated intermediate value corresponding to each of the visited ports; taking the sum of the designated intermediate values corresponding to each of the visited ports as the activity entropy characterizing the access chaos degree.
[0065] S250: If the access disorder degree meets the threshold condition, determine that the traffic corresponding to the target to be detected is malicious traffic.
[0066] Optionally, obtaining a set of ports accessed by the target to be detected is:
[0067] X=(x1,x2,…,x i , …, x n )
[0068] The activity corresponding to each accessed port is obtained as follows:
[0069]
[0070] Among them, a i Indicates the amount of access data corresponding to the port currently performing port activity calculation. It represents the sum of the access data volume corresponding to all ports in the set of accessed ports. Optionally, the access data volume is the number of data packets generated by the interaction. In this case, the activity entropy can be calculated by the following formula:
[0071]
[0072] The present application provides a flow detection method, which first obtains the flow data corresponding to the target to be detected within a preset time, then extracts features from the flow data to obtain the data features corresponding to the target to be detected, and then obtains the matching degree between the data features and the target features, and then if the matching degree does not meet the target matching condition, obtains the ports visited by the target to be detected, and obtains the activity corresponding to each of the visited ports, and then calculates the access confusion degree corresponding to the target to be detected based on the activity corresponding to each of the visited ports, and if the access confusion degree meets the threshold condition, determines that the flow corresponding to the target to be detected is malicious flow. Thus, by obtaining the activity of the visited ports, the access confusion degree corresponding to the target to be detected is calculated based on the activity corresponding to each of the visited ports, and then realizes the combination of the data features of the target to be detected extracted from the data flow and the access confusion degree of the detection target to determine whether the flow corresponding to the target to be detected is malicious flow, so that the detection process of malicious flow has better accuracy and robustness.
[0073] See also Figure 4 , the present application provides a flow detection method, the method comprising:
[0074] S310: Acquire data traffic corresponding to the target to be detected from the network adapter.
[0075] S320: Extracting a message corresponding to the detection target from the data traffic corresponding to the target to be detected.
[0076] For an attacker, when controlling the corresponding source to send messages for port scanning, unique identifiers may be added in different network layers. In order to be able to identify malicious traffic more comprehensively, as a method, based on multiple network layers, the messages corresponding to the detection target and the multiple network layers are extracted from the data traffic corresponding to the target to be detected.
[0077] Optionally, the network layering includes an application layer and a transport layer.
[0078] S330: Acquire data features corresponding to the target to be detected from the message.
[0079] S340: Obtaining the matching degree between the data feature and the target feature.
[0080] S350: If the matching degree does not satisfy the target matching condition, calculate the access confusion degree corresponding to the target to be detected.
[0081] S360: If the access disorder degree meets the threshold condition, determine that the traffic corresponding to the target to be detected is malicious traffic.
[0082] The present application provides a flow detection method, firstly obtains the data flow corresponding to the target to be detected from the network adapter, then extracts the message corresponding to the detection target from the data flow corresponding to the target to be detected, obtains the data feature corresponding to the target to be detected from the message, and then obtains the matching degree between the data feature and the target feature, and then if the matching degree does not meet the target matching condition, calculates the access confusion degree corresponding to the target to be detected, and if the access confusion degree meets the threshold condition, determines that the flow corresponding to the target to be detected is malicious flow. Thus, it is realized that the data flow corresponding to the target to be detected can be directly obtained from the network adapter, so that based on the above method, it is realized that the data feature of the target to be detected extracted from the data flow obtained from the network adapter can be directly combined with the access confusion degree of the detection target to determine whether the flow corresponding to the target to be detected is malicious flow, so that the detection process of malicious flow has better accuracy and robustness. Moreover, in this embodiment, data features can be extracted from the message, and data features can be extracted from multiple network layers respectively, so that malicious flow detection can be more accurate and comprehensive.
[0083] See also Figure 5 , the present application provides a flow detection method, the method comprising:
[0084] S410: Obtaining flow data corresponding to the target to be detected within a preset time.
[0085] S420: Extract features from the traffic data to obtain data features corresponding to the target to be detected.
[0086] S430: Obtaining the matching degree between the data feature and the target feature.
[0087] S440: If the matching degree does not satisfy the target matching condition, calculate the access confusion degree corresponding to the target to be detected.
[0088] S450: If the access confusion degree satisfies the threshold condition corresponding to the matching degree, determine that the traffic corresponding to the target to be detected is malicious traffic, wherein the threshold conditions corresponding to different matching degrees are different.
[0089] S460: If the access disorder degree meets the threshold condition, determine that the traffic corresponding to the target to be detected is malicious traffic.
[0090] The present application provides a flow detection method, first obtaining the flow data corresponding to the target to be detected within a preset time, then extracting features from the flow data to obtain the data features corresponding to the target to be detected, and then obtaining the matching degree between the data features and the target features, and then if the matching degree does not meet the target matching condition, calculating the access confusion degree corresponding to the target to be detected, and if the access confusion degree meets the threshold condition, determining that the flow corresponding to the target to be detected is malicious flow. Thus, through the above-mentioned method, it is realized to determine whether the flow corresponding to the target to be detected is malicious flow by combining the data features of the target to be detected extracted from the data flow with the access confusion degree of the detection target, so that the detection process of malicious flow has better accuracy and robustness. Moreover, in this embodiment, the threshold conditions corresponding to different matching degrees are different, so that the detection of malicious flow is more flexible and accurate. It should be noted that, in the case where the matching degree between the data features corresponding to the target to be detected and the target features does not meet the target matching condition, the more feature items included in the target features satisfied by the data features corresponding to the target to be detected, the more likely the target to be detected triggers malicious flow. In this case, the higher the matching degree, the lower the value included in the corresponding threshold condition.
[0091] Below through Figure 6 The flow detection method involved in the embodiment of the present application is described.
[0092] like Figure 6 As shown, the flow data in the network adapter can be extracted by packet extraction and a data block can be generated. Optionally, a corresponding data block can be generated for each target to be detected. Then, feature extraction is performed on the data block, wherein the feature extraction can be understood as the feature extraction from the flow data in the aforementioned embodiment to obtain the data features corresponding to the target to be detected. Then, feature matching is performed on the extracted data features, and optionally, Figure XThe feature matching step in can be understood as the degree of matching between the data feature and the target feature in the aforementioned embodiment. In this case, if it is detected that the extracted data feature meets the target matching condition, the detection structure is determined to be a determined feature, and then it is determined that the target to be detected corresponding to the data block from which the data feature originates corresponds to malicious scanning behavior. If it is detected that the extracted data feature does not meet the target matching condition, but at least one of the feature items included in the data feature and the target feature matches, it is determined to be a suspected feature, and then the suspected feature entropy calculation is performed. Correspondingly, if it is detected that the extracted data feature does not meet the target matching condition, and the data feature does not match the feature items included in the target feature, then featureless entropy calculation is performed. Further, when it is detected that the entropy value calculated based on the suspected feature entropy calculation or the entropy value calculated based on the featureless entropy calculation is in the malicious interval (i.e., it meets the threshold condition), it is determined that the target to be detected corresponding to the data block from which the data feature originates corresponds to malicious scanning behavior, otherwise, it is determined that the data access behavior of the target to be detected corresponding to the data block from which the data feature originates is normal behavior.
[0093] It should be noted that the calculation process of the suspected feature entropy calculation and the featureless entropy calculation is the same as the calculation process of the active entropy in the aforementioned embodiment, except that the malicious intervals corresponding to the suspected feature entropy calculation and the featureless entropy calculation are different.
[0094] See also Figure 7 The present application provides a flow detection device 500, the device 500 comprising:
[0095] The flow acquisition unit 510 is used to acquire flow data corresponding to the target to be detected within a preset time.
[0096] The feature acquisition unit 520 is used to extract features from the traffic data to obtain data features corresponding to the target to be detected.
[0097] The feature matching unit 530 is used to obtain the matching degree between the data feature and the target feature.
[0098] The confusion degree acquisition unit 540 is used to calculate the access confusion degree corresponding to the target to be detected if the matching degree does not meet the target matching condition.
[0099] The traffic detection unit 550 is used to determine that the traffic corresponding to the target to be detected is malicious traffic if the access disorder level meets a threshold condition.
[0100] As a method, the chaos acquisition unit 540 is specifically used to acquire the ports visited by the target to be detected; acquire the activity corresponding to each of the visited ports; and calculate the access chaos degree corresponding to the target to be detected based on the activity corresponding to each of the visited ports. In this method, the chaos acquisition unit 540 is specifically used to acquire the ports visited by the target to be detected within a specified time window. In this method, Figure 8 As shown, the device also includes a window adjustment unit 541, which is used to adjust the length of the specified time window based on the size of the flow data corresponding to the target to be detected; wherein, if it is detected that the flow data decreases within the specified time window, the length of the specified time window is increased. Optionally, the window adjustment unit 541 is specifically used to increase the length of the specified time window if it is detected that the flow data decreases within a specified time interval within the specified time window; if it is detected that the flow data decreases outside the specified time interval within the specified time window, the length of the specified time window remains unchanged. Optionally, the start time of the specified time interval is the start time of the specified time window, and the end time of the specified time interval is the middle time of the specified time window.
[0101] As a method, the window adjustment unit 541 is specifically used to obtain the reduction rate of the data traffic within the specified time window if it is detected that the traffic data decreases within the specified time window; obtain the corresponding window increase duration based on the reduction rate, wherein the greater the reduction rate, the longer the corresponding window increase duration; and increase the length of the specified time window by the window increase duration.
[0102] As a method, the chaos acquisition unit 540 is specifically used to compare the amount of access data corresponding to each of the visited ports with the total amount of data corresponding to the visited ports, so as to obtain the activity corresponding to each of the visited ports; wherein the total amount of data corresponding to the visited ports is the sum of the amount of access data corresponding to each of the visited ports.
[0103] As a method, the chaos acquisition unit 540 is specifically used to take the product of the activity corresponding to each of the visited ports and the logarithm of the activity as the designated intermediate value corresponding to each of the visited ports; and take the sum of the designated intermediate values corresponding to each of the visited ports as the activity entropy representing the degree of access chaos.
[0104] As a method, the traffic acquisition unit 510 is specifically used to obtain the data traffic corresponding to the target to be detected from the network adapter. In this method, the feature acquisition unit 520 is specifically used to extract the message corresponding to the detection target from the data traffic corresponding to the target to be detected; and obtain the data features corresponding to the target to be detected from the message. Optionally, the feature acquisition unit 520 is specifically used to extract the message of the detection target corresponding to the multiple network layers from the data traffic corresponding to the target to be detected based on multiple network layers respectively. Wherein, the network layer includes an application layer and a transport layer.
[0105] As a method, the traffic detection unit 550 is specifically used to determine that the traffic corresponding to the target to be detected is malicious traffic if the access chaos degree meets the threshold condition corresponding to the matching degree, wherein the threshold conditions corresponding to different matching degrees are different.
[0106] Furthermore, the traffic detection unit 550 is further configured to determine that the traffic corresponding to the target to be detected is malicious traffic if the matching degree meets the target condition.
[0107] As a method, the traffic acquisition unit 510 is also used to acquire all traffic data; and all source ends included in the traffic data are used as targets to be detected. Optionally, the traffic acquisition unit 510 is also used to acquire all traffic data; and the source end corresponding to the abnormal access behavior detected among all source ends included in the traffic data is used as the target to be detected. The abnormal access behavior includes at least one of the following behaviors: sending the same message content more than a specified number of times; and sending messages in the same time period more than a specified number of times.
[0108] The present application provides a flow detection device, which first obtains the flow data corresponding to the target to be detected within a preset time, then extracts features from the flow data to obtain the data features corresponding to the target to be detected, and then obtains the matching degree between the data features and the target features, and then if the matching degree does not meet the target matching condition, calculates the access confusion degree corresponding to the target to be detected, and if the access confusion degree meets the threshold condition, determines that the flow corresponding to the target to be detected is malicious flow. Thus, through the above-mentioned method, it is realized to determine whether the flow corresponding to the target to be detected is malicious flow by combining the data features of the target to be detected extracted from the data flow with the access confusion degree of the detection target, so that the detection process of malicious flow has better accuracy and robustness.
[0109] The following will be combined Fig. 9 An electronic device provided by the present application is described.
[0110] See also Fig. 9 Based on the above SMS push method, the embodiment of the present application also provides another electronic device 200 including a processor 102 that can execute the above SMS push method. The electronic device 200 also includes a memory 104 and a network module 106. The memory 104 stores a program that can execute the content of the above embodiment, and the processor 102 can execute the program stored in the memory 104.
[0111] Among them, the processor 102 uses various interfaces and lines to connect various parts within the entire electronic device 200, and executes various functions and processes data of the electronic device 200 by running or executing instructions, programs, code sets or instruction sets stored in the memory 104, and calling data stored in the memory 104. Optionally, the processor 102 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 102 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing display content; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 102, and it can be implemented separately through a communication chip.
[0112] The memory 104 may include a random access memory (RAM) or a read-only memory (ROM). The memory 104 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 104 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the following various method embodiments, etc. The data storage area may also store data (such as a phone book, audio and video data, chat record data) created by the terminal 100 during use.
[0113] The network module 106 is used to receive and send electromagnetic waves, realize the mutual conversion between electromagnetic waves and electrical signals, so as to communicate with a communication network or other devices, such as communicating with an audio playback device. The network module 106 may include various existing circuit elements for performing these functions, such as antennas, radio frequency transceivers, digital signal processors, encryption / decryption chips, user identity modules (SIM) cards, memories, etc. The network module 106 may communicate with various networks such as the Internet, corporate intranets, wireless networks, or communicate with other devices via wireless networks. The above-mentioned wireless networks may include cellular telephone networks, wireless local area networks, or metropolitan area networks. For example, the network module 106 may exchange information with a base station.
[0114] Optionally, the electronic device 200 may be a server for executing the aforementioned method embodiment.
[0115] Please refer to Fig.10 , which shows a structural block diagram of a computer-readable storage medium provided in an embodiment of the present application. The computer-readable medium 1100 stores program codes, which can be called by a processor to execute the method described in the above method embodiment.
[0116] The computer readable storage medium 1100 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read-only memory), an EPROM, a hard disk, or a ROM. Optionally, the computer readable storage medium 1100 includes a non-transitory computer-readable storage medium. The computer readable storage medium 1100 has storage space for program code 810 that performs any method steps in the above method. These program codes can be read from or written to one or more computer program products. The program code 1110 can be compressed, for example, in an appropriate form.
[0117] In summary, the present application provides a flow detection method, device, server and storage medium, which first obtains the flow data corresponding to the target to be detected within a preset time, then extracts features from the flow data to obtain the data features corresponding to the target to be detected, and then obtains the degree of matching between the data features and the target features, and then if the matching degree does not meet the target matching condition, calculates the access confusion degree corresponding to the target to be detected, and if the access confusion degree meets the threshold condition, determines that the flow corresponding to the target to be detected is malicious flow. Thus, through the above-mentioned method, it is achieved to combine the data features of the target to be detected extracted from the data flow with the access confusion degree of the detection target to determine whether the flow corresponding to the target to be detected is malicious flow, so that the detection process of malicious flow has better adaptability, accuracy and robustness.
[0118] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A flow detection method, characterized in that: The method comprises: Obtain the flow data corresponding to the target to be detected within a preset time; Extracting features from the traffic data to obtain data features corresponding to the target to be detected; Obtaining a degree of matching between the data feature and a target feature, where the target feature is a data feature corresponding to a message sent by a source end that is detected to trigger malicious traffic; If the matching degree does not meet the target matching condition, calculating the access confusion degree corresponding to the target to be detected; If the access confusion degree satisfies the threshold condition corresponding to the matching degree, it is determined that the traffic corresponding to the target to be detected is malicious traffic, wherein the threshold conditions corresponding to different matching degrees are different.
2. The method according to claim 1, characterized in that The calculating the access disorder degree corresponding to the target to be detected includes: Obtaining the ports accessed by the target to be detected; Obtaining the activity corresponding to each of the visited ports; The access disorder degree corresponding to the target to be detected is calculated based on the activity corresponding to each of the visited ports.
3. The method according to claim 2, characterized in that The obtaining of the ports accessed by the target to be detected includes: Obtain the ports that the target to be detected has accessed within a specified time window.
4. The method according to claim 3, characterized in that The method further comprises: The length of the specified time window is adjusted based on the size of the traffic data corresponding to the target to be detected; wherein, if it is detected that the traffic data decreases within the specified time window, the length of the specified time window is increased.
5. The method according to claim 4, characterized in that If it is detected that the flow data decreases within the specified time window, increasing the length of the specified time window includes: If it is detected that the flow data decreases within a specified time interval within the specified time window, increasing the length of the specified time window; If it is detected that the flow data decreases outside the specified time interval within the specified time window, the length of the specified time window is kept unchanged.
6. The method according to claim 5, characterized in that The start time of the specified time interval is the start time of the specified time window, and the end time of the specified time interval is the middle time of the specified time window.
7. The method according to claim 5, characterized in that If it is detected that the flow data decreases within the specified time window, increasing the length of the specified time window includes: If it is detected that the flow data decreases within the specified time window, obtaining a decrease amplitude of the flow data within the specified time window; Based on the reduction amplitude, a corresponding window increase duration is acquired, wherein a larger reduction amplitude corresponds to a longer window increase duration; The length of the specified time window is increased by the window increase duration.
8. The method according to any one of claims 2 to 7, characterized in that: The obtaining of the activity corresponding to each of the accessed ports includes: The access data volume corresponding to each of the visited ports is compared with the total data volume corresponding to the visited ports to obtain the activity corresponding to each of the visited ports; wherein the total data volume corresponding to the visited ports is the sum of the access data volume corresponding to each of the visited ports.
9. The method according to claim 2, characterized in that: The step of calculating the access disorder degree corresponding to the target to be detected based on the activity degree corresponding to each of the visited ports includes: Taking the product of the activity corresponding to each of the visited ports and the logarithm of the activity as the designated intermediate value corresponding to each of the visited ports; The sum of the designated intermediate values corresponding to each of the visited ports is used as the active entropy representing the access disorder degree.
10. The method according to claim 1, characterized in that The method of obtaining the flow data corresponding to the target to be detected within a preset time includes: Acquire flow data corresponding to the target to be detected from the network adapter; The extracting features from the traffic data to obtain data features corresponding to the target to be detected includes: Extracting the message corresponding to the detection target from the traffic data corresponding to the target to be detected; The data features corresponding to the target to be detected are obtained from the message.
11. The method according to claim 10, characterized in that The extracting the message corresponding to the detection target from the traffic data corresponding to the target to be detected includes: Based on multiple network layers respectively, messages of the detection target corresponding to the multiple network layers are extracted from the traffic data corresponding to the target to be detected.
12. The method according to claim 11, characterized in that The network layer includes an application layer and a transport layer.
13. The method according to any one of claims 1 to 7, characterized in that: The method further comprises: If the matching degree meets the target condition, it is determined that the traffic corresponding to the target to be detected is malicious traffic.
14. The method according to any one of claims 1 to 7, characterized in that: The method further comprises: Get all traffic data; All source ends included in all the traffic data are taken as targets to be detected.
15. The method according to any one of claims 1 to 7, characterized in that: The method further comprises: Get all traffic data; The source end corresponding to the abnormal access behavior detected among all the source ends included in all the traffic data is taken as a target to be detected.
16. The method according to claim 15, characterized in that The abnormal access behavior includes at least one of the following behaviors: Sending the same message content more than a specified number of times; and The number of packets sent in the same time period exceeds the specified number.
17. A flow detection device, characterized in that: The device comprises: A flow acquisition unit, used to acquire flow data corresponding to a target to be detected within a preset time; A feature acquisition unit, used for extracting features from the traffic data to obtain data features corresponding to the target to be detected; A feature matching unit, used to obtain a matching degree between the data feature and a target feature, wherein the target feature is a data feature corresponding to a message sent by a source end that is detected to trigger malicious traffic; A confusion degree acquisition unit, used for calculating the access confusion degree corresponding to the target to be detected if the matching degree does not meet the target matching condition; The traffic detection unit is used to determine that the traffic corresponding to the target to be detected is malicious traffic if the access chaos degree meets the threshold condition corresponding to the matching degree, wherein the threshold conditions corresponding to different matching degrees are different.
18. A server, characterized in that: including one or more processors and memory; One or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute the method according to any one of claims 1 to 16.
19. A computer-readable storage medium having a program code executable by a processor, characterized in that: The program code enables the processor to execute the method according to any one of claims 1-16.
