A host traffic anomaly detection method and device based on graph model
Through the traffic anomaly detection method based on the graph model, the session characteristics are used to reconstruct the traffic graph model and perform clustering and grouping, which solves the problem of low accuracy of traffic anomaly detection in complex networks and achieves effective identification of abnormal external hosts.
Patent Information
- Application Number
- CN202111667761.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-31
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2041-12-31
AI Technical Summary
It is difficult for the existing technology to effectively utilize the attribute information of nodes and edges in detecting traffic anomalies in complex networks. It lacks external node connection relationships, resulting in low detection accuracy, and it is difficult to train models due to the lack of label data.
A graph model-based method is used to generate a traffic graph model, reconstruct the session characteristics similarity between the external host and the target host, establish the connection relationship between the external hosts, and use an improved faction filtering algorithm to identify similar sessions. The external hosts with behavioral patterns are clustered and grouped to identify abnormal external hosts.
It improves the accuracy of traffic anomaly detection, can effectively detect abnormal external hosts in the traffic, and improves the accuracy and efficiency of detection.
Smart Images

Figure CN114726570B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of information security technology, and in particular to a method and device for detecting host traffic anomalies based on a graph model. Background Art
[0002] As the Internet grows and develops, various network applications provide users with high-quality and convenient services. At the same time, network security attacks of different sizes and diversity are always lurking in the network. Therefore, how to accurately and quickly identify and locate malicious attack behaviors that threaten network security has become an urgent problem to be solved.
[0003] During the operation of the server, many traffic records are generated. Faced with the increasing data traffic, it becomes increasingly important to detect the abnormal traffic contained therein efficiently and accurately. Traffic anomaly detection is an effective strategy for identifying network attacks. The purpose is to find connections and nodes in the traffic that are significantly different from other normal patterns. However, due to the large scale and complex structure of complex network data and the diversity of anomaly detection problems, the existing technology faces the following challenges for traffic anomaly detection in complex networks: 1) The nodes and edges in the network have rich attribute information, and the diverse attribute content cannot be well utilized; 2) The lack of connection relationships between external nodes in the traffic records makes it difficult to analyze the behavioral characteristics of external abnormal traffic; 3) The lack of labels, the accuracy of supervised learning is often higher than that of unsupervised learning, but the labeled data used to train the model is very difficult to obtain, and manual labeling is time-consuming and laborious. Summary of the invention
[0004] The present application provides a method and device for detecting host traffic anomaly based on a graph model, so as to improve the accuracy of host traffic anomaly detection.
[0005] In the first aspect, the embodiment of the present application provides a host traffic anomaly detection method based on a graph model, which can be executed by a device for detecting traffic anomalies on a target host. The method includes: generating a first traffic graph model according to the traffic records related to the target host collected within a set time period, wherein the first traffic graph model includes information of the target host, information of multiple external hosts, and a first type of connection relationship between the external host and the target host, wherein the first type of connection relationship is used to indicate the session characteristics between the external host and the target host; reconstructing the first traffic graph model according to the similarity of the session characteristics between different external hosts and the target host in the first traffic graph model to generate a second traffic graph model, wherein the second traffic graph model includes a second type of connection relationship between the external hosts, wherein the second type of connection relationship is used to indicate that the session behavior patterns of the two external hosts are similar; clustering and grouping the multiple external nodes according to the similarity of the session behavior patterns of different external nodes in the second traffic graph model to obtain one or more external host groups, wherein each external host group includes multiple external hosts; determining the external host that does not belong to any of the external host groups as an abnormal external host communicating with the target host.
[0006] The above technical solution can utilize the similarity of the session characteristics between the external host and the target host in the first traffic graph model to establish a connection relationship between the external hosts, thereby realizing the reconstruction of the first traffic graph model. Then, based on the improved faction filtering algorithm, the external hosts with similar session behavior patterns in the reconstructed second traffic graph model are clustered and grouped to find abnormal external hosts that are independent of the normal external host group. The solution of the present application has a good ability to discover abnormal external hosts in the traffic, and can effectively improve the accuracy of traffic anomaly detection.
[0007] In a possible design, each of the traffic records includes five-tuple information of the session associated with the traffic record, and the five-tuple information includes source IP address, source port number, destination IP address, destination port number and connection time, and the source IP address or the destination IP address in each of the traffic records is the IP address of the target host; the first traffic graph model is established based on the traffic records related to the target host within the set time period collected, including: aggregating traffic records with the same four-tuple information in the traffic records related to the target host, and determining the total number of connections and the connection time series corresponding to each of the four-tuple information, the four-tuple information including the source IP address, the source port number, the destination IP address, and the destination port number; generating the first traffic graph model based on the total number of connections and the connection time series corresponding to each of the four-tuple information.
[0008] In one possible design, the information of the target host includes the IP address of the target host, and the information of the external host includes the IP address of the external host; the first type of connection relationship includes the total number of connections and the connection time series corresponding to a set of the four-tuple information between the external host and the target host.
[0009] In a possible design, the first traffic graph model is reconstructed according to the similarity of the session characteristics between different external hosts and the target host in the first traffic graph model to generate a second traffic graph model, including: determining the session similarity distance between the multiple external hosts according to the first type of connection relationship between each of the external hosts and the target host, the session similarity distance being used to indicate the degree of similarity between the session behavior patterns of the two external hosts; if the session similarity distance between the two external hosts is greater than the product of the average session similarity distance and a preset threshold, establishing the second type of connection relationship between the two external hosts.
[0010] In a possible design, there are one or more first-type connection relationships between each of the external hosts and the target host; determining the session similarity distance between the two external hosts includes: determining the session feature similarity of the first-type mapping relationship pairs for each first-type mapping relationship pair that meets the set conditions and is composed of a first-type mapping relationship between the first external host and the target host and a first-type mapping relationship between the second external host and the target host; and determining the session similarity distance between the first external host and the second external host based on the session feature similarities of all first-type mapping relationship pairs that meet the set conditions between the first external host and the second external host.
[0011] In one possible design, the first type mapping relationship pair that satisfies the set conditions means that: the source IP addresses and source port numbers of the four-tuple information corresponding to the two first type mapping relationships included in the first type mapping relationship pair are the same, or the destination IP addresses and destination port numbers are the same.
[0012] In a possible design, the session feature similarity of the first type mapping relationship pair is: the similarity between connection time series in four-tuple information corresponding to two first type mapping relationships included in the first type mapping relationship pair.
[0013] In a possible design, the first type mapping relationship pair includes the i-th first type mapping relationship between the first external host and the target host and the j-th first type mapping relationship between the second external host and the target host, and the connection time sequence in the quadruple information corresponding to the i-th first type mapping relationship is the first connection time sequence, and the connection time sequence in the quadruple information corresponding to the j-th first type mapping relationship is the second connection time sequence, and i and j are integers; each of the connection time sequences includes one or more timestamps time and the number of connections num corresponding to each timestamp; determining the similarity of session features of the first type mapping relationship pair includes: if the length of the first connection time sequence is greater than the length of the second connection time sequence, and is less than or equal to twice the length of the second connection time sequence, then matching the length of the first connection time sequence with the second connection time sequence; determining the similarity between the first connection time sequence and the second connection time sequence after length matching by the following formula:
[0014]
[0015] Among them, x is the first connection time series after length matching, y is the second connection time series after length matching, similarity(x, y) is the similarity between the first connection time series and the second connection time series, xi.time is the i-th timestamp in the first connection time series after length matching, xi.num is the number of connections corresponding to the i-th timestamp in the first connection time series after length matching, yi.time is the i-th timestamp in the second connection time series after length matching, yi.num is the number of connections corresponding to the i-th timestamp in the second connection time series after length matching, and n is the number of timestamps in the second connection time series and the second connection time series after length matching.
[0016] In one possible design, determining the similarity of session features of the first type mapping relationship pair further includes: if the length of the first connection time series is greater than twice the length of the second connection time series, determining that the similarity between the first connection time series and the second connection time series is 0.
[0017] In one possible design, determining the session similarity distance between the first external host and the second external host based on the similarity of session features of all first type mapping relationship pairs between the first external host and the second external host that satisfy the set conditions includes: determining the session similarity distance between the first external host and the second external host based on the similarity of session features of all first type mapping relationship pairs between the first external host and the second external host that satisfy the set conditions and the corresponding weights.
[0018] In one possible design, the session similarity distance between the first external host and the second external host is determined by the following formula:
[0019]
[0020] Wherein, v1 is the first external host, v2 is the second external host, distance(v1, v2) is the session similarity distance between the first external host and the second external host, n is the total number of session feature similarities between the first external host and the second external host, and i is the similarity of the i-th session feature between the first external host and the second external host, the weight i is the weight corresponding to the similarity of the i-th session feature.
[0021] In a possible design, the weight corresponding to the similarity of the session features of the first type mapping relationship pair that meets the set condition is: the sum of the lengths of the connection time series in the four-tuple information corresponding to the two first type mapping relationships included in the first type mapping relationship pair.
[0022] In a possible design, the multiple external nodes are clustered and grouped according to the similarity of the session behavior patterns of different external nodes in the second traffic graph model to obtain one or more external host groups, including: according to the adjacency table of the second traffic graph model, N factions in the second traffic graph model are determined, each faction includes at most k external hosts, k is an integer greater than 3, and N is a positive integer; according to the N factions. A faction relationship matrix corresponding to the second traffic graph model is established, the faction relationship matrix is used to indicate the number of external hosts included in each faction, and the adjacency relationship between different factions; the faction relationship matrix is traversed by breadth-first traversal, and different connected factions are merged to obtain the one or more external host groups.
[0023] In a possible design, the faction relationship matrix has N rows and N columns, wherein each of the N rows corresponds to one of the N factions, and each of the N columns corresponds to one of the N factions; the off-diagonal elements in the faction relationship matrix are equal to the number of common external hosts between the faction corresponding to the row where the off-diagonal elements are located and the faction corresponding to the column where the off-diagonal elements are located, and the diagonal elements are equal to the number of external hosts included in the faction corresponding to the diagonal elements.
[0024] In one possible design, the external host that does not belong to any of the external host groups is determined as an abnormal external host communicating with the target host, including: determining a set consisting of the external hosts that do not belong to any of the external host groups; filtering the external hosts in the set according to a preset IP address whitelist, and determining the external hosts in the set whose IP addresses do not belong to the IP address whitelist as the abnormal external hosts.
[0025] In a second aspect, an embodiment of the present application provides a host traffic anomaly detection device based on a graph model, which may include a module / unit that executes any possible design method of the first aspect. These modules / units may be implemented by hardware, or by executing corresponding software implementations through hardware.
[0026] Exemplarily, the device may include a communication module and a processing module; wherein:
[0027] The communication module is used to collect traffic records related to the target host within a set time period;
[0028] The processing module is used to generate a first traffic graph model based on the collected traffic records related to the target host within a set time period, wherein the first traffic graph model includes information of the target host, information of multiple external hosts, and a first type of connection relationship between the external host and the target host, wherein the first type of connection relationship is used to indicate the session characteristics between the external host and the target host; according to the similarity of the session characteristics between different external hosts and the target host in the first traffic graph model, the first traffic graph model is reconstructed to generate a second traffic graph model, wherein the second traffic graph model includes a second type of connection relationship between the external hosts, wherein the second type of connection relationship is used to indicate that the session behavior patterns of the two external hosts are similar; according to the similarity of the session behavior patterns of different external nodes in the second traffic graph model, the multiple external nodes are clustered and grouped to obtain one or more external host groups, wherein each external host group includes multiple external hosts; and the external host that does not belong to any of the external host groups is determined as an abnormal external host communicating with the target host.
[0029] In one possible design, each of the traffic records includes five-tuple information of the session associated with the traffic record, the five-tuple information including source IP address, source port number, destination IP address, destination port number and connection time, and the source IP address or the destination IP address in each of the traffic records is the IP address of the target host; the processing module is specifically used to: aggregate traffic records with the same four-tuple information in the traffic records related to the target host, determine the total number of connections and connection time series corresponding to each of the four-tuple information, the four-tuple information including the source IP address, the source port number, the destination IP address, and the destination port number; generate the first traffic graph model according to the total number of connections and the connection time series corresponding to each of the four-tuple information.
[0030] In one possible design, the information of the target host includes the IP address of the target host, and the information of the external host includes the IP address of the external host; the first type of connection relationship includes the total number of connections and the connection time series corresponding to a set of the four-tuple information between the external host and the target host.
[0031] In one possible design, the processing module is specifically used to: determine the session similarity distance between each of the multiple external hosts based on the first type of connection relationship between each of the external hosts and the target host, and the session similarity distance is used to indicate the similarity of the session behavior patterns of the two external hosts; if the session similarity distance between the two external hosts is greater than the product of the average session similarity distance and a preset threshold, then establish the second type of connection relationship between the two external hosts.
[0032] In a possible design, there are one or more first-type connection relationships between each of the external hosts and the target host; the processing module is specifically used to: determine the session feature similarity of the first-type mapping relationship pairs for each first-type mapping relationship pair that meets the set conditions and is composed of a first-type mapping relationship between the first external host and the target host and a first-type mapping relationship between the second external host and the target host; and determine the session similarity distance between the first external host and the second external host based on the session feature similarities of all first-type mapping relationship pairs that meet the set conditions between the first external host and the second external host.
[0033] In one possible design, the first type mapping relationship pair that satisfies the set conditions means that: the source IP addresses and source port numbers of the four-tuple information corresponding to the two first type mapping relationships included in the first type mapping relationship pair are the same, or the destination IP addresses and destination port numbers are the same.
[0034] In a possible design, the session feature similarity of the first type mapping relationship pair is: the similarity between connection time series in four-tuple information corresponding to two first type mapping relationships included in the first type mapping relationship pair.
[0035] In a possible design, the first type mapping relationship pair includes the i-th first type mapping relationship between the first external host and the target host and the j-th first type mapping relationship between the second external host and the target host, and the connection time sequence in the quadruple information corresponding to the i-th first type mapping relationship is the first connection time sequence, and the connection time sequence in the quadruple information corresponding to the j-th first type mapping relationship is the second connection time sequence, and i and j are integers; each of the connection time sequences includes one or more timestamps time and the number of connections num corresponding to each timestamp; the processing module is specifically used for: if the length of the first connection time sequence is greater than the length of the second connection time sequence, and is less than or equal to twice the length of the second connection time sequence, then the first connection time sequence and the second connection time sequence are matched in length; the similarity between the first connection time sequence and the second connection time sequence after length matching is determined by the following formula:
[0036]
[0037] Among them, x is the first connection time series after length matching, y is the second connection time series after length matching, similarity(x, y) is the similarity between the first connection time series and the second connection time series, xi.time is the i-th timestamp in the first connection time series after length matching, xi.num is the number of connections corresponding to the i-th timestamp in the first connection time series after length matching, yi.time is the i-th timestamp in the second connection time series after length matching, yi.num is the number of connections corresponding to the i-th timestamp in the second connection time series after length matching, and n is the number of timestamps in the second connection time series and the second connection time series after length matching.
[0038] In a possible design, the processing module is specifically used to: if the length of the first connection time series is greater than twice the length of the second connection time series, determine that the similarity between the first connection time series and the second connection time series is 0.
[0039] In one possible design, the processing module is specifically used to determine the session similarity distance between the first external host and the second external host based on the session feature similarities and corresponding weights of all first type mapping relationship pairs between the first external host and the second external host that meet the set conditions.
[0040] In a possible design, the processing module is specifically configured to determine a session similarity distance between the first external host and the second external host by using the following formula:
[0041]
[0042] Wherein, v1 is the first external host, v2 is the second external host, distance(v1, v2) is the session similarity distance between the first external host and the second external host, n is the total number of session feature similarities between the first external host and the second external host, and i is the similarity of the i-th session feature between the first external host and the second external host, the weight i is the weight corresponding to the similarity of the i-th session feature.
[0043] In a possible design, the weight corresponding to the session feature similarity of the first type mapping relationship pair that meets the set condition is: the sum of the lengths of connection time series in the four-tuple information corresponding to the two first type mapping relationships included in the first type mapping relationship pair.
[0044] In a possible design, the processing module is specifically used to: determine N factions in the second traffic graph model according to the adjacency list of the second traffic graph model, each faction includes at most k external hosts, k is an integer greater than 3, and N is a positive integer; according to the N factions. Establish a faction relationship matrix corresponding to the second traffic graph model, the faction relationship matrix is used to indicate the number of external hosts included in each faction, and the adjacency relationship between different factions; traverse the faction relationship matrix in a breadth-first traversal manner, merge connected different factions, and obtain the one or more external host groups.
[0045] In a possible design, the faction relationship matrix has N rows and N columns, wherein each of the N rows corresponds to one of the N factions, and each of the N columns corresponds to one of the N factions; the off-diagonal elements in the faction relationship matrix are equal to the number of common external hosts between the faction corresponding to the row where the off-diagonal elements are located and the faction corresponding to the column where the off-diagonal elements are located, and the diagonal elements are equal to the number of external hosts included in the faction corresponding to the diagonal elements.
[0046] In one possible design, the processing module is specifically used to: determine a set consisting of external hosts that do not belong to any of the external host groups; filter the external hosts in the set according to a preset IP address whitelist, and determine the external hosts in the set whose IP addresses do not belong to the IP address whitelist as the abnormal external hosts.
[0047] In a third aspect, an embodiment of the present application further provides a computer device, including:
[0048] A memory for storing program instructions;
[0049] The processor is used to call the program instructions stored in the memory and execute the method described in various possible designs of the first aspect according to the obtained program instructions.
[0050] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, in which computer-readable instructions are stored. When a computer reads and executes the computer-readable instructions, the method described in any possible design of the above-mentioned first aspect is implemented.
[0051] In a fifth aspect, an embodiment of the present application further provides a computer program product, comprising computer-readable instructions, which, when executed by a processor, implement the method described in any possible design of the first aspect above. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] 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 ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0053] Figure 1 A schematic diagram of a flow chart of a host traffic anomaly detection method based on a graph model provided in an embodiment of the present application;
[0054] Figure 2 A schematic diagram of the structure of a first flow diagram model provided in an embodiment of the present application;
[0055] Figure 3 A schematic diagram of the structure of a second flow diagram model provided in an embodiment of the present application;
[0056] Figure 4 A schematic diagram of the format of a vertex file in a traffic graph model provided in an embodiment of the present application;
[0057] Figure 5 A schematic diagram of the format of the edge file in the flow graph model provided in the embodiment of the present application;
[0058] Figure 6 A schematic diagram of a process for calculating a session similarity distance between two external hosts provided in an embodiment of the present application;
[0059] Figure 7 A schematic diagram of a process for calculating the similarity of session features of two connection time series provided in an embodiment of the present application;
[0060] Figure 8 A schematic diagram of the overall process of host traffic anomaly detection provided by an embodiment of the present application;
[0061] Fig. 9 A schematic diagram showing the influence of different k values on the number of external host groups provided in an embodiment of the present application;
[0062] Fig.10 A schematic diagram showing the influence of different k values on the modularity of the external host grouping structure provided in the embodiment of the present application;
[0063] Fig.11 A schematic diagram of the structure of a host traffic anomaly detection device based on a graph model provided in an embodiment of the present application;
[0064] Fig.12 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0065] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0066] In the embodiments of the present application, a plurality refers to two or more than two. The words "first", "second" and the like are only used for the purpose of distinguishing descriptions and cannot be understood as indicating or implying relative importance or order.
[0067] In view of the problem of poor accuracy in traffic anomaly detection in the prior art, the present application provides a traffic anomaly detection method based on a graph model, which can utilize the similarity of session features between external hosts and target hosts in the traffic graph model to establish a connection relationship between external hosts in the traffic graph model, so as to achieve reconstruction of the traffic graph model. Then, an improved faction filtering algorithm is used to cluster and group external hosts with similar session behavior patterns in the reconstructed traffic graph model, and to find abnormal external hosts that are independent of normal external host groups. The solution of the present application has a good ability to discover abnormal external hosts in traffic, and can effectively improve the accuracy of traffic anomaly detection.
[0068] In the present application, the target host may be a server in the intranet, and the external host may be a device outside the intranet that is connected to the server in the intranet, without specific limitation.
[0069] In the following description of this application, the technical solution for detecting abnormalities in host traffic provided in this application is described by taking the abnormality detection of traffic of a target host in the intranet as an example. It can be understood that in practical applications, the method in this application can also be used to detect abnormalities in traffic of multiple target hosts, and this application does not make specific limitations.
[0070] The host traffic anomaly detection method in this application may include the following two stages:
[0071] 1. Graph model construction phase.
[0072] In this stage, the traffic records of the target host can be collected as the original data for constructing the first traffic graph model, and then the five-tuple information in each traffic record can be extracted to establish the first traffic graph model. The similarity calculation is performed on the session characteristics of the external hosts of the first traffic graph model, and the connection relationship is added between the external hosts with different similarities based on the set threshold. The reconstruction of the connection relationship between the external hosts in the first traffic graph model is completed to form the second traffic graph model.
[0073] In the present application, the target host of the collected traffic can be referred to as an internal node, and the external host that has a connection relationship with the target host of the collected traffic can be referred to as an external node.
[0074] The traffic graph model is used to mathematically represent the network composed of the complex connection relationship between the target host and the external host in the traffic. Therefore, the traffic graph model can also be called a network relationship graph model. A traffic graph model can include multiple nodes and edges connecting the nodes, where each node represents a host and the edges between the nodes represent the connection relationship between the hosts.
[0075] For example, the first traffic graph model may include an internal node representing the target host, one or more external nodes representing the external host, and an edge representing the connection relationship between the target host and the external host. Since the traffic records collected in this application are all related to the target host, the first traffic graph model does not include the edge representing the connection relationship between the external hosts. By reconstructing the first traffic graph model based on the similarity of the session features between different external hosts and the target host, the generated second traffic graph model may include not only the internal node representing the target host, one or more external nodes representing the external host, and the edge representing the connection relationship between the target host and the external host, but also the edge representing the connection relationship between the external hosts. The first traffic graph model in this application may also be referred to as the original traffic graph model, and the second traffic graph model may also be referred to as the reconstructed traffic graph model.
[0076] 2. External abnormal node detection phase.
[0077] In this stage, the attributes and data structures of the factions and external host groups in the reconstructed second traffic graph model are redefined, and the external hosts with similar session behavior patterns in the second traffic graph model are clustered and grouped using the improved faction filtering algorithm, and the external hosts that are separated from the normal group are found. Optionally, the evaluation function can be further used to optimize the grouping structure of the external host group, and a single external host that is separated from the normal group is marked as an abnormal traffic node in the network traffic.
[0078] Combine the following Figure 1 The process shown in FIG. 1 is a detailed description of the above two stages.
[0079] Figure 1 The flowchart of the host traffic anomaly detection method based on the graph model is shown as an example. Figure 1 As shown, the method includes:
[0080] Step 101, generates a first traffic graph model based on the collected traffic records related to the target host within a set time period, wherein the first traffic graph model includes information of the target host, information of multiple external hosts, and a first type of connection relationship between the external host and the target host, wherein the first type of connection relationship is used to indicate session characteristics between the external host and the target host.
[0081] In step 101, after collecting the traffic records related to the target host within the set time period, the five-tuple information in each traffic record can be first extracted. The five-tuple information includes the source IP address, source port number, destination IP address, destination port number and connection time. The connection time refers to the time when the session between the target host and the external host is established, which can be represented by a timestamp. Since each traffic record is a session connection record between the target host and the external host, the five-tuple information in each traffic record includes the IP address and port number of the target host. For example, the source IP address may be the IP address of the target host, and the source port number may be the port number of the target host; or, the destination IP address may be the IP address of the target host, and the destination port number may be the port number of the target host.
[0082] Then, by aggregating the traffic records with the same four-tuple information in the traffic records related to the target host within the set time period, the total number of connections and the connection time series corresponding to each four-tuple information are determined, and the first traffic graph model is generated based on the total number of connections and the connection time series corresponding to each four-tuple information.
[0083] The four-tuple information includes a source IP address, a source port number, a destination IP address and a destination port number. The total number of connections corresponding to the four-tuple information refers to the total number of times the traffic record of the four-tuple information appears within the set time period. Optionally, the total number of connections can be stored in a dictionary (data_dict), with the key being the four-tuple information (source IP address, source port number, destination IP address, destination port number), and the value being the total number of times the traffic record of the four-tuple information appears within the set time period.
[0084] The connection time sequence corresponding to the four-tuple information refers to a sequence composed of the connection time and the number of connections recorded in the flow record of the four-tuple information within the set time period. The sequence may include one or more timestamps and the number of connections corresponding to each timestamp, that is, a sequence of (timestamp, number of connections). Optionally, the connection time sequence can also be stored through a dictionary (time_seq), with the key being the four-tuple information (source IP address, source port number, destination IP address, destination port number), and the value being the key being the sequence of connection time and the number of connections recorded in the flow record of the four-tuple information within the set time period.
[0085] The first traffic graph model is used to represent the connection relationship between the target host and multiple external hosts. Among them, the first traffic graph model includes information of the target host, information of multiple external hosts and a first type of connection relationship between the external host and the target host. The first type of connection relationship is used to indicate the session characteristics between the external host and the target host, and the session characteristics may be the time, number of times, frequency, etc. of session establishment. The first type of connection relationship refers to the connection relationship between the external host and the target host, and the connection relationship between the external host and the target host for which there is a session connection record in the collected traffic record corresponds to the edge connecting the two host nodes in the graph structure.
[0086] Specifically, the target host information may include the IP address of the target host, the external host information may include the IP address of the external host, and the first type of connection relationship may include the total number of connections and the connection time series corresponding to a set of four-tuple information between the external host and the target host that have the first type of connection relationship, that is, the two dictionaries mentioned above. Since the first type of connection relationship corresponds to a set of four-tuple information, there may be one or more first type connection relationships between an external host and the target host, indicating a connection established between an external host and the target host through different source IP addresses, source port numbers, destination IP addresses, and destination port numbers, for example, the source and destination may be different, or the ports may be different.
[0087] Exemplarily, the first flow graph model is a graph structure, such as Figure 2 As shown, the structure of the first traffic graph model may include internal nodes, external nodes, and edges between internal nodes and external nodes. Each internal node represents a target host from which traffic records are extracted, each external node represents an external host that has a connection relationship (or a session connection record) with the target host from which traffic records are extracted, and each edge connecting an external node to an internal node represents a first type of connection relationship between an external host and a target host. Figure 3 The structure of the second traffic graph model shown is similar to this, except that the second traffic graph model also includes edges between external nodes added based on the similarity of session features between external nodes, corresponding to the second type of connection relationship mentioned below.
[0088] It should be noted that Figure 2 and Figure 3 This is only a schematic diagram. In this application, the number of internal nodes, the number of external nodes, and the number of edges included in the traffic graph model (such as the first traffic graph model or the second traffic graph model) are not specifically limited. That is, the first traffic graph model can be generated for one target host, or the first traffic graph model can be generated for multiple target hosts. Figure 2 As shown, this application is not specifically limited.
[0089] Exemplarily, the first traffic graph model can be described by G = (V, E), where each node in the node set V represents an IP address and a corresponding Boolean value, which describes whether the node is a node for extracting traffic, that is, whether it is a target host. Each edge in the edge set E represents a connection relationship between two nodes, and each edge contains the following information: source IP address, source port number, destination IP address, destination port number, total number of connections, connection time series and a Boolean value, which is used to identify whether the edge is original or manually added. Among them, the composition format of the connection time series is (time, num), time represents the connection time, and num represents the number of times this connection time occurs. The connection time series can reflect the behavior pattern of the session features between nodes, and the session feature similarity mentioned below in this application will also be calculated based on the connection time series.
[0090] Specifically, the node set V can be stored in a node file, and the format of the node file is as follows: Figure 4 shown.
[0091] Each row: Vertex number Vertex IP.
[0092] The edge set E can be stored in an edge file. The format of the edge file is as follows: Figure 5 shown.
[0093] Each segment: Source vertex number Destination vertex number Source port number Destination port number Number of connections
[0094] #start
[0095] Time series in the format of (time, quantity), with line breaks every ten lines
[0096] #end
[0097] It should be noted that the first traffic graph model corresponds to the set time period. The set time period may refer to a time slice of, for example, 5 minutes or 10 minutes. For example, traffic records for a long continuous period of time may be collected, and then the continuous time may be divided into time slices at a certain time granularity. The first traffic graph model may be generated according to the traffic records in each time slice, and subsequent anomaly detection may be performed. By dividing the time slices, changes in the network connection relationship may be detected, and this may help to screen abnormal external nodes. In the embodiments of the present application, a time slice is taken as an example to introduce the process of abnormal traffic detection.
[0098] Step 102, based on the similarity of session characteristics between different external hosts and the target host in the first traffic graph model, reconstruct the first traffic graph model to generate a second traffic graph model, wherein the second traffic graph model includes a second type of connection relationship between external hosts, and the second type of connection relationship is used to indicate that the session behavior patterns of the two connected external hosts are similar.
[0099] In step 102, the session similarity distance between two of the plurality of external hosts may be determined first according to the first type of connection relationship between each external host and the target host, and the session similarity distance is used to indicate the similarity of the session behavior patterns of the two external hosts. The larger the value of the session similarity distance between the two external hosts, the more similar the session behavior patterns of the two external hosts are.
[0100] Taking the first external host and the second external host as an example, determining the session similarity distance between the two external hosts may include: Figure 6 The two steps shown in:
[0101] Step 601, for each first type mapping relationship pair consisting of a first type mapping relationship between a first external host and a target host and a first type mapping relationship between a second external host and a target host that meets a set condition, determine the session feature similarity of the first type mapping relationship pair.
[0102] Step 602: Determine a session similarity distance between the first external host and the second external host according to session feature similarities of all first type mapping relationship pairs between the first external host and the second external host that meet a set condition.
[0103] In step 601, the setting condition refers to the same source IP address and the same source port number of the four-tuple information corresponding to the two first-type mapping relationships included in the first-type mapping relationship pair, or the same destination IP address and the same destination port number. In other words, the condition for calculating the similarity of the session features of the first-type mapping relationship pair is that the connection relationship between the two external hosts and the target host is to communicate with the same port of the same target host. The similarity of the session features of the first-type mapping relationship pair refers to the similarity between the connection time series in the four-tuple information corresponding to the two first-type mapping relationships included in this first-type mapping relationship pair.
[0104] Exemplarily, assume that a first type mapping relationship pair includes the i-th first type mapping relationship between the first external host and the target host and the j-th first type mapping relationship between the second external host and the target host, and the connection time sequence in the quadruple information corresponding to the i-th first type mapping relationship is the first connection time sequence, and the connection time sequence in the quadruple information corresponding to the j-th first type mapping relationship is the second connection time sequence, and i and j are integers, which refer to loop control variables. Each connection time sequence can be represented as a sequence of one or more (timestamp time, number of connections num) combinations.
[0105] In this case, determining the similarity of the session features of the first type mapping relationship pair may be:
[0106] First, the lengths of the two connection time sequences are determined, where the length of the connection time sequence may refer to the number of timestamps included in the connection time sequence. If the length of the first connection time sequence is greater than twice the length of the second connection time sequence, it can be determined that the similarity between the first connection time sequence and the second connection time sequence is 0, that is, the similarity of the session feature similarity of the first type mapping relationship pair is 0, or in other words, the session similarity between the i-th first type mapping relationship between the first external host and the target host and the j-th first type mapping relationship between the second external host and the target host is 0.
[0107] If the length of the first connection time series is greater than the length of the second connection time series, but less than or equal to twice the length of the second connection time series, the length of the first connection time series and the second connection time series can be matched, and the similarity between the first connection time series and the second connection time series can be calculated by the following formula:
[0108]
[0109] Wherein, x is the first connection time series after length matching, y is the second connection time series after length matching, similarity(x, y) is the similarity between the first connection time series and the second connection time series, and x i .time is the i-th timestamp in the first connection time sequence after length matching, and the x i .num is the number of connections corresponding to the i-th timestamp in the first connection time sequence after length matching. i .time is the i-th timestamp in the second connection time sequence after length matching, and the y i .num is the number of connections corresponding to the i-th timestamp in the second connection time sequence after length matching, and n is the number of timestamps in the second connection time sequence and the second connection time sequence after length matching.
[0110] In one possible design, the length matching means that, according to the principle of closest starting time, a second connection time sequence with a shorter length is used to match a first connection time sequence with a longer length, and the first connection time sequence is trimmed so that the two connection time sequences have the same length.
[0111] It should be noted that when the length of the second connection time series is greater than that of the first connection time series, the method for calculating the similarity between the two is similar to the above method, except that the two connection time series need to be swapped. That is, the above method for calculating the similarity between the two connection time series is to determine whether the length of the longer connection time series is greater than twice the length of the shorter connection time series. If so, the similarity is 0. If not, the lengths of the two connection time series are matched and then calculated using the above formula.
[0112] It can be understood that the process of calculating the similarity of the session features shown in the above step 601 is equivalent to traversing the combination of each first type mapping relationship between the first external host and the target host and each first type mapping relationship between the second external host and the target host. The combination of the two first type mapping relationships can be called a first type mapping relationship pair. Then, all possible combinations of the first type mapping relationships between the first external host and the second external host are screened. When the combination meets the set conditions, the session similarity between the two first type mapping relationships in the combination is calculated. Otherwise, the session similarity between the two first type mapping relationships in the combination is not calculated, or the session similarity between the two first type mapping relationships in the combination is considered to be 0.
[0113] Figure 7 The flowchart of calculating the similarity between two connected time series time_seq in the embodiment of the present application is exemplified. Figure 7 The corresponding algorithm is described as follows:
[0114] 1) The longer of the two time_seq is recorded as longList, and the shorter one is recorded as shortList. If longList.length>2*shortList.length, then similarity(longList, shortList)=0, indicating that their similarity is 0, otherwise go to (2);
[0115] 2) According to the principle of closest starting time, use shortList to match longList, and trim longList so that longList.length = shortList.length;
[0116] 3) Calculate similarity(longList, shortList) again, referring to the formula above.
[0117] In step 602, specifically, the session similarity distance between the first external host and the second external host can be determined according to the session feature similarities of all first type mapping relationship pairs between the first external host and the second external host that meet the set conditions and the corresponding weights. The weight corresponding to each session feature similarity refers to: the sum of the lengths of the connection time series in the four-tuple information corresponding to the two first type mapping relationships included in the first type mapping relationship pair used to calculate the session feature similarity.
[0118] Exemplarily, the session similarity distance between the first external host and the second external host may be calculated by the following formula:
[0119]
[0120] Wherein, v1 is the first external host, v2 is the second external host, distance (v1, v2) is the session similarity distance between the first external host and the second external host, n is the total number of session feature similarities calculated between the first external host and the second external host, and i is the similarity of the i-th session feature between the first external host and the second external host, the weight i is the weight corresponding to the similarity of the i-th session feature, which may be equal to the sum of the lengths of the two connected time series.
[0121] In a possible design, when the session feature similarities of all first type mapping relationship pairs between the first external host and the second external host that meet the set conditions calculated in step 601 can be stored in an array dis, the value of n in the above formula can represent the number of elements in the array. Similarly, the weight corresponding to each session feature similarity can be stored in another array weight, the number of elements of the array is the same as that of the array dis.
[0122] Furthermore, in step 102, if there is a session similarity distance between two external hosts that is greater than the product of the average session similarity distance and a preset threshold, a second type of connection relationship between the two external hosts can be established, thereby generating a second traffic graph model. The average session similarity distance can be obtained by calculating the average of the session similarity distances between all external hosts in the first traffic graph model. The preset threshold is used to constrain the number of second type connection relationships between external hosts in the second traffic graph model, that is, the number of edges between external nodes in the second traffic graph model. The preset threshold can be specifically designed according to actual needs.
[0123] Step 103: Cluster and group the multiple external nodes according to the similarity of the session behavior patterns of different external nodes in the second traffic graph model, to obtain one or more external host groups, where each external host group includes multiple external hosts.
[0124] In this step 103, all the cliques in the second traffic graph model can be determined according to the adjacency list of the second traffic graph model, to obtain a clique list. Each clique includes at most k external hosts and at least 3 external hosts, where k is an integer greater than 3, and the value of k is used to constrain the scale of the clique and can be adjusted according to actual needs.
[0125] Then, according to all the cliques found from the second traffic graph model (i.e., the clique list), a clique relationship matrix corresponding to the second traffic graph model is established, and this clique relationship matrix is used to indicate the number of external hosts included in each clique and the adjacency relationship between different cliques.
[0126] Specifically, assume that N cliques are found from the second traffic graph in total, then the clique relationship matrix C ij is an N×N matrix. Each row in this matrix corresponds to one of the N cliques, and each column also corresponds to one of the N cliques. The non-diagonal elements in this matrix are equal to the number of common external hosts between the clique represented by the row where the element is located and the clique represented by the column where the element is located, that is, C ij =(cliques i &cliques j ). The diagonal elements in this matrix are equal to the number of external hosts included in the clique corresponding to the element, that is, C ii =cliques i . It can be understood that for the elements on the diagonal of the matrix, the clique represented by the row where the element is located is the same as the clique represented by the column where the element is located.
[0127] Optionally, after obtaining the clique relationship matrix, the obtained clique relationship matrix can also be normalized so that the elements in the clique relationship matrix are 0 or 1, and then subsequent processing can be carried out. For example, the initial clique relationship matrix can be traversed. When i = j, if C ii <k, then the element is set to 0, otherwise it is set to 1. When i≠j, if C ij <k - 1, then the element is set to 0, otherwise it is set to 1.
[0128] Furthermore, the clique relationship matrix can be traversed in a breadth-first traversal manner to merge the connected different cliques, to obtain one or more external host groups.
[0129] Optionally, after one or more external host groups are obtained according to the second traffic graph model, in a possible design, the present application may also evaluate the structure of the obtained external host groups. Exemplarily, an evaluation function - EQ function, which is used to evaluate the degree of node overlap between groups, may be used to calculate and output the EQ value.
[0130] Step 104: determine an external host that does not belong to any external host group as an abnormal external host communicating with the target host.
[0131] In step 104, the external hosts that do not belong to any external host group may be determined to be abnormal external hosts that communicate directly with the target host. Alternatively, each external host that does not belong to any external host group may be formed into a set, and the external hosts in the set may be considered to be suspicious external hosts. Then, the external hosts in the set may be screened in one or more of the following ways, and the external hosts that remain after the screening may be determined to be abnormal external hosts that communicate with the target host.
[0132] Exemplary screening methods may include the following:
[0133] 1) Filter the suspicious external hosts in the set according to the preset IP address whitelist, remove the hosts represented by the IP addresses in the IP address whitelist from the set, and then determine the suspicious external hosts in the set whose IP addresses do not belong to the IP address whitelist as abnormal external hosts.
[0134] 2) Filtering based on the number of times the suspicious external hosts in the set appear in each time slice. From the set, remove external hosts whose number of appearances is greater than a certain percentage (such as 80%) of the number of time slices, and external hosts representing the IP addresses of LAN nodes.
[0135] 3) Filtering is performed based on the ports of the target hosts to which the suspicious external hosts in the set are connected. If the ports of the target host to which an external host is connected are one or more ports in normal use, the external host is removed from the set.
[0136] According to the above content, the present invention constructs a graph model establishment algorithm, reconstructs the constructed graph model according to the similarity of session features between external nodes and servers, and then uses a method based on an improved faction filtering algorithm to detect abnormal nodes.
[0137] Compared with the prior art, this application has the following advantages and technical effects:
[0138] Since the traffic data captured from the server host only contains the session connection records between the server node and the external node, and does not contain the session connection records between the external nodes, if the graph model is established only by relying on the original data, it will be a bipartite graph model from the dimension of a single host, and it is difficult to find a unified connection behavior pattern between different external nodes. The present application utilizes the law of similarity of session features between external nodes and servers, and uses a proposed method for calculating session feature similarity to reconstruct the connection relationship between external nodes of the traffic graph model. The present invention also designs an improved faction filtering algorithm to cluster and group external nodes with similar session behavior patterns. Free nodes or groups with fewer external nodes are found through the grouping structure, indicating that the external node or group is abnormal, which helps to improve the accuracy of host traffic anomaly detection.
[0139] The technical solution in this application is described in detail below through a specific example. The overall process of this example is as follows: Figure 8 shown.
[0140] 1. Graph model construction phase.
[0141] 1.1 Extract server traffic data. The extracted five-tuple entries are source IP, source port, destination IP, destination port, and session establishment time. Aggregate the four-tuple entries with the same source IP, source port, destination IP, and destination port, and use two dictionaries to store the connection count information and connection time information respectively. The key in data_dict is (source IP, destination IP, source port, destination port), and the value indicates the total number of times the record with this key as the connection four-tuple appears. The key in time_dict is (source IP, destination IP, source port, destination port), and the value indicates the connection time and number of times the record with this key as the connection four-tuple is time_seq. time_seq is also a dictionary structure, with the key being the timestamp and the value being the number of times this time appears.
[0142] For the traffic data, the traffic is sliced with a time granularity of 5 minutes, and the original traffic graph model is generated for each slice. It is described by G = (V, E). Each node in the node set V represents the IP address of the node and a Boolean value, which describes whether the node is a server node for extracting traffic. The edge set E contains 5 pieces of information, namely the number of connections, source port, destination port, connection time and connection number dictionary, which distinguishes whether the edge is original or manually added.
[0143] In a specific implementation, the attributes of the nodes and edges of the traffic graph model and their data structures can be defined in this module, thereby realizing a method for parsing node files and edge files, and a method for establishing a graph.
[0144] The data structure of vertex attributes is defined as follows:
[0145]
[0146] The data structure of edge attributes is defined as follows:
[0147]
[0148]
[0149] This module can use the Spark platform and GraphX framework, and the code is implemented in Scala language to process vertex files and edge files respectively, and finally get the graph structure. The specific steps of the graph building module are:
[0150] (1) Start Spark and initialize the Spark SQL entry program.
[0151] (2) Read and parse vertex files to generate resilient distributed datasets (RDD) of vertices.
[0152] (3) Read and parse the edge file to generate the edge RDD.
[0153] (4) Based on the RDDs of nodes and edges, the graph structure of the traffic graph model is generated using the construction method Graph(vertexRDD,edgeRDD). The vertexRDD and edgeRDD are the data of two points and edges input to the Graph method.
[0154] The pseudo code of the RDD method for generating a node is as follows:
[0155]
[0156] The pseudo code for generating edge RDD is as follows:
[0157]
[0158]
[0159] The data structure of the node V attribute includes: the IP address of the vertex, whether it is the IP of the extracted traffic server
[0160] The data structure of the edge E attribute includes: the number of connections, the source port, the destination port, and the time series, which is a Boolean value that distinguishes whether the edge is original or manually added.
[0161] 1.2 The connection time and frequency information in the connection time series time_seq reflects the behavior pattern of the external node and the server session characteristics. The similarity of session characteristics between different time_seq can be measured by defining a session characteristic similarity formula.
[0162] The time_seq format is (time, num), where time is the time when the connection is established and num is the number of times this time occurs. The session feature similarity algorithm proposed in the present invention is provided with time_seq sequences x and y of the same length, and the similarity calculation method is shown in the formula:
[0163]
[0164] The following is a description of the algorithm for calculating the similarity of two time_seq:
[0165] (1) The longer of the two time_seq is recorded as longList, and the shorter one is recorded as shortList. If longList.length>2*shortList.length, then similarity(longList, shortList)=0, indicating that their similarity is 0, otherwise go to (2);
[0166] (2) According to the principle of closest starting time, use shortList to match longList, and trim longList so that longList.length = shortList.length;
[0167] (3) Calculate similarity(longList, shortList) again. The calculation process is shown in the figure.
[0168] 1.3 The original graph model is a bipartite graph. In order to make the graph model better adapt to the anomaly detection algorithm, it is necessary to add some edges between external nodes. Whether to add edges depends on the distance between two external nodes. The "distance" here is not the distance in the traditional sense, but a measure of the conversation similarity between two nodes, that is, the conversation similarity distance. For two external nodes v1 and v2, DISTANCE is defined to measure the conversation similarity between external nodes. The larger the DISTANCE (v1, v2), the greater the conversation similarity.
[0169] Assume that the two nodes of the internal server are denoted as in_server1 and in_server2. For the two external vertices v1 and v2, the following is a method for calculating the distance between them:
[0170] (1) The double type array dis is used to store the calculated similarities, and the int type array weight is used to store the weights corresponding to the similarities. Weight(i) represents the weight of dis(i).
[0171] (2) For the server node in_server1, extract all the edges whose source IP is equal to the server node in_server1, the destination IP is equal to the node v1, and the source IP is equal to the node v1, the destination IP is equal to the server node in_server1, and store them in the list edgeList1; extract all the edges whose source IP is equal to the server node in_server1, the destination IP is equal to the node v2, and the source IP is equal to the node v2, the destination IP is equal to the server node in_server1, and store them in the list edgeList2.
[0172] (3) Traverse edgeList1, for each edge e1, if there is an edge e2 in edgeList2, such that the source IP of e1 is equal to the source IP of e2 and the source port of e1 is equal to the source port of e2, or the destination IP of e1 is equal to the destination IP of e2 and the destination port of e1 is equal to the destination port of e2, then the similarity of the two edges can be calculated as s =similarity(e1 time series, e2 time series), the weight of s is w = length of e1 time series + length of e2 time series, and s and w are put into arrays dis and weight respectively. The larger the weight, the stronger the reference of this similarity to the similarity distance of the session.
[0173] (4) For the internal server node in_server2, the operations are the same as (2) and (3) and will not be repeated here.
[0174] (5) The calculation formula for the distance between two external nodes v1 and v2 is:
[0175]
[0176] Where n is the length of the dis array and the weight array.
[0177] (6) Output the distance between v1 and v2.
[0178] 1.4 Connect external nodes.
[0179] For two external nodes v1 and v2, whether to add an edge between them depends on the distance distance(v1,v2) between them and the set threshold threshold. By setting the value of threshold, the number of added edges can be controlled within an appropriate range, so that the structure of the network connection relationship graph can better cooperate with the anomaly detection algorithm.
[0180] For the established original graph g, the following is the algorithm process for adding edges:
[0181] (1) For all two external nodes v1, v2 of the original graph, calculate the distance between them, so as to calculate the average value avg of the distances of external nodes in the whole graph.
[0182] (2) For any two external nodes v1, v2 of g, calculate the distance d between them. If the distance d is greater than or equal to the product of the weighted average of the distances of external nodes and the threshold, that is, d ≥ avg × threshold, then establish an edge between them, as Figure 3 shown.
[0183] (3) Output the new graph g after adding edges.
[0184] 2. External abnormal node detection stage.
[0185] 2.1 Based on the improved clique filtering algorithm.
[0186] The definitions of the attributes and data structures of the external node grouping after clique and clustering are as follows:
[0187] The data structure of the clique includes the size of the clique, the first node of the clique, and the members of the clique;
[0188] The external node grouping attributes include: the original graph, the adjacency list of the graph, the clique relationship matrix, and the list of connected cliques, and this list represents an external node grouping.
[0189] The algorithm process of the improved clique filtering algorithm is as follows:
[0190] (1) Calculate the adjacency list am of the new graph g newly constructed in the previous stage. The key of am represents the node number v of the current node, and the value represents the list composed of all vertices adjacent to the node v, and is arranged in ascending order of the node number.
[0191] (2) Use the adjacency list am to find all cliques in the graph g. The minimum number of nodes in the clique is 3, and the maximum is k. k is a parameter defined by the algorithm, and this parameter can be dynamically adjusted; in this process, if there is a clique m - clique (m < k) and there is a node v outside this clique that is adjacent to all nodes in this clique, then add v to form a clique (m + 1) - clique, and so on, and finally obtain a list cliques composed of cliques.
[0192] (3) Establish a clique relationship matrix C ij , and the non - diagonal elements of this matrix are equal to the number of common nodes between two cliques, that is, C ij =(cliquesi &cliques j ) The elements on the diagonal of this matrix are equal to the number of nodes in the corresponding clique, i.e., C ii = cliques i .
[0193] (4) Normalize the clique relationship matrix C ij . When i = j, if C ii < k, then set it to 0, otherwise set it to 1. When i ≠ j, if C ij < k - 1, then set it to 0, otherwise set it to 1.
[0194] (5) At this time, a diagonal element of 1 indicates that the corresponding clique is the clique that meets the conditions. A non - diagonal element of 1 indicates that there is an adjacency relationship between the two corresponding cliques.
[0195] (6) Traverse the clique relationship matrix in a breadth - first traversal manner, and obtain the maximally connected cliques by merging connected cliques, which is an external node grouping, and output all the grouping structures.
[0196] 2.2 Evaluation of external node grouping.
[0197] The external node grouping evaluation process includes: calculating the number of edges M in the reconstructed graph model; traversing the adjacency list of the reconstructed graph model, calculating the degree of each node and storing it in an array k, where k i represents the degree of node i; recording the number num of the grouping structures where node v is located, and traversing the clique list in matrix C; finally calculating the extended measure of quality of modularity (EQ) value and outputting it.
[0198] The EQ value is an evaluation index for the result of overlapping grouping (also called community) division. Its value range is 0 - 1. The larger the value, the better the overlapping structure and the more similar the session characteristics of these nodes.
[0199] In the process of external node grouping evaluation, use the evaluation function - EQ function that evaluates the degree of node overlap between groups. The calculation formula is:
[0200]
[0201] Among them, M represents the number of edges in the reconstructed graph model, O v represents the number of external node groups to which node v belongs, matrix A represents the adjacency matrix of the graph, matrix C is the matrix representing the external node grouping structure, and k v represents the degree of node v.
[0202] 2.3 Abnormal node marking.
[0203] For each time slice within the selected time period, its external node grouping structure and corresponding modular evaluation index (EQ function value) have been obtained from its corresponding network connection relationship graph model.
[0204] In the experiment, the faction filtering algorithm is used to discover communities in the graph structure, and the number of communities and the modularity index (EQ function value) of the community structure are obtained. For the faction filtering algorithm, different k values are set in the experiment, combined with the EQ function value for observation, and the impact of different k values on the community structure is compared, so as to select the appropriate k value.
[0205] In each time slice, the free nodes that do not belong to any group will be marked as suspicious abnormal nodes. After comparing and eliminating these suspicious abnormal nodes based on the external whitelist IP nodes, the remaining abnormal nodes can be used as a reference for finding abnormal traffic. If an abnormal node appears multiple times in all time slices, it will be regarded as a node with abnormal traffic.
[0206] The process of abnormal node marking is as follows:
[0207] (1) For each group in the external node grouping structure, find the set s of free nodes in the structure that do not belong to any group, and take the difference between s and the IP whitelist, that is, remove the nodes in the whitelist.
[0208] (2) m is used to record the number of times an IP appears in all time slices.
[0209] (3) Take out the node IPs whose number of appearances in m is greater than or equal to 80% of the number of time slices, and filter out the whitelist node IPs, and store them as the set abnormalIP;
[0210] (4) For each IP address in abnormalIP, find the edge connected to the internal server in the graph model and check whether the port used by the internal server is one or more of the normal application port numbers. If so, remove it;
[0211] (5) Output the abnormalIP set, where the nodes included in the set are abnormal.
[0212] 2.4 Community structure test.
[0213] When using the faction filtering algorithm, the community discovery results are different when different k values are selected. Therefore, it is necessary to first compare the impact of different k values on the community structure through experiments to select the appropriate k value.
[0214] Fig. 9 and Fig.10The figure shows the number of communities and the modularity index (EQ function value) of the community structure obtained by using the faction filtering algorithm to discover communities on the graph structure for the same network connection relationship graph structure under different k values. We can find that as the k value increases, the number of communities obtained by the faction filtering algorithm continues to decrease, and the EQ function value also continues to decrease and gradually tends to 0. When the EQ function value is too low, the modularity of the community structure is close to 0, and the community discovery effect is very weak at this time. Therefore, in practical applications, the k value is generally selected between 4-6. When k=4, the modularity of the community structure is the most ideal. In this data set, k=4 is selected as the actual parameter of the CPM algorithm.
[0215] After selecting the k value, community discovery is performed on several shards within a period of time. Ten consecutive shards are selected, and the time granularity of each shard is 5 minutes. Community discovery is performed on them. The number of communities and modularity index (EQ function value) of the community structure are obtained as follows: Fig. 9 and Fig.10 As shown in the figure, we can find that in the network connection graph structure, the number and modularity of communities fluctuate within a certain range in a short period of time. If there is a shard that deviates too much, it can be considered that there is abnormal traffic in this shard.
[0216] In summary, the present application proposes a graph model construction algorithm, which inputs the traffic captured from the server and parses the connection information and time series, proposes a method for calculating time series similarity based on improved cosine similarity, uses time series features to calculate the similarity between external nodes, and thus can calculate the distance between external vertices. By setting different thresholds, external vertices can be connected, and edges can be added between external nodes with higher similarity to improve the graph model. The present application also redefines the attributes and data structures of the factions and external associated nodes of the reconstructed traffic graph model, uses an improved faction filtering algorithm to cluster and group external nodes with similar session behavior patterns, and finds external abnormal nodes that are independent of normal groups, uses an evaluation function to optimize the results of external associated nodes, and marks single external nodes that are independent of groups or groups with fewer nodes as abnormal traffic nodes in network traffic.
[0217] Different from the solutions in the prior art, this application focuses on establishing a graph model using the communication characteristics of server traffic. The graph established using server traffic is a bipartite graph, and the connection relationship between external nodes cannot be obtained. This patent designs and implements a method based on calculating the similarity of session features. This method can calculate the similarity between non-equal-length vectors with two tuples as elements, and reconstruct the connection relationship of external nodes in the traffic graph model. At the same time, the present invention designs an improved faction filtering algorithm to explore the intrinsic correlation between external nodes, cluster and group external nodes with similar session behavior patterns, and find external abnormal nodes that are independent of other normal groups, thereby improving the accuracy of abnormal external node detection.
[0218] Based on the same inventive concept, the present application also provides a host traffic anomaly detection device based on a graph model, which is used to implement the host traffic anomaly detection method based on a graph model in the above method embodiment.
[0219] like Fig.11 As shown, the device 1100 includes: a communication module 1110 and a processing module 1120 .
[0220] The communication module 1110 is used to collect traffic records related to the target host within a set time period;
[0221] The processing module 1120 is used to generate a first traffic graph model based on the collected traffic records related to the target host within a set time period, wherein the first traffic graph model includes information of the target host, information of multiple external hosts, and a first type of connection relationship between the external host and the target host, wherein the first type of connection relationship is used to indicate the session characteristics between the external host and the target host; according to the similarity of the session characteristics between different external hosts and the target host in the first traffic graph model, the first traffic graph model is reconstructed to generate a second traffic graph model, wherein the second traffic graph model includes a second type of connection relationship between the external hosts, wherein the second type of connection relationship is used to indicate that the session behavior patterns of the two external hosts are similar; according to the similarity of the session behavior patterns of different external nodes in the second traffic graph model, the multiple external nodes are clustered and grouped to obtain one or more external host groups, wherein each external host group includes multiple external hosts; and the external host that does not belong to any of the external host groups is determined as an abnormal external host communicating with the target host.
[0222] In one possible design, each of the traffic records includes five-tuple information of the session associated with the traffic record, and the five-tuple information includes source IP address, source port number, destination IP address, destination port number and connection time, and the source IP address or the destination IP address in each of the traffic records is the IP address of the target host; the processing module 1120 is specifically used to: aggregate traffic records with the same four-tuple information in the traffic records related to the target host, determine the total number of connections and connection time series corresponding to each of the four-tuple information, and the four-tuple information includes the source IP address, the source port number, the destination IP address, and the destination port number; generate the first traffic graph model according to the total number of connections and the connection time series corresponding to each of the four-tuple information.
[0223] In one possible design, the information of the target host includes the IP address of the target host, and the information of the external host includes the IP address of the external host; the first type of connection relationship includes the total number of connections and the connection time series corresponding to a set of the four-tuple information between the external host and the target host.
[0224] In one possible design, the processing module 1120 is specifically used to: determine the session similarity distance between each of the multiple external hosts based on the first type of connection relationship between each of the external hosts and the target host, and the session similarity distance is used to indicate the similarity of the session behavior patterns of the two external hosts; if the session similarity distance between the two external hosts is greater than the product of the average session similarity distance and a preset threshold, then establish the second type of connection relationship between the two external hosts.
[0225] In one possible design, there are one or more first-type connection relationships between each of the external hosts and the target host; the processing module 1120 is specifically used to: determine the session feature similarity of the first-type mapping relationship pairs for each first-type mapping relationship pair that meets the set conditions and is composed of a first-type mapping relationship between the first external host and the target host and a first-type mapping relationship between the second external host and the target host; and determine the session similarity distance between the first external host and the second external host based on the session feature similarities of all first-type mapping relationship pairs that meet the set conditions between the first external host and the second external host.
[0226] In one possible design, the first type mapping relationship pair that satisfies the set conditions means that: the source IP addresses and source port numbers of the four-tuple information corresponding to the two first type mapping relationships included in the first type mapping relationship pair are the same, or the destination IP addresses and destination port numbers are the same.
[0227] In a possible design, the session feature similarity of the first type mapping relationship pair is: the similarity between connection time series in four-tuple information corresponding to two first type mapping relationships included in the first type mapping relationship pair.
[0228] In a possible design, the first type mapping relationship pair includes the i-th first type mapping relationship between the first external host and the target host and the j-th first type mapping relationship between the second external host and the target host, and the connection time sequence in the quadruple information corresponding to the i-th first type mapping relationship is the first connection time sequence, and the connection time sequence in the quadruple information corresponding to the j-th first type mapping relationship is the second connection time sequence, and i and j are integers; each of the connection time sequences includes one or more timestamps time and the number of connections num corresponding to each timestamp; the processing module 1120 is specifically used for: if the length of the first connection time sequence is greater than the length of the second connection time sequence, and is less than or equal to twice the length of the second connection time sequence, then the first connection time sequence and the second connection time sequence are matched in length; the similarity between the first connection time sequence and the second connection time sequence after length matching is determined by the following formula:
[0229]
[0230] Among them, x is the first connection time series after length matching, y is the second connection time series after length matching, similarity(x, y) is the similarity between the first connection time series and the second connection time series, xi.time is the i-th timestamp in the first connection time series after length matching, xi.num is the number of connections corresponding to the i-th timestamp in the first connection time series after length matching, yi.time is the i-th timestamp in the second connection time series after length matching, yi.num is the number of connections corresponding to the i-th timestamp in the second connection time series after length matching, and n is the number of timestamps in the second connection time series and the second connection time series after length matching.
[0231] In a possible design, the processing module 1120 is specifically used to: if the length of the first connection time series is greater than twice the length of the second connection time series, determine that the similarity between the first connection time series and the second connection time series is 0.
[0232] In one possible design, the processing module 1120 is specifically used to determine the session similarity distance between the first external host and the second external host based on the session feature similarities and corresponding weights of all first type mapping relationship pairs between the first external host and the second external host that meet the set conditions.
[0233] In a possible design, the processing module 1120 is specifically configured to determine a session similarity distance between the first external host and the second external host by using the following formula:
[0234]
[0235] Wherein, v1 is the first external host, v2 is the second external host, distance(v1, v2) is the session similarity distance between the first external host and the second external host, n is the total number of session feature similarities between the first external host and the second external host, and i is the similarity of the i-th session feature between the first external host and the second external host, the weight i is the weight corresponding to the similarity of the i-th session feature.
[0236] In a possible design, the weight corresponding to the session feature similarity of the first type mapping relationship pair that meets the set condition is: the sum of the lengths of connection time series in the four-tuple information corresponding to the two first type mapping relationships included in the first type mapping relationship pair.
[0237] In a possible design, the processing module 1120 is specifically used to: determine N factions in the second traffic graph model according to the adjacency list of the second traffic graph model, each faction includes at most k external hosts, k is an integer greater than 3, and N is a positive integer; according to the N factions. Establish a faction relationship matrix corresponding to the second traffic graph model, the faction relationship matrix is used to indicate the number of external hosts included in each faction, and the adjacency relationship between different factions; traverse the faction relationship matrix in a breadth-first traversal manner, merge connected different factions, and obtain the one or more external host groups.
[0238] In a possible design, the faction relationship matrix has N rows and N columns, wherein each of the N rows corresponds to one of the N factions, and each of the N columns corresponds to one of the N factions; the off-diagonal elements in the faction relationship matrix are equal to the number of common external hosts between the faction corresponding to the row where the off-diagonal elements are located and the faction corresponding to the column where the off-diagonal elements are located, and the diagonal elements are equal to the number of external hosts included in the faction corresponding to the diagonal elements.
[0239] In one possible design, the processing module 1120 is specifically used to: determine a set consisting of external hosts that do not belong to any of the external host groups; filter the external hosts in the set according to a preset IP address whitelist, and determine the external hosts in the set whose IP addresses do not belong to the IP address whitelist as the abnormal external hosts.
[0240] Based on the same technical concept, the embodiment of the present application also provides a computer device, such as Fig.12 As shown, it includes at least one processor 1201 and a memory 1202 connected to the at least one processor. The specific connection medium between the processor 1201 and the memory 1202 is not limited in the embodiment of the present application. Fig.12 For example, the processor 1201 and the memory 1202 are connected via a bus. The bus can be divided into an address bus, a data bus, a control bus, etc.
[0241] In the embodiment of the present application, the memory 1202 stores instructions that can be executed by at least one processor 1201. The at least one processor 1201 can implement the steps of the above-mentioned secret sharing method by executing the instructions stored in the memory 1202.
[0242] Among them, the processor 1201 is the control center of the computer device, and can use various interfaces and lines to connect various parts of the computer device, and perform resource settings by running or executing instructions stored in the memory 1202 and calling data stored in the memory 1202. Optionally, the processor 1201 may include one or more processing units, and the processor 1201 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 1201. In some embodiments, the processor 1201 and the memory 1202 may be implemented on the same chip, and in some embodiments, they may also be implemented separately on independent chips.
[0243] Processor 1201 can be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor, an application-specific integrated circuit (ASIC), a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, and can implement or execute the methods, steps and logic block diagrams disclosed in the embodiments of the present application. A general-purpose processor can be a microprocessor or any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware processor for execution, or can be executed by a combination of hardware and software modules in the processor.
[0244] Memory 1202, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer executable programs and modules. Memory 1202 may include at least one type of storage medium, such as flash memory, hard disk, multimedia card, card-type memory, random access memory (Random Access Memory, RAM), static random access memory (Static Random Access Memory, SRAM), programmable read-only memory (Programmable Read Only Memory, PROM), read-only memory (Read Only Memory, ROM), electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), magnetic memory, disk, optical disk, etc. Memory 1202 is any other medium that can be used to carry or store a desired program code in the form of an instruction or data structure and can be accessed by a computer, but is not limited thereto. The memory 1202 in the embodiment of the present application can also be a circuit or any other device that can realize a storage function, for storing program instructions and / or data.
[0245] Based on the same technical concept, an embodiment of the present application also provides a computer-readable storage medium, which stores computer-readable instructions. When a computer reads and executes the computer-readable instructions, the method in the above method embodiment is implemented.
[0246] Based on the same technical concept, an embodiment of the present application also provides a computer program product, including computer-readable instructions. When the computer-readable instructions are executed by a processor, the method in the above method embodiment is implemented.
[0247] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0248] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0249] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0250] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0251] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A host traffic anomaly detection method based on a graph model, characterized in that: The method comprises: Generate a first traffic graph model according to the collected traffic records related to the target host within a set time period, wherein the first traffic graph model includes information of the target host, information of multiple external hosts, and a first type of connection relationship between the external host and the target host, wherein the first type of connection relationship is used to indicate a session feature between the external host and the target host; According to the similarity of the session characteristics between different external hosts and the target host in the first traffic graph model, the first traffic graph model is reconstructed to generate a second traffic graph model, wherein the second traffic graph model includes a second type of connection relationship between the external hosts, and the second type of connection relationship is used to indicate that the session behavior patterns of the two external hosts are similar; wherein, according to the similarity of the session characteristics between different external hosts and the target host in the first traffic graph model, the first traffic graph model is reconstructed to generate a second traffic graph model, including: according to the first type of connection relationship between each of the external hosts and the target host, determining the session similarity distance between the multiple external hosts, wherein the session similarity distance is used to indicate the similarity degree of the session behavior patterns of the two external hosts; if the session similarity distance between the two external hosts is greater than the product of the average session similarity distance and a preset threshold, then establishing the second type of connection relationship between the two external hosts; Clustering and grouping the multiple external hosts according to the similarity of the session behavior patterns of different external hosts in the second traffic graph model to obtain one or more external host groups, each of which includes multiple external hosts; The external host that does not belong to any of the external host groups is determined as an abnormal external host communicating with the target host.
2. The method according to claim 1, characterized in that Each of the flow records includes five-tuple information of the session associated with the flow record, the five-tuple information includes a source IP address, a source port number, a destination IP address, a destination port number, and a connection time, and the source IP address or the destination IP address in each of the flow records is the IP address of the target host; The step of establishing a first flow graph model according to the collected flow records related to the target host within the set time period includes: Aggregate traffic records with the same four-tuple information in the traffic records related to the target host, and determine the total number of connections and the connection time sequence corresponding to each of the four-tuple information, wherein the four-tuple information includes the source IP address, the source port number, the destination IP address, and the destination port number; The first traffic graph model is generated according to the total number of connections and the connection time series corresponding to each of the four-tuple information.
3. The method according to claim 2, characterized in that The target host information includes the IP address of the target host, and the external host information includes the IP address of the external host; The first type of connection relationship includes the total number of connections and the connection time sequence corresponding to a set of the four-tuple information between the external host and the target host.
4. The method according to claim 1, characterized in that There are one or more first-type connection relationships between each of the external hosts and the target host; Determining the session similarity distance between two external hosts includes: For each first type mapping relationship pair satisfying a set condition, consisting of a first type mapping relationship between a first external host and the target host and a first type mapping relationship between a second external host and the target host, determining a session feature similarity of the first type mapping relationship pair; The session similarity distance between the first external host and the second external host is determined according to the session feature similarities of all the first type mapping relationship pairs between the first external host and the second external host that meet the set condition.
5. The method according to claim 4, characterized in that The first type of mapping relationship pair that satisfies the set condition refers to: The source IP addresses and source port numbers of the four-tuple information corresponding to the two first type mapping relationships included in the first type mapping relationship pair are the same, or the destination IP addresses and destination port numbers are the same.
6. The method according to claim 4, characterized in that The similarity of the session features of the first type of mapping relationship pair is: The similarity between the connection time series in the quadruple information respectively corresponding to the two first-type mapping relationships included in the first-type mapping relationship pair.
7. The method according to claim 6, characterized in that The first type mapping relationship pair includes the i-th first type mapping relationship between the first external host and the target host and the j-th first type mapping relationship between the second external host and the target host, and the connection time sequence in the quadruple information corresponding to the i-th first type mapping relationship is the first connection time sequence, and the connection time sequence in the quadruple information corresponding to the j-th first type mapping relationship is the second connection time sequence, and i and j are integers; each of the connection time sequences includes one or more timestamps time and the number of connections num corresponding to each timestamp; The determining the session feature similarity of the first type mapping relationship pair includes: If the length of the first connection time sequence is greater than the length of the second connection time sequence and less than or equal to twice the length of the second connection time sequence, matching the lengths of the first connection time sequence and the second connection time sequence; The similarity between the first connection time series and the second connection time series after length matching is determined by the following formula: Wherein, x is the first connection time series after length matching, y is the second connection time series after length matching, similarity(x, y) is the similarity between the first connection time series and the second connection time series, and x i .time is the i-th timestamp in the first connection time sequence after length matching, and the x i .num is the number of connections corresponding to the i-th timestamp in the first connection time sequence after length matching, and the y i .time is the i-th timestamp in the second connection time sequence after length matching, and the y i .num is the number of connections corresponding to the i-th timestamp in the second connection time series after length matching, and n is the number of timestamps in the second connection time series and the second connection time series after length matching.
8. The method according to claim 7, characterized in that The determining of the session feature similarity of the first type mapping relationship pair further includes: If the length of the first connection time sequence is greater than twice the length of the second connection time sequence, it is determined that the similarity between the first connection time sequence and the second connection time sequence is 0.
9. The method according to claim 4, characterized in that The determining, according to the similarities of the session features of all the first type mapping relationship pairs between the first external host and the second external host that meet the set condition, the session similarity distance between the first external host and the second external host comprises: The session similarity distance between the first external host and the second external host is determined according to the session feature similarities and corresponding weights of all the first type mapping relationship pairs between the first external host and the second external host that meet the set condition.
10. The method according to claim 9, characterized in that The session similarity distance between the first external host and the second external host is determined by the following formula: Wherein, v1 is the first external host, v2 is the second external host, DISTANCE(v1, v2) is the session similarity distance between the first external host and the second external host, n is the total number of session feature similarities between the first external host and the second external host, and i is the similarity of the i-th session feature between the first external host and the second external host, the weight i is the weight corresponding to the similarity of the i-th session feature.
11. The method according to claim 9 or 10, characterized in that: The weight corresponding to the similarity of the session features of the first type mapping relationship pair that meets the set condition is: The sum of the lengths of connection time sequences in the quadruple information corresponding to the two first-type mapping relationships included in the first-type mapping relationship pair.
12. The method according to claim 1, characterized in that According to the similarity of the session behavior patterns of different external hosts in the second traffic graph model, the multiple external hosts are clustered and grouped to obtain one or more external host groups, including: Determine, according to the adjacency list of the second traffic graph model, N cliques in the second traffic graph model, each of the cliques includes at most k of the external hosts, where k is an integer greater than 3, and N is a positive integer; According to the N factions, a faction relationship matrix corresponding to the second traffic graph model is established, wherein the faction relationship matrix is used to indicate the number of the external hosts included in each faction and the adjacency relationship between different factions; The faction relationship matrix is traversed in a breadth-first traversal manner, and different connected factions are merged to obtain the one or more external host groups.
13. The method according to claim 12, characterized in that The faction relationship matrix has N rows and N columns, wherein each of the N rows corresponds to one of the N factions, and each of the N columns corresponds to one of the N factions; The off-diagonal elements in the faction relationship matrix are equal to the number of common external hosts between the faction corresponding to the row where the off-diagonal elements are located and the faction corresponding to the column where the off-diagonal elements are located, and the diagonal elements are equal to the number of external hosts included in the faction corresponding to the diagonal elements.
14. The method according to claim 1, characterized in that The step of determining the external host that does not belong to any of the external host groups as an abnormal external host communicating with the target host includes: Determining a set consisting of the external hosts that do not belong to any of the external host groups; The external hosts in the set are filtered according to a preset IP address whitelist, and the external hosts in the set whose IP addresses do not belong to the IP address whitelist are determined as the abnormal external hosts.
15. A host traffic anomaly detection device based on a graph model, characterized in that: include: The communication module is used to collect traffic records related to the target host within a set time period; a processing module, configured to generate a first flow graph model according to the collected flow records related to the target host within the set time period, wherein the first flow graph model includes information of the target host, information of multiple external hosts, and a first type of connection relationship between the external host and the target host, wherein the first type of connection relationship is used to indicate a session feature between the external host and the target host; and, based on the similarity of the session characteristics between different external hosts and the target host in the first traffic graph model, reconstructing the first traffic graph model to generate a second traffic graph model, wherein the second traffic graph model includes a second type of connection relationship between the external hosts, and the second type of connection relationship is used to indicate that the session behavior patterns of the two external hosts are similar; According to the similarity of the session behavior patterns of different external hosts in the second traffic graph model, the multiple external hosts are clustered and grouped to obtain one or more external host groups, each of which includes multiple external hosts; and the external hosts that do not belong to any of the external host groups are determined as abnormal external hosts communicating with the target host; Among them, according to the similarity of the session characteristics between different external hosts and the target host in the first traffic graph model, the first traffic graph model is reconstructed to generate a second traffic graph model, including: according to the first type of connection relationship between each of the external hosts and the target host, the session similarity distance between two of the multiple external hosts is determined, and the session similarity distance is used to indicate the similarity of the session behavior patterns of the two external hosts; if the session similarity distance between the two external hosts is greater than the product of the average session similarity distance and a preset threshold, the second type of connection relationship between the two external hosts is established.
16. A computer device, characterized in that: include: A memory for storing program instructions; A processor is used to call the program instructions stored in the memory, and execute the method according to any one of claims 1 to 14 according to the obtained program instructions.
17. A computer-readable storage medium, characterized in that: The method comprises computer-readable instructions, and when a computer reads and executes the computer-readable instructions, the method according to any one of claims 1 to 14 is implemented.
18. A computer program product, characterized in that The method comprises computer readable instructions, which, when executed by a processor, enable the method according to any one of claims 1 to 14 to be implemented.
Citation Information
Patent Citations
Host abnormality detection method and system
CN106951776A
Host-oriented suspicious network connection identification method
CN107070930A
Abnormal mainframe group detection method based on dynamic graph
CN107528734A
A document subject term automatic extraction method
CN109726402A
Network abnormal flow detection method, device and equipment
CN111935170A
