Internet of vehicles attack detection method and system based on attention and space-time convolution

By using attention and space-time convolutional network models in the Internet of Vehicles system, combined with graph neural networks and recurrent neural networks, the problem of difficult to capture vehicle space dependence and time dependence in the existing technology is solved, and an attack on Internet of Vehicles is realized The efficient inspection improves the safety and efficiency of traffic management.

CN119316840APending Publication Date: 2025-01-14GUANGDONG UNIV OF TECH
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411417499.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-11
Publication Date
2025-01-14

AI Technical Summary

Technical Problem

The prior art is difficult to capture the vehicle's spatial dependence in learning the vehicle's topology on the road, while learning the dynamic changes of basic security messages, and the model is poorly robust, making it difficult to effectively detect Internet of Vehicle attacks.

Method used

Using the Internet of Vehicle Attack Detection Method based on Attention and Spatial Time Convolution, through the network model of graph neural network, recurrent neural network and attention mechanism, we learn communication interactions between vehicles, generate timing charts, and train models to predict basic security messages. category to improve model robustness.

Benefits of technology

Effectively capture the topological structure and time dependence of vehicles on the road, improve the robustness of the model, can more accurately detect vehicle network attacks, and improve the safety and efficiency of traffic management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119316840A_ABST
    Figure CN119316840A_ABST
Patent Text Reader

Abstract

The invention discloses an Internet of Vehicles attack detection method based on attention and space-time convolution, and relates to the field of Internet of Vehicles communication data security, and the method comprises the steps: enabling a vehicle to access a network at a trusted mechanism, and obtaining an ID; the edge cloud collects a basic safety message data set containing an ID of the vehicle and preprocesses the basic safety message data set; obtaining a time sequence diagram comprising an edge set and a node set; edge cloud generation comprises a network model of a graph convolutional neural network, a recurrent neural network and an attention mechanism, a training set and a test set are divided, and an attention and space-time convolutional network model is trained; and testing the network model by using the test set to obtain category prediction, and evaluating the model performance according to related indexes. According to the method, the graph convolutional neural network is adopted to learn the topological structure of the vehicle in the road to capture the spatial dependence of the vehicle, the recurrent neural network is adopted to learn the dynamic change of the basic safety message BSMs to capture the time dependence, and the attention mechanism is adopted to enable the model to have good robustness.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of Internet of Vehicles communication data security technology, and more specifically, to an Internet of Vehicles attack detection method and system based on attention and spatiotemporal convolution. Background Art

[0002] With the rapid evolution of Internet of Vehicles technology, data exchange between a large number of vehicles and infrastructure has become a reality. These data include vehicle location, speed, driving trajectory, sensor data, etc. Due to the huge amount of data and complex information sources, it is inevitable to be attacked by cyber attacks. The security of Internet of Vehicles data has also been a continuous challenge, mainly due to the following reasons:

[0003] Data service denial: The Internet of Vehicles is a network that may be subject to a large number of malicious requests or attack traffic, making the Internet of Vehicles system unable to provide data services normally. This attack will cause vehicles to be unable to obtain key services such as real-time traffic information and navigation guidance, affecting driving safety and traffic efficiency.

[0004] Data tampering: Internet of Vehicles data may be subject to the risk of tampering or forgery. For example, by modifying vehicle location information, traffic signal control data, etc., hackers can create false information, mislead vehicle navigation systems or traffic management systems, and cause traffic accidents or traffic jams, causing serious harm to public safety.

[0005] Large data flow: The data flow in the Internet of Vehicles system contains a large amount of sensitive information such as vehicle location, speed, driving trajectory, etc. However, these data transmissions usually occur in an open network environment and are vulnerable to attacks such as eavesdropping and tampering, which can lead to security issues such as data leakage and false data injection.

[0006] Sensitive information in vehicle data may be leaked or used maliciously, which may threaten the safety of the owner and the vehicle. In addition, if a malicious attacker manages to escape the regulatory system, he will still attack the entire communication network next time. Therefore, on the premise of ensuring the security of vehicle network data, we also need to record the reputation of previous vehicles, and determine whether the vehicle has malicious behavior, whether the vehicle poses a potential threat to the communication network, etc., to ensure that once a malicious attacker poses a danger to the network, it needs to be tracked and controlled.

[0007] Traditional machine learning models find it difficult to learn the topological structure of vehicles in the Internet of Vehicles to capture the spatial dependencies of vehicles, while learning the dynamic changes of basic safety messages (BSMs) to capture the temporal dependencies and making the model more robust. Summary of the invention

[0008] The purpose of the present invention is to overcome the problem in the prior art that it is difficult to learn the topological structure of vehicles on the road to capture the spatial dependency of vehicles while learning the dynamic changes of basic safety messages BSMs to capture the temporal dependency and at the same time enable the model to have better robustness, and to provide a vehicle network attack detection method based on attention and spatiotemporal convolution.

[0009] To achieve the above object, the technical solution of the present invention is as follows:

[0010] Initialize vehicle information, connect the vehicle to the network at a trusted institution and obtain a unique ID;

[0011] Using the edge cloud to collect basic safety messages containing the unique ID sent by vehicles within its communication range, to obtain a basic safety message data set;

[0012] Preprocessing the basic safety message data set;

[0013] Decomposing the preprocessed basic safety message data set, using a graph structure to represent vehicles and communication interactions between them, and obtaining a time sequence graph including an edge set and a node set, wherein a node represents a single vehicle and an edge represents communication interactions between vehicles;

[0014] The edge cloud generates a network model including a graph neural network, a recurrent neural network and an attention mechanism, divides the timing graph into a training set and a test set, uses the training set as input to train the network model, and obtains an attention and spatiotemporal convolutional network model with optimal model parameters;

[0015] The test set is used to test the attention and spatiotemporal convolutional network models, obtain category predictions for basic safety messages, and evaluate the model performance based on relevant indicators.

[0016] As a preferred solution, the vehicle is connected to the network at a trusted institution and obtains a unique ID, including:

[0017] Each car generates a unique public key-private key pair (P V ,S V ), and then submit it to the trusted third-party authority TA for network access. The vehicle will use the public key P V Send it to TA, and the trusted institution uses its own private key S TA The public key P of the vehicle V Encrypt and generate a unique ID number: ID = hash (P V ) and sends a digital certificate to the vehicle Complete the network access.

[0018] As a preferred solution, the basic safety message includes normal communication information and malicious attacks. The normal communication information is the data collected by the vehicle through its own sensors: data sensor ={d s1 ,d s2 ,…,d sn}, the data will be packaged as:

[0019] BSMs

[0020] ={Timestamp,Vehicle ID ,Location,Motion state ,Vehicle state ,Additional info}

[0021] Among them, Timestamp is the timestamp, Vehicle ID is the unique ID, Location is the vehicle location, Motion state is the speed and acceleration of the vehicle, Vehicle state The state of the vehicle, including acceleration, acceleration, stationary, and additional info It is the data interaction information between vehicles. interaction ={d i1 ,d i2 ,…,d in}, the malicious attack is the attack behavior information sent by the vehicle as a malicious node.

[0022] As a preferred solution, the preprocessing includes filtering out noise and formatting into a unified data structure, and the specific steps are as follows:

[0023] Eliminate invalid data from the generated data set, including negative values ​​of position and velocity;

[0024] The data is normalized using the normalization formula so that it conforms to the input format of the graph neural model.

[0025] As a preferred solution, the preprocessed basic safety message data set is disassembled, a graph structure is used to represent the vehicles and the communication interactions between them, and a time sequence graph including an edge set and a node set is obtained, including the following steps:

[0026] Divide the graph set by timestamps, divide the entire data set into multiple time segments according to the timestamps in the basic safety message data set, each time segment corresponds to a graph, and obtain a time sequence graph set containing n graphs, each graph representing the vehicle network status in a specific time period;

[0027] In each graph of the set of timing graphs, nodes are connected according to vehicles that send and receive messages to form an edge set, and the edges in the edge set represent communication interaction relationships between vehicles in a specific time period;

[0028] In each diagram of the set of time sequence diagrams, a set of node features is generated according to the basic safety messages of the vehicles, and the node features reflect the state and behavior of each vehicle in a specific time period.

[0029] As a preferred solution, the division of the time series graph into a training set and a test set uses a batch time iterator function to complete the division of the training set and the test set of the dynamic graph data:

[0030] train data ,test data =temporal_signal_split(dataset,train_ratio=0.8)

[0031] Among them, train_ratio=0.8 means that the ratio of the training set to the entire data set is 0.8.

[0032] As a preferred solution, the attention and spatiotemporal convolutional network model includes an input layer, a graph neural network convolutional layer, a temporal network layer, an output layer and a classification layer, wherein the attention mechanism acts on the input layer, the graph convolutional layer and the temporal network layer.

[0033] As a preferred solution, the training of the network model using the training set as input comprises the following steps:

[0034] The input layer of the model receives the node feature vector and the edge set in the node feature set;

[0035] The input layer inputs the node feature vector and edge set into the graph neural network convolution layer, and the graph neural network convolution layer maps the node feature vector and edge set from the input feature dimension to the first hidden layer dimension. The mapping expression is as follows:

[0036]

[0037] Among them, D is the edge matrix, I is the identity matrix, A is the adjacency matrix, F is the node feature matrix, and W is the training weight matrix;

[0038] The expression of the activation function of the convolutional layer of the graph neural network is:

[0039]

[0040] Where X is x i 、x jA set of nodes, i is the selected node, j is the neighbor node of i obtained by calculating the adjacency matrix;

[0041] The convolutional layer of the graph neural network includes a graph convolution layer and a global average pooling layer. The global average pooling layer aggregates the node features into a graph-level representation and extracts the overall features of the space. The expression is as follows:

[0042]

[0043] Among them, x n is the value of χ, x i ′ is the output of each graph convolutional layer;

[0044] The output x of each graph convolutional layer i ′After the attention mechanism, the final output of the graph neural network layer is as follows:

[0045]

[0046] Among them, generally θ s =θ t , β is the attention weight;

[0047] The final output of the convolutional layer of the graph neural network is used as the input feature of the temporal network layer, and the features of the first hidden layer dimension are mapped to the second hidden layer dimension. The mapping expression is as follows:

[0048] z t =ReLu(W z ·[h t-1 ,x]+b z )

[0049] r t =ReLu(W r ·[h t-1 ,x]+b r )

[0050]

[0051] Among them, z t is the update gate, r t is the reset gate, x is the input feature at the current time, h t-1 The hidden state of the door was last updated. is the candidate hidden state, and the hidden state is updated by considering the reset gate. The [] operation represents the concatenation of the hidden state of the previous state and the input feature of the current time, and ⊙ represents element multiplication;

[0052] Through the attention mechanism, the output is redistributed according to the attention weight;

[0053] The output layer includes a fully connected layer, which maps the output of the temporal network layer to the output layer dimension, and uses a Softmax activation function to convert the output into a logarithmic probability distribution to speed up the calculation of the cross entropy loss;

[0054] Finally, the category prediction result is obtained in the classification layer.

[0055] As a preferred solution, in the process of training the network model, a Dropout mechanism is added to prevent the model from over-extracting features, Negative Log Likelihood Loss is used as the loss function, and an Adam optimizer is used to automatically adapt the learning rate.

[0056] On the other hand, the present invention also provides an Internet of Vehicles attack detection system based on attention and spatiotemporal convolution, which uses an Internet of Vehicles attack detection method based on attention and spatiotemporal convolution as described in the above technical solution, characterized in that the Internet of Vehicles attack detection system based on attention and spatiotemporal convolution includes three main bodies: a trusted institution, an edge cloud, and a vehicle. The three main bodies of the trusted institution, the edge cloud, and the vehicle cooperate to perform the following steps when the Internet of Vehicles attack detection system based on attention and spatiotemporal convolution is running:

[0057] Initialize vehicle information, connect the vehicle to the network at a trusted institution and obtain a unique ID;

[0058] Using the edge cloud to collect basic safety messages containing the unique ID sent by vehicles within its communication range, to obtain a basic safety message data set;

[0059] Preprocessing the basic safety message data set;

[0060] Decomposing the preprocessed basic safety message data set, using a graph structure to represent vehicles and communication interactions between them, and obtaining a time sequence graph including an edge set and a node set, wherein a node represents a single vehicle and an edge represents communication interactions between vehicles;

[0061] The edge cloud generates a network model including a graph neural network, a recurrent neural network and an attention mechanism, divides the timing graph into a training set and a test set, uses the training set as input to train the network model, and obtains an attention and spatiotemporal convolutional network model with optimal model parameters;

[0062] The test set is used to test the attention and spatiotemporal convolutional network models, obtain category prediction values ​​of basic safety messages, and evaluate the model performance based on relevant indicators.

[0063] Compared with the prior art, the present invention has the following beneficial effects:

[0064] The present invention adopts a graph neural network to learn the topological structure of vehicles on the road to capture the spatial dependency of vehicles, and adopts a temporal neural network to learn the dynamic changes of basic safety messages BSMs to capture the temporal dependency. The attention mechanism is adopted in the model to make the model have better robustness. BRIEF DESCRIPTION OF THE DRAWINGS

[0065] Figure 1 A flowchart of a vehicle network attack detection method based on attention and spatiotemporal convolution in this application;

[0066] Figure 2 This is a schematic diagram of the structure of the attention and spatiotemporal convolution network model of this application;

[0067] Figure 3 A schematic diagram of a large-scale data collaboration system for an Internet of Vehicles according to an embodiment of the present application;

[0068] Figure 4 This is a comparison result diagram of the accuracy of the model of Example 2 of the present application at different attacker proportions (10%-30%);

[0069] Figure 5 This is a comparison result diagram of the recall rate of the model of Example 2 of the present application at different attacker proportions (10%-30%);

[0070] Figure 6 This is a comparison chart of the accuracy of the model of Example 2 of the present application at different attacker proportions (10%-30%). DETAILED DESCRIPTION

[0071] In order to more clearly understand the above-mentioned purpose, features and advantages of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other without conflict.

[0072] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein. Therefore, the protection scope of the present invention is not limited to the specific embodiments disclosed below.

[0073] Example 1

[0074] See also Figure 1 Embodiment 1 of the present application provides a method for detecting vehicle network attacks based on attention and spatiotemporal convolution, comprising the following steps:

[0075] S1: Initialize vehicle information. The vehicle accesses the network at a trusted institution and obtains a unique ID.

[0076] During system initialization, each vehicle generates a unique public key-private key pair (P V ,S V ), and then submit it to a trusted third-party authority (TA) for network access. After network access, each vehicle receives a unique ID number and a digital certificate. The vehicle sends the public key to the trusted institution, and the trustee uses its own private key S TA The public key P of the vehicle V Encrypt and generate a unique ID number: ID = hash (P V ).

[0077] S2: Use the edge cloud to collect basic safety messages containing the unique ID sent by vehicles within its communication range to obtain a basic safety message data set.

[0078] Vehicle V = {V 1 ,V 2 ,…,V n}Data collected through sensors sensor ={d s1 ,d s2 ,…,d sn}, the data will be packaged into basic security messages, which include normal communication information and malicious attacks. Normal communication information is:

[0079] BSMs

[0080] ={Timestamp,Vehicle ID ,Location,Motion state ,Vehicle state ,Additional info}

[0081] Among them, Timestamp is the timestamp, Vehicle ID is the unique ID, Location is the vehicle location, Motion state is the speed and acceleration of the vehicle, Vehicle state The state of the vehicle, including acceleration, acceleration, stationary, and additional info It is the data communication interaction information between vehicles. interaction ={d i1 ,d i2 ,…,d in}, in this embodiment 1, Additionalin info It is the data interaction information obtained by simulation under the Veins platform;

[0082] But sometimes the vehicle is a malicious node, and the basic security message sent by the vehicle as a malicious node is malicious attack behavior information.

[0083] When a vehicle enters the communication range of the edge cloud (EC), EC will obtain the BSMs message sent by the vehicle and collect the neighboring vehicles V = {V 1 ,V 2 ,…,V n}BSMs message.

[0084] According to the operational requirements of the intelligent Internet of Vehicles system, the trusted organization TA can issue a data collection task. The edge cloud (EC) will collect data from connected vehicles. The objectives of this task cover multiple aspects, aiming to assist the system based on the Internet of Vehicles attack detection method based on attention and spatiotemporal convolution in this embodiment 1 to make security judgments based on the category prediction results of the Internet of Vehicles attack detection model, so as to comprehensively improve the efficiency and safety of traffic management. Specifically, the task includes but is not limited to the following:

[0085] Traffic flow data: collect real-time traffic flow information for each road section.

[0086] Road condition information: Collect detailed road condition information including road quality, construction conditions, road obstacles, etc.

[0087] Vehicle behavior data: collects vehicle operation data, including speed, acceleration, braking frequency, etc.

[0088] S3: Preprocess the basic security message dataset.

[0089] The BSMs data is preprocessed to filter out noise and formatted into a unified data structure for subsequent processing. The preprocessing steps are as follows:

[0090] Eliminate invalid data from the generated data set, including negative values ​​of position and speed;

[0091] The data is normalized using the normalization formula so that it conforms to the input format of the graph neural model.

[0092] S4: The preprocessed basic safety message dataset is disassembled, and a graph structure is used to represent vehicles and the communication interactions between them, to obtain a time sequence graph including an edge set and a node set, where a node represents a single vehicle and an edge represents the communication interactions between vehicles.

[0093] By breaking down the BSMs messages, a graph structure can be used to represent vehicles and their communications and interactions. Nodes represent individual vehicles, and edges represent interactions or communication links between vehicles. The dynamic nature of the graph enables it to be updated over time to reflect vehicle movement and new interaction events. The specific construction steps are as follows:

[0094] Timestamp partitioned graph collection: According to the timestamp in the dataset, the entire dataset is divided into multiple time segments, each of which corresponds to a graph. A time series graph collection containing n graphs is generated, each of which represents the vehicle network status in a specific time period.

[0095] Generate edge sets: In each graph, nodes are connected according to the vehicles that send and receive messages to form edge sets. These edges represent the communication or interaction relationships between vehicles in a specific time period.

[0096] Generate node feature set: In each graph, a node feature set is generated based on the vehicle's BSMs message. These features can include speed, position, acceleration, direction, etc., reflecting the state and behavior of each vehicle in a specific time period.

[0097] Through these steps, a series of time series diagrams reflecting the dynamic behavior of vehicles are constructed. These diagrams can not only show the real-time interaction between vehicles, but can also be used for further analysis and processing, such as predicting traffic flow, identifying abnormal behavior, and improving traffic safety. This method can effectively capture the dynamic changes in the Internet of Vehicles system and provide a rich information foundation for subsequent data analysis and application.

[0098] S5: The edge cloud generates a network model including graph neural network, recurrent neural network and attention mechanism, divides the time series graph set into training set and test set, uses the training set as input to train the network model, and obtains the attention and spatiotemporal convolutional network model with optimal model parameters.

[0099] EC uses the processed data for model training. The input is divided into two parts: edge set and node set; see Figure 2 , Figure 2 This is a schematic diagram of the model structure. The attention and spatiotemporal convolutional network model includes an input layer, a graph neural network convolutional layer, a temporal network layer, an output layer, and a classification layer. The attention mechanism acts on the input layer, the graph convolutional layer, and the temporal network layer. GCN is used to learn the topological structure of vehicles on the road to capture the spatial dependency of vehicles; GRU gated units are used to learn the dynamic changes of BSMs messages to capture temporal dependencies. The Attention mechanism enables the model to better understand the characteristics of traffic scenes at different scales, thereby more accurately classifying and identifying traffic information, and has better robustness. .

[0100] GCN is responsible for message transmission and aggregation. After the aggregation is completed, the model parameters obtained by GCN message transmission and aggregation are updated again according to T time units before time t. The model training steps are as follows:

[0101] In the first step, the model input layer receives the feature vector of the node and the edge set. The dimension of the feature vector of each node is:

[0102] features = {Timestamp, Vehicle ID ,Location,Motion state ,Vehicle state ,Additional info}

[0103] In the vehicle network, these features include the state information of the vehicle. Because these features are time-related, they will have different values ​​at each time step. The batch time iterator function is used to complete the training set and test set division of dynamic graph data:

[0104] train data ,test data =temporal_signal_slpit(dataset,train_ratio=0.8)

[0105] Among them, train_ratio=0.8 means that the ratio of the training set to the entire data set is 0.8.

[0106] In the second step, the input layer inputs the node feature vector and edge set into the graph neural network convolution layer. The graph neural network convolution layer maps the node feature vector and edge set from the input feature dimension to the first hidden layer dimension. The formula is as follows:

[0107]

[0108] Among them, D is the edge matrix, I is the identity matrix, A is the adjacency matrix, F is the node feature matrix, and W is the training weight matrix.

[0109] The expression of the activation function of the convolutional layer of the graph neural network is:

[0110]

[0111] Where χ is x i 、x j A set of nodes, i is the selected node, j is the neighbor node of i obtained by calculating the adjacency matrix;

[0112] In this embodiment 1, the graph neural network convolution layer includes: three layers of graph convolution layer GCNConv, three layers of global average pooling layer global_mean_pool, and use the Attention mechanism for feature screening. The pooling layer aggregates the node features into a graph-level representation and extracts the overall features of the space. The formula is as follows:

[0113]

[0114] Among them, x n is the value of χ, x i ′ is the output of each graph convolutional layer;

[0115] The output x of each graph convolutional layer i ′After the attention mechanism, the diversity and stability of feature representation are enhanced, and the final output of the graph neural network layer is as follows:

[0116]

[0117] Among them, generally θ s =θ t , β is the attention weight;

[0118] The entire graph neural network convolutional layer processes the spatial features of each timestamp.

[0119] The next layer is the time series network model, which uses the final output of the graph neural network convolutional layer as the input feature of the time series network layer, maps the features of the first hidden layer dimension to the second hidden layer dimension, and processes the time series data. The formula is as follows:

[0120] z t =ReLu(W z ·[h t-1 ,x]+b z )

[0121] r t =ReLu(W r ·[h t-1 ,x]+b r )

[0122]

[0123] Among them, z t is the update gate, r t is the reset gate, x is the input feature at the current time, h t-1 The hidden state of the door was last updated. is a candidate hidden state, and the hidden state is updated by considering the reset gate. The [] operation represents the concatenation of the hidden state of the previous state and the input feature of the current time, and ⊙ represents element multiplication.

[0124] In this embodiment 1, the time series network layer is a recurrent neural network layer, and the time series network layer has only one recurrent neural network GRU unit. The GRU unit has a timestamp Timestamp, and the total number of GRU cells obtains the time relationship of n graphs. GRU captures the dynamic changes of time through the memory and forgetting mechanism, maps the first hidden layer feature to the second hidden layer dimension; and then obtains the output X after redistribution according to the attention weight through the Attention mechanism. t+1 The entire time series network layer processes the time features of each timestamp. The output layer is a fully connected layer that converts the output X of GRU into t+1 Mapped to the output layer dimension, the activation function Softmax is used, which converts the output into a logarithmic probability distribution to speed up the calculation of the cross entropy loss. The output layer outputs the probability of each category, and the category with the largest probability is assigned to it. Finally, the category prediction results are obtained in the classification layer, including two categories, normal communication messages Benign1-Benign n and malicious attacks Attack1-Attack n. In the above training process, the Dropout mechanism is added to prevent the model from over-extracting features. Negative Log Likelihood Loss is used as the loss function, and the Adam optimizer automatically adapts the learning rate. After multiple iterations of training, the cross entropy loss between the predicted value output by the model and the true label is calculated, and back propagation and weight update are performed to minimize the loss and converge the weights to obtain the optimal model parameters.

[0125] S6: Test the attention and spatiotemporal convolutional network models using the test set to obtain category predictions for basic safety messages and evaluate the model performance based on relevant metrics.

[0126] Example 2

[0127] Based on Example 1, this Example 2 uses a vehicle network attack detection method based on attention and spatiotemporal convolution in Example 1 for simulation.

[0128] This example 2 is implemented based on Python using the Pytorch library and the torch_geometric library. The GCN module with the Attention mechanism model requires very fine adjustment of the hyperparameters, so the Adam optimizer is used to automatically adjust the learning rate to simulate the optimal hyperparameter adjustment. The number of training iterations is 100, the batch size is 512, and the weights of each layer are initialized using He initialization, while the bias is initialized using a uniform distribution function. After multiple iterative training, the cross entropy loss between the predicted value output by the model and the true label is calculated, back propagation is performed, and the weights are updated to minimize the loss, converge the weights, and obtain the optimal model parameters. Then the model is tested using the test set to obtain the corresponding category prediction results, and the model performance is evaluated based on relevant indicators. The relevant indicators used for evaluation are as follows:

[0129] Accuracy:

[0130] Recall:

[0131] Accuracy:

[0132] Among them, TP (True Positives) is the true positive, the number of Benigns correctly predicted by the model.

[0133] TN (True Negatives): True negative examples, the number of attacks correctly predicted by the model.

[0134] FP (False Positives): False positive examples, the model incorrectly predicts the number of attacks of Benign.

[0135] FN (False Negatives): False negative examples, the number of Benigns that the model incorrectly predicts as Attack.

[0136] See also Figure 4 , Figure 5 , Figure 6 In this embodiment 2, the method is tested based on the data set collected on the Veins Internet of Vehicles simulation platform, and compared with four existing deep learning attack detection methods for testing. It can be seen that the overall performance of the method of the present invention in the Internet of Vehicles attack detection task is better than other deep learning models.

[0137] The other steps of this embodiment 2 are the same as those of embodiment 1 and will not be repeated here.

[0138] Example 3

[0139] Based on Example 1, this Example 3 further provides an Internet of Vehicles attack detection system based on attention and spatiotemporal convolution, and applies an Internet of Vehicles attack detection method based on attention and spatiotemporal convolution as described in Example 1. The Internet of Vehicles attack detection system based on attention and spatiotemporal convolution includes three main bodies: a trusted organization, an edge cloud, and a vehicle. The specific structure of the system is as follows:

[0140] See also Figure 3 ,In considering scenarios involving extensive data integration and communication, an IoV attack detection system based on attention and spatiotemporal convolution,i.e., a large-scale data collaborative system. Figure 3 The basic system architecture of this large-scale data collaboration system is given. First, the Trusted Authority (TA) is responsible for issuing private keys and certificates to legitimate vehicles to ensure the security of communication. Private keys are used to encrypt information to prevent unauthorized access and tampering. Secondly, vehicles communicate with other vehicles or edge clouds (EC) by sending and receiving BSMs through on-board units (OBUs). V2V communication enables vehicles to warn each other of potential dangers, while V2I communication can obtain traffic information from the edge cloud. The edge cloud receives data from vehicles and processes it, which may include data aggregation, analysis, or decision support for vehicles. The edge cloud can reduce latency and provide real-time or near-real-time services. Finally, in the system, the edge cloud is responsible for the generation and training of attention and spatiotemporal convolutional network models, and uses related machine learning algorithms to detect abnormal vehicle behavior to improve the security of the communication protocol. The main entities involved are the Trusted Authority (TA), edge cloud (EC), and vehicle.

[0141] Trusted Agency: TA is responsible for the node registration of vehicles and ECs (generating unique ID numbers), public and private keys, and digital certificate issuance. All ECs and vehicles must register with TA to generate unique IDs to be legitimate nodes. TA stores the ID numbers and malicious levels of all nodes. It also evaluates the status of surrounding vehicles and ECs. It ensures the identity authentication of network participants and the integrity of data.

[0142] Edge cloud: EC acts as a communication repeater for vehicle-to-infrastructure (V2I) communications, providing a network interface for vehicles to facilitate communication using a secure transmission protocol TA. EC uses Dedicated Short Range Communication (DSRC) or 5G-V2X technology to broadcast information to vehicles. The communication range of EC is generally within 1000m, and adjacent ECs communicate via wires. EC has both computing and storage capabilities. It is a distributed computing architecture that moves computing resources and data storage to the edge of the network, close to the data source or user. In the vehicle network, the edge cloud can process large amounts of data from vehicles and provide fast response services.

[0143] Vehicles have on-board units (OBU) for computing and storage. Vehicles collect data through multiple sensing sensors (MSS), and send messages to the network after federated learning. Vehicles can communicate with each other in vehicle-to-vehicle (V2V) or vehicle-to-infrastructure (V2I). These vehicles can send and receive basic safety messages (BSMs) to improve road safety. But sometimes vehicles are malicious nodes, and the BSMs messages sent will become malicious attack behavior information, which may lead to the safety of vehicle networking and traffic.

[0144] Basic Safety Messages (BSMs) are messages used by vehicles to share their status information, such as location, speed, and direction. This information can be used by surrounding vehicles or road infrastructure to improve road use efficiency and safety.

[0145] The system of the third embodiment also includes report messages (Report Msgs): Report Msgs are messages sent by the EC when an abnormal situation is detected, or status reports sent to the vehicle regularly to meet specific regulatory requirements.

[0146] When the IoV attack detection system based on attention and spatiotemporal convolution is a large-scale data collaborative system, the three entities in the system: trusted institutions, edge clouds and vehicles cooperate to perform the following steps:

[0147] Initialize vehicle information, connect the vehicle to the network at a trusted institution and obtain a unique ID;

[0148] Using the edge cloud to collect basic safety messages containing the unique ID sent by vehicles within its communication range, to obtain a basic safety message data set;

[0149] Preprocess the basic safety message dataset;

[0150] The preprocessed basic safety message dataset is disassembled, and a graph structure is used to represent vehicles and the communication interactions between them, to obtain a time sequence graph including an edge set and a node set, where a node represents a single vehicle and an edge represents the communication interactions between vehicles;

[0151] The edge cloud generates a network model including graph neural network, recurrent neural network and attention mechanism, divides the time series graph set into training set and test set, uses the training set as input to train the network model, and obtains the attention and spatiotemporal convolutional network models with optimal model parameters;

[0152] The attention and spatiotemporal convolutional network models are tested on the test set to obtain the category prediction values ​​of basic safety messages, and the model performance is evaluated based on relevant indicators.

[0153] Obviously, the above embodiments of the present invention are merely examples for clearly illustrating the present invention, and are not intended to limit the embodiments of the present invention. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the embodiments here. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the claims of the present invention.

Claims

1. A vehicle network attack detection method based on attention and spatiotemporal convolution, characterized in that: The following steps are involved: Initialize vehicle information, connect the vehicle to the network at a trusted institution and obtain a unique ID; Using the edge cloud to collect basic safety messages containing the unique ID sent by vehicles within its communication range, to obtain a basic safety message data set; Preprocessing the basic safety message data set; Decomposing the preprocessed basic safety message data set, using a graph structure to represent vehicles and communication interactions between them, and obtaining a time sequence graph including an edge set and a node set, wherein a node represents a single vehicle and an edge represents communication interactions between vehicles; The edge cloud generates a network model including a graph neural network, a recurrent neural network and an attention mechanism, divides the timing graph into a training set and a test set, uses the training set as input to train the network model, and obtains an attention and spatiotemporal convolutional network model with optimal model parameters; The test set is used to test the attention and spatiotemporal convolutional network models, obtain category predictions for basic safety messages, and evaluate the model performance based on relevant indicators.

2. According to claim 1, a method for detecting Internet of Vehicles attacks based on attention and spatiotemporal convolution is characterized in that: The vehicle is connected to the network at a trusted institution and obtains a unique ID, including: Each car generates a unique public key-private key pair (P V ,S V ), and then submit it to the trusted third-party authority TA for network access. The vehicle will use the public key P V Send it to TA, and the trusted institution uses its own private key S TA The public key P of the vehicle V Encrypt and generate a unique ID number: ID = hash (P V ) and sends a digital certificate to the vehicle Complete the network access.

3. According to claim 1, a method for detecting Internet of Vehicles attacks based on attention and spatiotemporal convolution is characterized in that: The basic safety message includes normal communication information and malicious attacks. The normal communication information is the data collected by the vehicle through its own sensors: data sensor ={d s1 ,d s2 ,…,d sn }, the data will be packaged as: BSMs={Timestamp,Vehicle ID ,Location,Motion state ,Vehicle state ,Additional info } Among them, Timestamp is the timestamp, Vehicle ID is the unique ID, Location is the vehicle location, Motion state is the speed and acceleration of the vehicle, Vehicle state The state of the vehicle, including acceleration, acceleration, stationary, and additional info It is the data interaction information between vehicles. interaction ={d i1 ,d i2 ,…,d in }, the malicious attack is the attack behavior information sent by the vehicle as a malicious node.

4. According to claim 1, a method for detecting vehicle network attacks based on attention and spatiotemporal convolution is characterized in that: The preprocessing includes filtering out noise and formatting into a unified data structure. The specific steps are as follows: Eliminate invalid data from the generated data set, including negative values ​​of position and velocity; The data is normalized using the normalization formula so that it conforms to the input format of the graph neural model.

5. According to claim 1, a method for detecting vehicle network attacks based on attention and spatiotemporal convolution is characterized in that: The preprocessed basic safety message data set is disassembled, a graph structure is used to represent vehicles and the communication interactions between them, and a time sequence graph set including an edge set and a node set is obtained, including the following steps: Dividing the graph set by timestamps, dividing the entire data set into multiple time segments according to the timestamps in the basic safety message data set, each time segment corresponds to a graph, and obtaining a graph set containing n graphs, each graph representing a vehicle network state in a specific time period; In each graph of the set of timing graphs, nodes are connected according to vehicles that send and receive messages to form an edge set, and the edges in the edge set represent communication interaction relationships between vehicles in a specific time period; In each diagram of the set of time sequence diagrams, a set of node features is generated according to the basic safety messages of the vehicles, and the node features reflect the state and behavior of each vehicle in a specific time period.

6. The method for detecting vehicle network attacks based on attention and spatiotemporal convolution according to claim 5 is characterized in that: The division of the time series graph into a training set and a test set uses a batch time iterator function to complete the division of the training set and the test set of the dynamic graph data: train data ,test data =temporal_signal_split(dataset,train_ratio=0.8) Among them, train_ratio=0.8 means that the ratio of the training set to the entire data set is 0.

8.

7. The method for detecting Internet of Vehicles attacks based on attention and spatiotemporal convolution according to claim 1, characterized in that: The attention and spatiotemporal convolutional network model includes an input layer, a graph neural network convolutional layer, a temporal network layer, an output layer and a classification layer, wherein the attention mechanism acts on the input layer, the graph convolutional layer and the temporal network layer.

8. A method for detecting vehicle network attacks based on attention and spatiotemporal convolution according to any one of claims 5 or 7, characterized in that: The step of using the training set as input to train the network model comprises the following steps: The input layer of the model receives the node feature vector and the edge set in the node feature set; The input layer inputs the node feature vector and edge set into the graph neural network convolution layer, and the graph neural network convolution layer maps the node feature vector and edge set from the input feature dimension to the first hidden layer dimension. The mapping expression is as follows: Among them, D is the edge matrix, I is the identity matrix, A is the adjacency matrix, F is the node feature matrix, and W is the training weight matrix; The expression of the activation function of the convolutional layer of the graph neural network is: Where X is x i 、x j A set of nodes, i is the selected node, j is the neighbor node of i obtained by calculating the adjacency matrix; The convolutional layer of the graph neural network includes a graph convolution layer and a global average pooling layer. The global average pooling layer aggregates the node features into a graph-level representation and extracts the overall features of the space. The expression is as follows: Among them, x n is the value of χ, x′ i is the output of each graph convolutional layer; The output x′ of each graph convolutional layer i After the attention mechanism, the final output of the graph neural network layer is as follows: Among them, generally θ s =θ t , β is the attention weight; The time series network layer is the recurrent neural network layer. The final output of the graph neural network convolution layer is used as the input feature of the time series network layer. The features of the first hidden layer dimension are mapped to the second hidden layer dimension. The mapping expression is as follows: With t =ReLu(W z ·[h t-1 ,x]+b z ) r t =ReLu(W r ·[h t-1 ,x]+b r ) Among them, z t is the update gate, r t is the reset gate, x is the input feature at the current time, h t-1 The hidden state of the door was last updated. is the candidate hidden state, and the hidden state is updated by considering the reset gate. The [] operation represents the concatenation of the hidden state of the previous state and the input feature of the current time, and ⊙ represents element multiplication; Through the attention mechanism, the output is redistributed according to the attention weight; The output layer includes a fully connected layer, which maps the output of the temporal network layer to the output layer dimension, and uses a Softmax activation function to convert the output into a logarithmic probability distribution to speed up the calculation of the cross entropy loss; Finally, the category prediction result is obtained in the classification layer.

9. The method for detecting vehicle network attacks based on attention and spatiotemporal convolution according to claim 8, characterized in that: In the process of training the network model, a Dropout mechanism is added to prevent the model from over-extracting features, Negative Log Likelihood Loss is used as the loss function, and an Adam optimizer is used to automatically adapt the learning rate.

10. A vehicle network attack detection system based on attention and spatiotemporal convolution, applying a vehicle network attack detection method based on attention and spatiotemporal convolution as described in any one of claims 1 to 9, characterized in that: The vehicle network attack detection system based on attention and spatiotemporal convolution includes three main bodies: a trusted institution, an edge cloud, and a vehicle. The three main bodies, the trusted institution, the edge cloud, and the vehicle, cooperate to perform the following steps when the vehicle network attack detection system based on attention and spatiotemporal convolution is running: Initialize vehicle information, connect the vehicle to the network at a trusted institution and obtain a unique ID; Using the edge cloud to collect basic safety messages containing the unique ID sent by vehicles within its communication range, to obtain a basic safety message data set; Preprocessing the basic safety message data set; Decomposing the preprocessed basic safety message data set, using a graph structure to represent vehicles and communication interactions between them, and obtaining a time sequence graph including an edge set and a node set, wherein a node represents a single vehicle and an edge represents communication interactions between vehicles; The edge cloud generates a network model including a graph neural network, a recurrent neural network and an attention mechanism, divides the timing graph into a training set and a test set, uses the training set as input to train the network model, and obtains an attention and spatiotemporal convolutional network model with optimal model parameters; The test set is used to test the attention and spatiotemporal convolutional network models, obtain category prediction values ​​of basic safety messages, and evaluate the model performance based on relevant indicators.

Citation Information

Cited By

  • Internet of vehicles cooperative attack anomaly detection method and device

    CN120785662A

  • A method and device for detecting anomalies in vehicle-to-everything (V2X) collaborative attacks

    CN120785662B