A method and system for identifying abnormal behavior of OSPF protocol
By using a machine learning-based method, we extract the feature vectors of OSPF protocol messages and use pre-trained models to detect abnormal behaviors, which solves the problem of low OSPF protocol detection accuracy in the existing technology and achieves efficient abnormal behavior in different networks. Detection improves the stability and security of the routing system.
Patent Information
- Application Number
- CN202210487066.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-06
- Publication Date
- 2024-10-18
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing technology is difficult to distinguish the OSPF protocol from other routing protocols in the autonomous domain. Especially when it is attacked, it cannot accurately detect the abnormal behavior of the OSPF protocol, resulting in low detection accuracy.
A method based on machine learning is designed to obtain OSPF protocol messages in real time, extract a preset message feature set to form a feature vector, and use a pre-trained machine learning model to determine whether the message is abnormal, including scale feature groups, LSU The feature group, LSAck feature group, LSR feature group and Hello feature group are combined with the sniffer, feature extraction module and machine learning model system to achieve unified detection of abnormal behavior.
It improves the discrimination and detection accuracy of abnormal behavior of the OSPF protocol, can be applied in networks of different sizes and topologies, enhances the stability and security of the routing system, and simplifies system integration.
Smart Images

Figure CN114785879B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of network security, in particular to the field of gateway protocols in the field of network security, and more particularly to a method for identifying abnormal behavior of the OSPF (Open Shortest Path First) protocol. Background Art
[0002] OSPF (Open Shortest Path First) is an internal gateway protocol widely used by operators in backbone networks.
[0003] The OSPF protocol defines five types of messages, namely Hello (detection) messages, LSU (Link State Update) messages, LSR (Link State Request) messages, DD (Database Description) messages, and LSAck (Link State Acknowledgement) messages. The LSU message contains a complete LSA (Link State Advertisement) message, and the LSAck message contains an incomplete LSA message with only a header. (hereinafter, "LSA" refers to the "Link State Advertisement" message, and "LSAck" refers to the "Link State Acknowledgement" message)
[0004] Since this protocol is vulnerable to network attacks and prone to adjacency failures, researchers have proposed a detection method for abnormal nodes in the OSPF protocol in order to improve the security and stability of the network. There are two commonly used methods. One is to obtain the routing table through the router management interface and then infer the status of the link; the other is to collect information such as the online time of network nodes and interface traffic through network management tools to infer the operation status of the routing system. In actual application, when multiple protocols are running simultaneously in the domain, the above two methods cannot distinguish the OSPF protocol from other routing protocols in the domain. For example, OSPF and IS-IS routing protocols are running simultaneously in an autonomous domain. The OSPF protocol of a node cannot run normally due to an attack, but the IS-IS protocol runs normally. At this time, the routing function of the node still appears normal. In this case, if the online time and traffic information of the node are observed, it is impossible to find that the OSPF protocol is abnormal. That is, the above methods cannot distinguish the OSPF protocol from other routing protocols.
[0005] One of the latest methods is to use machine learning to detect nodes with abnormal OSPF protocols. Machine learning methods require feature engineering of link status, but industry engineers have failed to reach a consensus on the data type, feature coverage, feature calculation rules, and feature representation of features. This leads to unreasonable feature design: if the feature design does not fully consider the characteristics of the protocol, is not targeted, has low discrimination, and has poor scalability, then the detection accuracy will be difficult to improve. Summary of the invention
[0006] Therefore, the purpose of the present invention is to overcome the defects of the above-mentioned prior art and provide a new method for identifying abnormal behavior of OSPF protocol based on machine learning.
[0007] The objective of the present invention is achieved through the following technical solutions:
[0008] According to a first aspect of the present invention, there is provided a method for identifying abnormal behavior of the OSPF protocol in a network, comprising the following steps: S1, acquiring OSPF protocol messages in real time in a network environment to be detected; S2, extracting feature vectors corresponding to the OSPF protocol messages acquired in step S1 according to a preset message feature set, wherein the preset message feature set comprises a scale feature group, an LSU feature group, an LSAck feature group, an LSR feature group, and a Hello feature group; S3, using a pre-trained machine learning model to determine whether a message is abnormal based on the feature vector of the OSPF protocol message, wherein the machine learning model is generated through training using historical OSPF protocol messages as sample data with a message feature vector as input and whether the message is abnormal as output.
[0009] In some embodiments of the present invention, the features of the scale feature group include: the total number of routers and the total number of links; the features of the LSU feature group include: the sequence number variance, sequence number range, maximum number of sequence numbers, maximum number of ages, number of different sequence numbers, number of LSU messages, and number of LSA message pairs with the same LSU message checksum but different content; the features of the LSAck feature group include: the number of LSAck messages, the number of LSA messages in the LSAck message, and the number of LSA messages with the maximum age in the LSAck message with the maximum sequence number; the features of the LSR feature group include: the number of LSR messages, the number of different senders of LSR messages, and L The number of repeated SR message requests; the characteristics of the Hello feature group include: the number of message pairs with unequal area number fields in the Hello messages, the number of message pairs with unequal detection time interval fields, the number of message pairs with unequal extinction time interval fields, the number of message pairs with unequal network segment numbers, the number of message pairs with unequal authentication type fields, the number of message pairs with unequal backbone area flag fields, the number of non-majority area number fields, the number of non-majority detection time interval fields, the number of non-majority extinction time interval fields, the number of non-majority network segment numbers, the number of non-majority authentication type fields, the number of non-majority backbone area flag fields, the number of Hello messages, and the number of different senders of Hello messages.
[0010] In some embodiments of the present invention, the machine learning model is pre-trained in the following manner: S21. Acquire multiple historical OSPF protocol messages, wherein the state corresponding to each historical OSPF protocol message is normal or abnormal; S22. Extract the feature vector corresponding to each historical OSPF protocol message based on the feature set; S23. Use the state corresponding to each historical OSPF protocol message as a label and fuse it with the feature vector corresponding to the message to form a sample to form a data set; S24. Use the obtained data set to train the machine learning model until convergence.
[0011] In some embodiments of the present invention, in step S22, according to the features in the feature set, the information corresponding to each feature in each historical OSPF protocol message is extracted to form a feature vector, wherein when performing statistical numerical feature processing on the LSA messages in the historical OSPF protocol messages, each feature is processed in the following manner: the LSA messages are grouped according to the source router field so that the LSA messages in the same group come from the same router; the numerical statistics of the current features are performed on all LSA messages in each group to generate the statistical value of the current features corresponding to each group; the current feature statistical values of all groups are summarized, and the maximum statistical value is taken as the feature value of the current feature of the LSA message.
[0012] In some embodiments of the present invention, the state abnormality of the OSPF protocol message refers to the OSPF protocol message being a message generated by abnormal behavior, wherein the abnormal behavior includes: abnormal attack behavior and abnormal configuration behavior. In some embodiments of the present invention, the abnormal attack behavior includes: abnormal flood attack behavior based on LSR messages, abnormal attack behavior based on the maximum age of LSU messages, abnormal attack behavior based on the sequence number plus one of LSU messages, abnormal attack behavior based on the maximum sequence number of LSU messages, and abnormal camouflage attack behavior based on LSU messages. In some embodiments of the present invention, the abnormal configuration behavior includes: abnormal area number configuration error of nodes in the OSPF protocol, abnormal detection time interval configuration error, abnormal extinction time interval configuration error, abnormal network segment number configuration error, abnormal identity authentication type configuration error, and abnormal backbone area flag configuration error.
[0013] In some embodiments of the present invention, in step S23, the specific abnormal behavior of the corresponding OSPF protocol message in abnormal state is used as its label and fused with its corresponding feature vector to form a sample.
[0014] According to a second aspect of the present invention, there is provided a system for identifying abnormal behavior of the OSPF protocol in a network, the system comprising: a sniffer for acquiring OSPF messages in real time; a feature extraction module for extracting feature vectors corresponding to the acquired OSPF protocol messages according to a preset feature set; and a machine learning model for determining whether a message is abnormal based on the feature vector of the OSPF protocol message, wherein the machine learning model is generated after training using historical OSPF protocol messages as sample data, with the message feature vector as input and whether the message is abnormal as output.
[0015] Compared with the prior art, the advantages of the present invention are:
[0016] 1. The present invention designs different feature sets according to the message characteristics of the OSPF protocol and the characteristics of abnormal messages, and uses the designed feature sets to enhance the distinction between various abnormal behaviors in the OSPF protocol messages and improve the accuracy of abnormal behavior detection.
[0017] 2. The present invention designs a system consisting of a sniffer, a feature extraction module, and a trained machine learning model. By deploying this system at a node in the routing system, it can avoid the sensitive permissions of the router and directly obtain the network scale information in the OSPF protocol message.
[0018] 3. The present invention combines the features of configuration abnormal behavior and attack abnormal behavior in OSPF protocol messages into a new feature vector as the input of the machine learning model, thereby realizing unified detection and processing of abnormal behavior, expanding the concept of attack, and simplifying system integration.
[0019] In addition, compared with the existing methods which are difficult to promote on different systems, the present invention is adaptable and can be applied to networks of different scales and different topologies without modification, thereby improving the stability and security of the intra-domain routing system. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The embodiments of the present invention are further described below with reference to the accompanying drawings, in which:
[0021] Figure 1 A flow chart of a method for training a machine learning model according to an embodiment of the present invention;
[0022] Figure 2 A system structure diagram for identifying abnormal behavior of OSPF protocol in a network according to an embodiment of the present invention;
[0023] Figure 3 The diagram is a schematic diagram of an example network structure for identifying whether an OSPF message is abnormal by using the method of the present invention according to an embodiment of the present invention. DETAILED DESCRIPTION
[0024] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below through specific embodiments in conjunction with the accompanying drawings. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0025] As mentioned in the background technology, the traditional methods of the prior art have the risk of exposing key node information and introducing additional detection traffic when detecting the status of network nodes, and it is difficult to analyze the true status of the link. However, due to the problem of unreasonable feature design, the machine learning method makes the abnormal behavior detection of OSPF protocol messages not accurate enough.
[0026] In view of the defects of the existing methods, the present invention proposes a new method for identifying abnormal behavior of the OSPF protocol based on a machine learning model. By performing reasonable feature design, a machine learning model with accurate detection capabilities is trained to detect whether the OSPF protocol message is abnormal.
[0027] In order to better understand the present invention, the following first introduces the possible abnormal types in OSPF protocol messages, wherein the abnormal types mainly include: abnormal attack behavior and abnormal configuration behavior.
[0028] According to one embodiment of the present invention, the abnormal attack behavior includes:
[0029] 1) Abnormal behavior of flood attack based on LSR messages, wherein the flood attack means that the attacker will continuously send repeated LSR messages to the target router, which will cause the three characteristic values of the number of LSR messages, the number of different senders of LSR messages, and the number of repeated requests of LSR messages in the OSPF protocol messages obtained by the relevant routers in the corresponding time window to be much larger than the characteristic values corresponding to the normal state in the network to be detected;
[0030] 2) Abnormal behavior based on the maximum age attack of the LSU message, wherein the maximum age attack means that the attacker will tamper with the age field of the LSA message in the LSU message to the maximum value of 3600 and continuously send it in the network, which will cause the number of LSU messages in the OSPF protocol message obtained by the relevant router in the corresponding time window and the maximum age of the LSA message in the LSU message. These two characteristic values will be much larger than the characteristic values corresponding to the normal state in the network to be detected;
[0031] 3) Abnormal behavior based on the sequence number plus one attack of the LSU message, wherein the sequence number plus one attack means that the attacker will increase the sequence number of the LSA message in the LSU message by one or more and continuously send it in the network, which will cause the three characteristic values of the number of LSU messages in the OSPF protocol message obtained by the relevant routers in the corresponding time window, the sequence number variance of the LSA message in the LSU message, and the number of different sequence numbers of the LSA message in the LSU message to be much larger than the characteristic values corresponding to the normal state in the network to be detected;
[0032] 4) Abnormal behavior based on the maximum sequence number attack of the LSU message, wherein the maximum sequence number attack means that the attacker will tamper with the sequence number of the LSA message in the LSU message to the maximum value 0x7FFFFFFF and continuously send it in the network, which will cause the maximum number of sequence numbers of the LSA message in the LSU message in the OSPF protocol message obtained by the relevant router in the corresponding time window and the sequence number extreme difference of the LSA message in the LSU message to be much larger than the characteristic values corresponding to the normal state in the network to be detected;
[0033] 5) Abnormal behavior of masquerading attack based on LSU messages, wherein the masquerading attack means that the attacker will send multiple LSA messages with the same LSU message checksum but different contents in the network, which will cause the number of LSA message pairs with the same LSU message checksum but different contents in the OSPF protocol messages obtained by the relevant routers within the corresponding time window to be much larger than the characteristic value corresponding to the normal state in the network to be detected.
[0034] According to one embodiment of the present invention, configuring abnormal behavior includes:
[0035] 1) Based on the abnormal behavior of the area number misconfiguration of the Hello message, when the area number of a node in the OSPF protocol is misconfigured, the number of message pairs with unequal area number fields in the Hello message in the OSPF protocol message obtained by the relevant routers within the corresponding time window and the characteristic value of the number of non-mode numbers of key fields in the Hello message will be much larger than the characteristic value corresponding to the normal state in the network to be detected;
[0036] 2) Based on the abnormal behavior of the incorrect configuration of the detection time interval of the Hello message, when the detection time interval of a node in the OSPF protocol is incorrectly configured, the number of message pairs with unequal detection time interval fields in the Hello messages of the OSPF protocol messages obtained by the relevant routers within the corresponding time window and the number of non-mode detection time interval fields in the Hello messages will be much larger than the characteristic values corresponding to the normal state in the network to be detected;
[0037] 3) Based on the abnormal behavior of the misconfiguration of the extinction time interval of the Hello message, when the extinction time interval of a node in the OSPF protocol is misconfigured, the number of message pairs with unequal extinction time interval fields in the OSPF protocol messages obtained by the relevant routers within the corresponding time window and the number of non-mode numbers of the extinction time interval fields in the Hello messages will be much larger than the characteristic values corresponding to the normal state in the network to be detected;
[0038] 4) Based on the abnormal behavior of incorrect configuration of the network segment number of the Hello message, when the network segment number of a node in the OSPF protocol is incorrectly configured, the number of Hello message network segment numbers in the OSPF protocol messages obtained by the relevant routers within the corresponding time window will be much larger than the characteristic values corresponding to the normal state in the network to be detected;
[0039] 5) Based on the abnormal behavior of incorrect configuration of the identity authentication type of the Hello message, when the identity authentication type of a node in the OSPF protocol is incorrectly configured, the number of message pairs with unequal Hello message identity authentication type fields and the number of non-majority Hello message identity authentication type fields in the OSPF protocol messages obtained by the relevant routers within the corresponding time window will be much larger than the characteristic values corresponding to the normal state in the network to be detected;
[0040] 6) Based on the abnormal behavior of incorrect configuration of the backbone area flag bit of the Hello message, when the backbone area flag bit of a node in the OSPF protocol is incorrectly configured, the number of message pairs with unequal backbone area flag bit fields of the Hello message obtained by the relevant routers within the corresponding time window and the non-majority count of the backbone area flag bit field of the Hello message will be much larger than the characteristic values corresponding to the normal state in the network to be detected.
[0041] In view of the message characteristics of the OSPF protocol and the characteristics of abnormal messages, the present invention designs different feature sets according to message categories. According to one embodiment of the present invention, as shown in Table 1, the OSPF message feature set designed by the present invention includes a scale feature group, an LSU feature group, an LSAck feature group, an LSR feature group, and a Hello feature group.
[0042] Among them, the features of the scale feature group include: the total number of routers and the total number of links; the features of the LSU feature group include: the sequence number variance, sequence number range, maximum sequence number number, maximum age number, number of different sequence numbers, number of LSU messages, and number of LSA message pairs with the same LSU message checksum but different content; the features of the LSAck feature group include: the number of LSAck messages, the number of LSA messages in the LSAck message, and the number of LSA messages with the maximum age in the LSAck message with the maximum sequence number; the features of the LSR feature group include: the number of LSR messages, the number of different senders of LSR messages, and the number of repeated requests for LSR messages. The features of the Hello feature group include: the number of message pairs with unequal area number fields in the Hello messages, the number of message pairs with unequal detection time interval fields, the number of message pairs with unequal extinction time interval fields, the number of message pairs with unequal network segment numbers, the number of message pairs with unequal authentication type fields, the number of message pairs with unequal backbone area flag fields, the number of non-majority area number fields, the number of non-majority detection time interval fields, the number of non-majority extinction time interval fields, the number of non-majority network segment numbers, the number of non-majority authentication type fields, the number of non-majority backbone area flag fields, the number of Hello messages, and the number of different senders of Hello messages.
[0043] Table 1
[0044]
[0045]
[0046]
[0047] The constructed feature set basically encompasses the features of different OSPF protocol messages. The present invention extracts feature vectors from OSPF historical messages based on the constructed feature set, and uses message feature vectors as input, whether the message is abnormal as output, and historical OSPF protocol messages as sample data to train a machine learning model. According to one embodiment of the present invention, the present invention uses a sniffer to obtain OSPF historical messages from a training simulation environment or obtains OSPF historical messages within a period of time from an actual network topology. According to one embodiment of the present invention, the present invention uses a feature extraction module to extract message features, and the feature extraction module is an application program that inputs and outputs text feature vectors based on binary message data. Here, the present invention uses a feature extraction module to calculate and output features of OSPF protocol messages in terms of quantity, field values, and spatiotemporal distribution to form feature vectors. Since feature extraction is a common technology in the field, it will not be repeated here.
[0048] In order to better understand the present invention, the process of training a machine learning model is described in detail below in conjunction with specific embodiments.
[0049] like Figure 1 As shown, according to one embodiment of the present invention, the present invention trains the machine learning model in the following manner:
[0050] Step 1: Acquire multiple historical OSPF protocol messages, wherein the status corresponding to each historical OSPF protocol message is normal or abnormal;
[0051] Step 2, extracting the feature vector corresponding to each historical OSPF protocol message based on the feature set preset by the present invention; as shown in Table 1, the OSPF message feature set designed by the present invention includes an LSU feature group, an LSAck feature group, an LSR feature group, and a Hello feature group, wherein the features of the LSU feature group include: the sequence number variance, sequence number range, maximum number of sequence numbers, maximum number of ages, number of different sequence numbers, number of LSU messages, and number of LSA message pairs with the same LSU message checksum but different contents; the features of the LSAck feature group include: the number of LSAck messages, the number of LSA messages in the LSAck message, and the number of LSA messages with the maximum age in the LSAck message with the maximum sequence number; the features of the LSR feature group include: the number of LSAck messages, the number of LSA messages in the LSAck message, and the number of LSA messages with the maximum age in the LSAck message with the maximum sequence number; The characteristics include: the number of LSR messages, the number of different senders of LSR messages, and the number of repeated requests of LSR messages; the characteristics of the Hello feature group include: the number of message pairs with unequal area number fields in the Hello message, the number of message pairs with unequal detection time interval fields, the number of message pairs with unequal extinction time interval fields, the number of message pairs with unequal network segment numbers, the number of message pairs with unequal authentication type fields, the number of message pairs with unequal backbone area flag fields, the number of non-majority area number fields, the number of non-majority detection time interval fields, the number of non-majority extinction time interval fields, the number of non-majority network segment numbers, the number of non-majority authentication type fields, the number of non-majority backbone area flag fields, and the number of Hello messages, the number of different senders of Hello messages. Preferably, the feature set designed by the present invention also includes a scale feature group, wherein the characteristics of the scale feature group include: the total number of routers and the total number of links. The feature set designed by the present invention encompasses all possible characteristic features of OSPF protocol messages, and is more reasonable than the feature design corresponding to the recognition method using a machine learning model under the prior art.
[0052] When extracting statistical numerical features such as the variance of the sequence number of LSA messages in historical OSPF protocol messages based on a preset feature set, the sequence numbers of the LSA messages of each router are different due to the different online times of each router in the domain. The routers in the domain that are deployed with a sniffer, a feature extraction module, and a machine learning model system will capture LSA messages from different routers and carrying different sequence numbers within a specified time window, thereby interfering with the calculation of statistical numerical features such as the variance and range of the LSA sequence number. The present invention adopts the following method to reduce the interference caused by the different online times of routers for statistical numerical features: LSA messages are grouped according to the source router field so that LSA messages in the same group come from the same router, and current feature statistics are performed on all LSA messages in each group to generate current feature statistical values corresponding to each group, and then the current feature statistical values of all groups are summarized, and finally the maximum statistical value is taken as the feature value of the current feature of the LSA message.
[0053] In addition, when extracting statistical numerical features such as the variance of the sequence number of LSA messages in historical OSPF protocol messages based on a preset feature set, since the number of LSU messages sent by each router in the domain is proportional to the number of routers and the number of links in the domain, the calculation of statistical numerical features such as the variance and range of the LSA sequence number in the OSPF protocol message will be interfered by the network scale composed of the number of routers and the number of links. For this reason, the present invention provides a method for standardizing statistical numerical features, wherein the method comprises: obtaining the total number of routers and the total number of links in the domain respectively through the LSA messages and Hello messages in the captured OSPF protocol messages, and dividing the value of the statistical numerical feature calculated by the feature extraction module by the total number of routers in the domain and the total number of links around each router to obtain the value of the standardized statistical numerical feature, so as to reduce the interference of the network scale on the statistical numerical feature.
[0054] Step 3, the state corresponding to each historical OSPF protocol message is used as a label and fused with the feature vector corresponding to the message to form a sample, and all samples constitute a data set. According to one embodiment of the present invention, the specific abnormal behavior of the OSPF protocol message whose corresponding state is abnormal is used as its label and fused with its corresponding feature vector to form a sample. For example, a certain historical OSPF protocol message is a message generated by the abnormal behavior of the flood attack based on the LSR message, then the abnormal attack behavior is used as a label and fused with the feature vector corresponding to the message to form a sample, and other abnormal types refer to this form. Among them, it should be noted that the message feature vector extracted by the present invention is a vector containing the corresponding features of all feature groups, and the features of the configuration anomaly are all reflected in the Hello feature group, which means that the attack anomaly and the configuration anomaly may exist in the same feature vector at the same time. At this time, the specific attack anomaly and the configuration anomaly are used as sample labels to realize the splicing of the features of the configuration abnormal behavior and the features of the attack abnormal behavior, and as the input of the machine learning model, the purpose of unified detection and processing of abnormal behavior is achieved.
[0055] Step 4: Use the data set obtained in step 3 to train the machine learning model until convergence.
[0056] Machine learning models need to use supervised learning models suitable for classification tasks, such as decision trees, logistic regression models, support vector machines, Bayesian (probability) models, and artificial neural networks. Because the number of labels (categories) and possible values need to be determined in advance and reflected in the training data set, machine learning models are not suitable for unsupervised learning models whose main purpose is clustering. Because the task of machine learning models is to predict labels given feature vectors, reinforcement learning models are not suitable.
[0057] According to one embodiment of the present invention, the present invention determines whether the machine learning model has converged in the following manner: a test set with the same distribution as the data set of the training model is obtained and used to test the trained machine learning model to obtain a test result. If the test result meets the specific requirements, it can be considered that the machine learning model has been trained to convergence. Among them, the specific requirements should be formulated according to the actual situation of the intra-domain routing network. For example, the qualified standard for the trained machine learning model to identify abnormal behavior of OSPF protocol messages is given in advance with an accuracy rate of not less than 98%. If the accuracy rate of the trained machine learning model in identifying abnormal behavior on the test set is greater than or equal to 98%, it can be considered that the machine learning model has been trained to convergence. If the accuracy rate of the machine learning model in identifying abnormal behavior is lower than 98%, then the machine learning model needs to continue training until convergence.
[0058] The machine learning model trained with samples based on OSPF message feature vectors + labels has the ability to identify whether a message is abnormal. For example, if the number of LSR message duplicate requests for all feature vectors with the label "Flood attack based on LSR messages" in the training set is greater than 80, and the number of LSR message duplicate requests for other feature vectors is less than 5, then the machine learning model will predict feature vectors with more than 80 LSR message duplicate requests as flood attacks based on LSR messages.
[0059] According to the previous description of abnormal attack behavior, when there is abnormal flood attack behavior based on LSR messages in the network environment to be detected, the three characteristic values of the number of LSR messages in the specified time window corresponding to the feature vector obtained based on the feature set and the feature extraction module, the number of different senders of LSR messages, and the number of repeated requests for LSR messages will be much larger than the characteristic values corresponding to the normal state in the network to be detected. By deploying the trained machine learning model to the network environment to be detected, when the three characteristic values are too large, the machine learning model will most likely identify the message as abnormal flood attack behavior based on LSR messages, and when the three characteristic values are too small, the machine learning model will most likely predict that there is no abnormal flood attack behavior based on LSR messages in the network environment to be detected.
[0060] When there is abnormal behavior of maximum age attack based on LSU messages in the network environment to be detected, the two characteristic values of the number of LSU messages in the specified time window corresponding to the feature vector obtained based on the feature set and the feature extraction module and the maximum age number of LSA messages in the LSU messages will be much larger than the characteristic values corresponding to the normal state in the network to be detected. By deploying the trained machine learning model to the network environment to be detected, when the two characteristic values are too large, the machine learning model will most likely identify the message as abnormal behavior of maximum age attack based on LSU messages, and when the two characteristic values are too small, the machine learning model will most likely predict that there is no abnormal behavior of maximum age attack based on LSU messages in the network environment to be detected.
[0061] When there is abnormal behavior of sequence number plus one attack based on LSU message in the network environment to be detected, the three characteristic values of the number of LSU messages in the specified time window corresponding to the feature vector obtained based on the feature set and the feature extraction module, the sequence number variance of LSA messages in the LSU message, and the number of different sequence numbers of LSA messages in the LSU message will be much larger than the characteristic values corresponding to the normal state in the network to be detected. By deploying the trained machine learning model to the network environment to be detected, when the three characteristic values are too large, the machine learning model will most likely identify the message as abnormal behavior of sequence number plus one attack based on LSU message, and when the three characteristic values are too small, the machine learning model will most likely predict that there is no abnormal behavior of sequence number plus one attack based on LSU message in the network environment to be detected.
[0062] When there is abnormal behavior of maximum sequence number attack based on LSU message in the network environment to be detected, the two characteristic values of the maximum number of sequence numbers of LSA messages in the LSU message within the specified time window corresponding to the feature vector obtained by the feature set and the feature extraction module and the sequence number extreme value of LSA messages in the LSU message will be much larger than the characteristic values corresponding to the normal state in the network to be detected. By deploying the trained machine learning model to the network environment to be detected, when the two characteristic values are too large, the machine learning model will most likely identify the message as abnormal behavior of maximum sequence number attack based on LSU message, and when the two characteristic values are too small, the machine learning model will most likely predict that there is no abnormal behavior of maximum sequence number attack based on LSU message in the network environment to be detected.
[0063] When there is abnormal behavior of disguised attack based on LSU messages in the network environment to be detected, the characteristic value of the number of LSA message pairs with the same LSU message checksum but different content within the specified time window corresponding to the feature vector obtained by the feature set and the feature extraction module will be much larger than the characteristic value corresponding to the normal state in the network to be detected. By deploying the trained machine learning model to the network environment to be detected, when the characteristic value is too large, the machine learning model will most likely identify the message as abnormal behavior of disguised attack based on LSU messages, and when the characteristic value is too small, the machine learning model will most likely predict that there is no abnormal behavior of disguised attack based on LSU messages in the network environment to be detected.
[0064] When there is abnormal behavior due to area number configuration error in the network environment to be detected, the characteristic values of the number of message pairs with unequal area number fields in the Hello message within the specified time window and the non-mode number of key fields in the Hello message corresponding to the feature vector obtained by the feature set and the feature extraction module will be much larger than the characteristic values corresponding to the normal state in the network to be detected. By deploying the trained machine learning model to the network environment to be detected, when the characteristic value is too large, the machine learning model will most likely identify the message as abnormal behavior due to area number configuration error, and when the characteristic value is too small, the machine learning model will most likely predict that there is no abnormal behavior due to area number configuration error in the network environment to be detected.
[0065] When there is abnormal behavior due to incorrect detection time interval configuration in the network environment to be detected, the two characteristic values, namely the number of message pairs with unequal detection time interval fields in the Hello message within the corresponding specified time window in the feature vector obtained based on the feature set and the feature extraction module, and the number of non-mode detection time interval fields in the Hello message, will be much larger than the characteristic values corresponding to the normal state in the network to be detected. By deploying the trained machine learning model to the network environment to be detected, when the two characteristic values are too large, the machine learning model will most likely identify the message as abnormal behavior due to incorrect detection time interval configuration, and when the two characteristic values are too small, the machine learning model will most likely predict that there is no abnormal behavior due to incorrect detection time interval configuration in the network environment to be detected.
[0066] When there is abnormal behavior of extinction time interval configuration error in the network environment to be detected, the two characteristic values of the number of message pairs with unequal extinction time interval fields in the Hello message within the corresponding specified time window in the feature vector obtained based on the feature set and the feature extraction module and the number of non-mode extinction time interval fields in the Hello message will be much larger than the characteristic values corresponding to the normal state in the network to be detected. By deploying the trained machine learning model to the network environment to be detected, when the two characteristic values are too large, the machine learning model will most likely identify the message as abnormal behavior of extinction time interval configuration error, and when the two characteristic values are too small, the machine learning model will most likely predict that there is no abnormal behavior of extinction time interval configuration error in the network environment to be detected.
[0067] When there is abnormal behavior due to incorrect network segment number configuration in the network environment to be detected, the two characteristic values, namely the number of message pairs with unequal network segment numbers in the Hello message within the specified time window corresponding to the feature vector obtained based on the feature set and the feature extraction module, and the number of non-modal network segment numbers in the Hello message, will be much larger than the characteristic values corresponding to the normal state in the network to be detected. By deploying the trained machine learning model to the network environment to be detected, when the two characteristic values are too large, the machine learning model will most likely identify the message as abnormal behavior due to incorrect network segment number configuration, and when the two characteristic values are too small, the machine learning model will most likely predict that there is no abnormal behavior due to incorrect network segment number configuration in the network environment to be detected.
[0068] When there is abnormal behavior of identity authentication type configuration error in the network environment to be detected, the two characteristic values of the number of message pairs with unequal identity authentication type fields in the Hello message within the specified time window corresponding to the feature vector obtained by the feature set and the feature extraction module and the number of non-mode identity authentication type fields in the Hello message will be much larger than the characteristic values corresponding to the normal state in the network to be detected. By deploying the trained machine learning model to the network environment to be detected, when the two characteristic values are too large, the machine learning model will most likely identify the message as abnormal behavior of identity authentication type configuration error, and when the two characteristic values are too small, the machine learning model will most likely predict that there is no abnormal behavior of identity authentication type configuration error in the network environment to be detected.
[0069] When there is abnormal behavior of backbone area flag bit configuration error in the network environment to be detected, the two characteristic values of the number of message pairs with unequal backbone area flag bit fields in the Hello message within the specified time window corresponding to the feature vector obtained by the feature set and the feature extraction module and the non-majority count of the backbone area flag bit field in the Hello message will be much larger than the characteristic values corresponding to the normal state in the network to be detected. By deploying the trained machine learning model to the network environment to be detected, when the two characteristic values are too large, the machine learning model will most likely identify the message as abnormal behavior of backbone area flag bit configuration error, and when the two characteristic values are too small, the machine learning model will most likely predict that there is no abnormal behavior of backbone area flag bit configuration error in the network environment to be detected.
[0070] In addition, the features in the scale feature group designed by the present invention can not only be used as input of the machine learning model, but also provide network scale and network topology information when other statistical numerical features are standardized.
[0071] In summary, the present invention determines whether the OSPF protocol message in the network to be detected is abnormal by using a specific system according to a certain process to achieve this function, such as Figure 2 As shown, according to one embodiment of the present invention, the present invention provides a system for identifying abnormal behavior of OSPF protocol in a network, wherein the system comprises:
[0072] (1) Sniffer, used to obtain OSPF messages in real time;
[0073] (2) a feature extraction module, used to extract a feature vector corresponding to the obtained OSPF protocol message according to a preset feature set;
[0074] (3) A machine learning model for determining whether a message is abnormal based on a feature vector of the OSPF protocol message, wherein the machine learning model is generated by training a model using historical OSPF protocol messages as sample data and taking the message feature vector as input and whether the message is abnormal as output.
[0075] According to one embodiment of the present invention, using a trained machine learning model to identify abnormal behavior of OSPF messages includes the following steps: Step 1, using a sniffer to capture network data packets in real time, parsing the captured network data packets, filtering out all non-OSPF protocol data packets, and obtaining a pcap format file containing only OSPF protocol messages, wherein all information of the OSPF protocol messages, such as field values, timestamps, and other information, is obtained; Step 2, according to a preset message feature set, extracting a feature vector corresponding to the OSPF protocol message captured in real time, for example, using the obtained pcap format file containing only OSPF protocol messages as input to a feature extraction module, using the feature extraction module to calculate and output the features of all OSPF protocol messages in the corresponding time window in terms of quantity, field values, spatiotemporal distribution, etc. based on the feature set to form a feature vector, and using it as input to the trained machine learning model, and judging whether the OSPF protocol message is abnormal by the trained machine learning model.
[0076] For a better understanding, the following is a specific example to illustrate the process of machine learning model identifying abnormal behavior. Figure 3, a network topology containing 8 routing nodes (R1-R8 respectively), where L1 is the link connecting routing node R1 and routing node R2, L2 is the link connecting routing node R2 and routing node R3, L3 is the link connecting routing node R2 and routing node R5, L4 is the link connecting routing node R3 and routing node R4, L5 is the link connecting routing node R4 and routing node R5, L6 is the link connecting routing node R5 and routing node R6, L7 is the link connecting routing node R5 and routing node R8, L8 is the link connecting routing node R6 and routing node R7, and L9 is the link connecting routing node R7 and routing node R8. Assume that in this network topology, routing nodes R1-R7 are normal routing nodes in the domain, and routing node R8 is a node controlled by an attacker; a system consisting of a sniffer, a feature extraction module, and a trained machine learning model is deployed on routing node R5, and the sniffer in the system dumps all OSPF messages on links L3, L5, L6, and L7 within a specified time window, and the dumped messages are handed over to the feature extraction module for feature extraction, and the extracted feature vector is input into the machine learning model, which determines whether there is an abnormality in this time window.
[0077] If routing node R8 launches a flood attack based on LSR messages on routing node R5, a large number of LSR messages will appear on link L7, and the request content will be repeated. At this time, the three feature values of the LSR message feature group will be much larger than the feature values corresponding to the normal state of the OSPF protocol message, so the machine learning model can identify the abnormal behavior of the flood attack based on LSR messages.
[0078] If routing node R8 launches a maximum age attack based on LSU messages against routing node R1, a large number of LSU messages will appear on all links, including a large number of LSA messages from R1 with an age field equal to 3600. At this time, the three characteristic values of the number of LSU messages, the number of LSA messages of LSU messages, and the maximum age of LSA messages of LSU messages will be much larger than the characteristic values corresponding to the normal state of OSPF protocol messages, so the machine learning model can identify abnormal behavior of the maximum age attack based on LSU messages.
[0079] If routing node R8 launches a sequence number plus one attack based on LSU messages against routing node R1, a large number of LSU messages will appear on all links, among which a large number of LSU messages also contain a large number of LSA messages from routing node R1. The sequence number field of these LSA messages will gradually increase, and the system deployed on routing node R5 will detect significant changes in the sequence number of LSA messages within the same time window. At this time, the three characteristic values of the sequence number variance of LSA messages in LSU messages, the number of different sequence numbers of LSA messages in LSU messages, and the number of LSU messages will be much larger than the characteristic values corresponding to the normal state of OSPF protocol messages, so the machine learning model can identify abnormal behavior of the sequence number plus one attack based on LSU messages.
[0080] If routing node R8 launches a maximum sequence number attack based on LSU messages against routing node R2, specific LSU messages and LSAck messages will appear on all links, where the sequence number field of the LSA message in the LSU message is equal to the maximum value 0x7FFFFFFF, and the header sequence number field of the LSA message in the LSAck message is equal to the maximum value 0x7FFFFFFF and the age field is equal to the maximum value 3600. At this time, the two feature values of "the maximum number of sequence numbers of LSA messages in LSU messages" and "the number of LSA messages with the maximum age in LSAck messages with the maximum sequence number" will be much larger than the feature values corresponding to the normal state of OSPF protocol messages, so the machine learning model can identify abnormal behavior of the maximum sequence number attack based on LSU messages.
[0081] If routing node R8 launches a camouflage attack based on LSU messages, attempting to declare the status of link L1 as disconnected in the name of routing node R2, two different LSU messages will appear in the network: one carrying a correct LSA message (link L1 connected) and one carrying an incorrect LSA message (link L1 disconnected). These two LSA messages are identical except for the link status field, including the checksum. Depending on the position of the node in the network topology, some nodes will first receive an incorrect LSA message, then receive a correct LSA message and discard it, and finally obtain incorrect link status information. When a camouflage attack occurs, the system deployed on routing node R5 will detect the above two LSU messages with different contents but the same checksum in the same time window. At this time, the feature value of "the number of LSA message pairs with the same LSU message checksum but different contents" will be much larger than the feature value corresponding to the normal state of the OSPF protocol message, so the machine learning model can identify abnormal behavior of camouflage attacks based on LSU messages.
[0082] If the parameters of the OSPF protocol message of routing node R8 are configured incorrectly, two types of Hello messages with unequal key field values will appear on links L7 and L9. Taking the incorrect configuration of the OSPF protocol message area number as an example, assuming that the area numbers configured in the OSPF protocol messages in routing nodes R1-R7 are all correct values, and the area number configured in the OSPF protocol message in routing node R8 is an incorrect value, then the two characteristic values, the number of message pairs with unequal area number fields in the Hello message and the number of non-mode numbers in the area number fields in the Hello message, will be much larger than the characteristic values corresponding to the normal state of the OSPF protocol message. Therefore, the machine learning model can identify the abnormal behavior of the parameter configuration error of the OSPF protocol message. Other abnormal behaviors of the parameter configuration error of the OSPF protocol message, such as the abnormal behavior of the detection time interval configuration error, the abnormal behavior of the extinction time interval configuration error, the abnormal behavior of the network segment number configuration error, the abnormal behavior of the identity authentication type configuration error, and the abnormal behavior of the backbone area flag bit configuration error in the OSPF protocol message, refer to this form.
[0083] Compared with the prior art, the advantages of the present invention are:
[0084] 1. The present invention designs different feature sets according to the message characteristics of the OSPF protocol and the characteristics of abnormal messages, and uses the designed feature sets to enhance the distinction between various abnormal behaviors in the OSPF protocol messages and improve the accuracy of abnormal behavior detection.
[0085] 2. The present invention designs a system consisting of a sniffer, a feature extraction module, and a trained machine learning model. By deploying this system at a node in the routing system, it can avoid the sensitive permissions of the router and directly obtain the network scale information in the OSPF protocol message.
[0086] 3. The present invention combines the features of configuration abnormal behavior and attack abnormal behavior in OSPF protocol messages into a new feature vector as the input of the machine learning model, thereby realizing unified detection and processing of abnormal behavior, expanding the concept of attack, and simplifying system integration.
[0087] In addition, the existing methods are difficult to generalize to different systems without any modification, while the present invention is adaptable and can be applied to networks of different sizes and different topologies without modification, thereby improving the stability and security of the intra-domain routing system.
[0088] It should be noted that although the above describes the various steps in a specific order, it does not mean that the various steps must be executed in the above specific order. In fact, some of these steps can be executed concurrently or even in a different order as long as the required functions can be achieved.
[0089] The present invention may be a system, a method and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for causing a processor to implement various aspects of the present invention.
[0090] Computer readable storage medium can be a tangible device that holds and stores instructions used by an instruction execution device. Computer readable storage medium can include, for example, but is not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination thereof. More specific examples (non-exhaustive list) of computer readable storage medium include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, for example, a punch card or a protruding structure in a groove on which instructions are stored, and any suitable combination thereof.
[0091] The embodiments of the present invention have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or technical improvements in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.
Claims
1. A method for identifying abnormal behavior of OSPF protocol in a network, characterized in that: The method comprises the following steps: S1, obtain OSPF protocol messages in real time; S2. Extract the feature vector corresponding to the OSPF protocol message obtained in step S1 according to the preset message feature set, wherein the preset message feature set includes a scale feature group, an LSU feature group, an LSAck feature group, an LSR feature group, and a Hello feature group; wherein, The characteristics of the scale characteristic group include: the total number of routers and the total number of links; The features of the LSU feature group include: sequence number variance, sequence number range, maximum number of sequence numbers, maximum number of ages, number of different sequence numbers, number of LSU messages, and number of LSA message pairs with the same LSU message checksum but different content; The characteristics of the LSAck characteristic group include: the number of LSAck messages, the number of LSA messages in the LSAck messages, and the number of LSA messages with the maximum age in the LSAck messages with the maximum sequence number; The features in the LSR feature group include: the number of LSR messages, the number of different senders of LSR messages, and the number of repeated requests for LSR messages; The features of the Hello feature group include: the number of message pairs with unequal area number fields in the Hello message, the number of message pairs with unequal detection time interval fields, the number of message pairs with unequal extinction time interval fields, the number of message pairs with unequal network segment numbers, the number of message pairs with unequal identity authentication type fields, the number of message pairs with unequal backbone area flag fields, the number of non-majority area number fields, the number of non-majority detection time interval fields, the number of non-majority extinction time interval fields, the number of non-majority network segment numbers, the number of non-majority identity authentication type fields, the number of non-majority backbone area flag fields, the number of Hello messages, and the number of different senders of Hello messages; S3. Use a pre-trained machine learning model to determine whether a message is abnormal based on a feature vector of the OSPF protocol message, wherein the machine learning model is generated through training using historical OSPF protocol messages as sample data and taking the message feature vector as input and whether the message is abnormal as output.
2. The method according to claim 1, characterized in that: The machine learning model is pre-trained in the following way: S21. Acquire multiple historical OSPF protocol messages, wherein the status corresponding to each historical OSPF protocol message is normal or abnormal; S22, extracting a feature vector corresponding to each historical OSPF protocol message based on the feature set; S23, taking the state corresponding to each historical OSPF protocol message as a label and fusing it with the feature vector corresponding to the message to form a sample to form a data set; S24. Use the data set obtained in step S23 to train the machine learning model until convergence.
3. The method according to claim 2, characterized in that In step S22, according to the features in the feature set, information corresponding to each feature in each historical OSPF protocol message is extracted to form a feature vector, wherein when performing statistical numerical feature processing on the LSA message in the historical OSPF protocol message, each feature is processed in the following manner: S221, grouping the LSA messages according to the source router field so that LSA messages in the same group come from the same router; S222, performing numerical statistics of current characteristics on all LSA messages in each group to generate a statistical value of the current characteristics corresponding to each group; S223: Summarize the current characteristic statistics of all groups, and take the maximum statistical value as the characteristic value of the current characteristic of the LSA message.
4. The method according to claim 2, characterized in that: The abnormal state of the OSPF protocol message refers to the OSPF protocol message being a message generated by abnormal behavior, wherein the abnormal behavior includes: Attack abnormal behavior and configuration abnormal behavior.
5. The method according to claim 4, characterized in that The abnormal attack behaviors include: Abnormal behaviors of flood attacks based on LSR messages, abnormal behaviors of maximum age attacks based on LSU messages, abnormal behaviors of sequence number plus one attacks based on LSU messages, abnormal behaviors of maximum sequence number attacks based on LSU messages, and abnormal behaviors of masquerading attacks based on LSU messages.
6. The method according to claim 5, characterized in that The abnormal configuration behaviors include: Abnormal behavior of incorrect area number configuration, incorrect detection time interval configuration, incorrect extinction time interval configuration, incorrect network segment number configuration, incorrect identity authentication type configuration, and incorrect backbone area flag configuration in the OSPF protocol.
7. The method according to claim 6, characterized in that In step S23, the specific abnormal behavior of the corresponding OSPF protocol message in abnormal state is used as its label and fused with its corresponding feature vector to form a sample.
8. A system for identifying abnormal behavior of OSPF protocol in a network, characterized in that: The system is deployed at a network routing node, and the system includes: Sniffer, used to obtain OSPF messages in real time; A feature extraction module is used to extract the feature vector corresponding to the obtained OSPF protocol message according to a preset feature set; wherein the preset message feature set includes a scale feature group, an LSU feature group, an LSAck feature group, an LSR feature group, and a Hello feature group; wherein, The characteristics of the scale characteristic group include: the total number of routers and the total number of links; The features of the LSU feature group include: sequence number variance, sequence number range, maximum number of sequence numbers, maximum number of ages, number of different sequence numbers, number of LSU messages, and number of LSA message pairs with the same LSU message checksum but different content; The characteristics of the LSAck characteristic group include: the number of LSAck messages, the number of LSA messages in the LSAck messages, and the number of LSA messages with the maximum age in the LSAck messages with the maximum sequence number; The features in the LSR feature group include: the number of LSR messages, the number of different senders of LSR messages, and the number of repeated requests for LSR messages; The features of the Hello feature group include: the number of message pairs with unequal area number fields in the Hello message, the number of message pairs with unequal detection time interval fields, the number of message pairs with unequal extinction time interval fields, the number of message pairs with unequal network segment numbers, the number of message pairs with unequal identity authentication type fields, the number of message pairs with unequal backbone area flag fields, the number of non-majority area number fields, the number of non-majority detection time interval fields, the number of non-majority extinction time interval fields, the number of non-majority network segment numbers, the number of non-majority identity authentication type fields, the number of non-majority backbone area flag fields, the number of Hello messages, and the number of different senders of Hello messages; A machine learning model is used to determine whether a message is abnormal based on a feature vector of an OSPF protocol message, wherein the machine learning model is generated after training with historical OSPF protocol messages as sample data, taking the message feature vector as input and whether the message is abnormal as output.
9. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and the computer program can be executed by a processor to implement the steps of any method described in claims 1 to 7.
10. An electronic device, characterized in that: include: one or more processors; A storage device for storing one or more programs, which, when executed by the one or more processors, enables the electronic device to implement the steps of the method as claimed in any one of claims 1 to 7.
Citation Information
Patent Citations
Method for generating training set for detecting states of network nodes
CN114257517A
