An explainable ghost attack automatic detection method

CN117909968BActive Publication Date: 2026-09-22SHANGHAI MARITIME UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410049000.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-01-12
Publication Date
2026-09-22
Estimated Expiration
2044-01-12

AI Technical Summary

Technical Problem

[0006]本发明提供一种可解释性的幽灵攻击自动检测方法,以解决幽灵攻击数据环境复杂、攻击数据与无攻击数据难以鉴别、检测防御过程功耗大等问题

Benefits of technology

1、充分考虑了系统范围数据而非某个进程数据,同时用无噪声干扰数据训练模型检测有噪声干扰数据,这样更贴合实际情况。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117909968B_ABST
    Figure CN117909968B_ABST
Patent Text Reader

Abstract

The application discloses an interpretable ghost attack automatic detection method, and has the characteristics that: hardware performance counters are used to collect hardware events to construct a data set one; each sample in the data set one is marked as "with ghost attack" and "without ghost attack", and the marked data set is used to train multiple monitoring models; each trained monitoring model is used to perform online testing on a computer to be tested, an optimal monitoring model is screened out by combining a security power consumption evaluation algorithm, and the optimal monitoring model is used to perform regular detection on the ghost attack of the computer to be tested. The automatic detection method has the characteristics of high accuracy, low power consumption and meeting user requirements.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and more specifically, to an interpretable automatic detection method for Spectrum attacks. Background Technology

[0002] Confidentiality is a crucial factor in information security, ensuring that information is accessed and used only by authorized parties. However, in the context of processor microarchitecture, multiple executions can compete for and share microarchitectural resources, such as caches, branch predictors, and branch target buffers. This creates opportunities for unauthorized parties to exploit side-channel leaks of information.

[0003] A Spectre attack is an attack that exploits speculative execution and microarchitectural side-channels to violate the memory independence boundary principle. This attack primarily involves three steps: 1) The attacker first introduces a series of instructions into the process address space. When the instructions are executed, they will save the victim's memory or register contents into the cache and memory. 2) Then train the branch predictor to force the CPU to guess and execute incorrect instruction sequences, thereby leaking the victim's information through the cache side channel; 3) Finally, the victim's information is retrieved through the cache channel. Although this erroneous guessing execution results in changes to the CPU state (which will eventually be restored), previously leaked information or other microarchitectural state changes, such as cached content, are preserved.

[0004] Currently, researchers are using machine learning and hardware performance counters (HPCs) to detect Spectre attacks. Compared to traditional hardware-based defense mechanisms, such as InvisiSpec, which require redesigning the underlying architecture, or software patches such as fences, which reduce computer performance, this new method using machine learning and HPCs can effectively balance the contradictions between the two.

[0005] Meanwhile, in real-world environments, computers always run in different environments, which greatly interferes with the detection process. 55.26% of non-attack data was detected as attacks. To address this issue, He et al. proposed a method for detecting cross-container Spectrum attacks. They used HPCs to collect data from containers and then employed random forests for feature selection to obtain both benign and attack data. While this method considers the influence of various environmental factors, collecting data from different processes using containers is a complex and power-intensive task. Therefore, collecting system-wide data and using effective feature selection to detect interfering Spectrum attacks is a more reasonable and practical approach. Summary of the Invention

[0006] This invention provides an interpretable automatic detection method for Spectral Attacks to solve problems such as the complex data environment of Spectral Attacks, the difficulty in distinguishing between attack data and non-attack data, and the high power consumption of the detection and defense process.

[0007] This invention can be achieved through the following technical solutions: An interpretable method for automatic detection of ghost attacks includes acquiring hardware events collected by hardware performance counters to construct a dataset. Each sample in Dataset 1 is labeled as either "with ghost attack" or "without ghost attack," and multiple monitoring models are trained using the labeled dataset. Each trained monitoring model is used to conduct online tests on the computer under test. The optimal monitoring model is selected by combining the security power consumption assessment algorithm. Then, the optimal monitoring model is used to perform routine detection of Spectre attacks on the computer under test.

[0008] Furthermore, the secure power consumption assessment algorithm includes the following steps: Step 1: Obtain hardware events collected by hardware performance counters to construct dataset 2, and mark each sample in dataset 2 as "with ghost attack" and "without ghost attack"; Step II: On the computer under test, use the trained monitoring model to detect dataset 2. Based on the predicted and actual values ​​of each sample, calculate the security parameter TP and the current power consumption parameter TN of the computer under test. Step III: Based on the current computer status of the computer under test and the user's security level requirements, calculate the weight evaluation parameter H for each sample. Select the weight α based on the maximum value of the weight evaluation parameter H, and then use the formula... Calculate the optimal evaluation parameter PST, and then select the optimal monitoring model based on the optimal evaluation parameter corresponding to each monitoring model.

[0009] Furthermore, the weight evaluation parameter H is calculated using the following formula. Branch prediction missing rate B i =Number of missing branches predicted / Total number of branches predicted Last-level cache miss rate L i =Number of last-level cache misses / Total number of last-level cache accesses Among them, L i Indicates the last-level cache miss rate, I ri Indicates an interruption, Bi x represents the branch prediction missing rate. i Let represent the i-th sample, and μ represent the user demand influencing factor.

[0010] Furthermore, the optimal monitoring model is selected using the following formula.

[0011] Among them, PST m1 PST m2 ... represent the PST values ​​corresponding to each monitoring model.

[0012] Furthermore, the hardware events include five hardware events: total number of branch predictions, number of branch mispredictions, total number of Last Level Cache (LLC) references, number of Last Level Cache misses, and number of Hardware Interrupts.

[0013] Furthermore, the sample data of the training set in the dataset 1 is set to hardware events acquired under conditions without noise interference, while the sample data of the test set is set to hardware events acquired under conditions with noise interference.

[0014] The beneficial technical effects of this invention are as follows: 1. It fully considers system-wide data rather than data from a specific process, and uses noise-free data to train the model to detect noisy data, which is more in line with the actual situation.

[0015] 2. A multi-feature selection-based method was adopted to detect ghost attacks. Ghost attacks and noisy data were separated based on multiple features, and the highest accuracy rate was 0.999329.

[0016] 3. Multiple simple yet highly accurate monitoring models were trained, and the most suitable monitoring model was selected to detect Spectrum attacks in the current environment after balancing security and power consumption. Attached Figure Description

[0017] Figure 1 This is a schematic diagram of the overall process of the present invention; Figure 2 This is a schematic diagram of the online monitoring process of the present invention. Detailed Implementation

[0018] The present invention will now be described in further detail with reference to the accompanying drawings and specific embodiments.

[0019] See appendix Figure 1 and 2This invention discloses an interpretable automatic detection method for Spectral Attacks, comprising: acquiring hardware events collected by hardware performance counters to construct a dataset; labeling each sample in the dataset as "with Spectral Attack" and "without Spectral Attack"; training multiple monitoring models using the labeled dataset; performing prior tests on the computer under test using each trained monitoring model; selecting the optimal monitoring model by combining a security power consumption assessment algorithm; and then performing routine detection of Spectral Attacks on the computer under test using the optimal monitoring model.

[0020] Specifically as follows: (1) Data collection: The perf tool, which uses hardware performance counters (HPCs), counts system-wide hardware event characteristics in a counting mode. The selection of these characteristics is determined based on the characteristics of Spectre attacks to ensure accurate and reliable performance data in the training and test sets. Data samples are typically counted once per second, with each type of data counted for about ten minutes. Alternatively, the count time can be randomly selected as needed.

[0021] Since Spectre attacks, by using speculative branch predictions during the attack process, can lead to a low branch prediction miss rate, and by constantly evicting cached content, can lead to a high cache miss rate, these two characteristics are helpful in determining whether a Spectre attack exists in the current environment. Therefore, we first selected four hardware events as the features we statistically analyzed: total number of branch predictions, number of branch mispredictions, total number of Last Level Cache (LLC) references, and number of Last Level Cache misses.

[0022] Secondly, due to noise interference, when many processes are running simultaneously, the data collected system-wide can exhibit characteristics similar to a Spectre attack. This can lead to the misconception that a Spectre attack is occurring even when no Spectre attack is present, resulting in significant system overhead from constantly defending against it. Therefore, to differentiate between Spectre attacks and noise interference, we selected another hardware event, Hardware Interrupts, as a new feature.

[0023] Secondly, this process primarily focuses on effective feature extraction based on two key characteristics of Spectre attacks: a high cache miss rate and a low branch prediction miss rate. To more comprehensively reflect the system's performance and security status, we perform additional calculations on the aforementioned sample data, introducing two extra features: the branch miss rate and the LLC miss rate (last-level cache miss rate). This generates a rich feature set, further enhancing the data's expressive power. Each sample now includes seven key features: branches, branch mispredictions, branch miss rate, LLC references, LLC misses, LLC miss rate, and hardware interruption. These features provide detailed information about program execution and system status, aiding the model in learning and detecting specific patterns of Spectre attacks.

[0024] Building training and test sets: a. Training set data: The training set mainly consists of data under noise-free conditions. Positive samples are collected in the current environment where only ghost attacks and system programs that keep the machine running normally exist, while negative samples are obtained in the current environment where only system programs that keep the machine running normally exist. This design aims to provide a benchmark so that the model can learn the difference between ghost attack and normal operation during training. b. Test set data: The test set mainly consists of data under noise interference. The noise comes from seven common applications, covering seven types of noise: downloading pictures, listening to music, watching videos, editing documents, calling databases, sending emails, and application chat. By arranging and combining these seven types of noise, a total of 127 types of noise were collected. Sample data of these noises were collected under both Spectral Attack and Non-Spectral Attack conditions to more comprehensively cover the data under different noise and attack conditions. This invention collects data on five hardware events per second, and separately collects data from two different versions: one with noise interference and one without. These data correspond to positive and negative samples in the training and test sets, respectively. This choice is made because the noise within the system is inexhaustible, and we cannot collect all the noise data. Therefore, we choose to use the unique characteristics of Spectrum attacks to detect attacks, rather than using training and test sets with the same data type, in order to improve the generalization of the detection model.

[0025] To better support supervised learning tasks, we also labeled each sample data with "spooky attack" and "no spooky attack," adding a label to indicate the category or state corresponding to the data sample. This made the dataset more informative and provided strong support for subsequent model training, thus enabling us to obtain richer and more representative sample data, laying a solid foundation for further analysis and modeling.

[0026] (2) Monitoring Model Training: Six simple monitoring models were used: SVM, MLP, LSTM, LSTM_MLP, CNN_MLP, and CNN_LSTM. To meet the requirements of real-time detection, the training time of the monitoring models was controlled to about one minute. This strategy aims to maintain high performance while ensuring that the monitoring models can make accurate predictions in a timely manner in rapidly changing environments. In the selection of monitoring models, we further improved the adaptability and generalization ability of the models by using combinations of different structures and algorithms. The diverse selection of models helps to cope with potential complexity and diversity, making the system more robust.

[0027] (3) The selection of the optimal monitoring model is achieved by conducting online tests on the computer under test, balancing security and power consumption. The specific process is as follows: Step 1: Use the above method to obtain hardware events collected by the hardware performance counter to construct Dataset 2, and mark each sample in Dataset 2 as "with ghost attack" and "without ghost attack". The sample data in Dataset 2 can be obtained from the computer under test, such as collecting data once per second for 1-3 minutes, or it can be pre-prepared data.

[0028] Step II: On the computer under test, use the trained monitoring model to perform online detection on dataset 2. Based on the predicted and actual values ​​of each sample, calculate the security parameter TP and the current power consumption parameter TN of the computer under test. Using the confusion matrix shown in the figure below, the security parameter TP and the current power consumption parameter TN are calculated. During online detection, for Specter attacks, if the test result is consistent with the actual result, the TP value is incremented by one; if the test result is inconsistent with the actual result, the FN value is incremented by one. For non-Specter attacks, if the test result is consistent with the actual result, the TN value is incremented by one; if they are inconsistent, the FP value is incremented by one. At the same time, to avoid slight differences in the amount of attack data and non-attack data, we normalize the attack data and non-attack data, i.e., TP+FN=1, TN+FP=1.

[0029] Step III: Based on the current computer status of the computer under test and the user's security level requirements, calculate the weight evaluation parameter H for each sample. Select the weight α based on the maximum value of the weight evaluation parameter H, and then use the formula... Calculate the optimal evaluation parameter PST, and then select the optimal monitoring model based on the optimal evaluation parameter corresponding to each monitoring model.

[0030] The weight α is selected based on user needs and the current security status of the computer (e.g., whether a Spectre attack exists). In scenarios with high security and high demand, the weight α can be set to 0.999; while in scenarios with low security and low demand, the parameter α can be appropriately reduced to 0.9 to more flexibly adapt to different environmental requirements. The specific value of the weight α is shown in the following formula: Regarding user requirements, we have set three levels: high, medium, and low. Users need to fill in their requirements based on their own needs. Once the user confirms their requirements, then all data D(x) will be processed. i The levels will also be fixed, as shown in the following formula: The current computer state is determined by a combination of three factors: branch prediction missing rate, cache missing rate, and interrupts, as shown in the following formula: Among them, L i For the last-level cache miss rate, I ri For interruption, B i To predict the missing rate for branches, and to ensure timeliness, x i This represents the i-th sample data.

[0031] The formulas for the last-level cache miss rate (LLC miss rate) and the branch prediction missing rate are as follows: Branch prediction missing rate B i =Number of missing branches / Total number of branch predictions Last-level cache miss rate L i =Number of cache misses at the last level Total number of accesses to the last-level cache Based on the above two requirements, we have derived the following calculation formula, where the sample data x i It includes two parts: samples and labels. Furthermore, once the user requests a determination, D(x) i It will also remain fixed and will not change with the data: Based on the weight α mentioned above, we can calculate the optimal evaluation parameter PST. Using this indicator, we can select the most suitable monitoring model, i.e., the optimal monitoring model. The specific selection is shown in the following formula: Among them, PST m1 PST m2 ... represent the PST values ​​corresponding to each monitoring model.

[0032] This online detection process takes into account user needs, computer security, and the performance of various monitoring models, enabling the system to flexibly adjust model selection under real-time requirements to achieve the best balance between performance and security. This fully reflects intelligent decision-making that takes into account multiple factors, providing effective support for the system's real-time performance and adaptability.

[0033] (4) Attack Detection: This is a crucial step after selecting the optimal monitoring model. It aims to detect pre-processed data with noise interference and provide corresponding detection results. The results of attack detection directly reflect the system's sensitivity and accuracy to security threats. When a potential attack is detected, the system will respond promptly to ensure the security of the computing environment.

[0034] While specific embodiments of the present invention have been described above, those skilled in the art should understand that these are merely illustrative examples. Various changes or modifications can be made to these embodiments without departing from the principles and essence of the present invention. Therefore, the scope of protection of the present invention is defined by the appended claims.

Claims

1. An interpretable automatic detection method for ghost attacks, characterized in that: This includes acquiring hardware events collected by hardware performance counters to construct Dataset 1; Each sample in dataset 1 is labeled as "with ghost attack" or "without ghost attack", and multiple monitoring models are trained using the labeled dataset; Each trained monitoring model is used to conduct online tests on the computer under test. The optimal monitoring model is selected by combining the security power consumption assessment algorithm. Then, the optimal monitoring model is used to perform routine detection of Spectre attacks on the computer under test. The secure power consumption assessment algorithm includes the following steps: Step 1: Obtain hardware events collected by hardware performance counters to construct dataset 2, and label each sample in dataset 2 as "with ghost attack" or "without ghost attack"; Step II: On the computer under test, use the trained monitoring model to detect dataset 2. Based on the predicted and actual values ​​of each sample, calculate the security parameter TP and the current power consumption parameter TN of the computer under test. Step III: Based on the current computer status of the computer under test and the user's security level requirements, calculate the weight evaluation parameter H for each sample. Select the weight α based on the maximum value of the weight evaluation parameter H, and then use the formula... Calculate the optimal evaluation parameter PST, and then select the optimal monitoring model based on the optimal evaluation parameter corresponding to each monitoring model. Calculate the weight evaluation parameter H using the following formula. Branch prediction missing rate B i =Number of missing branches predicted / Total number of branches predicted Last-level cache miss rate L i =Number of last-level cache misses / Total number of last-level cache accesses Among them, L i Indicates the last-level cache miss rate, I ri Indicates an interruption, B i x represents the branch prediction missing rate. i Let represent the i-th sample, and μ represent the user demand influencing factor; The optimal monitoring model can be selected using the following formula; Among them, PST m1 PST m2 ... represent the PST values ​​corresponding to each monitoring model; The hardware events include five events: total number of branch predictions, number of branch mispredictions, total number of Last Level Cache (LLC) references, number of Last Level Cache misses, and number of Hardware Interrupts.

2. The interpretable ghost attack automatic detection method according to claim 1, characterized in that: The training set in dataset one consists of hardware events acquired without noise interference, while the test set consists of hardware events acquired with noise interference.