Cascaded two-stage CAN intrusion detection method, system and device based on open set recognition
Through a cascading two-level CAN intrusion detection method based on open set recognition, data classification is solved by using a hybrid vehicle-mounted network intrusion detection network, and the problem of difficult to identify unknown data sets in the prior art is solved, and accurate detection of multiple types of attacks and effective identification of unknown data is achieved.
Patent Information
- Application Number
- CN202311674519.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-06
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2043-12-06
AI Technical Summary
In the prior art, a single CNN network and a GAN network are difficult to identify unknown data sets and cannot effectively detect other types of attacks other than DoS, fuzzy, and gear spoofing attacks.
A cascading two-level CAN intrusion detection method based on open set recognition is adopted, and data preprocessing and feature encoding are carried out by constructing a data set of multiple types of attacks, and a hybrid vehicle-mounted network intrusion detection network is used for classification and judgment, including a discriminator module, an AC classification head module, a judgment module and an RFC classification head module.
Effective identification of unknown data sets and accurate determination of attack types are realized, data that is difficult to identify as known types can be marked as unknown attacks, and the time correlation of CAN messages is fully considered, which improves detection accuracy and coverage.
Smart Images

Figure CN117857103B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of in-vehicle network data detection, and relates to a cascaded two-stage CAN intrusion detection method, system and device, and specifically to a cascaded two-stage CAN intrusion detection method, system and device based on open set recognition. Background Art
[0002] Nowadays, the security of vehicles has become a critical issue in the automotive industry. With the increase of external interfaces supporting mobile services in modern vehicles, Electronic Controller Units (ECU) are vulnerable to more and more cyber attacks. Attackers can access the in-vehicle network through these interfaces and send forged CAN controller area network messages to interfere with the normal operation of the vehicle. They were able to send an attack packet into the vehicle through the Jeep Cherokee head unit because the head unit is attached to the CAN. Message authentication on the CAN protocol can prevent spoofing attacks, but it is not widely used because it cannot prevent certain attacks, such as DoS attacks. Intrusion Detection System (IDS) is a security system used to detect intrusions in network systems. It identifies possible attacks or abnormal activities by monitoring network traffic, system logs, and other information. When used to diagnose various faults in the in-vehicle network, IDS communicates with various ECUs in the vehicle through the CAN bus. It obtains data from various sensors and actuators and uses machine learning to identify possible attacks.
[0003] At present, machine learning has shown promising results in this field. It actually converts the task into binary classification (normal vs. attack) or multi-classification (normal or some type of attack) when using machine learning-based methods. Some artificial neural networks have been introduced to detect abnormal traffic, such as Convolutional Neural Network (CNN) and Generative Adversarial Network (GAN). For example, the Deep Convolutional Neural Network (DCNN) method uses a framework to convert CAN bus data into 2D images and inputs them into CNN. Although the IDS implemented in this way has a high accuracy rate, there are still some defects. For example, if some information (such as timestamps, serial numbers, etc.) is tampered with or resent in a replay attack, it is difficult for DCNN to detect a replay attack. In addition, although the GAN method can detect attacks using non-attack data, it can only detect DoS, fuzzy, and gear deception attacks. Therefore, its disadvantage is that it cannot detect other types of attacks. Summary of the invention
[0004] In order to solve the problem that a single CNN network and a GAN network cannot identify unknown data sets, the present invention provides a cascaded two-stage CAN intrusion detection method and system based on open set recognition.
[0005] The technical solution adopted by the method of the present invention is: a cascaded two-stage CAN intrusion detection method based on open set recognition, characterized in that it includes the following steps:
[0006] Step 1: Construct datasets, including normal dataset, DoS attack dataset, deceptive gear attack dataset, deceptive RPM attack dataset and fuzzy attack dataset;
[0007] Step 2: Obtain vehicle network input data, and preprocess the vehicle network input data to obtain vehicle network preprocessed data;
[0008] Step 3: Encode the vehicle network preprocessed data to obtain feature data;
[0009] Step 4: Input the feature data into the hybrid vehicle network intrusion detection network, output the classification result, and determine whether it has been invaded based on the classification result.
[0010] Preferably, in step 2, the vehicle network input data is preprocessed by first collecting the continuous data arriving on the CAN bus, selecting the ID field of the continuous data, and encoding its ID into a vector x i ; Select a time window and encode the ID field of the data arriving within the time window in the same way.
[0011] As a preferred embodiment, in step 3, the vehicle network preprocessing data is encoded based on a recursive graph algorithm; the specific implementation process is: the encoded data x in the time window i Compare two by two and generate a recursive graph matrix R; if the ID code x of the i-th data i The ID code x of the jth data j The same, then the recursive graph matrix R i,j If it is 1, the pixel is drawn black, otherwise R i,j is 0, the pixel is white.
[0012] Preferably, in step 4, the hybrid vehicle network intrusion detection network includes a discriminator module, an AC classification header module, a judgment module, and an RFC classification header module;
[0013] The discriminator module includes five convolutional layers arranged in series, and a batch normalization layer and an activation layer are sequentially added after the second to fifth convolutional layers;
[0014] The AC classification head module is used to preliminarily judge the sample category; a fully connected layer with 4 output units is used, and the activation function is LogSoftmax; and the logits of each output unit is calculated to obtain the maximum logits value, which is recorded as MLP and used as the input of the judgment module in the next stage;
[0015] The judgment module determines which category it belongs to based on the MLP of the previous layer; first, a threshold T is set. If the MLP is greater than or equal to the threshold, the sample is classified into the category pointed to by the MLP, otherwise the sample is input into the RFC classification header for further judgment;
[0016] The RFC classification header module uses a fully connected layer with an output of 2 units to determine whether the input sample is an existing sample in the database or an unknown sample.
[0017] Preferably, the hybrid vehicle network intrusion detection network in step 4 is a trained network;
[0018] The training process consists of the following sub-steps:
[0019] Step 4.1: Obtain several data sets, including a normal data set, a DoS attack data set, a deceptive gear attack data set, a deceptive RPM attack data set, and a fuzzy attack data set;
[0020] Step 4.2: Encode the data set data and obtain feature data;
[0021] The recursive graph algorithm is used to encode the vehicle network preprocessing data; the specific implementation process is: the encoded data x in the time window i Compare two by two and generate a recursive graph matrix R; if the ID code x of the i-th data i The ID code x of the jth data j The same, then the recursive graph matrix R i,j If it is 1, the pixel is drawn black, otherwise R i,j is 0, the pixel is white;
[0022] Step 4.3: Determine the label of the recursive graph matrix according to the label of the data in the time window, where the last column of the data in the time window is the data label, R represents normal, and T represents attack; if all the data in the time window are normal data, the label of the recursive graph matrix is normal; if one or more data in the time window is marked as attack, the recursive graph matrix is also marked as attack;
[0023] Step 4.4: Classify the recursive graph matrix into known types and unknown types. The unknown type data does not participate in network training, and the known type data is used as a training set for network training; in the first stage of training, the probability value of the sample being an out-of-distribution sample is output. If it is less than the threshold, the second stage of training is entered to further determine whether it is an out-of-distribution sample, otherwise its category is output; the third stage of training is further performed to obtain the final classification result;
[0024] Step 4.5: The training ends after reaching the preset number of rounds.
[0025] Preferably, in the first stage of training, a threshold T is set to determine whether a known attack is misclassified as an unknown attack; the AC-T classifier uses the AC classification head for classification, and uses the AC classification head to calculate its maximum logical probability MLP; when the MLP is greater than or equal to the threshold T, the sample is considered to belong to a known type; otherwise, the sample is considered to belong to an unknown attack, and the classification result is output.
[0026] Preferably, the second stage of training uses an AC-RFC classifier to classify samples to determine whether an unknown attack is misclassified as a normal type; the AC-RFC classifier uses AC and RFC classification heads for classification; the AC classification head is used to distinguish types and its MLP is calculated; the RFC classification head is used to detect whether the sample is true or false, and is a binary classifier composed of a fully connected neural network; the AC classification head determines the sample category, and if the output type is a known attack, the classification is output; if the output type is normal, the sample is sent to the RFC classification head; the trained RFC classification head determines whether the sample is normal data and outputs the final classification result.
[0027] Preferably, in the third stage of training, a threshold T is set to determine whether a known attack is misclassified as an unknown attack; the sample is classified using the AC-RFC-T classifier to determine whether an unknown attack is misclassified as a normal type; the MLP calculated by the AC classification head determines whether to proceed to the next classification; if the MLP is greater than or equal to the threshold T, the sample is considered to be an in-division sample, and the output is the type indicated by the MLP; otherwise, the RFC classification head is used to further determine its type; if the sample MLP value is less than the threshold T, the sample is input into the fully connected layer of the RFC classification head and the preset activation function for processing to obtain the final classification result.
[0028] The technical solution adopted by the system of the present invention is: a cascaded two-stage CAN intrusion detection system based on open set recognition, comprising:
[0029] A data acquisition and preprocessing module, used to acquire vehicle network input data, preprocess the vehicle network input data, and obtain vehicle network preprocessed data;
[0030] A feature data acquisition module is used to encode the vehicle network preprocessing data to obtain feature data;
[0031] The intrusion detection module is used to input feature data into the hybrid vehicle network intrusion detection network, output classification results, and determine whether there is an intrusion based on the classification results.
[0032] The technical solution adopted by the device of the present invention is: a cascaded two-stage CAN intrusion detection device based on open set recognition, characterized in that it includes:
[0033] one or more processors;
[0034] A storage device is used to store one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the cascaded two-stage CAN intrusion detection method based on open set recognition.
[0035] The beneficial effects of the present invention include:
[0036] 1. For data that is difficult to identify as a known type (i.e., MLP is low), it can flag unknown attacks;
[0037] 2. Previous methods using neural networks create training or test images by extending the ID bit by bit in consecutive messages, usually ignoring the time dependency of the ID sequence. The ID and data fields of multiple adjacent messages are usually the same, or have more bits in common. This system is designed with the time dependency of CAN messages in mind. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] The technical solution of this invention is further described below using embodiments and specific implementation methods. In addition, some drawings are also used in the process of describing the technical solution. For those skilled in the art, other drawings and the intention of the invention can also be obtained based on these drawings without paying creative labor.
[0039] Figure 1 is a flow chart of a method according to an embodiment of the present invention;
[0040] Figure 2 A diagram showing a hybrid vehicle network intrusion detection network structure according to an embodiment of the present invention;
[0041] Figure 3 A flow chart of a hybrid vehicle network intrusion detection network training according to an embodiment of the present invention;
[0042] Figure 4 It is a diagram of the AC-T classifier method of an embodiment of the present invention;
[0043] Figure 5It is a diagram of the AC-RFC classifier method of an embodiment of the present invention;
[0044] Figure 6 It is a diagram of the AC-RFC-T classifier method of an embodiment of the present invention;
[0045] Figure 7 This is a graph showing the influence of the threshold on the F1 scores of four classifiers according to an embodiment of the present invention;
[0046] Figure 8 This is a diagram after RP encoding according to an embodiment of the present invention. DETAILED DESCRIPTION
[0047] In order to facilitate ordinary technicians in the field to understand and implement the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the implementation examples described herein are only used to illustrate and explain the present invention, and are not used to limit the present invention.
[0048] Please see Figure 1 The present embodiment provides a cascaded two-stage CAN intrusion detection method based on open set recognition, comprising the following steps:
[0049] Step 1: Construct datasets, including normal dataset, DoS attack dataset, deceptive gear attack dataset, deceptive RPM attack dataset and fuzzy attack dataset;
[0050] Because most hackers use remote attacks (illegal access, impersonation attacks, DoS attacks, etc.) to gain control of IoT devices, special attention should be paid to traffic from external networks. The main attack traffic that needs to be collected includes: DoS attacks, fuzzy attacks, deceptive gear attacks, and deceptive speed attacks.
[0051] Step 2: Obtain vehicle network input data, and preprocess the vehicle network input data to obtain vehicle network preprocessed data;
[0052] In one embodiment, the vehicle network input data is preprocessed by first collecting the continuous data arriving on the CAN bus, selecting the ID field of the continuous data, and encoding its ID into a vector x i ; Select a time window (128 is selected in this embodiment) and encode the ID field of the data arriving within the time window in the same manner.
[0053] Step 3: Encode the vehicle network preprocessed data to obtain feature data;
[0054] In one embodiment, the vehicle network preprocessing data is encoded by using a recursive graph algorithm (RP algorithm), and the encoded data x in the time window is iCompare two by two and generate a 128×128 recursive graph matrix R; if the ID code x of the i-th data i The ID code x of the jth data j The same, then the recursive graph matrix R i,j If it is 1, the pixel is drawn black, otherwise R i,i is 0, the pixel is white.
[0055] Previous methods using neural networks create training or test images by extending the ID bit by bit in consecutive messages, usually ignoring the temporal dependency of the ID sequence. The ID and data fields of multiple adjacent messages are often the same, or have more bits in common, so temporal correlation can be exploited to improve detection.
[0056] The recursive graph algorithm is the basis of recursive quantitative analysis. It is a nonlinear signal research method formally proposed by Eckmann et al. in 1987. It is very sensitive to the regularity of the system trajectory in space and time. Previous studies have ignored the temporal consistency of messages: the ID field and DATA field of several adjacent messages are often the same or have more identical bits. Using RP is useful for understanding the time dependence of CAN ID. The formula is as follows:
[0057]
[0058] Where R i,j represents the pixel at row i and column j in the result image, N is the number of measurement messages, is the vector represented by the ID field of the i-th message, ε is the distance parameter measurement point that determines the influence radius of each message, and ‖‖ represents the second norm. Θ(x) is the piecewise function defined by the following equation.
[0059]
[0060] Among them, ε is crucial for the recursive graph algorithm. In this embodiment, ε is set to 0. In this way, when the i-th and j-th messages are equal, If R is equal to 0 i,j is 1 if the value is true, otherwise it is 0.
[0061] Step 4: Input the feature data into the hybrid vehicle network intrusion detection network, output the classification result, and determine whether it has been invaded based on the classification result.
[0062] In one embodiment, see Figure 2 , the hybrid vehicle network intrusion detection network includes a discriminator module, an AC classification header module, a judgment module, and an RFC classification header module;
[0063] The discriminator module includes five convolutional layers arranged in series, the first to fifth layers are all convolutional layers with a convolution kernel size of 3 and a step size of 2, and batch normalization layers and activation layers are added in sequence after the second to fifth convolutional layers, and the activation layers all use Leaky ReLU functions;
[0064] The AC classification head module is used to preliminarily judge the sample category; a fully connected layer with 4 output units is used, and the activation function is LogSoftmax; and the logits of each output unit is calculated to obtain the maximum logits value, which is recorded as MLP (MaximumLogits Probability, MLP), as the input of the judgment module in the next stage;
[0065] The judgment module determines which category it belongs to based on the MLP of the previous layer; first, a threshold T is set. If the MLP is greater than or equal to the threshold, the sample is classified into the category pointed to by the MLP, otherwise the sample is input into the RFC classification header for further judgment;
[0066] The RFC classification head module adopts a fully connected layer with an output of 2 units, and the activation function adopts Sigmoid. After training, the RFC classifier can determine whether the input sample is an existing sample in the data set or an unknown sample.
[0067] In one embodiment, see Figure 3 ,The hybrid vehicle network intrusion detection network ,is a trained network;
[0068] The training process consists of the following sub-steps:
[0069] Step 3.1: Obtain several data sets, including a normal data set, a DoS attack data set, a deceptive gear attack data set, a deceptive RPM attack data set, and a fuzzy attack data set;
[0070] Step 3.2: Encode the data set data and obtain feature data;
[0071] The recursive graph algorithm is used to encode the vehicle network preprocessing data; the specific implementation process is: the encoded data x in the time window i Compare two by two and generate a recursive graph matrix R; if the ID code x of the i-th data i The ID code x of the jth data j The same, then the recursive graph matrix R i,j If it is 1, the pixel is drawn black, otherwise R i,j is 0, the pixel is white;
[0072] Step 3.3: Determine the label of the recursive graph matrix according to the label of the data in the time window, where the last column of the data in the time window is the data label, R represents normal, and T represents attack; if all the data in the time window are normal data, the label of the recursive graph matrix is normal; if one or more data in the time window is marked as attack (such as DoS attack), the recursive graph matrix is also marked as attack (such as DoS attack);
[0073] Step 3.4: Classify the recursive graph matrix into known types and unknown types. The unknown type data does not participate in network training, and the known type data is used as a training set for network training; in the first stage of training, the probability value of the sample being an out-of-distribution sample is output. If it is less than the threshold, the second stage of training is entered to further determine whether it is an out-of-distribution sample, otherwise its category is output; the third stage of training is further performed to obtain the final classification result;
[0074] In one embodiment, see Figure 4 In the first stage of training, a threshold T is set to determine whether a known attack is misclassified as an unknown attack; the AC-T classifier uses the AC classification head for classification, and uses the AC classification head to calculate its maximum logical probability MLP; when the MLP is greater than or equal to the threshold T, the sample is considered to belong to a known type; otherwise, the sample is considered to belong to an unknown attack, and the classification result is output.
[0075] In one embodiment, see Figure 5 In the second stage of training, the AC-RFC classifier is used to classify samples to determine whether unknown attacks are misclassified as normal types; the AC-RFC classifier uses AC and RFC classification heads for classification; the AC classification head is used to distinguish types and calculate its MLP; the RFC classification head is used to detect whether the sample is true or false, and is a binary classifier composed of a fully connected neural network; the AC classification head determines the sample category, and if the output type is a known attack, the classification is output; if the output type is normal, the sample is sent to the RFC classification head; the trained RFC classification head determines whether the sample is normal data and outputs the final classification result.
[0076] In one embodiment, see Figure 6In the third stage of training, a threshold T is set to determine whether a known attack is misclassified as an unknown attack; the AC-RFC-T classifier is used to classify the sample to determine whether an unknown attack is misclassified as a normal type; the MLP calculated by the AC classification head determines whether to proceed to the next classification; if the MLP is greater than or equal to the threshold T, the sample is considered to belong to the in-division sample, and the output is the type indicated by the MLP; otherwise, the RFC classification head is used to further determine its type; if the sample MLP value is less than the threshold T, the sample is input into the fully connected layer of the RFC classification head and the preset activation function for processing to obtain the final classification result.
[0077] Step 3.5: The training is terminated after reaching a preset number of rounds (50 in this embodiment).
[0078] The present invention is further described below through experiments.
[0079] In the experiment, in order to train the AC-T classifier, AC-RFC classifier and AC-RFC-T classifier (hereinafter referred to as ACGAN classifier) to classify the data that is not involved in the training, we constructed known types: 1 normal sample and 3 known attacks and unknown types: 1 unknown attack. In this experiment, considering that DoS attacks have characteristics that are obviously different from other attacks, the DoS dataset is used as an unknown attack. When designing the classifier, we need to consider the following three issues shown in Table 1:
[0080] Table 1
[0081] Assumption 1 The MLP of unknown attacks is lower than that of known attacks; Assumption 2 Unknown attacks may be misclassified as normal attacks; Assumption 3 Known attacks may be incorrectly classified as unknown attacks.
[0082] Combined with the Out of Distribution (OOD) idea, if the MLP of a sample is smaller than the threshold, it is considered to be an unknown sample.
[0083] 1) Classifier AC-T constructed according to Question 1: Use the AC head of the discriminator to distinguish which known type the sample belongs to. After obtaining logits through the fully connected layer, the MLP can be obtained through the AC head and determine which known type the sample belongs to. When the MLP is lower than the set threshold T, it is considered to be an unknown type, otherwise, it is considered to be the type specified by the MLP. ACGAN is trained using real datasets and generated fake datasets, so the discriminator has better performance than ordinary CNN;
[0084] 2) Classifier AC-RFC constructed according to Question 2: No threshold is used, but AC and RFC headers are used. The RFC header is a binary classifier for detecting whether a sample is true or false. In AC-RFC and AC-RFC-T, a cascaded two-stage classification is used. In the first stage, if the MLP indicates that it is a known attack of a certain type, it is considered to be that type. If the indication is normal, the RFC classification header is used for further judgment in the second stage. If the output of the RFC classification header is true, it is considered to be normal, otherwise it is considered to be an unknown type.
[0085] 3) Classifier AC-RFC-T constructed according to Question 3: Using the threshold T, the first stage determines whether it is a known type. If the MLP exceeds the threshold T, it is classified as the specified type, otherwise it enters the second stage; when the RFC output is true, it is considered to be a known type, and when the RFC classification header output is false, it is considered to be an unknown type.
[0086] Table 2 illustrates the ACGAN classifier architecture, setting CNN-T as a comparison to AC-T, and then replacing the discriminator of AC-GAN with a normal CNN. The process is the same as AC-T: logits are obtained through the fully connected layer of CNN. Then the MLP is inferred to determine which known type it belongs to. If the MLP is lower than T, the method classifies it as an unknown type.
[0087] The training process involves 50 iterations with a batch size of 64. After training, the ACGAN classifier parameters are checked and the F1 score on the validation dataset is calculated using the formula The overall classification performance was evaluated by calculation, the best classifier that produced the highest F1 score was selected from the four classifiers, and the most appropriate threshold T for the method was determined.
[0088] Table 2
[0089]
[0090]
[0091] It can be seen that the performance of the classifier using the threshold is more significantly affected by T than the classifier not using T. This is because when T exceeds a certain value, a large number of known types are misclassified as unknown types. Although the AC-RFC-T method also uses a threshold, the change in its F1 score is not as large as that of AC-T and CNN-T. This shows that the RFC header can classify known and unknown attacks well and is less affected by the threshold. In any case, the performance of AC-RFC-T is the best.
[0092] Figure 7The F1 score of each method is shown as a function of the threshold T. From the figure, it can be concluded that among the three classifiers using the threshold T, the best performing classifier has an optimal threshold T of 0.995.
[0093] Table 3
[0094]
[0095]
[0096] Table 3 shows the performance results of each method after adopting the optimal threshold T. Among them, AC-T has the best T = 0.94, CNN-T has T = 0.96, and AC-RFC-T has T = 0.995.
[0097] Based on this, the following conclusions can be drawn:
[0098] 1) AC-RFC-T achieves the highest F1 score in all categories except the “spoofed gear attack” category. This is because the spoofed gear attack data itself is easy to distinguish.
[0099] 2) Among the overall indicators, the CNN-T method has the lowest overall F1 score, which fully demonstrates that the discriminator trained with ACGAN is more effective than ordinary CNN.
[0100] Comparison with other existing machine learning methods:
[0101] The experimental reconstruction dataset, the training set and the test set each contain 5 datasets, namely normal + 3 known attacks + 1 unknown attack. Then calculate the values of the 4 indicators on each class.
[0102] Table 4
[0103] Work method Recall rate (%) Accuracy (%) F1(%) Alshammari KNN 96.3 94.7 93.4 Alshammari SVM 95.7 95.2 93.3 Song DCNN 97.42 94.68 96.03 This method ACGAN 99.34 99.35 99.34
[0104] Experimental results show that the proposed classifier is effective, especially AC-RFC-T is a cascade classifier, the first stage uses the multi-classification header AC to classify normal attacks and known attacks, and the second stage passes the OOD samples to the RFC header to detect unknown attacks. Compared with other machine learning methods, higher classification accuracy is achieved under the same data set.
[0105] Figure 8 It is a graphical display of the dataset encoded by the recursive graph algorithm. It can be clearly seen that the DoS attack is darker and the frequency of black stripes is greater. This is because DoS attacks have a large number of messages with the same ID in a short period of time, so there are more black pixels in the recursive graph matrix R.
[0106] The present invention can mark data that is difficult to be significantly identified as a known type as an unknown attack; the system of the present invention fully considers the time correlation of CAN messages when designing, and increases the feature dimension.
[0107] It should be understood that the above description of the preferred embodiment is relatively detailed and cannot be regarded as limiting the scope of patent protection of the present invention. Under the enlightenment of the present invention, ordinary technicians in this field can also make substitutions or modifications without departing from the scope of protection of the claims of the present invention, which all fall within the scope of protection of the present invention. The scope of protection requested for the present invention shall be based on the attached claims.
Claims
1. A cascaded two-stage CAN intrusion detection method based on open set recognition, characterized in that: The following steps are involved: Step 1: Construct datasets, including normal dataset, DoS attack dataset, deceptive gear attack dataset, deceptive RPM attack dataset and fuzzy attack dataset; Step 2: Obtain vehicle network input data, and preprocess the vehicle network input data to obtain vehicle network preprocessed data; Step 3: Encode the vehicle network preprocessed data to obtain feature data; Step 4: Input the feature data into the hybrid vehicle network intrusion detection network, output the classification result, and determine whether it is invaded according to the classification result; The hybrid vehicle network intrusion detection network includes a discriminator module, an AC classification header module, a judgment module, and an RFC classification header module; The discriminator module includes five convolutional layers arranged in series, and a batch normalization layer and an activation layer are sequentially arranged after the second to fifth convolutional layers; The AC classification head module is used to preliminarily judge the sample category; a fully connected layer with 4 output units is used, and the activation function is LogSoftmax; and the logits of each output unit is calculated to obtain the maximum logits value, which is recorded as MLP and used as the input of the judgment module in the next stage; The judgment module determines which category it belongs to based on the MLP of the previous layer; first, a threshold T is set. If the MLP is greater than or equal to the threshold, the sample is classified into the category pointed to by the MLP, otherwise the sample is input into the RFC classification header for further judgment; The RFC classification header module uses a fully connected layer with an output of 2 units to determine whether the input sample is an existing sample in the data set or an unknown sample.
2. The cascaded two-stage CAN intrusion detection method based on open set recognition according to claim 1 is characterized in that: In step 2, the vehicle network input data is preprocessed by first collecting the continuous data arriving on the CAN bus, selecting the ID field of the continuous data, and encoding its ID into a vector x i ; Select a time window and encode the ID field of the data arriving within the time window in the same way.
3. The cascaded two-stage CAN intrusion detection method based on open set recognition according to claim 2 is characterized in that: In step 3, the vehicle network preprocessing data is encoded using a recursive graph algorithm; the specific implementation process is: the encoded data x in the time window i Compare two by two and generate a recursive graph matrix R; if the ID code x of the i-th data i The ID code x of the jth data j The same, then the element R in the recursive graph matrix i,j is 1, R i,j The corresponding pixel is drawn black, otherwise R i,j is 0, R i,j The corresponding pixels are painted white.
4. The cascaded two-stage CAN intrusion detection method based on open set recognition according to any one of claims 1 to 3, characterized in that: The hybrid vehicle network intrusion detection network described in step 4 is a trained network; The training process consists of the following sub-steps: Step 4.1: Obtain several data sets, including a normal data set, a DoS attack data set, a deceptive gear attack data set, a deceptive RPM attack data set, and a fuzzy attack data set; Step 4.2: Encode the data set data and obtain feature data; The recursive graph-based algorithm is used to encode the vehicle network preprocessed data; The specific implementation process is: the encoded data x in the time window i Compare two by two and generate a recursive graph matrix R; if the ID code x of the i-th data i The ID code x of the jth data j The same, then the element R in the recursive graph matrix i,j is 1, R i,j The corresponding pixel is drawn black, otherwise R i,j is 0, R i,j The corresponding pixels are painted white; Step 4.3: Determine the label of the recursive graph matrix according to the label of the data in the time window, where the last column of the data in the time window is the data label, R represents normal, and T represents attack; if all the data in the time window are normal data, the label of the recursive graph matrix is normal; if one or more data in the time window is marked as attack, the recursive graph matrix is also marked as attack; Step 4.4: Classify the recursive graph matrix into known types and unknown types. The unknown type data does not participate in network training, and the known type data is used as a training set for network training; in the first stage of training, the probability value of the training sample being an out-of-distribution sample is output. If it is less than the threshold, the second stage of training is entered to further determine whether it is an out-of-distribution sample, otherwise its category is output; the third stage of training is further performed to obtain the final classification result; Step 4.5: The training ends after reaching the preset number of rounds.
5. The cascaded two-stage CAN intrusion detection method based on open set recognition according to claim 4 is characterized in that: In the first stage of training, a threshold T is set to determine whether a known attack is misclassified as an unknown attack; the AC-T classifier uses the AC classification head for classification, and uses the AC classification head to calculate its maximum logical probability MLP; when the MLP is greater than or equal to the threshold T, the sample is considered to belong to a known type; otherwise, the sample is considered to belong to an unknown attack and the classification result is output.
6. The cascaded two-stage CAN intrusion detection method based on open set recognition according to claim 4 is characterized in that: In the second stage of training, the AC-RFC classifier is used to classify samples to determine whether unknown attacks are misclassified as normal types; the AC-RFC classifier uses the AC and RFC classification heads for classification; the AC classification head is used to distinguish the types and its MLP is calculated; The RFC classification head is used to detect whether the sample is true or false. It is a binary classifier composed of a fully connected neural network. The AC classification head determines the sample category. If the output type is a known attack, the classification is output. If the output type is normal, the sample is sent to the RFC classification head. The trained RFC classification head determines whether the sample is normal data and outputs the final classification result.
7. The cascaded two-stage CAN intrusion detection method based on open set recognition according to claim 4 is characterized in that: The third stage of training is to set a threshold T to determine whether a known attack is misclassified as an unknown attack; Use AC-RFC-T classifier to classify samples and determine whether unknown attacks are misclassified as normal types; Determine whether to proceed to the next classification based on the MLP calculated by the AC classification header; if the MLP is greater than or equal to the threshold T, the sample is considered to be an intra-division sample, and the output is the type indicated by the MLP; otherwise, the RFC classification header is used to further determine its type; If the sample MLP value is less than the threshold T, the sample is input into the fully connected layer and the preset activation function of the RFC classification head for processing to obtain the final classification result.
8. A cascaded two-stage CAN intrusion detection system based on open set recognition, used to implement the method described in any one of claims 1 to 7; characterized in that: include: A data acquisition and preprocessing module, used to acquire vehicle network input data, preprocess the vehicle network input data, and obtain vehicle network preprocessed data; A feature data acquisition module is used to encode the vehicle network preprocessing data to obtain feature data; The intrusion detection module is used to input feature data into the hybrid vehicle network intrusion detection network, output classification results, and determine whether there is an intrusion based on the classification results.
9. A cascaded two-stage CAN intrusion detection device based on open set recognition, 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 one or more processors to implement the cascaded two-stage CAN intrusion detection method based on open set recognition as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Vehicle-mounted network intrusion detection method and detection system based on improved ACGAN
CN116707939A