Hardware trojan detection method, apparatus, device, and storage medium
By classifying and training multiple chip samples to construct a sample data training set, and using a preset classification model to detect hardware Trojans, the problems of low detection accuracy and high cost in existing technologies are solved, achieving efficient and low-cost hardware Trojan detection.
Patent Information
- Application Number
- CN202211209321.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-30
- Publication Date
- 2025-10-24
- Estimated Expiration
- 2042-09-30
AI Technical Summary
Existing hardware Trojan detection technologies suffer from low detection accuracy, high cost, and complex operation.
By classifying multiple chip samples, a sample data training set is constructed, and a preset classification model is used for training to detect whether the sample to be detected contains a hardware Trojan.
It improves the accuracy and efficiency of hardware Trojan detection, and the method is simple to implement and low in cost.
Smart Images

Figure CN115906072B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of information security, and in particular to a hardware Trojan detection method, device, equipment and storage medium. BACKGROUND
[0002] With the increasing popularity of the Internet, the Internet has become an indispensable part of people's life and work. However, the openness of the Internet brings great security risks to people's life while bringing convenience. Therefore, it is crucial to protect the security of the Internet and ensure the confidentiality and integrity of information. At the same time, with the continuous development and improvement of the integrated circuit industry, integrated circuits are also applied to all aspects of life. However, in the design or manufacturing process of integrated circuits, due to the involvement of third-party foundries, the third-party foundries may maliciously tamper with the original circuit, such as implanting hardware Trojan horses on the security vulnerabilities of the circuit to attack, so that the chip has a great security risk. For example, hardware Trojan horse is a kind of hardware Trojan horse that is intentionally implanted in a special module of an electronic system during the manufacturing process of an integrated circuit. Compared with software Trojan horse, hardware Trojan horse has a larger logic component, which does not have a great impact on system efficiency, so it is not easy to be found out, and its design is flexible, the mechanism is complex, and the damage is strong. Once the hardware Trojan horse is invaded, it will bring incalculable economic losses.
[0003] At present, the detection of hardware Trojan horse mainly includes physical detection, functional detection, built-in self-checking technology and bypass signal analysis. Among them, the physical detection is to scan the circuit one by one, and then compare the differences between the two according to the scanning results, and find the hardware Trojan horse in the circuit. The functional detection is to detect the defects or obstacles in the chip creation process. The built-in self-checking technology is a kind of trusted chip that generates a signature on the circuit, while the chip containing defects or implanted Trojan horse will generate another different signature, and the different signatures are used to distinguish the Trojan horse chip to detect the hardware Trojan horse. The bypass signal analysis is to collect temperature, electromagnetic radiation and other power consumption information, and use signal processing technology to extract information for Trojan detection. Although the current hardware Trojan detection has achieved certain research results, there are still problems such as low detection accuracy, high detection cost and complex operation. SUMMARY
[0004] The present application aims to at least solve one of the technical problems in the related art. To this end, the first object of the present application is to provide a hardware Trojan detection method, which can not only improve the efficiency and accuracy of Trojan detection, but also is simple and easy to implement, and low in cost.
[0005] The second object of the present application is to provide a computer readable storage medium.
[0006] A third object of the present application is to provide a detection device.
[0007] A fourth object of the present application is to provide a hardware Trojan detection device.
[0008] To achieve the above objects, a first aspect of the present application provides a hardware Trojan detection method, comprising: classifying a plurality of chip samples in different ways to obtain a normal sample set and a Trojan sample set; obtaining sample data of each sample in the normal sample set and the Trojan sample set to obtain a normal sample data set and a Trojan sample data set; constructing a sample data training set according to the normal sample data set and the Trojan sample data set; training a preset classification model using the sample data training set to obtain a trained classification model; and detecting whether a to-be-detected sample has a hardware Trojan using the trained classification model.
[0009] According to the hardware Trojan detection method of the present application, a plurality of chip samples are classified in different ways to obtain a normal sample set and a Trojan sample set, and sample data of each sample in the normal sample set and the Trojan sample set is obtained to obtain a normal sample data set and a Trojan sample data set. A sample data training set is constructed according to the normal sample data set and the Trojan sample data set. Then, a preset classification model is trained using the sample data training set to obtain a trained classification model. Finally, whether a to-be-detected sample has a hardware Trojan is detected using the trained classification model. Since the plurality of chip samples are classified in different ways to obtain the sample data training set, the classification result is more accurate, thereby ensuring the accuracy of the positive samples and the negative samples in the sample data training set, so as to improve the accuracy of Trojan detection. Moreover, the detection is performed based on the trained classification model, which can improve the efficiency of Trojan detection. The method is simple and easy to implement, and has low cost.
[0010] In some embodiments, the plurality of chip samples are classified in different ways to obtain a normal sample set and a Trojan sample set, comprising: classifying the plurality of chip samples in different ways to obtain a first normal sample set and a first Trojan sample set, and a second normal sample set and a second Trojan sample set; obtaining an intersection of the first normal sample set and the second normal sample set to obtain the normal sample set, and obtaining an intersection of the first Trojan sample set and the second Trojan sample set to obtain the Trojan sample set.
[0011] In some embodiments, the plurality of chip samples are classified in different manners respectively, including: the plurality of chip samples are classified by using a power consumption data analysis manner to obtain a first normal sample set and a first Trojan sample set; and the plurality of chip samples are classified by using a self-comparison manner to obtain a second normal sample set and a second Trojan sample set.
[0012] In some embodiments, the plurality of chip samples are classified by using the power consumption data analysis manner, including: each chip sample in the plurality of chip samples is simulated to obtain side channel current information, the side channel current information being used to represent power consumption of the chip sample; and the plurality of chip samples are classified according to the side channel current information.
[0013] In some embodiments, the plurality of chip samples are classified by using the self-comparison manner, including: an excitation signal is applied to each chip sample in the plurality of chip samples, and a flow value of the excitation signal in different time windows is obtained; and the plurality of chip samples are classified according to a change of the flow value.
[0014] In some embodiments, the hardware Trojan detection method further includes: according to the normal sample data set and the Trojan sample data set, a sample data test set and a sample data verification set are constructed; the trained classification model is tested by using the sample data test set to obtain a tested classification model, and the tested classification model is verified by using the sample data verification set to obtain a verification result; and the trained classification model is optimized according to the verification result.
[0015] In some embodiments, the trained classification model is optimized according to the verification result, including: in a case where the verification result does not satisfy a preset requirement, the sample data training set is denoised to obtain a denoised sample data training set; and the trained classification model is trained by using the denoised sample data training set to optimize the trained classification model.
[0016] To achieve the above object, a second aspect of the present application provides a computer readable storage medium, which stores a hardware Trojan detection program, and the hardware Trojan detection program is executed by a processor to implement the hardware Trojan detection method of any of the above embodiments.
[0017] The computer readable storage medium according to the embodiments of the present application adopts the hardware Trojan detection method described above, which can improve the efficiency and accuracy of Trojan detection, and the method is simple, easy to implement and low in cost.
[0018] To achieve the above object, a third aspect of the present application provides a detection device, which includes a memory, a processor and a hardware Trojan detection program stored in the memory and executable on the processor, and the processor implements the hardware Trojan detection method of any of the above embodiments when executing the program.
[0019] The detection device according to the embodiment of the present application adopts the hardware Trojan detection method described above, and can improve the efficiency and accuracy of Trojan detection, and the method is simple, easy to implement and low in cost.
[0020] To achieve the above object, the fourth aspect embodiment of the present application provides a hardware Trojan detection device, which comprises: a sample construction unit, configured to classify a plurality of chip samples in different ways to obtain a normal sample set and a Trojan sample set, and obtain sample data of each sample in the normal sample set and the Trojan sample set to obtain a normal sample data set and a Trojan sample data set, and construct a sample data training set according to the normal sample data set and the Trojan sample data set; a model training unit, configured to train a preset classification model using the sample data training set to obtain a trained classification model; and a detection unit, configured to detect whether a to-be-detected sample has a hardware Trojan using the trained classification model.
[0021] The hardware Trojan detection device according to the embodiment of the present application classifies a plurality of chip samples in different ways by the sample construction unit to obtain a normal sample set and a Trojan sample set, and obtains sample data of each sample in the normal sample set and the Trojan sample set to obtain a normal sample data set and a Trojan sample data set, and constructs a sample data training set according to the normal sample data set and the Trojan sample data set; then, the model training unit trains a preset classification model using the sample data training set to obtain a trained classification model; finally, the detection unit detects whether a to-be-detected sample has a hardware Trojan using the trained classification model. Since the plurality of chip samples are classified in different ways to obtain the sample data training set, the classification result is more accurate, and the accuracy of positive samples and negative samples in the sample data training set is ensured, so that the accuracy of Trojan detection can be improved, and the efficiency of Trojan detection can be improved based on the trained classification model during detection, and the method is simple, easy to implement and low in cost.
[0022] Additional aspects and advantages of the application will be set forth in part in the description which follows, and in part will become apparent to those skilled in the art upon examination of the following and / or can be learned by practice of the application. BRIEF DESCRIPTION OF DRAWINGS
[0023] Figure 1 Flowchart of a hardware Trojan detection method according to one embodiment of the present application;
[0024] Figure 2 Structure diagram of a side channel test platform according to one embodiment of the present application;
[0025] Figure 3A clustering result diagram obtained by training a classification model according to a training set of un-noise-processed sample data of one specific embodiment of the present application;
[0026] Figure 4 A clustering result diagram obtained by training a classification model according to a training set of noise-processed sample data of one specific embodiment of the present application;
[0027] Figure 5 A flowchart of an optimization process of a classification model according to one embodiment of the present application;
[0028] Figure 6 A structural diagram of a detection device according to one embodiment of the present application;
[0029] Figure 7 A structural diagram of a hardware Trojan detection apparatus according to one embodiment of the present application. DETAILED DESCRIPTION
[0030] Embodiments of the present application are described in detail below with reference to the accompanying drawings, in which the same or similar components have the same or similar reference numbers throughout. The embodiments described below are exemplary and are intended to explain the present application, and should not be understood as limiting the present application.
[0031] A hardware Trojan detection method, apparatus, device and storage medium are described below with reference to the accompanying drawings.
[0032] Figure 1 A flowchart of a hardware Trojan detection method according to one embodiment of the present application. Referring to FIG. 9, the hardware Trojan detection method includes: Figure 1
[0033] S101, classifying a plurality of chip samples in different ways to obtain a normal sample set and a hardware Trojan sample set.
[0034] Specifically, the plurality of chip samples include both normal chips and hardware Trojan chips with malicious modules attached, and therefore the plurality of chip samples can be classified to distinguish normal sample chips from hardware Trojan sample chips, thereby obtaining the normal sample set and the hardware Trojan sample set.
[0035] In the classification of multiple chip samples, different ways are used to classify the multiple chip samples, different classification results are obtained, and then the normal sample set and the Trojan sample set are obtained based on the different classification results. Since the multiple chip samples are classified based on multiple ways, the accuracy of sample classification can be ensured, so that the accuracy of positive samples and negative samples in the subsequent obtained sample data training set can be ensured, the accuracy of the trained classification model can be ensured, and the accuracy of Trojan detection can be improved.
[0036] In some embodiments, different ways are used to classify the multiple chip samples to obtain the normal sample set and the Trojan sample set, including: using different ways to classify the multiple chip samples respectively to obtain the first normal sample set and the first Trojan sample set, and the second normal sample set and the second Trojan sample set; obtaining the intersection of the first normal sample set and the second normal sample set to obtain the normal sample set, and obtaining the intersection of the first Trojan sample set and the second Trojan sample set to obtain the Trojan sample set.
[0037] Specifically, the first classification method can be used to classify the multiple chip samples to obtain the first normal sample set and the first Trojan sample set. Since this classification method may not be accurate, a second classification method different from the first classification method can be used to classify the multiple chip samples to obtain the second normal sample set and the second Trojan sample set. Then, the intersection of the first normal sample set and the second normal sample set is obtained to obtain the normal sample set, and the intersection of the first Trojan sample set and the second Trojan sample set is obtained to obtain the Trojan sample set. Thus, the multiple chip samples are classified based on multiple ways, making the classification result more accurate, thereby ensuring the accuracy of positive samples and negative samples in the sample data training set, and further improving the accuracy of Trojan detection.
[0038] As an example, if there are a total of 400 chip samples, and they are numbered in order as sample #1, sample #2, sample #3, …, sample #399, and sample #400. Suppose that the result obtained by using the first classification method is that the first 385 chip samples belong to the first normal sample set, and the last 15 chip samples belong to the first Trojan sample set; at the same time, the result obtained by using the second classification method is that the first 383 chip samples belong to the second normal sample set, and the last 17 chip samples belong to the second Trojan sample set. Then, the intersection of the first normal sample set and the second normal sample set in the two classification results is taken, and finally the first 383 chip samples belong to the normal sample set, and the intersection of the first Trojan sample set and the second Trojan sample set in the two classification results is taken, and finally the last 15 chip samples belong to the Trojan sample set, so that the classification result with errors can be screened out, and the accuracy of classification can be improved.
[0039] In some embodiments, the way of classifying the plurality of chip samples can include: classifying the plurality of chip samples by using the power consumption data analysis way to obtain a first normal sample set and a first Trojan sample set; classifying the plurality of chip samples by using the self-comparison way to obtain a second normal sample set and a second Trojan sample set.
[0040] That is, the plurality of chip samples can be classified by using the power consumption data analysis way and the self-comparison way respectively to obtain the normal sample set and the Trojan sample set under two different classification ways.
[0041] In some embodiments, classifying the plurality of chip samples by using the power consumption data analysis way includes: simulating each chip sample in the plurality of chip samples to obtain side channel current information, the side channel current information being used to represent the power consumption of the chip sample; and classifying the plurality of chip samples according to the side channel current information.
[0042] Specifically, when the power consumption data analysis way is used, each chip sample in the plurality of chip samples needs to be simulated first to obtain side channel current information that can reflect the power consumption of the chip sample, and then the plurality of chip samples are classified based on the side channel current information.
[0043] Specifically, a power consumption data analysis platform can be built first, as shown in FIG. 1, and then the same test vector is input to each sample chip under the same test environment (i.e., the same temperature, humidity, test equipment, and other conditions) to make the sample chip work normally, and then the side channel current information is collected using a digital oscilloscope in the working state. Figure 2
[0044] The relationship between the power consumption and the current of a normal chip can be represented by the following formula (1):
[0045] I(t,I k ,C,M)=I(t,C)+v(t,I k ,C)+n(t,M) (1)
[0046] Wherein, I(t,I k ,C,M) is the total power consumption generated when the normal chip is running; I(t,C) is the average measured side channel current information, which is obtained by measuring the chip multiple times; v(t,I k C) is the process deviation noise caused by the fluctuation of process parameters in the manufacturing process of the chip, so even the chips of the same batch have subtle differences in power consumption, and the average of the side channel current information of the chips of the same batch is used to eliminate the process deviation noise; n(t, M) is a random noise caused by different measurement devices and measurement conditions in the measurement process, and the influence of the measurement noise can be eliminated by measuring the chip multiple times.
[0047] For hardware Trojan chip with malicious module, no matter the hardware Trojan is in the active or semi-active state, it will bring certain additional side channel current information overhead, and the relationship between the power consumption and the current of the hardware Trojan chip can be represented by the following formula (2):
[0048] I(t, I m ,C, M) = I(t, C) + v(t, I m ,C) + n(t, M) + τ(t, Im, C) (2)
[0049] Where, I(t, I m ,C, M) is the total power consumption of the hardware Trojan chip when running; I(t, C) is the average side channel current information, which is obtained by measuring the hardware Trojan chip multiple times; v(t, I m ,C) is the process deviation noise caused by the fluctuation of process parameters in the manufacturing process of the hardware Trojan chip; n(t, M) is a random noise caused by different measurement devices and measurement conditions in the measurement process. τ(t, Im, C) is the side channel overhead caused by the Trojan chip.
[0050] Comparing the above two formulas, it can be seen that the current consumed by the normal chip and the hardware Trojan chip in the running process is not consistent, therefore, based on the two generated side channel current information, multiple chip samples can be classified to obtain a first normal chip set and a first Trojan chip set.
[0051] In some embodiments, the multiple chip samples are classified in a self-comparison manner, including: applying an excitation signal to each chip sample in the multiple chip samples, and obtaining the flow value of the excitation signal in different time windows; and classifying the multiple chip samples according to the change of the flow value.
[0052] It should be noted that, for the chip, the dynamic current generated in the running is related to the number of MOS tubes that are flipped in the circuit, by applying the same excitation signal at the input end of the circuit, the number of MOS tubes that are flipped in each time period after the original circuit (i.e. the normal chip) is stable is the same, for the Trojan circuit, the number of MOS tubes that are flipped at each clock edge is different, and the corresponding current is also different, when the original circuit part in the circuit reaches stability, the current of the circuit is measured, and the current will change due to the flipping of the MOS tubes in the Trojan circuit, therefore, by comparing the current values at different times, it can be detected whether there is a Trojan in the circuit.
[0053] Further, since the normal chip has a periodic cycle under the same test vector, a repeated cycle test vector group is applied during simulation, the circuit state under the same test vector is the same, and the corresponding current test result is also the same. In combination with the cycle period of the circuit state, the time window selection interval is determined, and the flow values of the excitation signal in different time windows are obtained.
[0054] The relationship between the power consumption and the current of the normal chip can be represented by the following formula (3):
[0055] Ig=I(f·k)+Ipr+Ie (3)
[0056] Wherein, Ig is the total power consumption generated when the normal chip runs; I(f·k) is the dynamic current generated by the chip at a frequency of f; Ipr is the process deviation noise generated by the chip when the process parameters exist fluctuations in the manufacturing process; Ie is a random noise generated due to different measurement devices and measurement conditions in the measurement process.
[0057] The relationship between the power consumption and the current of the hardware Trojan chip can be represented by the following formula (4):
[0058] Im=I(f·k)+Ipr+Ie+Im(f·k) (4)
[0059] Wherein, Im is the total power consumption generated when the hardware Trojan chip runs; I(f·k) is the dynamic current generated by the MOS tubes that are flipped in the original circuit, and Im(f·k) is the dynamic current generated by the MOS tubes that are flipped in the Trojan circuit. It can be seen that the dynamic current of the hardware Trojan chip includes two parts of I(f·k) and Im(f·k).
[0060] Therefore, the same and repeated excitation can be added to the chip, and the normal chip and the hardware Trojan chip can be distinguished based on the comparison of the changes of the current values generated by the corresponding excitation.
[0061] S102, sample data of each sample in the normal sample set and the Trojan sample set is obtained, to obtain a normal sample data set and a Trojan sample data set.
[0062] Specifically, after obtaining the normal sample set and the Trojan sample set according to the two classification manners, sample data of each sample in the normal sample set and the Trojan sample set is further obtained, and the sample data specifically includes power consumption data of the sample, so as to obtain a normal sample power consumption data set and a Trojan sample power consumption data set.
[0063] S103, constructing a sample data training set according to the normal sample data set and the Trojan sample data set.
[0064] The manner of constructing the sample data training set can be that the power consumption data set containing the normal sample and the Trojan sample is split according to a preset ratio, and one part of the split power consumption data set is taken as the sample data training set. For example, there are totally 1000 sample power consumption sets, 800 of which are normal sample power consumption data sets, and the other 200 are Trojan sample power consumption data sets, and 700 of the normal sample power consumption data sets and 100 of the Trojan sample power consumption data sets are taken to construct the sample data training set.
[0065] It should be noted that, in order to improve the accuracy of the hardware Trojan detection, the sample data training set can be averaged to obtain an averaged sample data training set. Averaging the sample data training set can reduce the influence from noise, and the final obtained average curve can be approximately the noise-free sample data training set.
[0066] Further, the averaged sample data training set can be preprocessed to obtain a preprocessed sample data training set. The preprocessing includes power consumption data difference value accumulation and power consumption data principal component analysis.
[0067] S104, training a preset classification model by using the sample data training set to obtain a trained classification model.
[0068] The preset classification model can be a K-means classification model or an isolated forest model. The K-means classification model is a distance-based clustering algorithm, which usually forms a cluster by comparing the distances of objects, and takes the compact and independent cluster as the final target. The K-means classification model has the advantages of simple principle, fast convergence speed, good clustering effect, and strong algorithm interpretability. Therefore, in the embodiment of the present application, the K-means classification model is preferably selected for training.
[0069] The training process of the K-means classification model will be described in detail as follows:
[0070] Step 1, the sample data training set can be represented as D={x1,x2,…,x n},in the sample data training set D K data points are randomly selected as K clusters G = {G1, G2, …, x k} respective centroid μ k Therefore, in the embodiments of the present application, only normal chips and hardware Trojan chips need to be classified, and thus K is set to 2.
[0071] Step 2, the distance of each sample in D to each centroid μ k is calculated respectively, the minimum value in the distance of each sample to all centroids is selected, and the sample is classified into the cluster represented by the centroid.
[0072] Step 3, after each sample in D is divided into a new cluster, the centroid of each cluster is recalculated.
[0073] The above steps 1-3 are repeated until the criterion function converges.
[0074] It should be noted that SSE (Sum of Square Error) is a representation of the similarity of samples in a cluster. The smaller the error sum of squares of a divided cluster, the greater the similarity of samples in the cluster; on the contrary, the greater the error sum of squares, the smaller the similarity of samples in the cluster.
[0075] The calculation formula (5) of the error sum of squares is as follows:
[0076]
[0077] Wherein, SSE is the sum of square errors of all objects in the sample, X is a sample object, μ i is the centroid of cluster G i
[0078] The K-means classification model is trained using the divided sample data training set. When the accuracy reaches a preset threshold or no longer improves, the training is stopped, and thus a trained classification model is obtained.
[0079] S105, using the trained classification model to detect whether the to-be-detected sample contains hardware Trojan.
[0080] After obtaining the trained classification model, the to-be-detected sample is input into the trained classification model. If the output result is consistent with the normal chip, it is determined that the to-be-detected sample does not contain hardware Trojan, otherwise, it is considered that the to-be-detected sample contains hardware Trojan sample.
[0081] Further, in order to determine the accuracy of the trained classification model, in some embodiments, the hardware Trojan detection method further comprises: constructing a sample data test set and a sample data validation set according to the normal sample data set and the hardware Trojan sample data set; testing the trained classification model using the sample data test set to obtain a tested classification model, and verifying the tested classification model using the sample data validation set to obtain a verification result; and optimizing the trained classification model according to the verification result.
[0082] That is, after classifying a plurality of chip samples in different ways to obtain a normal sample data set and a hardware Trojan sample data set, not only a sample data training set is constructed according to the normal sample data set and the hardware Trojan sample data set, but also a sample data test set and a sample data validation set are constructed according to the normal sample data set and the hardware Trojan sample data set. The way of constructing the sample data training set, the sample data test set and the sample data validation set can be that the normal sample data set and the hardware Trojan sample data set are split according to a preset ratio to form the sample data training set, the sample data test set and the sample data validation set, for example, the preset ratio can be 8:1:1.
[0083] It should be noted that the hardware Trojan insertion position of the chip sample corresponding to the sample data test set is the same as the hardware Trojan insertion position of the chip sample corresponding to the sample data training set, and the hardware Trojan insertion position of the chip sample corresponding to the sample data validation set is different from the hardware Trojan insertion position of the chip sample corresponding to the sample data training set, so as to ensure the reliability of the test and verification results.
[0084] Further, the trained classification model is tested for accuracy using the sample data test set. Specifically, the sample data test set is input into the trained classification model, and the output test result is observed. Since the classification model is tested using the known sample data test set containing or not containing a hardware Trojan, the test result is also known. Therefore, the trained classification model can be tested according to the actual output test result and the known test result, thereby obtaining a tested classification model.
[0085] Finally, the tested classification model is verified using the sample data validation set. Specifically, the sample data validation set is input into the trained classification model, and the output verification result is observed to obtain a verification result. Similarly, since the classification model is verified using the known sample data validation set containing or not containing a hardware Trojan, the verification result is also known. Therefore, based on the actual output verification result and the known result, the accuracy of the classification model can be clearly determined.
[0086] In some embodiments, in the case that the verification result does not meet the preset requirement, the sample data training set is subjected to noise reduction processing to obtain a sample data training set subjected to noise reduction processing; and the trained classification model is trained by using the sample data training set subjected to noise reduction processing, so as to optimize the trained classification model.
[0087] Specifically, since the noise in the normal sample data set and the Trojan sample data set will affect the clustering result, in the case that the verification result does not meet the preset requirement, the sample data training set can be subjected to noise reduction processing to obtain a sample data training set subjected to noise reduction processing, and the trained classification model is retrained by using the sample data training set subjected to noise reduction processing, so as to optimize the trained classification model, thereby further improving the accuracy of the clustering result.
[0088] As a specific example, Figure 3 the clustering result graph obtained by training the classification model by using the sample data training set not subjected to noise reduction processing, Figure 4 the clustering result graph obtained by training the classification model by using the sample data training set subjected to noise reduction processing. The first 200 sample data sets are normal sample data sets, and the last 200 sample data sets are Trojan sample data sets. It can be seen from Figure 3 and Figure 4 that, after the classification model is trained by using the sample data training set not subjected to noise reduction processing, the clustering result obtained by training the normal sample data set not subjected to noise reduction processing contains part of the Trojan chip, and the clustering result obtained by training the Trojan sample data set not subjected to noise reduction processing contains part of the normal chip, it can be seen that there is a certain difference between the result obtained by clustering analysis and the actual classification, and the clustering result obtained by training the classification model by using the sample data training set subjected to noise reduction processing is consistent with the actual classification, so it can be seen that the noise reduction processing increases the accuracy of the classification model, and also makes the result of subsequent testing and verification of the trained classification model more accurate.
[0089] In order for those skilled in the art to more clearly understand the process of optimizing the classification model in the present application, the method of optimizing the classification model will be described in detail below with reference to a specific example. As shown in Figure 5 the optimization method of the classification model includes:
[0090] S501, obtaining a plurality of chips, the plurality of chip samples including normal chips and hardware Trojan chips.
[0091] S502, collecting power consumption data information on the chips.
[0092] S503, preprocessing the data, the preprocessing process including classifying the plurality of chip samples in multiple ways.
[0093] S504, respectively, obtain a sample data training set and a sample data test set.
[0094] S505, pre-process the sample data training set and the sample data test set. The pre-processing process includes taking the mean of the sample data training set and the sample data test set, respectively, and performing power consumption data difference accumulation and power consumption data principal component analysis on the sample data training set and the sample data test set after taking the mean.
[0095] S506, train the K-means classification model using the sample training set, and select the centroid of the sample data training set.
[0096] S507, calculate the distance of each sample in the sample data training set to each centroid, and divide the sample data training set into clusters.
[0097] S508, calculate the error sum of squares of the samples in the cluster, repeat steps 506-508 until the K-means function converges, and obtain the K-means classification model.
[0098] S509, determine whether there is a Trojan chip in the sample piece.
[0099] S510, check whether the training result meets the requirements, if yes, end the training of the classification model; otherwise, execute step S511.
[0100] S511, optimize the trained model, and return to step S504.
[0101] In the above implementation, when obtaining the sample data training set, a plurality of chip samples are classified based on a plurality of ways, so that the classification result is more accurate, and the accuracy of the positive samples and negative samples in the sample data training set is ensured, thereby improving the accuracy of Trojan detection. The processed data set is then divided into a training set, a test set and a validation set, the classification model is trained using the divided training set, the accuracy of the classification model is further tested through the test set, and the validation set is used for verification. If the classification model does not meet the preset requirements, the classification model is continuously optimized until the classification model meets the requirements, thereby improving the accuracy of the classification model.
[0102] In summary, by adopting different manners to classify a plurality of chip samples, a normal sample set and a Trojan sample set are obtained, sample data of each sample in the normal sample set and the Trojan sample set is acquired, a normal sample data set and a Trojan sample data set are obtained, and a sample data training set is constructed according to the normal sample data set and the Trojan sample data set; then, the preset classification model is trained by using the sample data training set, and a trained classification model is obtained; finally, whether the to-be-detected sample exists the hardware Trojan is detected by using the trained classification model. Since the sample data training set is obtained by classifying a plurality of chip samples based on a plurality of manners, the classification result is more accurate, and the accuracy of positive samples and negative samples in the sample data training set is ensured, so that the accuracy of Trojan detection can be improved, and the efficiency of Trojan detection can be improved based on the trained classification model during detection, and the method is simple to implement and low in cost.
[0103] Corresponding to the above-mentioned embodiments, the embodiments of the present application also propose a computer readable storage medium, on which a hardware Trojan detection program is stored, and the hardware Trojan detection program is executed by a processor to implement the hardware Trojan detection method of any of the above-mentioned embodiments.
[0104] According to the computer readable storage medium of the embodiments of the present application, the hardware Trojan detection method is adopted, the efficiency and accuracy of Trojan detection can be improved, and the method is simple to implement and low in cost.
[0105] Corresponding to the above-mentioned embodiments, the embodiments of the present application also propose a detection device, Figure 6 Fig. 1 is a structural schematic diagram of the detection device according to an embodiment of the present application. As shown in the figure, the detection device 600 comprises a memory 602, a processor 604, and a hardware Trojan detection program 606 stored in the memory 604 and executable on the processor. When the processor 604 executes the program, the hardware Trojan detection method of any of the above-mentioned embodiments is implemented. Figure 6
[0106] According to the detection device of the embodiments of the present application, the hardware Trojan detection method is adopted, the efficiency and accuracy of Trojan detection can be improved, and the method is simple to implement and low in cost.
[0107] Figure 7 Fig. 2 is a structural schematic diagram of the hardware Trojan detection device according to an embodiment of the present application.
[0108] Referring to Figure 7 As shown in the figure, the hardware Trojan detection device 700 comprises a sample construction unit 701, a model training unit 702, and a detection unit 703.
[0109] The sample construction unit 701 is configured to classify the plurality of chip samples in different manners to obtain a normal sample set and a Trojan sample set, and obtain sample data of each sample in the normal sample set and the Trojan sample set, to obtain a normal sample data set and a Trojan sample data set, and construct a sample data training set according to the normal sample data set and the Trojan sample data set. The model training unit 502 is configured to train the preset classification model by using the sample data training set to obtain a trained classification model. The detection unit 503 is configured to detect whether the to-be-detected sample contains a hardware Trojan by using the trained classification model.
[0110] In some embodiments, the sample construction unit 701 is specifically configured to classify the plurality of chip samples in different manners respectively to obtain a first normal sample set and a first Trojan sample set, and a second normal sample set and a second Trojan sample set; obtain an intersection of the first normal sample set and the second normal sample set to obtain the normal sample set, and obtain an intersection of the first Trojan sample set and the second Trojan sample set to obtain the Trojan sample set.
[0111] In some embodiments, the sample construction unit 701 is further configured to classify the plurality of chip samples in a power consumption data analysis manner to obtain a first normal sample set and a first Trojan sample set; and classify the plurality of chip samples in a self-comparison manner to obtain a second normal sample set and a second Trojan sample set.
[0112] In some embodiments, the sample construction unit 701 is further configured to simulate each chip sample in the plurality of chip samples to obtain side channel current information, the side channel current information being used to represent power consumption of the chip sample; and classify the plurality of chip samples according to the side channel current information.
[0113] In some embodiments, the sample construction unit 701 is further configured to apply an excitation signal to each chip sample in the plurality of chip samples, and obtain a flow value of the excitation signal in different time windows; and classify the plurality of chip samples according to a change of the flow value.
[0114] In some embodiments, the hardware Trojan detection apparatus 700 further includes a model testing unit, a model verifying unit and a model optimizing unit (not shown in the figure), and the model construction unit 701 is further configured to construct a sample data testing set and a sample data verifying set according to the normal sample data set and the Trojan sample data set. The model testing unit is configured to test the trained classification model by using the sample data testing set to obtain a tested classification model. The model verifying unit is configured to verify the tested classification model by using the sample data verifying set to obtain a verification result. The model optimizing unit is configured to optimize the trained classification model according to the verification result.
[0115] In some embodiments, the model optimization unit is specifically configured to, in a case where the verification result does not satisfy the preset requirement, perform noise reduction processing on the sample data training set to obtain a sample data training set after noise reduction processing; and train the trained classification model by using the sample data training set after noise reduction processing, so as to optimize the trained classification model.
[0116] It should be noted that details about the hardware Trojan detection device are not disclosed, and reference is made to details disclosed in the hardware Trojan detection method in the present application. To avoid redundancy, details are not expanded here.
[0117] The hardware Trojan detection device according to the embodiment of the present application classifies a plurality of chip samples by using different ways through the sample construction unit, obtains a normal sample set and a Trojan sample set, and obtains sample data of each sample in the normal sample set and the Trojan sample set, to obtain a normal sample data set and a Trojan sample data set, and constructs a sample data training set according to the normal sample data set and the Trojan sample data set. Then, the model training unit trains a preset classification model by using the sample data training set to obtain a trained classification model. Finally, the detection unit detects whether a to-be-detected sample has a hardware Trojan by using the trained classification model. Since the plurality of chip samples are classified by using different ways to obtain the sample data training set, the classification result is more accurate, thereby ensuring the accuracy of positive samples and negative samples in the sample data training set, so as to improve the accuracy of Trojan detection. Moreover, the detection is performed based on the trained classification model, which can improve the efficiency of Trojan detection, and the method is simple, easy to implement, and low in cost.
[0118] It should be noted that the logic and / or steps represented in the flowcharts or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing the logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, apparatus, or device (such as a computer-based system, a system including a processor, or other system that can fetch and execute instructions from an instruction execution system, apparatus, or device), or in conjunction with such instruction execution system, apparatus, or device. For the purposes of this specification, a "computer-readable medium" can be any device that can contain, store, communicate, propagate, or transmit a program for use by an instruction execution system, apparatus, or device, or in conjunction with such instruction execution system, apparatus, or device. More specific examples (non-exhaustive list) of computer-readable media include the following: an electrical connection portion having one or more wires (electronic device), a portable computer disk cartridge (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and programmable read-only memory (EPROM or flash memory), fiber optic devices, and portable compact disc read-only memory (CDROM). Furthermore, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or otherwise processing it in a suitable manner if necessary, and then storing it in a computer memory.
[0119] It should be understood that various parts of the present invention can be implemented using hardware, software, firmware, or a combination thereof. In the above-described embodiments, multiple steps or methods can be implemented using software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented using hardware, as in another embodiment, any one of the following technologies known in the art or a combination thereof can be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application-specific integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0120] Throughout this specification, reference to terms such as "one embodiment," "some embodiments," "examples," "specific examples," or "some examples" means that a specific feature, structure, material, or characteristic described in conjunction with that embodiment or example is included in at least one embodiment or example of the present invention. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
[0121] In addition, the terms "first", "second" and the like in the embodiments of the present application are used only for the purpose of description, and can not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated in the embodiments. Therefore, the features defined with the terms "first", "second" and the like in the embodiments of the present application can be explicitly or implicitly indicated to include at least one of the features in the embodiments. In the description of the present application, the meaning of the word "plurality" is at least two or two or more, such as two, three, four, etc., unless otherwise specifically limited in the embodiments.
[0122] Although the embodiments of the present application have been shown and described above, it will be understood that the above-described embodiments are exemplary and can not be construed as limiting the present application, and those skilled in the art can make changes, modifications, replacements and variations to the above-described embodiments within the scope of the present application.
Claims
1. A hardware Trojan detection method, characterized in that, The method comprises: Classifying a plurality of chip samples in different manners to obtain a normal sample set and a Trojan sample set; Obtaining sample data of each sample in the normal sample set and the Trojan sample set to obtain a normal sample data set and a Trojan sample data set; Constructing a sample data training set according to the normal sample data set and the Trojan sample data set; Training a preset classification model by using the sample data training set to obtain a trained classification model; Detecting whether a to-be-detected sample exists a hardware Trojan by using the trained classification model; The method comprises: Classifying the plurality of chip samples in different manners respectively to obtain a first normal sample set and a first Trojan sample set, and a second normal sample set and a second Trojan sample set; Obtaining an intersection of the first normal sample set and the second normal sample set to obtain the normal sample set, and obtaining an intersection of the first Trojan sample set and the second Trojan sample set to obtain the Trojan sample set; The method comprises: Classifying the plurality of chip samples by using a power consumption data analysis manner to obtain the first normal sample set and the first Trojan sample set; Classifying the plurality of chip samples by using a self-comparison manner to obtain the second normal sample set and the second Trojan sample set.
2. The hardware Trojan detection method of claim 1, wherein, The method comprises: Simulating each chip sample in the plurality of chip samples to obtain side channel current information, the side channel current information being used to represent power consumption of the chip sample; Classifying the plurality of chip samples according to the side channel current information.
3. The hardware Trojan detection method of claim 1, wherein, The method comprises: Applying an excitation signal to each chip sample in the plurality of chip samples, and obtaining a flow value of the excitation signal in different time windows; Classifying the plurality of chip samples according to a change of the flow value.
4. The hardware Trojan detection method of any one of claims 1-3, wherein, The method further comprises: Constructing a sample data test set and a sample data verification set according to the normal sample data set and the Trojan sample data set; Testing the trained classification model by using the sample data test set to obtain a tested classification model, and verifying the tested classification model by using the sample data verification set to obtain a verification result; Optimizing the trained classification model according to the verification result.
5. The hardware Trojan detection method of claim 4, wherein, The method comprises: In a case where the verification result does not satisfy a preset requirement, performing noise reduction processing on the sample data training set to obtain a sample data training set after noise reduction processing; Training the trained classification model by using the sample data training set after noise reduction processing to optimize the trained classification model.
6. A computer-readable storage medium, characterized in that, A hardware Trojan detection program is stored thereon, and the hardware Trojan detection program, when executed by a processor, implements the hardware Trojan detection method according to any one of claims 1-5.
7. A detection device, characterized in that Comprise: A memory, a processor, and a hardware Trojan detection program stored on the memory and executable on the processor, and the processor implements the hardware Trojan detection method according to any one of claims 1-5 when executing the program.
8. A hardware Trojan detection apparatus, characterized by, The device comprises: The sample construction unit is configured to classify the plurality of chip samples in different manners to obtain a normal sample set and a hardware Trojan sample set, obtain sample data of each sample in the normal sample set and the hardware Trojan sample set, obtain a normal sample data set and a hardware Trojan sample data set, and construct a sample data training set according to the normal sample data set and the hardware Trojan sample data set. The model training unit is configured to train a preset classification model by using the sample data training set to obtain a trained classification model. The detection unit is configured to detect whether a to-be-detected sample contains a hardware Trojan by using the trained classification model. The sample construction unit is specifically configured to classify the plurality of chip samples in different manners to obtain a first normal sample set and a first hardware Trojan sample set, and a second normal sample set and a second hardware Trojan sample set. An intersection of the first normal sample set and the second normal sample set is obtained to obtain the normal sample set, and an intersection of the first hardware Trojan sample set and the second hardware Trojan sample set is obtained to obtain the hardware Trojan sample set. The sample construction unit is specifically configured to classify the plurality of chip samples by using a power consumption data analysis manner to obtain the first normal sample set and the first hardware Trojan sample set. The sample construction unit is specifically configured to classify the plurality of chip samples by using a self-comparison manner to obtain the second normal sample set and the second hardware Trojan sample set.
Citation Information
Patent Citations
Method for detecting malicious circuit in FPGA (field programmable gate array) chip by power consumption analysis and system thereof
CN102592068A
Hardware Trojan detection and discrimination method based on support vector machine
CN108154051A