An unknown attack detection method for communication security of a connected vehicle
Patent Information
- Application Number
- CN202611506760.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-28
- Publication Date
- 2026-10-30
AI Technical Summary
[0041]本发明围绕基于正常模式偏离的开集未知攻击检测展开,其优点首先来自正常样本训练机制。由于模型训练阶段仅使用正常样本,模型学习的是正常V2X时空交互场景的可重构结构;所以当待检测节点表现出未预设的异常形态时,系统仍可根据其是否偏离正常交通交互模式进行异常发现。该机制能够降低对完备攻击标注数据的依赖,更适合攻击形式持续变化、未知攻击难以预先收集的V2X开放环境。
Smart Images

Figure CN123020249A_ABST
Abstract
Description
Technical Field
[0001] This invention provides a method for detecting unknown attacks on the communication security of connected vehicles, belonging to the field of traffic safety technology. Background Technology
[0002] In V2X (Vehicle to Everything) communication, message fields such as location, speed, heading, and timestamps directly affect surrounding vehicles' judgment of the local traffic situation. When malicious nodes generate unknown anomalies through methods such as field tampering, progressive state forgery, or collaborative construction of false situations, their outward manifestations may not correspond to predefined attack categories, but may disrupt the normal consistency between vehicle motion states and traffic interactions. Therefore, detection systems need to establish an unknown anomaly detection mechanism based on normal traffic behavior and normal interactions, even in the absence of prior attack labels.
[0003] To address the aforementioned needs, key issues that urgently need to be resolved include: how to uniformly represent the node state sequence, adjacency relationship, and effective node constraints in local V2X traffic scenarios as a spatiotemporal interaction graph; how to learn normal traffic interaction patterns under the condition of training only with normal samples; and how to quantify the degree of deviation of the node to be detected in its own state, temporal evolution, and inter-node relationships through the node state reconstruction results.
[0004] Furthermore, the detection of unknown attacks requires the formation of interpretable and calibrable open set decision boundaries. To this end, it is also necessary to solve how to estimate the anomaly threshold based on the residual distribution of normal training samples, and to fuse the direct reconstruction residual, the temporal increment residual, and the pairwise relation residual, so that the detection results can reflect various anomalies such as state deviation, temporal evolution deviation, and interaction relation deviation. Summary of the Invention
[0005] This invention provides a method for detecting unknown attacks on the communication security of connected vehicles, in order to solve the following technical problems:
[0006] (1) Unknown attacks in the V2X open communication environment are characterized by suddenness, evolution and combination, requiring the detection model to establish normal behavior boundaries in the absence of attack prior labels.
[0007] In V2X (Vehicle to Everything) systems, vehicles, roadside units, and edge nodes continuously exchange status information such as location, speed, heading, and timestamps. Due to the continuous changes in the number of traffic participants, road topology, adjacency relationships, and communication environment, abnormal behavior may manifest as new methods of field tampering, progressive location forgery, collaborative false situational awareness construction, or combinations of abnormal behaviors. Such unknown attacks are often difficult to fully collect and label before they occur; therefore, detection systems need to have the ability to identify abnormal deviations based on normal traffic interaction patterns.
[0008] To address the aforementioned technical requirements, one of the objectives of this invention is to propose an open-set anomaly detection method for detecting unknown attacks in V2X. This method enables the model to learn normal V2X spatiotemporal interaction patterns using only normal traffic scenarios or normal node samples during the training phase. During the detection phase, the method outputs an unknown anomaly judgment based on the degree of deviation of the node to be detected from the normal pattern, thereby improving the system's ability to detect anomalies that are not pre-defined.
[0009] (2) V2X attacks can affect both the state of the node itself and the interaction structure of multiple nodes, requiring the detection model to reconstruct the local traffic scene as a whole.
[0010] The anomalous behavior of unknown V2X attacks is not only reflected in the out-of-bounds movement of a vehicle's position, speed, or heading, but also in the disruption of the relative positional relationships, motion consistency, and local traffic interaction structure between the node and surrounding vehicles. For example, an attacking node may still be within a reasonable speed range when observed alone, but its relative motion trend, spacing changes, or interaction relationships with neighboring nodes no longer conform to normal traffic scenarios. Therefore, unknown attack detection needs to utilize node state sequences, adjacency relationships, and effective node constraints in the local scene simultaneously, so that anomaly measurement can cover both individual state deviations and interaction structure deviations. Therefore, one of the objectives of this invention is to organize the local V2X traffic scene into a spatiotemporal interaction graph containing node state sequences, adjacency relationships, and effective node masks, and to learn the reconstructable structure of normal traffic interaction scenarios through a spatiotemporal graph reconstruction model. The model outputs a reconstructed sequence with dimensions consistent with the input node state sequence, and further measures the degree of deviation from normal interaction patterns at both the node state and node relationship levels.
[0011] (3) Unknown attacks may manifest as state deviation, time evolution anomalies or relationship consistency disruption, requiring anomaly scores to be composed of multiple types of residual signals.
[0012] In V2X scenarios, unknown attacks do not always manifest as significant anomalies in state values at a single moment. Some attacks may exhibit unnatural motion increments within a continuous time window, or inconsistent relative motion relationships between multiple nodes. To ensure that anomaly measurement covers different anomaly manifestations, it is necessary to simultaneously answer three questions: "Can the node state be reconstructed from a normal pattern?", "Do the changes in nodes over time conform to normal evolutionary patterns?", and "Do the relationships between nodes maintain normal interaction logic?" To address these technical requirements, one objective of this invention is to construct a multi-residual anomaly scoring mechanism that simultaneously calculates direct reconstruction residuals, time increment residuals, and pairwise relationship residuals. The direct reconstruction residual measures the difference between the node state sequence and the reconstructed sequence; the time increment residual measures the inconsistency in the changes between the original and reconstructed sequences at adjacent moments; and the pairwise relationship residual measures the deviation of relative positions, motion differences, or mixed relationships between nodes before and after reconstruction. By using multiple residual signals to jointly measure the degree of anomaly, the unknown attack determination can cover three complementary types of manifestations: state anomalies, evolutionary anomalies, and relationship anomalies.
[0013] (4) Open set unknown attack detection requires calibrable normal boundaries, and the threshold is required to be derived from the statistical distribution of normal training samples.
[0014] In open operating environments, unknown attack detection requires anomaly determination based on the normal sample distribution boundary. Since different road scenarios, traffic densities, number of nodes, feature scales, and model training states affect the residual distribution, the anomaly threshold needs to be calibrable. Especially in multi-residual scoring scenarios, different residual components have different numerical ranges and statistical distributions, requiring the establishment of a stable correspondence between the fused anomaly score and the individual component threshold. Therefore, one objective of this invention is to estimate the anomaly determination threshold based on the residual distribution of normal training samples, including a fused anomaly score threshold and at least one residual component guard threshold. Specifically, residual statistics, quantiles, empirical distributions, or robust normalization parameters on normal training samples can be used to calibrate different anomaly components; when the fused anomaly score of the node to be detected exceeds the set threshold, or any key residual component exceeds the corresponding guard threshold, an unknown anomaly determination is output. Thus, the open-set rejection boundary originates from the normal sample distribution, making the detection results more suitable for unknown attack scenarios.
[0015] (5) V2X security detection has the requirement of edge-side deployment, which requires the reconstructed model to maintain a compact structure while expressing normal interaction patterns.
[0016] V2X security detection typically requires deployment on Roadside Units (RSUs), Multi-access Edge Computing (MEC) nodes, or other resource-constrained devices. Reconstructive detection necessitates generating node state sequences and calculating various residuals during the inference phase; therefore, the model representation and decoding structure must balance expressive power with runtime overhead. If the model can retain overall scene information using compact latent variables and node-level interaction information using a small number of memory variables, it helps reduce the redundancy of the reconstruction structure and improves the feasibility of edge-side operation. Therefore, one objective of this invention is to compress the local interaction scene representation into global latent variables and a small number of node-level memory variables after spatiotemporal encoding. The global latent variables are used to control the decoding process, and the memory variables provide cross-attention memory, thereby reducing the redundancy of the reconstruction structure while maintaining the expressive power of normal interaction patterns. This supports runtime evaluation and deployment verification of open-set unknown attack detection on edge-side devices.
[0017] The specific technical solution of this invention is as follows:
[0018] An unknown attack detection method for connected vehicle communication security takes local V2X traffic scenarios as the processing object. First, it acquires V2X messages received by vehicles or roadside units and organizes the state sequences of each traffic participant within a sliding time window. Then, it constructs a local spatiotemporal interaction graph based on the adjacency relationships, relative positional relationships, and effective node masks between vehicles. During the training phase, the spatiotemporal graph reconstruction model is trained using only normal traffic scenario graph samples, enabling the model to learn the normal node state evolution rules and normal interaction relationships. After model training is complete, the model parameters are fixed, and a normal residual distribution is established based on the direct reconstruction residuals, time-increment residuals, and pairwise relation residuals of normal training samples. Corresponding anomaly detection thresholds are then calibrated. During the detection phase, the scenario to be detected is input into the model with fixed parameters, the node state sequence is reconstructed, three types of residuals are calculated, and anomaly scores are calculated using the established normal residual distribution. When the fused anomaly score or any residual component exceeds the corresponding threshold, an unknown anomaly is output.
[0019] Specifically, the following steps are included:
[0020] Step S1: V2X message preprocessing;
[0021] The system acquires V2X messages received by vehicles or roadside units, extracts message frequency, location, speed, acceleration, and heading node status information according to a preset field order, and performs status field cleaning and time alignment based on the message timestamp; subsequently, it sorts the data according to a length of... A sliding time window is used to organize the continuous state sequence of each traffic participant.
[0022] Step S2: Constructing the spatiotemporal interaction graph;
[0023] As part of the graph structure design in the spatiotemporal graph reconstruction model, the graph structure is constructed based on the distance, relative orientation, direction of movement, or communication adjacency between nodes in the local traffic scenario.
[0024] Step S3: Spatiotemporal coding and fusion;
[0025] Based on the graph structure in the spatiotemporal graph reconstruction model, the spatiotemporal encoding and fusion module, as the spatiotemporal feature extraction part of the spatiotemporal graph reconstruction model, converts the node state sequence, adjacency matrix, and effective node mask in the local spatiotemporal interaction graph into a spatiotemporal representation that can be used by the reconstruction module. This module first performs a linear mapping on the historical state sequence of each node to obtain query, key, and value representations, and then extracts the temporal evolution features of the nodes within the observation window through local causal temporal attention. Subsequently, graph attention is calculated under the constraint of the adjacency matrix, and the spatial interaction contributions of different neighboring nodes are modulated by edge-gated weights. Finally, an adaptive fusion gate is used to fuse the temporal and spatial encoding representations into a unified spatiotemporal representation. .
[0026] Step S4: Latent variable memory compression and node state reconstruction;
[0027] Based on the spatiotemporal feature extraction part in the spatiotemporal graph reconstruction model, the latent variable memory compression and node state reconstruction module, which serves as the feature compression and original input reconstruction module in the spatiotemporal graph reconstruction model, further compresses the fused spatiotemporal representation and restores it to a node state sequence consistent with the input dimension.
[0028] This module first... Each node's temporal dimension representation is scored for importance and weighted pooled to obtain several compressed state variables. These variables are then used to generate node-level memory variables and global latent variables, where memory variables retain local temporal cues and global latent variables provide stable decoding control. During the decoding phase, global latent variables generate decoding seeds, and memory variables provide historical context through cross-attention. The fused components are then input into the GRU sequence decoder, ultimately outputting a reconstructed sequence of node states. .
[0029] Step S5: Assessment of abnormalities in multiple disabilities;
[0030] Three types of residuals are used to measure the degree to which nodes deviate from normal patterns to evaluate the difference between the reconstruction results and the original input in the spatiotemporal graph reconstruction model; the first type is the direct reconstruction residual, which measures the difference between the original node state sequence and the reconstructed node state sequence:
[0031] The second type is time-increment residuals, which are used to measure the inconsistency between the original sequence and the reconstructed sequence in terms of changes at adjacent time points.
[0032] The third category is pairwise residuals, which are used to measure the deviation of the relative relationship between nodes before and after reconstruction.
[0033] Step S6: Normal distribution threshold calibration and open set determination;
[0034] After the model is trained, various residual distributions are calculated using normal training samples.
[0035] Step S7: Determine if there is an unknown anomaly in the open set;
[0036] The node to be detected is determined as an unknown abnormal node or a normal node according to the open set determination rule.
[0037] Step S8: Model training;
[0038] The normal sample training protocol is adopted, meaning the training set only contains normal traffic scene samples or normal node samples.
[0039] The goal of model training is to enable the reconstructed model to learn the reconstructable structure of normal traffic interaction scenarios.
[0040] The loss function during the training phase is used to constrain the model's reconstruction of node states, temporal evolution, and interaction relationships in normal traffic scenarios. Specifically, the loss function consists of direct reconstruction loss, temporal increment loss, pairwise relationship loss, and auxiliary regularization terms. The direct reconstruction loss constrains the reconstructed node state sequence to remain consistent with the original node state sequence; the temporal increment loss constrains the consistency of state changes between adjacent time steps; the pairwise relationship loss constrains the relative positional or motion relationships between nodes to remain consistent before and after reconstruction; and the auxiliary regularization term is used to constrain latent variable norms, fusion gate balance, memory token diversity, or attention distribution.
[0041] This invention focuses on open-set unknown attack detection based on deviations from normal patterns. Its advantages primarily stem from its normal sample training mechanism. Since the model training phase uses only normal samples, the model learns the reconfigurable structure of normal V2X spatiotemporal interaction scenarios. Therefore, when a node to be detected exhibits an anomaly without pre-defined patterns, the system can still detect the anomaly based on whether it deviates from the normal traffic interaction pattern. This mechanism reduces reliance on complete attack annotation data and is more suitable for V2X open environments where attack forms are constantly changing and unknown attacks are difficult to collect in advance.
[0042] This invention further reconstructs local traffic scenes as spatiotemporal interaction graphs, and retains the overall structure and local interaction information of normal scenes through global latent variables and node-level memory variables, enabling anomaly detection to simultaneously focus on node states and inter-node interaction relationships. Since the reconstruction result has the same dimension as the original node state sequence, the system can simultaneously calculate direct reconstruction residuals, time-increment residuals, and pairwise relation residuals: direct reconstruction residuals are used to detect deviations at the state level, time-increment residuals are used to detect continuous evolution anomalies, and pairwise relation residuals are used to detect disruptions in inter-node interaction consistency. Because these residual signals characterize deviations from normal patterns from different angles, this invention can cover various unknown anomaly manifestations such as slow drift, short-term camouflage, relationship disruption, and cooperative anomalies.
[0043] Furthermore, this invention estimates and fuses anomaly thresholds and component guard thresholds based on normal training distribution, ensuring that the open-set decision boundary originates from the statistical regularity of normal samples. This improves the interpretability of unknown anomaly detection and facilitates threshold calibration based on different datasets, road scenarios, and deployment environments. Because this invention uses compact latent variables and a small number of memory variables for reconstruction, it avoids retaining excessively redundant spatiotemporal representations at the edge, while simultaneously supporting node-level sequence reconstruction and multi-residual scoring. Therefore, it possesses the technical foundation for runtime evaluation and deployment verification on edge devices such as RSU or MEC. In summary, the core advantages of this invention are concentrated in the combined technical chain of "normal sample-driven spatiotemporal graph reconstruction, multi-residual anomaly scoring, normal distribution threshold calibration, and unknown attack open-set rejection." Attached Figure Description
[0044] Figure 1 This is a flowchart of the present invention;
[0045] Figure 2 This is a flowchart of the spatiotemporal coding and adaptive fusion module of the present invention;
[0046] Figure 3 This is a flowchart of the latent variable memory compression and node state reconstruction module of the present invention. Detailed Implementation
[0047] like Figure 1As shown, the overall process of this invention includes three stages: model training, normal distribution threshold calibration, and online detection. In the model training stage, firstly, steps S1 and S2 organize V2X messages in a normal traffic scenario into a local spatiotemporal interaction graph. Then, steps S3 and S4 complete spatiotemporal encoding, latent variable memory compression, and node state reconstruction. Step S5 calculates the three types of residuals between the original state sequence and the reconstructed state sequence. In step S8, the training loss is calculated based on the residuals, and the model parameters are updated. In the normal distribution threshold calibration stage, the model parameters after training are fixed, and reconstruction and residual calculation are re-executed using normal training samples. Step S6 establishes the normal residual distribution and corresponding judgment threshold. In the online detection stage, the V2X messages in the scenario to be detected are processed through steps S1 to S5. The anomaly score is calculated using the normal residual distribution saved in step S6, and then the node-level normal or anomaly judgment is output in step S7. Step S8 is an offline training process and is not executed after each online anomaly judgment. Steps S1 to S8 are organized and implemented according to the dependencies between the above stages. Specifically:
[0048] Step S1: V2X message preprocessing;
[0049] In step S1, V2X messages received by the vehicle or roadside unit are acquired, and node status information such as message frequency, location, speed, acceleration, and heading are extracted according to a preset field order. Status field cleaning and time alignment are then performed based on the message timestamp. Subsequently, according to the length of... A sliding time window is used to organize the continuous state sequence of each traffic participant. Assume a local traffic scenario includes a central vehicle node and its neighboring traffic participants, totaling [number missing]. There are nodes, denoted as: in, This can represent the central vehicle or a reference node for the current local scene. Let the observation window length be... At any moment Next, node The state characteristics are represented as follows: in, This indicates the frequency of message reception or occurrence by a node within the corresponding time interval. These represent state information such as position, velocity, acceleration, and heading. After arranging the states of all nodes within a continuous time window, the node state sequence input is obtained: in For node indexing, For time indexing, This represents the dimension of node state features. Represents a node At any moment The complete state vector, node The state sequence within the entire observation window. In summary, step S1 outputs the node set. and the time-aligned node state sequence This provides a basis for step S2 to construct the spatiotemporal interaction graph.
[0050] Step S2: Spatiotemporal interaction graph construction; As the graph structure design part of the spatiotemporal graph reconstruction model, the graph structure is constructed based on the distance between nodes, relative orientation, movement direction or communication adjacency relationship in the local traffic scene.
[0051] In step S2, a graph structure is constructed based on the distance, relative orientation, direction of movement, or communication adjacency between nodes in the local traffic scenario: in, This is an adjacency matrix. For each node... and ,like lie in Within the effective interaction area, then let Otherwise To preserve the historical state of a node, the diagonal elements... In one alternative implementation, the off-diagonal adjacency weights can be normalized based on the dynamic distance: in, Indicates the distance between nodes. This indicates information about relative orientation or direction consistency. The interaction strength function is determined by both distance and orientation. Represents a node The effective set of neighbors, To prevent small constants with a denominator of zero, an effective node mask is used to fill in invalid nodes due to inconsistent node counts during batch processing. To perform shielding, among which Represents a node efficient, This indicates that the node is a filler node, so that invalid nodes do not participate in encoding, reconstruction residual calculation and threshold statistics.
[0052] Step S2 outputs a sequence of node states. Adjacency matrix and valid node mask The resulting local spatiotemporal interaction graph is used as input for subsequent normal sample training, spatiotemporal coding, and processing of the scene to be detected.
[0053] Step S3: Spatiotemporal Encoding and Fusion; Based on the graph structure in the spatiotemporal graph reconstruction model, the spatiotemporal encoding and fusion module, as the spatiotemporal feature extraction part of the spatiotemporal graph reconstruction model, converts the node state sequence, adjacency matrix, and effective node mask in the local spatiotemporal interaction graph into a spatiotemporal representation that can be used by the reconstruction module. .
[0054] like Figure 2 As shown, the spatiotemporal coding and fusion module is used to convert the node state sequences, adjacency matrices, and effective node masks in the local spatiotemporal interaction graph into a spatiotemporal representation that can be used by the reconstruction module. This module first performs a linear mapping on the historical state sequence of each node to obtain query, key, and value representations, and extracts the temporal evolution features of nodes within the observation window through local causal temporal attention. Then, graph attention is calculated under the constraint of the adjacency matrix, and the spatial interaction contributions of different neighboring nodes are modulated through edge-gated weights. Finally, an adaptive fusion gate is used to fuse the temporal and spatial coding representations into a unified spatiotemporal representation. This process allows the model to retain both the historical evolution information of each node and the interaction information between nodes before reconstruction.
[0055] Specifically, the model first performs temporal encoding on the node state sequence. For each node... Project its state sequence into queries, keys, and values: in For learnable mappings, They are nodes Queries, key and value sequences, This represents the latent space dimension for temporal attention. To ensure that the temporal encoding conforms to the causal order within the observation window, a local causal temporal mask can be defined: in This represents a localized time attention window. The corresponding time attention score and weight are: in, This indicates the historical time index that is being followed. Indicates time The set of time steps that can be focused on This indicates that time steps excluded by the mask are not included in the softmax normalization. For nodes At any moment time step Attention weights, and in Inner normalization summation is Thus, the node is obtained. At any moment Temporal context representation: in, For nodes At any moment The time context vector. This includes all nodes and time steps. After arrangement, the time code representation is obtained. .
[0056] Obtain time-coded representation Then, the model further incorporates the adjacency matrix. Perform spatial interactive encoding. For any node pair First, calculate the basic attention score: in Represents a node Time encoding representation, For linear matrix Projected node representation Assign a scoring vector to the attention. Indicates splicing, Represents a node For nodes The basic spatial attention score. To incorporate traffic adjacency priors, edge gating weights are calculated: in, It is a multilayer perceptron. For the Sigmoid function, For adjacency weight The nodes represent the edge gating coefficients determined jointly. When At that time, node Not as a node Effective spatial neighbors participate in aggregation. The final spatial attention weights are: in, To calculate the spatial attention score after adding side gating, For nodes For neighboring nodes Normalized spatial attention weights, in the denominator Traversing nodes Effective Neighbor Set Correspondingly, nodes Spatial aggregation is represented as: .
[0057] After time encoding and spatial encoding are completed, an adaptive fusion gate is used to generate a spatiotemporal representation: ,in, Indicates the node at time [time]. Time encoding representation, This represents the corresponding spatial encoding representation, which is an adaptive fusion gate. In order to integrate the lower realm, Used to compute fusion gates, and They are used to project temporal and spatial codes onto a unified dimension, respectively. The fused spatiotemporal representation includes node historical evolution information and local traffic interaction information. In summary, step S3 outputs the fused spatiotemporal representation. This is used for latent variable memory compression and node state reconstruction in step S4.
[0058] Step S4: Latent variable memory compression and node state reconstruction;
[0059] Building upon the spatiotemporal feature extraction component in the spatiotemporal graph reconstruction model, the latent variable memory compression and node state reconstruction module, serving as the feature compression and original input reconstruction module in the spatiotemporal graph reconstruction model, further compresses the fused spatiotemporal representation and restores it to a node state sequence consistent with the input dimension; as shown in the appendix. Figure 3 As shown, the latent variable memory compression and node state reconstruction module is used to further compress the fused spatiotemporal representation and restore it to a node state sequence consistent with the input dimension. This module first... Each node's temporal dimension representation is scored for importance and weighted pooled to obtain several compressed state variables. These variables are then used to generate node-level memory variables and global latent variables, where memory variables retain local temporal cues and global latent variables provide stable decoding control. During the decoding phase, global latent variables generate decoding seeds, and memory variables provide historical context through cross-attention. The fused components are then input into the GRU sequence decoder, ultimately outputting a reconstructed sequence of node states. This process enables the reconstruction model to recover the temporal evolution and interaction structure of normal traffic scenarios using a compact representation.
[0060] In obtaining the spatiotemporal representation Then, the model compresses the time series representation of each node into global latent variables and node-level memory variables. For each node... The For each memory token, first calculate the importance score for each time step: .
[0061] Then normalize along the time dimension: .
[0062] This yields the node-level compressed state token: ,in, For remembering the token index, For nodes At time step For the The unnormalized importance score of each memory token , and For learnable parameters, The weights are normalized along the time dimension. The first one obtained by time-weighted pooling A compressed state token. Then, the compressed state token is mapped to a decoding memory: .
[0063] And aggregate all tokens into a node-level global latent variable: in To remember the number of tokens, Representation layer normalization, and It is a learnable linear mapping. Preserve local time clues in the node's historical state. Provides global decoding control information. In the subsequent decoding stage, the global latent variables are projected as decoding seeds: in, For nodes At any moment Decoding seed, This is a learnable projection matrix. Since the decoding of the same node is controlled by the same global latent variable, Global information at the same node level can be shared across different time steps. Subsequently, the decoding seed is used as a query and cross-attention is performed with the memory variable. in, These are the query, key, and value projection matrices in cross-attention, respectively. To decode the latent space dimension of attention, Indicates time Decoding seed for the first Attention weight of each memory token This is the historical context vector obtained by aggregating memory variables. Then, the global seed and the memory context are fused and fed into the sequence decoder. in, The decoder input vector, For the input fusion matrix, For memory context scaling factor, For gated loop unit, For nodes At any moment The hidden state is decoded. Finally, the node state reconstruction value is obtained through output mapping: in, For context projection mapping, For output mapping, For nodes At any moment The reconstructed state vector, whose feature component order and representation are the same as the input vector. Maintain consistency. This is achieved by combining the reconstruction results of all nodes and all time steps. And because and Since the dimensions are consistent, residuals can be calculated at the node and relation levels subsequently. This output reconstructs the node state sequence within the current observation window, not the future states after the observation window. Step S4 outputs the reconstructed node state sequence. This provides step S5 with the corresponding input. Calculate the direct reconstruction residual, time increment residual, and pairwise relational residual values.
[0064] Step S5: Assessment of abnormalities in multiple disabilities;
[0065] Three types of residuals are used to measure the degree to which nodes deviate from normal patterns to evaluate the difference between the reconstruction results and the original input in the spatiotemporal graph reconstruction model; the first type is the direct reconstruction residual, which measures the difference between the original node state sequence and the reconstructed node state sequence: in, and Representing nodes respectively At any moment , No. Reconstructed values and original values in each feature dimension; The mean squared error residual, For log-cosh residuals, ; For the fusion weights of the two types of directly reconstructed residuals, Residuals are directly reconstructed at the node level.
[0066] The second type is time-increment residuals, used to measure the inconsistency between the original and reconstructed sequences in terms of changes at adjacent time points. Definition: in, , This represents the change in the original state of a node between adjacent time points. This represents the change in the corresponding reconstructed state. The time increment residual can be expressed as: in, and The form is consistent with the direct reconstruction residual, except that the state difference is replaced with and in Calculate the average over each time increment; For time-increment residual fusion weights, This represents the node-level time increment residual.
[0067] The third type is pairwise residuals, used to measure the deviation of the relative relationship between nodes before and after reconstruction. For node pairs... Define static and dynamic relative relationships: in, and Representing node pairs respectively The relative state relationships between the original sequence and the reconstructed sequence; and These represent the relative motion relationship of node pairs in terms of changes at adjacent time points. Correspondingly, the node pair relationship residual is expressed as: in, Represents node pairs At any moment The degree of deviation in the relationship To represent the L2 norm, the denominator contains... This is used to normalize the feature dimensions of static and dynamic relative relation residuals. Subsequently, by normalizing the nodes... We obtain the node-level pairwise residuals by weighting the effective neighbors: in, The number of time steps involved in the calculation of relational residuals can typically be taken as [value missing]. It simultaneously includes dynamic relative relationships; For nodes For nodes The adjacency weight, For nodes The paired residuals.
[0068] In summary, step S5 outputs node-level direct reconstruction residuals. Time increment residual and paired residuals During the training phase, the residuals are used for loss calculation in step S8; after model training is completed, the residuals are used for normal distribution statistics in step S6; during the detection phase, the residuals are used for anomaly detection in step S7.
[0069] Step S6: Normal distribution threshold calibration and open set determination;
[0070] After model training is complete, the residual distributions of various types are calculated using normal training samples. Let the set of residual signals be: in, , and Let represent the direct reconstruction residual, the time increment residual, and the pairwise relational residual, respectively. Further, let... This is a statistical set consisting of all valid nodes in the normal training samples. For each type of residual... Based on the empirical cumulative distribution function estimated from the residuals of normal training nodes: in, Indicates the residual type. Let be the independent variable of the empirical distribution function. Represents nodes in the normal training set The Class of residuals, For indicator functions, This represents the number of valid, normally trained nodes participating in the residual distribution statistics. Since a larger residual indicates a stronger deviation from the normal pattern, the residual is mapped to an upper-tail outlier score: in For nodes In the Upper tail anomaly fraction on the residual signal This represents the probability estimate that the residual lies in the upper tail of the normal distribution. Used to avoid taking the logarithm of zero.
[0071] Define the fusion anomaly score as: in, , and These are non-negative fusion weights used to control the impact of the three types of upper-tail outlier scores on the final node outlier score. The contribution. Let's assume... express The quantile operator, with the fusion anomaly score threshold as follows: .
[0072] The guard threshold for each residual component is: .in, To integrate the abnormal score threshold, For the first Guard threshold for residual components, This is the component threshold amplification factor. The target confidence level can be set based on the normal residual distribution of the training set. Step S6 is executed after model training is complete and model parameters are fixed, using only valid nodes from the normal training samples for statistical analysis. After calibration, the empirical cumulative distribution function of each type of normal residual is saved. Abnormal score fusion weights and abnormal score fusion thresholds and the protection threshold for each residual component During online detection, the residual of the node to be detected obtained in step S5 is input into the saved database. The abnormal scores of each component and the fusion abnormal score are calculated according to the aforementioned mapping formula. Then, in step S7, the fusion abnormal score and each residual component are compared with the corresponding threshold, and the normal or unknown abnormality judgment is output.
[0073] Step S7: Determine if there is an unknown anomaly in the open set;
[0074] For the node to be detected The final rule for determining the open set is: in, This indicates that the node has been identified as an unknown abnormal node. This indicates that the node is determined to be a normal node. This rule utilizes both a fusion anomaly score and a component guard threshold: the fusion anomaly score is used to comprehensively reflect the overall degree of deviation, while the component guard threshold is used to retain sensitivity to a single strong anomaly signal.
[0075] Step S8: Model training;
[0076] This invention employs a normal sample training protocol, meaning the training set contains only normal traffic scene samples or normal node samples, denoted as: Here, the superscript 0 indicates the set of normal samples. Each training sample is a complete local spatiotemporal interaction graph, where the central node and all valid neighboring nodes are considered normal observations within the entire observation window. The goal of model training is to enable the reconstructed model... Learn the reconfigurable structure of normal traffic interaction scenarios: in This represents a reconstruction map consisting of spatiotemporal coding, latent variable memory compression, and sequence decoding. Indicates model parameters, To reconstruct the node state sequence, its dimensions are the same as the input. Maintaining consistency is crucial. Since the training samples are derived from normal traffic patterns, optimizing the model reconstruction error allows the model to form a compressed representation of normal state evolution and normal interaction relationships. Training optimizes the direct reconstruction loss, time increment loss, and pairwise relationship loss between the original node state sequence and the reconstructed node state sequence, enabling the reconstruction model to learn the reconstructable structure of normal traffic interaction scenarios. During the detection phase, nodes deviating from the normal pattern will produce significant residuals in the reconstruction sequence, time increment, or pairwise relationships.
[0077] The loss function during training constrains the model's reconstruction of node states, temporal evolution, and interaction relationships in normal traffic scenarios. Specifically, the loss function consists of direct reconstruction loss, temporal increment loss, pairwise relationship loss, and an auxiliary regularization term. The direct reconstruction loss constrains the reconstructed node state sequence to remain consistent with the original node state sequence; the temporal increment loss constrains the consistency of state changes between adjacent time steps; the pairwise relationship loss constrains the consistency of relative positional or motion relationships between nodes before and after reconstruction; and the auxiliary regularization term constrains latent variable norms, fusion gate balance, memory token diversity, or attention distribution. In summary, the overall loss function during training can be written as: in, The set of valid nodes; , , Representing nodes respectively The direct reconstruction residuals, time-increment residuals, and pairwise residuals; , , , For the corresponding loss weights; This serves as an auxiliary regularization term. Through the aforementioned loss function, the model simultaneously learns node state reconfigurability, temporal evolution consistency, and interaction consistency during normal sample training.
Claims
1. A method for detecting unknown attacks on connected vehicle communication security, characterized in that, Taking local V2X traffic scenarios as the processing object, the method first acquires the V2X messages received by vehicles or roadside units and organizes the state sequences of each traffic participant within a sliding time window. Then, a local spatiotemporal interaction graph is constructed based on the adjacency relationship, relative position relationship, and effective node mask between vehicles. During the training phase, the spatiotemporal graph reconstruction model is trained using only normal traffic scenario samples, enabling the model to learn the normal node state evolution rules and normal interaction relationships. During the detection phase, the scene to be detected is input into the trained model, the node state sequence is reconstructed, and the anomaly score is calculated based on the direct reconstruction residual, time increment residual, and pairwise relation residual between the original sequence and the reconstructed sequence. Finally, the threshold is calibrated based on the residual distribution of normal training samples. When the fused anomaly score or any residual component exceeds the corresponding threshold, an unknown anomaly judgment is output.
2. The method for detecting unknown attacks on connected vehicle communication security according to claim 1, characterized in that, Specifically, the following steps are included: Step S1: V2X message preprocessing; The system acquires V2X messages received by vehicles or roadside units, extracts message frequency, location, speed, acceleration, and heading node status information according to a preset field order, and performs status field cleaning and time alignment based on the message timestamp; subsequently, it sorts the data according to a length of... A sliding time window is used to organize the continuous state sequence of each traffic participant; Step S2: Constructing the spatiotemporal interaction graph; As the graph structure design part of the spatiotemporal graph reconstruction model, the graph structure is constructed based on the distance between nodes, relative orientation, direction of movement, or communication adjacency in the local traffic scenario; Step S3: Spatiotemporal coding and fusion; Based on the graph structure in the spatiotemporal graph reconstruction model, the spatiotemporal encoding and fusion module, as the spatiotemporal feature extraction part of the spatiotemporal graph reconstruction model, converts the node state sequence, adjacency matrix, and effective node mask in the local spatiotemporal interaction graph into a spatiotemporal representation that can be used by the reconstruction module. ; Step S4: Latent variable memory compression and node state reconstruction; Based on the spatiotemporal feature extraction part in the spatiotemporal graph reconstruction model, the latent variable memory compression and node state reconstruction module, which serves as the feature compression and original input reconstruction module in the spatiotemporal graph reconstruction model, further compresses the fused spatiotemporal representation and restores it to a node state sequence consistent with the input dimension. Step S5: Assessment of abnormalities in multiple disabilities; Three types of residuals are used to measure the degree to which nodes deviate from normal patterns to evaluate the difference between the reconstruction results and the original input in the spatiotemporal graph reconstruction model; the first type is the direct reconstruction residual, which measures the difference between the original node state sequence and the reconstructed node state sequence: The second type is time increment residuals, which are used to measure the inconsistency between the original sequence and the reconstructed sequence in terms of the amount of change at adjacent time points; The third type is pairwise residuals, which are used to measure the deviation of the relative relationship between nodes before and after reconstruction; Step S6: Normal distribution threshold calibration and open set determination; After the model training is completed, the distributions of various residuals are calculated using normal training samples; Step S7: Determine if there is an unknown anomaly in the open set; The node to be detected is determined as an unknown abnormal node or a normal node according to the open set determination rule; Step S8: Model training; The normal sample training protocol is adopted, meaning the training set only contains normal traffic scene samples or normal node samples. The goal of model training is to enable the reconstruction model to learn the reconstructable structures of normal traffic interaction scenarios; The loss function during the training phase is used to constrain the model to reconstruct the node states, temporal evolution, and interaction relationships in normal traffic scenarios.
3. The method for detecting unknown attacks on connected vehicle communication security according to claim 2, characterized in that, In step S3, the spatiotemporal coding and fusion module first performs a linear mapping on the historical state sequence of each node to obtain query, key and value representations, and extracts the temporal evolution features of the node within the observation window through local causal temporal attention; Subsequently, graph attention is calculated under the adjacency matrix constraint, and the spatial interaction contributions of different neighbor nodes are modulated by edge-gated weights. Finally, an adaptive fusion gate is used to fuse the temporal and spatial encoding representations into a unified spatiotemporal representation. .
4. The method for detecting unknown attacks on connected vehicle communication security according to claim 2, characterized in that, In step S4, the latent variable memory compression and node state reconstruction module first performs... Each node's temporal dimension representation is scored for importance and weighted pooled to obtain several compressed state variables. These variables are then used to generate node-level memory variables and global latent variables, where memory variables retain local temporal cues and global latent variables provide stable decoding control. During the decoding phase, global latent variables generate decoding seeds, and memory variables provide historical context through cross-attention. The fused components are then input into the GRU sequence decoder, ultimately outputting a reconstructed sequence of node states. .
5. The method for detecting unknown attacks on connected vehicle communication security according to claim 2, characterized in that, In step S8, the loss function consists of direct reconstruction loss, time increment loss, pairwise relation loss, and auxiliary regularization term. The direct reconstruction loss constrains the reconstructed node state sequence to be consistent with the original node state sequence; the time increment loss constrains the consistency of state changes at adjacent time points; the pairwise relation loss constrains the relative positional relationship or relative motion relationship between nodes to be consistent before and after reconstruction; and the auxiliary regularization term is used to constrain the latent variable norm, fusion gate balance, memory variable diversity, or attention distribution.