Fine-grained anomaly detection method for encrypted traffic of intelligent networked automobile
By obtaining data flow time series data in intelligent network-connected cars, constructing data flow time-series data, and performing anomaly detection, the problem of low information security in intelligent network-connected cars is solved, fine-grained anomaly detection of encrypted traffic is achieved, and information security risks are reduced. .
Patent Information
- Application Number
- CN202410604103.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-15
- Publication Date
- 2024-08-27
AI Technical Summary
The information security of intelligent connected cars is low, and existing technology cannot effectively detect unknown and abnormal behaviors outside the rules, resulting in high information security risks.
By obtaining the data flow time series data, determining the data packet feature set, constructing the data flow time series data, and performing anomaly detection, fine-grained anomaly detection of encrypted traffic can be achieved and information security can be improved.
There is no need to use matching rules, which improves the accuracy and robustness of anomaly detection, reduces information security risks, and ensures the security of the communication process.
Smart Images

Figure CN118555099A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of network security technology, and in particular to a method for fine-grained anomaly detection of encrypted traffic of intelligent connected vehicles. Background Art
[0002] At present, with the continuous development of network technology, electronic devices (such as vehicle terminals in intelligent and connected vehicles (ICV)) are more interconnected with external information, which increases information security risks and leads to low information security. Among them, with the continuous deepening of the integration of intelligent vehicles and vehicle networking technology, intelligent connected vehicles, as emerging products in the era of the Internet of Everything, have become the strategic development focus of many countries in the world. In order to realize the intelligence of automobiles, automobile manufacturers have added a large number of electronic control units (ECU), sensors and actuators inside the vehicles; accordingly, vehicle-mounted wireless communication technology has become one of the technologies widely used in intelligent vehicles, which can significantly reduce the risk of automobile safety accidents and improve the comfort of drivers. That is, automobile manufacturers integrate technologies such as Bluetooth, Wi-Fi, GPS (Global Positioning System) and cellular networks into T-box (vehicle terminals) to enable vehicles to be more widely connected with the outside world, so that the information security risks of ICVs continue to increase, and vehicle information and user privacy face more severe security challenges. In this regard, related technologies usually achieve anomaly detection through rule matching, and are unable to analyze unknown abnormal behaviors outside the rules, resulting in low accuracy of anomaly detection results, and thus low information security. Based on this, there is currently no good solution for how to improve the information security of intelligent connected vehicles and reduce information security risks. Summary of the invention
[0003] In view of this, an embodiment of the present invention provides a method for fine-grained anomaly detection of encrypted traffic of intelligent connected vehicles to solve the problem of high information security risks in the communication process of intelligent connected vehicles; that is, the embodiment of the present invention can obtain a highly accurate anomaly detection result through the data flow timing data to determine whether the data flow to be detected is abnormal, thereby effectively improving the information security of the intelligent connected vehicle to reduce information security risks, and there is no need to use matching rules to implement anomaly detection, and the robustness is high; and each data packet feature in the data packet feature set is still visible in the encrypted traffic, and the data packet to be detected can be accurately represented in fine granularity through the data packet feature set, and the flow-level semantics can be obtained at the packet-level granularity (that is, the data flow timing data of the data flow to be detected can be obtained through the representation vector of each data packet to be detected), thereby obtaining a fine-grained representation of the data flow to be detected, and then realizing fine-grained anomaly detection of encrypted traffic.
[0004] According to one aspect of an embodiment of the present invention, a method for fine-grained anomaly detection of encrypted traffic of an intelligent connected vehicle is provided, the method comprising:
[0005] When a data stream to be detected is detected, a data packet feature set is determined, wherein the data stream to be detected includes at least one data packet to be detected; wherein the data stream to be detected is encrypted traffic, and one data packet to be detected is an encrypted data packet;
[0006] Based on the data packet feature set, obtaining a representation vector to be detected of each data packet to be detected in the data stream to be detected, wherein one representation vector to be detected includes a feature value of each data packet feature in the data packet feature set under the corresponding data packet to be detected;
[0007] Constructing data stream timing data of the data stream to be detected based on the to-be-detected representation vectors of the to-be-detected data packets;
[0008] Based on the data stream time series data, anomaly detection is performed on the data stream to be detected to obtain an anomaly detection result of the data stream to be detected.
[0009] According to another aspect of an embodiment of the present invention, a device for fine-grained anomaly detection of encrypted traffic of an intelligent connected vehicle is provided, the device comprising:
[0010] A processing unit, configured to determine a data packet feature set when a data stream to be detected is detected, wherein the data stream to be detected includes at least one data packet to be detected; wherein the data stream to be detected is encrypted traffic, and one data packet to be detected is an encrypted data packet;
[0011] An acquisition unit, configured to acquire, based on the data packet feature set, a representation vector to be detected of each data packet to be detected in the data stream to be detected, wherein one representation vector to be detected includes a feature value of each data packet feature in the data packet feature set under the corresponding data packet to be detected;
[0012] The processing unit is further used to construct data flow timing data of the data flow to be detected based on the to-be-detected representation vectors of the to-be-detected data packets;
[0013] The processing unit is further used to perform anomaly detection on the data stream to be detected based on the data stream time series data to obtain anomaly detection results of the data stream to be detected.
[0014] According to another aspect of an embodiment of the present invention, an electronic device is provided, comprising a processor and a memory storing a program, wherein the program comprises instructions, which, when executed by the processor, enable the processor to perform the above-mentioned method.
[0015] According to another aspect of an embodiment of the present invention, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable a computer to execute the above-mentioned method.
[0016] The embodiment of the present invention can determine a data packet feature set when a data stream to be detected is detected, the data stream to be detected includes at least one data packet to be detected, the data stream to be detected is encrypted traffic, and one data packet to be detected is an encrypted data packet; and based on the data packet feature set, obtain the to-be-detected representation vector of each to-be-detected data packet in the data stream to be detected, and one to-be-detected representation vector includes the feature value of each data packet feature in the data packet feature set under the corresponding data packet to be detected. Further, based on the to-be-detected representation vector of each data packet to be detected, the data stream time series data of the data stream to be detected can be constructed; and based on the data stream time series data, the data stream to be detected is subjected to anomaly detection to obtain anomaly detection results of the data stream to be detected. It can be seen that the embodiment of the present invention can obtain anomaly detection results with high accuracy through data flow timing data to determine whether the data flow to be detected is abnormal, thereby effectively improving the information security of intelligent connected vehicles and reducing information security risks, and there is no need to use matching rules to achieve anomaly detection, and the robustness is high; and each data packet feature in the data packet feature set is still visible in the encrypted traffic, and the data packet to be detected can be accurately represented in a fine-grained manner through the data packet feature set, and the flow-level semantics can be obtained at the packet level granularity (that is, the data flow timing data of the data flow to be detected can be obtained through the representation vector of each data packet to be detected), so as to obtain a fine-grained representation of the data flow to be detected, and then realize the fine-grained anomaly detection of encrypted traffic. In addition, the embodiment of the present invention can consider the timing characteristics in the data flow to be detected through the data flow timing data, that is, consider the timing relationship between each data packet to be detected, thereby further improving the accuracy of the anomaly detection result. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Further details, features and advantages of the invention are disclosed in the following description of exemplary embodiments in conjunction with the accompanying drawings, in which:
[0018] Figure 1 A schematic diagram of a process for fine-grained anomaly detection of encrypted traffic of an intelligent connected vehicle according to an exemplary embodiment of the present invention is shown;
[0019] Figure 2 A schematic diagram of string matching according to an exemplary embodiment of the present invention is shown;
[0020] Figure 3 A schematic diagram of a process of another method for fine-grained anomaly detection of encrypted traffic of an intelligent connected vehicle according to an exemplary embodiment of the present invention is shown;
[0021] Figure 4 A schematic diagram of a convolutional neural network according to an exemplary embodiment of the present invention is shown;
[0022] Figure 5A schematic diagram of a bidirectional long short-term memory network according to an exemplary embodiment of the present invention is shown;
[0023] Figure 6 A schematic block diagram of a fine-grained anomaly detection device for encrypted traffic of an intelligent connected vehicle according to an exemplary embodiment of the present invention is shown;
[0024] Figure 7 A block diagram of an exemplary electronic device that can be used to implement an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0025] Embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present invention. It should be understood that the drawings and embodiments of the present invention are only for exemplary purposes and are not intended to limit the scope of protection of the present invention.
[0026] It should be understood that the various steps described in the method embodiments of the present invention may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present invention is not limited in this respect.
[0027] The term "including" and its variations used in this document are open inclusions, that is, "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one other embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions of other terms will be given in the following description. It should be noted that the concepts of "first", "second", etc. mentioned in the present invention are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0028] It should be noted that the modifications of "one" and "plurality" mentioned in the present invention are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0029] The names of the messages or information exchanged between multiple devices in the embodiments of the present invention are only used for illustrative purposes, and are not used to limit the scope of these messages or information.
[0030] It should be noted that the execution subject of the method for fine-grained anomaly detection of encrypted traffic of intelligent connected vehicles provided in the embodiment of the present invention may be one or more electronic devices, and the present invention does not limit this; wherein, the electronic device may be a terminal (i.e., a client) or a server, then when the execution subject includes multiple electronic devices, and the multiple electronic devices include at least one terminal and at least one server, the method for fine-grained anomaly detection of encrypted traffic of intelligent connected vehicles provided in the embodiment of the present invention may be jointly executed by the terminal and the server. Correspondingly, the terminal mentioned here may be a vehicle-mounted terminal in an intelligent connected vehicle. The server mentioned here may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, security services, and big data and artificial intelligence platforms, etc.
[0031] Based on the above description, an embodiment of the present invention proposes a method for fine-grained anomaly detection of encrypted traffic of intelligent connected vehicles. The method for fine-grained anomaly detection of encrypted traffic of intelligent connected vehicles can be executed by the electronic device (terminal or server) mentioned above; or, the method for fine-grained anomaly detection of encrypted traffic of intelligent connected vehicles can be executed jointly by the terminal and the server. For the sake of convenience, the following description will be given by taking the example of an electronic device executing the method for fine-grained anomaly detection of encrypted traffic of intelligent connected vehicles; Figure 1 As shown, the method for detecting fine-grained anomalies of encrypted traffic of intelligent connected vehicles may include the following steps S101-S104:
[0032] S101, when a data stream to be detected is detected, a data packet feature set is determined, where the data stream to be detected includes at least one data packet to be detected.
[0033] The data stream to be detected may be any data stream, which is not limited in the embodiment of the present invention.
[0034] In the embodiment of the present invention, the data flow to be detected can be encrypted traffic (i.e., network encrypted traffic), and a data packet to be detected can be an encrypted data packet, and the characteristic values of each data packet feature under a data packet to be detected are all visible, that is, the characteristic values of each data packet feature under a data packet to be detected can be determined by the plaintext information involved in the corresponding data packet to be detected. Optionally, the format of a data packet can be in PCAP format (a data message storage format), and the data packet in PCAP format can be used for network traffic analysis. Based on this, the embodiments of the present invention can analyze the characteristics of the network data flow (i.e., the data flow to be detected) through the metadata and certain non-encrypted parts of the data packet to be detected; among them, the metadata (timestamp and data packet length, etc.) are obtainable even in encrypted communication, providing an entry point for analysis, especially in the SSL (Secure Sockets Layer) / TLS (Transport Layer Security) protocol, although most of the data is encrypted, some information in the handshake stage such as the Hello messages of the client and the server is still visible, and this part of the content reveals key information such as the protocol version and the encryption suite; that is, the data packet characteristics involved in the embodiments of the present invention are still visible in the encrypted traffic.
[0035] Optionally, the data packet feature set can be filtered out from the initial data packet feature set; based on this, the data packet feature set can include at least one initial data packet feature in the initial data packet feature set, that is, at least one initial data packet feature can be filtered out from the initial data packet feature set, and the filtered out at least one initial data packet feature can be added to the data packet feature set, so that each filtered out initial data packet feature serves as a data packet feature in the data packet feature set.
[0036] In the embodiment of the present invention, the manner of determining the data packet feature set may include but is not limited to the following:
[0037] In one implementation, a data packet feature set may be stored in the storage space of the electronic device itself. In this case, the electronic device may determine the data packet feature set from its own storage space.
[0038] In another implementation, the electronic device may obtain a feature set download link, and use the feature set downloaded based on the feature set download link as the data packet feature set, so as to determine the data packet feature set.
[0039] In another embodiment, the electronic device can obtain a feature screening training sample set, wherein a feature screening training sample includes an initial representation vector and a training label of a training data packet, and an initial representation vector includes the feature value of each initial data packet feature in the initial data packet feature set under the corresponding training data packet; and the feature screening training sample set can be used to construct a target random forest, and the target random forest can include N decision trees, where N is a positive integer. Further, the contribution of each initial data packet feature can be determined by the target random forest; and based on the contribution of each initial data packet feature, a data packet feature set is screened from the initial data packet feature set to determine the data packet feature set, and so on; wherein the contribution of any data packet feature in the data packet feature set is greater than or equal to the contribution of any initial data packet feature in the initial data packet feature set except the data packet feature set. Optionally, a training label can be an abnormal category identifier or a non-abnormal category identifier, and the abnormal category identifier can be used to indicate an abnormal category, and the non-abnormal category identifier can be used to indicate a non-abnormal category; optionally, the abnormal category identifier and the non-abnormal category identifier can both be digital identifiers, or text identifiers, etc., and the embodiment of the present invention is not limited to this. Optionally, after filtering out the data packet feature set from the initial data packet feature set, the electronic device may store the data packet feature set in its own storage space (ie, local storage space) to facilitate subsequent determination of the data packet feature set when detecting a newly received data stream to be detected.
[0040] Optionally, when filtering out a data packet feature set from an initial data packet feature set based on the contribution of each initial data packet feature, the electronic device may sort each initial data packet feature in order of contribution from large to small to obtain a first sorting result, and select the first H initial data packet features from the first sorting result, thereby adding the selected H initial data packet features to the data packet feature set, so as to filter out a data packet feature set from the initial data packet feature set, where H is a positive integer; or, each initial data packet feature may be sorted in order of contribution from small to large to obtain a second sorting result, and the last H initial data packet features may be selected from the second sorting result, thereby adding the selected H initial data packet features to the data packet feature set, so as to filter out a data packet feature set from the initial data packet feature set; or, all initial data packet features whose contribution is greater than a preset contribution threshold may be filtered out from the initial data packet feature set, and all the filtered initial data packet features are added to the data packet feature set, so as to filter out a data packet feature set from the initial data packet feature set, where the contribution of each data packet feature in the data packet feature set is greater than the preset contribution threshold, and so on; the embodiments of the present invention are not limited to this. Optionally, the preset contribution threshold may be set according to experience or according to actual needs, which is not limited in the embodiment of the present invention.
[0041] Optionally, the initial data packet feature set may include at least one of the following: arrival time interval, data packet length, security protocol type, and M data packet plaintext status coding features, where M is a positive integer; optionally, the security protocol type may be a protocol such as SSL or TLS, which is not limited in the embodiment of the present invention. Optionally, the M data packet plaintext status coding features may include, but are not limited to: Ethernet category coding features, file category coding features, port category coding features, and warning category coding features, etc., which are not limited in the embodiment of the present invention. Optionally, the initial data packet feature set may also include, but are not limited to: signature algorithm coding features supported by the security protocol, version coding features supported by the security protocol, security protocol pre-shared key exchange mode coding features, arrival time interval mean, and arrival time interval standard deviation, etc.; the embodiment of the present invention is not limited in this. In an embodiment of the present invention, the arrival time interval of a data packet may be the time interval between the arrival time of the corresponding data packet (i.e., the time when the corresponding data packet is captured, which may also be referred to as the timestamp of extracting the corresponding data packet) and the arrival time of the previous data packet of the corresponding data packet (i.e., the previous data packet whose arrival time is earlier than the arrival time of the corresponding data packet), that is, the electronic device may calculate an arrival time interval through the arrival times of two consecutive data packets, usually in seconds or microseconds; wherein, the arrival time interval of the first data packet in a data stream (i.e., the earliest data packet arriving in a data stream) may be 0, that is, the characteristic value of the arrival time interval under the first data packet may be 0. Then, accordingly, the mean of the arrival time interval of a data packet may be the mean of the arrival time intervals of each data packet in the data stream where the corresponding data packet is located, and the standard deviation of the arrival time interval of a data packet may be the standard deviation of the arrival time intervals of each data packet in the data stream where the corresponding data packet is located.
[0042] Based on this, the data packet feature set may include at least one initial data packet feature in the initial data packet feature set, such as arrival time interval and data packet length, etc.; that is, the data packet feature set may include at least one of the following: arrival time interval, data packet length, security protocol type, M data packet plaintext state encoding features, arrival time interval mean and arrival time interval standard deviation, etc.; the embodiment of the present invention does not limit this. Among them, the arrival time interval provides basic data for measuring the frequency of network traffic. All arrival time intervals in a data stream can construct an interval feature data set, which lays the foundation for further analysis, thereby revealing the characteristics of network traffic (i.e., data streams) and providing important information for understanding and predicting network behavior. Among them, the features in the initial data packet feature set and the data packet feature set are all plaintext features, that is, the features in the initial data packet feature set and the data packet feature set are visible in encrypted traffic.
[0043] Optionally, a decision tree may be a CART (classification and regression tree), that is, the target random forest may be composed of N CARTs; and a decision tree may be generated based on multiple feature screening training samples selected from the feature screening training sample set.
[0044] In one embodiment, when determining the contribution of each initial data packet feature respectively through the target random forest, for any initial data packet feature in the initial data packet feature set and any decision tree in the N decision trees, the electronic device can determine K nodes split according to any initial data packet feature from any decision tree, where K is a non-negative integer; then, the Gini index of each node in the K nodes and the Gini index of each child node of each node can be determined respectively, so as to calculate the contribution of any initial data packet feature under any decision tree based on the Gini index of each node and the Gini index of each child node of each node, that is, the contribution of any initial data packet feature under each node can be determined respectively, so as to determine the contribution of any initial data packet feature under any decision tree based on the contribution of any initial data packet feature under each node; optionally, the electronic device can sum the contribution of any initial data packet feature under each node to obtain the contribution of any initial data packet under any decision tree; wherein, the contribution of any initial data packet feature under any node in the K nodes can be the Gini index of any node minus the Gini index of each child node of any node. Furthermore, after obtaining the contribution of any initial data packet feature under each decision tree in N decision trees, the contribution of any initial data packet feature under each decision tree can be summed to obtain the contribution of any initial data packet; optionally, after obtaining the contribution of each initial data packet feature, the contribution of each initial data packet feature can be normalized to update the contribution of each initial data packet feature, thereby determining the contribution of each initial data packet feature.
[0045] In another embodiment, when determining the contribution of each initial data packet feature respectively through the target random forest, for any initial data packet feature in the initial data packet feature set and any decision tree in the N decision trees, the electronic device can determine the out-of-bag data (OOB) under any decision tree, and the out-of-bag data under one decision tree may include all feature screening training samples in the feature screening training sample set except the decision tree construction sample set of the corresponding decision tree, and the decision tree construction sample set of one decision tree includes all feature screening training samples in the feature screening training sample set used to construct the corresponding decision tree; then, the out-of-bag data under any decision tree can be used to calculate the first An out-of-bag data error can be obtained, and the feature value of any initial data packet feature included in each feature screening training sample in the out-of-bag data under any decision tree can be randomly perturbed to obtain the noisy out-of-bag data under any decision tree, so as to use the noisy out-of-bag data under any decision tree to calculate the second out-of-bag data error of any decision tree, so as to take the difference between the second out-of-bag data error and the first out-of-bag data error as the contribution of any initial data packet feature under any decision tree; after obtaining the contribution of any initial data packet feature under each decision tree, the contribution of any initial data packet feature under each decision tree can be averaged to obtain the contribution of any initial data packet feature, and so on.
[0046] It can be seen that the embodiment of the present invention can perform feature screening through the random forest model (i.e., the above-mentioned target random forest) to determine the data packet feature set. Since the target random forest can be built on multiple decision trees, the accuracy and robustness of data flow analysis can be effectively improved, and the accuracy and robustness of encrypted traffic analysis can be improved when the data flow is encrypted traffic; that is, the embodiment of the present invention can process diverse data through the random forest model to achieve importance (i.e., contribution) evaluation, and has high robustness and generalization.
[0047] S102, based on the data packet feature set, obtaining a representation vector for each data packet to be detected in the data stream to be detected, wherein one representation vector to be detected includes a feature value of each data packet feature in the data packet feature set under the corresponding data packet to be detected.
[0048] In an embodiment of the present invention, for any data packet to be detected in a data stream to be detected, the electronic device can obtain a representation vector to be detected of any data packet to be detected based on a data packet feature set; that is, the electronic device can obtain the feature values of each data packet feature under any data packet to be detected, and use the feature values of each data packet feature under any data packet to be detected to construct a representation vector to be detected of any data packet to be detected, thereby achieving the acquisition of the representation vector to be detected of any data packet to be detected.
[0049] Exemplarily, assuming that the data packet feature set includes an arrival time interval, a data packet length, and a security protocol type, the electronic device can determine the arrival time interval of any data packet to be detected (i.e., the characteristic value of the data packet feature "arrival time interval" under any data packet to be detected), the data packet length of any data packet to be detected (i.e., the characteristic value of the data packet feature "data packet length" under any data packet to be detected), and the security protocol type of any data packet to be detected (i.e., the characteristic value of the data packet feature "security protocol type" under any data packet to be detected, such as when the security protocol type of any data packet to be detected is the TLS protocol, and the TLS protocol can be encoded as 1, the security protocol type of any data packet to be detected can be expressed as 1), so as to determine the characteristic value of each data packet feature under any data packet to be detected.
[0050] Optionally, when identifying the protocol type of a data packet (such as a security protocol type), the electronic device may use the KMP algorithm (The Knuth-Morris-Pratt Algorithm, a string matching algorithm) to determine the protocol type (such as a security protocol type or a transmission protocol type, etc.) of any data packet to be detected; wherein the KMP algorithm is an efficient string matching algorithm, which allows matching without rolling back the main string pointer, which can save a lot of time overhead, thereby effectively improving the efficiency and accuracy of data packet protocol type identification. For example, Figure 2 As shown, assuming that the character string to be searched is ASD (that is, S2 is ASD), and the character string S1 includes DSAASD, etc., then the character A in S2 does not match the characters D and S in S1, and it can be continuously shifted right by one position until the character A in S2 matches the first character A in S1; at this time, the character S in S2 does not match the character A in S1 (the number of matched characters is 1 at this time), and it can be determined that the maximum length value 0 corresponding to the previous character A of the character S needs to be shifted right by 1-character S (that is, it can be determined that it needs to be shifted right by 1 position), so as to find the character string S2; based on this, the character string can be quickly searched by determining the number of right shift bits, which can effectively save resources.
[0051] S103: constructing data flow time series data of the data flow to be detected based on the to-be-detected representation vector of each to-be-detected data packet.
[0052] In one embodiment, the electronic device may serialize the representation vectors to be detected of each data packet to be detected into data stream timing data of the data stream to be detected in time sequence (i.e., the arrival time sequence of the data packets), so as to construct the data stream timing data of the data stream to be detected based on the representation vectors to be detected of each data packet to be detected; in this case, the data stream timing data may include the representation vectors to be detected of each data packet to be detected in sequence in time sequence.
[0053] In another implementation, the electronic device may determine the target representation vector of each data packet to be detected based on the representation vector of each data packet to be detected, and construct the data stream timing data of the data stream to be detected based on the target representation vector of each data packet to be detected. At this time, the data stream timing data may include the target representation vector of each data packet to be detected in chronological order, and so on. The method for determining the target representation vector of each data packet to be detected can be seen as follows, and the embodiments of the present invention will not be repeated here.
[0054] S104, performing anomaly detection on the data stream to be detected based on the data stream time series data, and obtaining anomaly detection results of the data stream to be detected.
[0055] Optionally, the anomaly detection result can be an anomaly category or a non-abnormal category, in which case the anomaly detection process can be a binary classification process; if the anomaly detection result is used to indicate that the data flow to be detected is abnormal (such as the anomaly detection result is an abnormal category), it can be determined that the data flow to be detected has not passed the anomaly detection, and each data packet to be detected can be discarded. Correspondingly, if the anomaly detection result is used to indicate that the data flow to be detected is not abnormal (such as the anomaly detection result is a non-abnormal category), it can be determined that the data flow to be detected has passed the anomaly detection, and each data packet to be detected can be parsed. Optionally, the anomaly category can also include multiple anomaly subcategories, such as multiple anomaly subcategories that can include but are not limited to: traffic surge anomaly category, packet loss anomaly category, data leakage anomaly category, and packet attack anomaly category, etc. At this time, the anomaly detection process can be a multi-classification process, then the anomaly detection result can be any one of the multiple anomaly subcategories and the non-abnormal category; then if the anomaly detection result is any one of the multiple anomaly subcategories, it can be determined that the data flow to be detected is abnormal, and data processing is performed according to the anomaly detection result, such as when the anomaly detection result is a packet attack anomaly category, each data packet to be detected can be discarded, and so on.
[0056] In summary, the embodiment of the present invention can filter out the data packet feature set from the initial data packet feature set through the target random forest, thereby extracting the data packet feature set with a larger contribution, which can effectively reduce the dimension of the representation vector, thereby improving the computational efficiency and reducing the computational resources; based on this, the application scenarios of electronic devices with limited resources (such as scenarios such as the Internet of Vehicles) can be effectively considered, thereby realizing the determination of the abnormal detection results under limited resource conditions, thereby improving information security; and when the abnormal category includes multiple abnormal subcategories, it can determine whether the traffic transmission is abnormal, thereby ensuring the efficiency and stability of communication, etc. It can be seen that when the electronic device is a vehicle-mounted terminal, the embodiment of the present invention can prevent potential network attacks through abnormal detection (especially encrypted traffic abnormal detection), thereby accurately judging the hidden attack behavior in the network through the abnormal detection results, ensuring the communication security between vehicles, vehicles and infrastructure, and vehicles and the cloud, ensuring the data integrity and confidentiality during the communication process, and preventing data from being tampered with or leaked; and the representation vector to be detected of each data packet to be detected is obtained by statistical quantification of the data packet feature set, which can have the performance of simplicity, generality and high efficiency.
[0057] The embodiment of the present invention can determine a data packet feature set when a data stream to be detected is detected, the data stream to be detected includes at least one data packet to be detected, the data stream to be detected is encrypted traffic, and one data packet to be detected is an encrypted data packet; and based on the data packet feature set, obtain the to-be-detected representation vector of each to-be-detected data packet in the data stream to be detected, and one to-be-detected representation vector includes the feature value of each data packet feature in the data packet feature set under the corresponding data packet to be detected. Further, based on the to-be-detected representation vector of each data packet to be detected, the data stream time series data of the data stream to be detected can be constructed; and based on the data stream time series data, the data stream to be detected is subjected to anomaly detection to obtain anomaly detection results of the data stream to be detected. It can be seen that the embodiment of the present invention can obtain anomaly detection results with high accuracy through data flow timing data to determine whether the data flow to be detected is abnormal, thereby effectively improving the information security of intelligent connected vehicles and reducing information security risks, and there is no need to use matching rules to achieve anomaly detection, and the robustness is high; and each data packet feature in the data packet feature set is still visible in the encrypted traffic, and the data packet to be detected can be accurately represented in a fine-grained manner through the data packet feature set, and the flow-level semantics can be obtained at the packet level granularity (that is, the data flow timing data of the data flow to be detected can be obtained through the representation vector of each data packet to be detected), so as to obtain a fine-grained representation of the data flow to be detected, and then realize the fine-grained anomaly detection of encrypted traffic. In addition, the embodiment of the present invention can consider the timing characteristics in the data flow to be detected through the data flow timing data, that is, consider the timing relationship between each data packet to be detected, thereby further improving the accuracy of the anomaly detection result.
[0058] Based on the above description, the embodiment of the present invention also proposes a more specific method for detecting fine-grained anomalies in encrypted traffic of intelligent connected vehicles. Accordingly, the method for detecting fine-grained anomalies in encrypted traffic of intelligent connected vehicles can be executed by the electronic device (terminal or server) mentioned above; or, the method for detecting fine-grained anomalies in encrypted traffic of intelligent connected vehicles can be executed jointly by the terminal and the server. For the sake of ease of explanation, the following description will be made by taking the example of an electronic device executing the method for detecting fine-grained anomalies in encrypted traffic of intelligent connected vehicles; please refer to Figure 3 The method for detecting fine-grained anomalies of encrypted traffic of intelligent connected vehicles may include the following steps S301-S305:
[0059] S301, when a data stream to be detected is detected, a data packet feature set is determined, where the data stream to be detected includes at least one data packet to be detected.
[0060] S302, based on the data packet feature set, obtaining a representation vector for each data packet to be detected in the data stream to be detected, wherein one representation vector to be detected includes a feature value of each data packet feature in the data packet feature set under the corresponding data packet to be detected.
[0061] Optionally, the data formats of each eigenvalue in a representation vector are the same, such as all are hexadecimal data format or decimal data format; optionally, if there are eigenvalues with different data formats, the data format of each eigenvalue can be unified according to a preset data format, so that the data formats of each eigenvalue in a representation vector are the same; optionally, the preset data format can be set according to experience or according to actual needs, and the embodiments of the present invention are not limited to this.
[0062] S303 , extracting features from the representation vectors to be detected of the respective data packets to be detected, and obtaining target representation vectors of the corresponding data packets to be detected.
[0063] In an embodiment of the present invention, a target representation vector of a data packet to be detected may be determined by a target convolutional neural network (CNN); based on this, for any data packet to be detected in the data stream to be detected, the electronic device may determine the target image size; optionally, the electronic device may use a preset image size as the target image size, or may determine the target image size based on the length of the representation vector to be detected of any data packet to be detected (i.e., the vector dimension), etc., and the embodiment of the present invention does not limit this; optionally, the preset image size may be set according to experience, or may be set according to actual needs, and the embodiment of the present invention does not limit this. Optionally, when determining the target image size based on the length of the representation vector to be detected of any data packet to be detected, the length of the representation vector to be detected of any data packet to be detected may be squared to obtain a length square root operation result, and the rounding result of the length square root operation result may be used as the target image size, and the rounding result or the rounding result of the length square root operation result may be used as the target image size, and the like.
[0064] Then, accordingly, the electronic device can perform image conversion on the representation vector to be detected of any data packet to be detected according to the target image size, and obtain the image data corresponding to any data packet to be detected. Optionally, the electronic device can generate an initial grayscale image corresponding to any data packet to be detected according to the target image size, the size of the initial grayscale image is the target image size, and each pixel value in the initial grayscale image can be a preset pixel value; based on this, each characteristic value in the representation vector to be detected of any data packet to be detected can be filled into the initial grayscale image in sequence, so that each characteristic value in the representation vector to be detected of any data packet to be detected is sequentially used as the pixel value of the corresponding pixel point in the initial grayscale image, thereby obtaining the image data corresponding to any data packet to be detected; or, the electronic device can perform normalization processing on the representation vector to be detected of any data packet to be detected, obtain the normalized representation vector, and fill each characteristic value in the normalized representation vector into the initial grayscale image in sequence, thereby obtaining the image data corresponding to any data packet to be detected, and so on. Optionally, the preset pixel value can be set according to experience or according to actual needs, and the embodiment of the present invention is not limited to this; exemplary, the preset pixel value can be 0. Optionally, the electronic device may fill the initial grayscale image in a row priority order, or may fill the initial grayscale image in a column priority order, etc., which is not limited in the embodiment of the present invention.
[0065] For example, taking the example of filling each eigenvalue in the to-be-detected representation vector of any to-be-detected data packet into the initial grayscale image in row priority order, assuming that the target image size is 28×28, the electronic device may use the first eigenvalue in the to-be-detected representation vector of any to-be-detected data packet as the pixel value of the pixel point in the first row and first column of the initial grayscale image, the second eigenvalue as the pixel value of the pixel point in the first row and second column of the initial grayscale image, ..., the 28th eigenvalue as the pixel value of the pixel point in the first row and 28th column of the initial grayscale image, the 29th eigenvalue as the pixel value of the pixel point in the second row and first column of the initial grayscale image, the 30th eigenvalue as the pixel value of the pixel point in the second row and second column of the initial grayscale image, ..., etc. It can be seen that at this time, the first row in the initial grayscale image can be filled first and then the second row, and so on.
[0066] Furthermore, the electronic device may call the target convolutional neural network to perform feature extraction on the image data corresponding to any data packet to be detected, obtain the first feature extraction representation vector of any data packet to be detected, and determine the target representation vector of any data packet to be detected based on the first feature extraction representation vector of any data packet to be detected. Optionally, the embodiment of the present invention does not limit the specific model structure of the convolutional neural network; illustratively, the first convolutional layer of the convolutional neural network involved in the embodiment of the present invention may include a convolutional kernel of size 3×3 and a depth (i.e., the number of convolutional kernels) of 32, that is, a convolutional kernel of size 3×3 and a depth of 32 may be used to perform feature extraction in the first convolutional layer of the convolutional neural network, and no padding strategy may be used here to maintain the original size of the image; then, the ReLU activation function may be used to increase nonlinearity, and the 2×2 maximum pooling may be used to reduce the dimension to enhance the feature capture capability; and, the first The depth of the second convolutional layer can be increased to 64, such as the second convolutional layer may include a convolution kernel of size 3×3 and depth 64, so as to continue to refine the feature extraction, followed by a ReLU activation function and a 2×2 maximum pooling; finally, the convolutional neural network may include a fully connected layer, that is, the features can be integrated through the fully connected layer, so as to obtain the first feature extraction representation vector of any data packet to be detected; it should be understood that in the process of training the convolutional neural network, a softmax (an activation function) layer can also be used for classification (such as when classifying by protocol type, encrypted traffic of different protocol types can be effectively identified), such as Figure 4 shown.
[0067] Optionally, the electronic device may also obtain image data corresponding to each training data packet in multiple training data packets and feature extraction labels for each training data packet; optionally, a feature extraction label may be an abnormal category identifier or a non-abnormal category identifier (in this case, it may be classified according to whether it is abnormal to train the convolutional neural network), or it may be a protocol type identifier of the corresponding training data packet (in this case, it may be classified according to the protocol type to train the convolutional neural network), etc., and the embodiments of the present invention do not limit this. Then, accordingly, the electronic device may call the initial convolutional neural network, perform feature extraction on the image data corresponding to each training data packet respectively, obtain the first feature extraction representation vector of the corresponding training data packet, and use the first feature extraction representation vector of each training data packet to perform classification prediction, obtain the classification prediction result of the corresponding training data packet, thereby calculating the first model loss value based on the classification prediction result and feature extraction label of each training data packet, and optimizing the model parameters in the initial convolutional neural network in the direction of reducing the first model loss value, to obtain the initial convolutional neural network after model optimization. Based on this, the electronic device can determine the target convolutional neural network based on the initial convolutional neural network after model optimization; specifically, the electronic device can continue to use the image data corresponding to each training data packet and the feature extraction label of each training data packet to perform model training on the initial convolutional neural network after model optimization until the convergence condition is met (such as the number of iterations reaches the first preset iteration number threshold or the first model loss value is less than the first model loss threshold, etc.), and use the convolutional neural network that meets the convergence condition as the target convolutional neural network. Optionally, the first preset iteration number threshold and the first model loss threshold can be set according to experience or according to actual needs, and the embodiment of the present invention is not limited to this.
[0068] Optionally, when the electronic device is a vehicle-mounted terminal, due to the limited computing resources and high real-time requirements in the Internet of Vehicles environment, and the trend of dynamic change of data streams, the embodiment of the present invention can use Adam (Adaptive Moment Estimation) to optimize the model parameters in the convolutional neural network, that is, the electronic device can use the adaptive moment estimation algorithm to optimize the model of the initial convolutional neural network based on the image data corresponding to each training data packet and the feature extraction label of each training data packet, so as to obtain the target convolutional neural network; wherein, the Adam method combines the advantages of the momentum method and RMSprop (Root Mean Square Propagation, an adaptive learning rate method), and adjusts the learning rate of each parameter by calculating the first-order matrix estimation and second-order moment estimation of the gradient, and Adam also shows very high efficiency and excellent robustness under a variety of different conditions and data sets; based on this, the embodiment of the present invention can provide fast and stable convergence performance through Adam in the Internet of Vehicles environment, and in addition, due to its built-in learning rate adjustment mechanism, the model training can be made more efficient and more stable.
[0069] In a specific implementation, the electronic device may extract a representation vector of the first feature of any data packet to be detected as a target representation vector of any data packet to be detected, so as to determine the target representation vector of any data packet to be detected based on the representation vector extracted from the first feature of any data packet to be detected.
[0070] In another specific implementation, the electronic device may also call the target self-attention mechanism model to perform feature extraction on the representation vector of each data packet to be detected, and obtain a second feature extraction representation vector of each data packet to be detected; based on this, when determining the target representation vector of any data packet to be detected based on the first feature extraction representation vector of any data packet to be detected, the electronic device may integrate the first feature extraction representation vector and the second feature extraction representation vector of any data packet to be detected, and obtain the target representation vector of any data packet to be detected, and so on.
[0071] Optionally, when the first feature extraction representation vector and the second feature extraction representation vector of any data packet to be detected are integrated to obtain the target representation vector of any data packet to be detected, a mean operation can be performed on the first feature extraction representation vector and the second feature extraction representation vector of any data packet to be detected to obtain a vector mean operation result, and the vector mean operation result is used as the target representation vector of any data packet to be detected; or, the first feature extraction representation vector and the second feature extraction representation vector of any data packet to be detected can be spliced to obtain a spliced representation vector, and the spliced representation vector is used as the target representation vector of any data packet to be detected; or, after obtaining the spliced representation vector of each data packet to be detected, principal component analysis can be performed on the spliced representation vector of each data packet to be detected to achieve dimensionality reduction processing of each data packet to be detected, thereby obtaining the target representation vector of each data packet to be detected, and so on; the embodiments of the present invention are not limited to this.
[0072] It can be seen that the embodiment of the present invention can obtain the second feature extraction representation vector of each data packet to be detected through the target self-attention mechanism model, and thus construct the target representation vector of each data packet to be detected through the first feature extraction representation vector and the second feature extraction representation vector of each data packet to be detected, so as to improve the accuracy of the target representation vector of each data packet to be detected, that is, the target representation vector of each data packet to be detected can more accurately describe the data flow to be detected.
[0073] Optionally, a self-attention mechanism model can be a Transformer model (a model that learns context and thus meaning through relationships in sequence data), or a BERT model (BidirectionalEncoder Representation from Transformers, a pre-trained language representation model), etc., which is not limited in the embodiments of the present invention. Optionally, the electronic device can also obtain the representation vector to be detected of each data packet included in each training data stream in multiple training data streams; for any training data stream in multiple training data streams, the initial self-attention mechanism model can be called to extract features of the representation vector to be detected of each data packet in any training data stream to obtain the second feature extraction representation vector of each data packet in any training data stream, so that after obtaining the second feature extraction representation vector of each data packet in each training data stream, the attention model loss value is calculated based on the second feature extraction representation vector of each data packet in each training data stream, so as to optimize the model parameters in the initial self-attention mechanism model in the direction of reducing the attention model loss value, and obtain the initial self-attention mechanism model after model optimization, so as to determine the target self-attention mechanism model based on the initial self-attention mechanism model after model optimization. Optionally, the electronic device may use the representation vector to be detected of each data packet included in each training data stream to continue model training for the initial self-attention mechanism model after model optimization until a convergence condition is reached (such as the number of iterations reaches the attention iteration number threshold or the attention model loss value is less than the attention model loss threshold, etc.), thereby using the self-attention mechanism model when the convergence condition is reached as the target self-attention mechanism model, etc. Optionally, both the attention iteration number threshold and the attention model loss threshold can be set according to experience or according to actual needs, and the embodiments of the present invention are not limited to this.
[0074] S304, constructing data stream timing data of the data stream to be detected based on the target representation vector of each data packet to be detected, wherein the data stream timing data sequentially includes the target representation vector of each data packet to be detected in chronological order.
[0075] Specifically, the electronic device may serialize the target representation vectors of each data packet to be detected into data stream timing data of the data stream to be detected in chronological order, so as to construct the data stream timing data of the data stream to be detected based on the target representation vectors of each data packet to be detected.
[0076] Based on this, the embodiment of the present invention can obtain data flow timing data with higher accuracy through the target representation vector of each data packet to be detected, so as to more accurately represent the data flow to be detected through the data flow timing data.
[0077] S305: Based on the data stream time series data, perform anomaly detection on the data stream to be detected to obtain an anomaly detection result of the data stream to be detected.
[0078] In an embodiment of the present invention, the anomaly detection result can be determined by a target bidirectional long short-term memory network (Bi-directional Long Short-Term Memory, BiLSTM); based on this, the target bidirectional long short-term memory network can be called to perform anomaly detection on the data stream to be detected based on the data stream time series data to obtain the anomaly detection result of the data stream to be detected, that is, the data stream time series data can be input into the target bidirectional long short-term memory network to run the target bidirectional long short-term memory network and output the anomaly detection result. Among them, BiLSTM retains the basic principles of the long short-term memory network (Long Short-Term Memory, LSTM), and effectively realizes the long-term and short-term memory of information by introducing four main components: forget gate, input gate, memory unit update and output gate. The role of the forget gate is to determine which information should be retained or discarded. This design enables BiLSTM to not only process complex time series data, but also capture past and future information through a bidirectional structure, such as Figure 5 As shown; based on this, the embodiments of the present invention can greatly improve the performance and accuracy in processing time series features through the target bidirectional long short-term memory network, thereby improving the accuracy of anomaly detection results.
[0079] Optionally, the electronic device may also obtain the training data stream time series data of each training data stream in multiple training data streams and the anomaly detection label of each training data stream, and the training data stream time series data of a training data stream is constructed by the target representation vector of each training data packet in the corresponding training data stream. Among them, an anomaly detection label can be an abnormal category identifier or a non-abnormal category identifier, in which case the anomaly detection can be a binary classification process; optionally, the abnormal category identifier may include multiple abnormal subcategory identifiers, that is, the abnormal category may include multiple abnormal subcategories, and an abnormal subcategory identifier can be used to indicate an abnormal subcategory, in which case the anomaly detection can be a multi-classification process; the embodiment of the present invention does not limit this. Then, accordingly, the electronic device can call the initial bidirectional long short-term memory network, perform anomaly detection on the corresponding training data stream based on the time series data of each training data stream, and obtain the anomaly detection probability vector of each training data stream. The anomaly detection probability vector of a training data stream can be used to indicate the probability that the corresponding training data stream belongs to each classification category (such as the probability of belonging to an abnormal category and the probability of belonging to a non-abnormal category, etc.), and calculate the second model loss value based on the anomaly detection probability vector and the anomaly detection label of each training data stream, so as to optimize the model parameters in the initial bidirectional long short-term memory network in the direction of reducing the second model loss value, and obtain the initial bidirectional long short-term memory network after model optimization. Based on this, the electronic device can determine the target bidirectional long short-term memory network based on the initial bidirectional long short-term memory network after model optimization; specifically, the electronic device can continue to use the training data stream time series data and anomaly detection labels of each training data stream to perform model training on the initial bidirectional long short-term memory network after model optimization until the convergence condition is reached (such as the number of iterations reaches the second preset number of iterations threshold or the second model loss value is less than the second model loss threshold, etc.), so as to use the bidirectional long short-term memory network that meets the convergence condition as the target bidirectional long short-term memory network. Optionally, the second preset iteration number threshold and the second model loss threshold may be set based on experience or actual needs, and this is not limited in the embodiment of the present invention.
[0080] Optionally, in the process of optimizing the parameters of the bidirectional long short-term memory network, the electronic device may also use the Adam algorithm to optimize the model parameters in the bidirectional long short-term memory network, thereby effectively accelerating the training process. Optionally, when calculating the model loss value (such as the first model loss value or the second model loss value), the electronic device may use the cross entropy loss function to calculate the difference between the model output and the true label to achieve the calculation of the model loss value.
[0081] In other embodiments, the anomaly detection result may also be determined by a long short-term memory network, etc.; the present invention is not limited to this.
[0082] When a data stream to be detected is detected, the embodiment of the present invention can determine a data packet feature set, wherein the data stream to be detected includes at least one data packet to be detected; and based on the data packet feature set, obtain a representation vector to be detected of each data packet to be detected in the data stream to be detected, wherein one representation vector to be detected includes the feature value of each data packet feature in the data packet feature set under the corresponding data packet to be detected. Further, feature extraction can be performed on the representation vector to be detected of each data packet to be detected, respectively, to obtain a target representation vector of the corresponding data packet to be detected; and based on the target representation vector of each data packet to be detected, data stream time series data of the data stream to be detected is constructed, and the data stream time series data sequentially includes the target representation vectors of each data packet to be detected in chronological order; and further, based on the data stream time series data, anomaly detection can be performed on the data stream to be detected, to obtain anomaly detection results of the data stream to be detected. It can be seen that the embodiments of the present invention can obtain a target representation vector with higher accuracy through feature extraction to more accurately represent the corresponding data packet to be detected, so that data stream timing data with higher accuracy can be constructed through the target representation vector of each data packet to be detected to further improve the accuracy of the anomaly detection result; based on this, the embodiments of the present invention can determine whether the data stream to be detected is abnormal through anomaly detection results with higher accuracy, thereby improving the information security of intelligent connected vehicles and reducing information security risks.
[0083] Based on the description of the related embodiments of the method for detecting fine-grained anomalies of encrypted traffic of intelligent connected vehicles, the embodiment of the present invention further proposes a device for detecting fine-grained anomalies of encrypted traffic of intelligent connected vehicles, and the device for detecting fine-grained anomalies of encrypted traffic of intelligent connected vehicles can be a computer program (including program code) running in an electronic device; Figure 6 As shown, the intelligent network-connected vehicle encrypted traffic fine-grained anomaly detection device may include a processing unit 601 and an acquisition unit 602. The intelligent network-connected vehicle encrypted traffic fine-grained anomaly detection device may execute Figure 1 or Figure 3 The method for detecting fine-grained anomalies of encrypted traffic of intelligent connected vehicles shown in the figure, that is, the device for detecting fine-grained anomalies of encrypted traffic of intelligent connected vehicles can run the above-mentioned units:
[0084] The processing unit 601 is used to determine a data packet feature set when a data stream to be detected is detected, wherein the data stream to be detected includes at least one data packet to be detected; wherein the data stream to be detected is encrypted traffic, and one data packet to be detected is an encrypted data packet;
[0085] An acquisition unit 602 is configured to acquire, based on the data packet feature set, a representation vector to be detected of each data packet to be detected in the data stream to be detected, wherein one representation vector to be detected includes a feature value of each data packet feature in the data packet feature set under the corresponding data packet to be detected;
[0086] The processing unit 601 is further configured to construct data stream timing data of the data stream to be detected based on the to-be-detected representation vectors of the to-be-detected data packets;
[0087] The processing unit 601 is further configured to perform anomaly detection on the data stream to be detected based on the data stream time series data to obtain an anomaly detection result of the data stream to be detected.
[0088] In one implementation, when the processing unit 601 constructs the data flow timing data of the data flow to be detected based on the to-be-detected representation vectors of the to-be-detected data packets, it can be specifically used to:
[0089] Extracting features from the representation vectors to be detected of the respective data packets to be detected to obtain target representation vectors of the corresponding data packets to be detected;
[0090] Based on the target representation vector of each data packet to be detected, data stream timing data of the data stream to be detected is constructed, and the data stream timing data sequentially includes the target representation vector of each data packet to be detected in chronological order.
[0091] In another implementation manner, a target representation vector of a data packet to be detected is determined by a target convolutional neural network, and the processing unit 601 extracts features of the representation vectors to be detected of each data packet to be detected, respectively, to obtain the target representation vector of the corresponding data packet to be detected, which can be specifically used for:
[0092] For any data packet to be detected in the data stream to be detected, determining a target image size;
[0093] According to the target image size, performing image conversion on the to-be-detected representation vector of any to-be-detected data packet to obtain image data corresponding to any to-be-detected data packet;
[0094] Call the target convolutional neural network to perform feature extraction on the image data corresponding to any data packet to be detected, obtain a first feature extraction representation vector of any data packet to be detected, and determine a target representation vector of any data packet to be detected based on the first feature extraction representation vector of any data packet to be detected.
[0095] In another implementation, the processing unit 601 may also be used to:
[0096] Calling the target self-attention mechanism model to perform feature extraction on the representation vector to be detected of each of the data packets to be detected, and obtaining a second feature extraction representation vector of each of the data packets to be detected;
[0097] When the processing unit 601 extracts the representation vector based on the first feature of any data packet to be detected and determines the target representation vector of any data packet to be detected, it can be specifically used to:
[0098] The first feature extraction representation vector and the second feature extraction representation vector of any data packet to be detected are integrated to obtain a target representation vector of any data packet to be detected.
[0099] In another embodiment, the anomaly detection result is determined by a target bidirectional long short-term memory network.
[0100] In another implementation, the acquisition unit 602 may also be used to:
[0101] Acquire a feature screening training sample set, where one feature screening training sample includes an initial representation vector and a training label of a training data packet, and one initial representation vector includes a feature value of each initial data packet feature in the initial data packet feature set under the corresponding training data packet;
[0102] The processing unit 601 may also be used to:
[0103] The feature-screening training sample set is used to construct a target random forest, wherein the target random forest includes N decision trees, where N is a positive integer;
[0104] Determining the contribution of each of the initial data packet features respectively through the target random forest;
[0105] Based on the contribution of each of the initial data packet features, the data packet feature set is filtered out from the initial data packet feature set; wherein the contribution of any data packet feature in the data packet feature set is greater than or equal to the contribution of any initial data packet feature in the initial data packet feature set except the data packet feature set.
[0106] According to one embodiment of the present invention, Figure 1 or Figure 3 Each step involved in the method shown can be Figure 6 The fine-grained anomaly detection device for encrypted traffic of intelligent connected vehicles is executed by various units. For example, Figure 1 The steps S101, S103 and S104 shown in FIG. 1 can be performed by Figure 6 The processing unit 601 shown in FIG. 1 is executed, and step S102 can be performed by Figure 6 The acquisition unit 602 shown in is executed. For example, Figure 3 The steps S301 and S303-S305 shown in FIG. 1 can be performed by Figure 6 The processing unit 601 shown in FIG. 1 is executed, and step S302 can be performed by Figure 6The acquisition unit 602 shown in is executed, and so on.
[0107] According to another embodiment of the present invention, Figure 6 Each unit in the fine-grained anomaly detection device for encrypted traffic of intelligent connected vehicles shown can be separately or completely combined into one or several other units to constitute, or one (some) of the units can be further divided into multiple functionally smaller units to constitute, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present invention. The above-mentioned units are divided based on logical functions. In practical applications, the function of one unit can also be implemented by multiple units, or the functions of multiple units can be implemented by one unit. In other embodiments of the present invention, any fine-grained anomaly detection device for encrypted traffic of intelligent connected vehicles may also include other units. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented by the collaboration of multiple units.
[0108] According to another embodiment of the present invention, the program can be executed by running a program on a general electronic device such as a computer including a central processing unit (CPU), a random access memory medium (RAM), a read-only memory medium (ROM), and other processing elements and storage elements. Figure 1 or Figure 3 A computer program (including program code) for each step involved in the corresponding method shown in Figure 6 The apparatus for detecting fine-grained anomalies of encrypted traffic of intelligent networked vehicles shown in the embodiment of the present invention and the method for detecting fine-grained anomalies of encrypted traffic of intelligent networked vehicles are implemented. The computer program can be recorded on, for example, a computer storage medium, and loaded into the above-mentioned electronic device through the computer storage medium and run therein.
[0109] The embodiment of the present invention can determine a data packet feature set when a data stream to be detected is detected, the data stream to be detected includes at least one data packet to be detected, the data stream to be detected is encrypted traffic, and one data packet to be detected is an encrypted data packet; and based on the data packet feature set, obtain the to-be-detected representation vector of each to-be-detected data packet in the data stream to be detected, and one to-be-detected representation vector includes the feature value of each data packet feature in the data packet feature set under the corresponding data packet to be detected. Further, based on the to-be-detected representation vector of each data packet to be detected, the data stream time series data of the data stream to be detected can be constructed; and based on the data stream time series data, the data stream to be detected is subjected to anomaly detection to obtain anomaly detection results of the data stream to be detected. It can be seen that the embodiment of the present invention can obtain anomaly detection results with high accuracy through data flow timing data to determine whether the data flow to be detected is abnormal, thereby effectively improving the information security of intelligent connected vehicles and reducing information security risks, and there is no need to use matching rules to achieve anomaly detection, and the robustness is high; and each data packet feature in the data packet feature set is still visible in the encrypted traffic, and the data packet to be detected can be accurately represented in a fine-grained manner through the data packet feature set, and the flow-level semantics can be obtained at the packet level granularity (that is, the data flow timing data of the data flow to be detected can be obtained through the representation vector of each data packet to be detected), so as to obtain a fine-grained representation of the data flow to be detected, and then realize the fine-grained anomaly detection of encrypted traffic. In addition, the embodiment of the present invention can consider the timing characteristics in the data flow to be detected through the data flow timing data, that is, consider the timing relationship between each data packet to be detected, thereby further improving the accuracy of the anomaly detection result.
[0110] Based on the description of the above method embodiment and device embodiment, the exemplary embodiment of the present invention further provides an electronic device, including: at least one processor; and a memory connected to the at least one processor in communication. The memory stores a computer program that can be executed by the at least one processor, and the computer program is used to enable the electronic device to perform the method according to the embodiment of the present invention when executed by the at least one processor.
[0111] Exemplary embodiments of the present invention also provide a non-transitory computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor of a computer, is used to cause the computer to perform a method according to an embodiment of the present invention.
[0112] An exemplary embodiment of the present invention further provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor of a computer, the computer is used to enable the computer to perform a method according to an embodiment of the present invention.
[0113] refer to Figure 7, a block diagram of an electronic device 700 that can be used as a server or client of the present invention will now be described, which is an example of a hardware device that can be applied to various aspects of the present invention. The electronic device is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0114] like Figure 7 As shown, the electronic device 700 includes a computing unit 701, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 702 or a computer program loaded from a storage unit 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the electronic device 700 can also be stored. The computing unit 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0115] A plurality of components in the electronic device 700 are connected to the I / O interface 705, including: an input unit 706, an output unit 707, a storage unit 708, and a communication unit 709. The input unit 706 may be any type of device capable of inputting information to the electronic device 700, and the input unit 706 may receive input digital or character information, and generate key signal inputs related to user settings and / or function control of the electronic device. The output unit 707 may be any type of device capable of presenting information, and may include but is not limited to a display, a speaker, a video / audio output terminal, a vibrator, and / or a printer. The storage unit 708 may include but is not limited to a disk, an optical disk. The communication unit 709 allows the electronic device 700 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks, and may include but is not limited to a modem, a network card, an infrared communication device, a wireless communication transceiver, and / or a chipset, such as a Bluetooth™ device, a WiFi device, a WiMax device, a cellular communication device, and / or the like.
[0116] The computing unit 701 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 701 performs the various methods and processes described above. For example, in some embodiments, the fine-grained anomaly detection method for encrypted traffic of intelligent networked vehicles may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 708. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 700 via the ROM 702 and / or the communication unit 709. In some embodiments, the computing unit 701 may be configured to perform the fine-grained anomaly detection method for encrypted traffic of intelligent networked vehicles in any other appropriate manner (e.g., by means of firmware).
[0117] The program code for implementing the method of the present invention can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code can be executed entirely on the machine, partially on the machine, partially on the machine as a stand-alone software package and partially on a remote machine, or entirely on a remote machine or server.
[0118] In the context of the present invention, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0119] As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and / or device (e.g., disk, optical disk, memory, programmable logic device (PLD)) for providing machine instructions and / or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal for providing machine instructions and / or data to a programmable processor.
[0120] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0121] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0122] A computer system may include clients and servers. Clients and servers are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship to each other.
[0123] Furthermore, it should be understood that what is disclosed above is only a preferred embodiment of the present invention, and certainly cannot be used to limit the scope of rights of the present invention. Therefore, equivalent changes made according to the claims of the present invention are still within the scope of the present invention.
Claims
1. A fine-grained anomaly detection method for encrypted traffic of intelligent connected vehicles, characterized in that: include: When a data stream to be detected is detected, a data packet feature set is determined, wherein the data stream to be detected includes at least one data packet to be detected; wherein the data stream to be detected is encrypted traffic, and one data packet to be detected is an encrypted data packet; Based on the data packet feature set, obtaining a representation vector to be detected of each data packet to be detected in the data stream to be detected, wherein one representation vector to be detected includes a feature value of each data packet feature in the data packet feature set under the corresponding data packet to be detected; Constructing data stream timing data of the data stream to be detected based on the to-be-detected representation vectors of the to-be-detected data packets; Based on the data stream time series data, anomaly detection is performed on the data stream to be detected to obtain an anomaly detection result of the data stream to be detected.
2. The method according to claim 1, characterized in that The step of constructing data stream timing data of the data stream to be detected based on the to-be-detected representation vectors of the to-be-detected data packets comprises: Extracting features from the representation vectors to be detected of the respective data packets to be detected to obtain target representation vectors of the corresponding data packets to be detected; Based on the target representation vector of each data packet to be detected, data stream timing data of the data stream to be detected is constructed, and the data stream timing data sequentially includes the target representation vector of each data packet to be detected in chronological order.
3. The method according to claim 2, characterized in that A target representation vector of a data packet to be detected is determined by a target convolutional neural network, and the feature extraction of the representation vectors to be detected of each data packet to be detected is performed to obtain the target representation vector of the corresponding data packet to be detected, including: For any data packet to be detected in the data stream to be detected, determining a target image size; According to the target image size, performing image conversion on the to-be-detected representation vector of any to-be-detected data packet to obtain image data corresponding to any to-be-detected data packet; Call the target convolutional neural network to perform feature extraction on the image data corresponding to any data packet to be detected, obtain a first feature extraction representation vector of any data packet to be detected, and determine a target representation vector of any data packet to be detected based on the first feature extraction representation vector of any data packet to be detected.
4. The method according to claim 3, characterized in that The method further comprises: Calling the target self-attention mechanism model to perform feature extraction on the representation vector to be detected of each of the data packets to be detected, and obtaining a second feature extraction representation vector of each of the data packets to be detected; The extracting a representation vector based on the first feature of any data packet to be detected and determining a target representation vector of any data packet to be detected comprises: The first feature extraction representation vector and the second feature extraction representation vector of any data packet to be detected are integrated to obtain a target representation vector of any data packet to be detected.
5. The method according to any one of claims 1 to 4, characterized in that: The anomaly detection result is determined by a target bidirectional long short-term memory network.
6. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: Acquire a feature screening training sample set, where one feature screening training sample includes an initial representation vector and a training label of a training data packet, and one initial representation vector includes a feature value of each initial data packet feature in the initial data packet feature set under the corresponding training data packet; The feature-screening training sample set is used to construct a target random forest, wherein the target random forest includes N decision trees, where N is a positive integer; Determining the contribution of each of the initial data packet features respectively through the target random forest; Based on the contribution of each of the initial data packet features, the data packet feature set is filtered out from the initial data packet feature set; wherein the contribution of any data packet feature in the data packet feature set is greater than or equal to the contribution of any initial data packet feature in the initial data packet feature set except the data packet feature set.
7. A fine-grained anomaly detection device for encrypted traffic of intelligent connected vehicles, characterized in that: The device comprises: A processing unit, configured to determine a data packet feature set when a data stream to be detected is detected, wherein the data stream to be detected includes at least one data packet to be detected; wherein the data stream to be detected is encrypted traffic, and one data packet to be detected is an encrypted data packet; An acquisition unit, configured to acquire, based on the data packet feature set, a representation vector to be detected of each data packet to be detected in the data stream to be detected, wherein one representation vector to be detected includes a feature value of each data packet feature in the data packet feature set under the corresponding data packet to be detected; The processing unit is further used to construct data flow timing data of the data flow to be detected based on the to-be-detected representation vectors of the to-be-detected data packets; The processing unit is further used to perform anomaly detection on the data stream to be detected based on the data stream time series data to obtain anomaly detection results of the data stream to be detected.
8. An electronic device, characterized in that: include: processor; as well as Memory for storing programs, The program includes instructions, which, when executed by the processor, cause the processor to perform the method according to any one of claims 1 to 6.
9. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to make a computer execute the method according to any one of claims 1-6.
