An Intel-processor-trace-based cache side-channel attack detection method and system
By using Intel Processor Trace (PT) instead of hardware performance counters, a multi-dimensional feature space is constructed and an extreme gradient boosting classifier is trained, solving the accuracy and robustness issues in cache side-channel detection and achieving efficient cache side-channel attack detection.
Patent Information
- Application Number
- CN202611705656.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-30
- Publication Date
- 2026-11-27
AI Technical Summary
Existing cached side-channel detection methods based on hardware performance counters cannot simultaneously meet the requirements of high detection accuracy, strong robustness against attacks, and fine temporal resolution. They suffer from problems such as measurement nondeterminism, slow rate avoidance, and overlap of malicious and benign features.
Intel Processor Trace (PT) is used as the detection data source. By collecting raw PT trace files containing control flow and timing information, a multi-dimensional feature space is constructed. Feature subsets are selected using multi-scale sliding window segmentation and the worst-case pair Cohen effect criterion, and an extreme gradient boosting classifier is trained for detection.
Under baseline conditions without implementing evasion measures, the recall rate for the five attacks is no less than 99.96% and the false positive rate is no more than 0.009% in a 1-millisecond detection window. When deployed online, monitoring one process consumes 1.09 to 1.49 CPU cores, the size of the detector process tree proportional set is 420 to 449 MB, and the normal load throughput decreases by 28.6%.
Smart Images

Figure CN123184992A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer system security and microarchitecture side-channel protection technology, and in particular to a cache side-channel attack detection method and system based on Intel-Processor-Trace. Background Technology
[0002] Modern processors improve performance through microarchitectural optimizations such as caching, speculative execution, and out-of-order execution. However, the timing side effects introduced by these mechanisms can be exploited as cache side-channel attacks. Attack primitives such as Flush+Reload, Prime+Probe, Flush+Flush, Spectre, and Meltdown have been proven to be able to recover Advanced Encryption Standard (AES) and RSA keys and leak kernel data across processes, virtual machines, and even privilege boundaries, posing a serious threat to data confidentiality in cloud computing and multi-tenant systems. To mitigate cache side-channel attacks, existing solutions can be broadly categorized into proactive defense and reactive detection. Proactive defense blocks attack channels at the hardware or operating system level through methods such as cache isolation, noise injection, and partitioning scheduling, but the performance overhead of continuous operation is often unacceptable for production environments. Reactive detection, on the other hand, continuously monitors the system status with low overhead, triggering defensive measures only when a potential attack is detected, thus enabling stronger defenses while maintaining normal performance.
[0003] Over the past decade, research and industrial practice in the field of passive detection have almost universally employed Hardware Performance Counters (HPCs) as their data source. HPCs are event counter registers built into the processor, capable of counting events such as cache misses, branches, and instructions, with extremely low access overhead and no need for special drivers. Early work classified HPC count vectors using machine learning models, reporting high accuracy in controlled experiments. However, recent research has systematically revealed the fundamental limitations of hardware performance counter (HPC)-based detection, mainly manifested in three failure modes: First, measurement nondeterminism. Existing research shows that due to event reuse, interrupt-based sampling offsets, and context switching, HPC measurements exhibit nondeterminism, overcounting, and undercounting, leading to unstable classification decision boundaries. Second, slow-rate evasion. Attackers can reduce event density by executing attacks at lower injection rates, thereby evading threshold-based detectors without changing their attack targets. Third, malicious-benign feature overlap. Parallel benign workloads can cause significant overlap in the HPC feature distributions of malicious and benign executions. The commonality among these problems lies in the fact that HPC only exposes aggregated event counts, which are easily perturbed by low-rate execution or parallel benign workloads. Furthermore, the limited number of available counters on Intel processors forces event reuse when more events need to be monitored, further exacerbating these problems.
[0004] Therefore, existing buffered side-channel detection methods based on hardware performance counters (HPC) cannot simultaneously meet the requirements of high detection accuracy, strong anti-attack robustness, and fine temporal resolution. Summary of the Invention
[0005] In view of this, the present invention provides a cache side-channel attack detection method and system based on Intel-Processor-Trace to solve the problems of measurement nondeterminism, slow rate evasion, and malicious-benign feature overlap caused by existing detection methods based on hardware performance counters (HPC) that rely solely on aggregated event counts, thereby improving detection accuracy, robustness against attacks, and temporal resolution. The technical solution adopted by the embodiments of the present invention to solve its technical problems is as follows: The first aspect of this invention provides a cache side-channel attack detection method based on Intel-Processor-Trace, characterized in that it includes: Step S1, Data Acquisition: Using Intel Processor Trace (PT) as the detection data source, hardware tracing is performed on normal working workloads and attack workloads to collect raw PT trace files containing control flow and timing information; the raw PT trace files include Conditional Branch Packets (TNT) that record the direction of conditional branch jumps, Indirect Jump Target Packets (TIP) that record the indirect jump target address, Flow Update Packets (FUP), Cycle Count Packets (CYC) that provide clock cycle timing, and Micro Time Count Packets (MTC) that provide a periodic coarse-grained time base; Step S2, construct and train the cached side-channel attack detection model: decode the original PT trace file and segment it according to a multi-scale sliding window, extract multi-dimensional features describing the control flow and timing patterns from each window to form the original feature space; The multidimensional features include at least: the target address bucketing Herfindahl index, which is obtained by bucketing the target addresses of indirect jump target packets within the window according to a preset byte granularity; and the average proportion of indirect jump target packets after the stream update packet, which is to calculate the proportion of indirect jump target packets in a preset number of packets after each stream update packet within the window, and take the arithmetic mean of this proportion of all stream update packets within the window. For each feature, the Cohen effect is calculated for each scene pair consisting of a normal scene and an attack scene. The minimum value across all scene pairs is taken as the robustness score, and the mean value is taken as the auxiliary score. The robustness score and the auxiliary score are divided by the maximum value among all feature scores, and then weighted and summed according to a 60% weighting for the robustness score and a 40% weighting for the auxiliary score to obtain a comprehensive score. The top K features in descending order of comprehensive score are selected as a feature subset. Based on the feature subset, under the grouping leave-out protocol, the median and interquartile range of each feature are first calculated on the training data to obtain a feature normalizer. The feature normalizer is then used to normalize the features, and a gradient boosting classifier is trained based on the normalized features with a fixed decision threshold to obtain the detection model. The multi-scale sliding window includes five window scales: 1 microsecond, 10 microsecond, 100 microsecond, 1 millisecond, and 10 millisecond, with the step size set to half of the window scale. Step S3, Online Detection: The target process is monitored by real-time acquisition of PT traces through output files switched at fixed time intervals. The continuous trace stream is divided into independent file units that can be processed in parallel. For each independent file unit, its size is read twice at preset intervals, and the results are compared to determine if the writing is complete. Independent file units deemed to have completed writing are submitted to a processing pool consisting of P resident worker processes. Each resident worker process pre-loads the detection model and the feature normalizer and processes different independent file units in parallel, where P ≥ [T_proc / Δt]. T_proc is the processing time for a single independent file unit, and Δt is the fixed time interval. Each of the resident working processes extracts features according to the multi-scale sliding window and normalizes them through the feature normalizer before inputting them into the detection model. The window-level output probability is compared with the fixed decision threshold to obtain the window-level detection result. The proportion of windows whose output probability exceeds the fixed decision threshold is used as the window-level detection rate, and the average output probability of the M windows with the highest output probability is taken as the confidence level. Based on the comparison result of the confidence level and the fixed decision threshold, it is determined whether to trigger a system-level alarm, where M is a preset positive integer.
[0006] Preferably, in step S2, the multidimensional features are constructed based on the structural signature analysis of PT traces of five types of attacks, namely, Flush+Flush, Flush+Reload, Prime+Probe, Spectre, and Meltdown.
[0007] Preferably, the multidimensional features are 28-dimensional PT features, including 24-dimensional aggregation layer features and 4-dimensional structural layer features; the aggregation layer features include count-type, rate-type, inter-type ratio-type, intra-domain distribution-type, and load statistical moment-type features; the structural layer features include: the target address bucket Herfindahl exponent (tip_addr_cluster_256) obtained by dividing the target address of the indirect jump target packet into 256-byte intervals and calculating the Herfindahl exponent of the resulting address distribution; the mean of the proportion of indirect jump target packets after the stream update packet (fup_tip_burst); the conditional branch bit sequence periodic score (tnt_period_score) obtained by calculating the maximum normalized autocorrelation of the conditional branch packet (TNT) bit sequence within a preset lag range; and the target address stride regularity (tip_stride_regularity) obtained by adding one to the coefficient of variation of the difference sequence of continuous indirect jump target addresses and taking the reciprocal.
[0008] Preferably, step S2 selects a subset of features using the worst-case pair Cohen effect criterion, including: for each feature i, calculating the Cohen effect for each scene pair (n, a) consisting of a normal scene n and an attack scene a; and taking the minimum value of the effect for feature i across all scene pairs. The robustness score of feature i is the mean of the effect sizes of feature i across all scenario pairs. As an auxiliary scorer; The normalized robustness score is obtained by dividing the robustness score of each feature by the maximum value among all feature robustness scores; the normalized auxiliary score is obtained by dividing the auxiliary score of each feature by the maximum value among all feature auxiliary scores; and the comprehensive score is constructed by weighting the scores with the normalized robustness score accounting for 60% and the normalized auxiliary score accounting for 40%. ; All features are sorted in descending order of their overall scores, and the top K features are selected as the feature subset.
[0009] Preferably, the value of K is determined through a performance scanning experiment: all features are sorted in descending order of comprehensive score, and the number of features is increased from 1 to the original dimension. A classifier is trained for each number of features, and the area under the receiver operating characteristic curve (AUC), recall, and specificity are evaluated on the test set. Using the recall and specificity of all features as a reference, the minimum number of features for which the difference between the recall and specificity and the reference value is less than the preset tolerance is taken as the saturation point K_sat, and K = K_sat + 1 is taken.
[0010] Preferably, K is set to 8, and the preset tolerance is 1×10⁻⁶. -4 The eight features selected, in descending order of their comprehensive scores, are: the ratio of indirect jump target packets to conditional branch packets (tip_per_tnt), the ratio of taken branches to conditional branches (tnt_taken_ratio), the periodicity score of the conditional branch bit sequence (tnt_period_score), the mean of bus ratio values (cbr_mean), the regularity of the target address stride (tip_stride_regularity), the cycle count packet rate (cyc_count_rate), the ratio of cycle count packets to the total number of packets (cyc_per_pkt), and the flow update packet count (fup_count).
[0011] Preferably, in step S2: When collecting PT traces, the Cycle Count Packet (CYC), Mini Time Count Packet (MTC), Time Stamp Count Packet (TSC), Conditional Branch Packet (TNT), and Indirect Jump Target Packet (TIP) are enabled simultaneously. The gradient boosting classifier is an extreme gradient boosting classifier (XGBoost), and the feature normalizer is a robust scaler based on the median and interquartile range. The grouping leaveout protocol is as follows: the collected data is grouped by scenario and divided into training set and test set according to file level ratio, and all windows from the same file are placed in the training set or test set as a whole. The fixed decision threshold is set to 0.5 and is frozen after training is completed. It will not be readjusted during adversarial evaluation and online detection.
[0012] Preferably, in step S3: the fixed time interval is 1 second; M is 5; P is 4; and the file unit is deleted after the reasoning for a certain independent file unit is completed.
[0013] A second aspect of the present invention provides a cache side-channel attack detection system based on Intel-Processor-Trace, comprising: The data acquisition module is used to perform hardware tracing on normal and attack workloads using Intel Processor Trace (PT) as the detection data source, and to collect raw PT trace files containing control flow and timing information. The feature construction module is used to decode the original PT traces and segment them according to a multi-scale sliding window. From each window, multi-dimensional features describing the control flow and temporal patterns are extracted to form the original feature space. The feature selection module is used to calculate the Cohen effect for each feature in each scene pair. The minimum value is used as the robustness score and the mean value is used as the auxiliary score. The two scores are normalized by their respective maximum values and then weighted by 60% and 40% to obtain the comprehensive score. The top K features are selected as the feature subset in descending order of the comprehensive score. The model training module is used to first calculate the median and interquartile range of each feature on the training data based on the feature subset under the grouping leave-out protocol, to obtain a feature normalizer, then use the feature normalizer to normalize the features, and train a gradient boosting classifier based on the normalized features with a fixed decision threshold to obtain a detection model. The online detection module is used to collect PT traces of the target process in real time. P resident processes, preloaded with the detection model and the normalizer, process each independent file unit in parallel. Features are extracted according to the multi-scale sliding window and normalized by the normalizer before being input into the detection model. The window-level output probability is compared with the fixed decision threshold to obtain the window-level detection result. The proportion of windows with output probabilities exceeding the fixed decision threshold is counted as the window-level detection rate. The average output probability of the M windows with the highest output probabilities is taken as the confidence level. The system-level alarm is determined based on the comparison result of the confidence level and the fixed decision threshold.
[0014] As can be seen from the above technical solution, the cache side-channel attack detection method and system based on Intel-Processor-Trace provided in this invention replaces the aggregated event count of the hardware performance counter (HPC) with the instruction-level control flow and time-series data packets of processor tracing (PT), capturing the attack as a structural invariant; it constructs 28-dimensional features through structural signature analysis of five types of attacks and uses the worst-case pair Cohen effect (Cohen's d) The criteria are compressed to 8 dimensions to train an Extreme Gradient Boosting (XGBoost) detector. Under baseline conditions without evasion measures, the recall rate for five attacks within a 1-millisecond detection window is no less than 99.96%, and the false positive rate is no more than 0.009% (Table 3). In 112 evasion sub-scenarios per platform, the average detection rate of processor tracking (PT) across both platforms is 94.57%, and the hardware performance counter (HPC) rate is 46.79% (Table 5). Among these, the detection rate of flush + reload significantly decreases under low duty cycles. During online deployment, monitoring a process consumes 1.09 to 1.49 CPU cores, the proportional set size (PSS) of the detector process tree is 420 to 449 MB, and the normal load throughput of the monitored system decreases by 28.6% (Table 6). This invention can accurately and robustly achieve real-time detection of cache side-channel attacks and is suitable for security monitoring scenarios such as cloud computing and multi-tenant systems. Attached Figure Description
[0015] Figure 1 This is a schematic diagram of the overall architecture of the detection system of the present invention.
[0016] Figure 2 This is a schematic diagram of the minimum Cohen effect (Cohen's d) of the 28-dimensional PT features of this invention.
[0017] Figure 3 This is a schematic diagram illustrating how the detection performance of the present invention varies with the number of selected features K.
[0018] Figure 4This is a schematic diagram comparing the processor tracking (PT) and hardware performance counter (HPC) curves of the present invention within a 1-millisecond window, representing a comparison of the receiver operating characteristic (ROC) curves.
[0019] Figure 5 This diagram illustrates the detection rate of processor tracking (PT) under various evasion strategies.
[0020] Figure 6 This diagram illustrates the detection rate of the Hardware Performance Counter (HPC) under the same evasion strategy.
[0021] Figure 7 This is a schematic diagram illustrating the change in the number of file units to be processed over time during the online detection process of this invention.
[0022] Figure 8 This is a schematic diagram showing the CPU usage of each component of the online detector of the present invention. Detailed Implementation
[0023] The technical solution and effects of the present invention will be further described in detail below with reference to the accompanying drawings.
[0024] The core concept of this invention lies in replacing the Hardware Performance Counter (HPC) with Intel Processor Trace (PT) as the detection data source. PT is a hardware tracing mechanism available on Broadwell and later Intel microarchitectures, transmitting control flow and timing packets such as Conditional Branch Packets (TNT), Indirect Jump Target Packets (TIP), Cycle Count Packets (CYC), and Micro Time Count Packets (MTC). Compared to the HPC, PT has four key advantages: instruction-level control flow visibility, microsecond-level time resolution, unlimited number of concurrent monitoring events, and hardware-based trace generation. These characteristics enable PT to capture attack behavior as structured patterns rather than coarse-grained aggregated counts, thereby overcoming the measurement nondeterminism, slow-rate evasion, and overlapping feature distributions problems in HPC detection. (Reference) Figure 1As shown, the detection system of this invention follows a two-stage pipeline of offline training and online detection. In the offline stage, the detector is built in a controlled environment: First, Intel Processor Tracking (Intel PT) is used to collect hardware traces of normal and attack workloads, recording instruction flow and timing information and outputting raw trace files; then, the trace files are decoded and segmented according to a multi-scale sliding window, extracting statistical features to characterize control flow and timing patterns, forming a high-dimensional raw feature space; next, a worst-pair feature selection algorithm selects a compact feature subset that maintains strong discriminative power across all attack types and avoids weaknesses; based on this subset, a base classifier is trained with a fixed decision threshold under a strict grouping leave-out protocol to obtain the detection model and its normalizer; finally, the fixed model is evaluated on all adversarial scenarios to quantify its performance under evasion strategies. During the online phase, the system runs in the production environment and continuously monitors the target process. It collects real-time traces by switching files at short intervals, divides the continuous trace stream into independent file units that can be processed in parallel, extracts features from each unit, normalizes and infers, compares the window-level probability with a fixed threshold to obtain window-level decisions, and further aggregates them into system-level alarms. At the same time, the monitoring submodule measures the central processing unit (CPU) usage and memory increment in real time to verify the feasibility of deployment.
[0025] based on Figure 1As shown in the diagram, this invention provides a cache side-channel attack detection method based on Intel-Processor-Trace. The specific implementation steps are as follows: Step S1, data acquisition: Collect PT traces on two Intel processor platforms to evaluate the cross-microarchitecture generalization capability of the detection method. The two platforms are an Intel Core processor (Intel Core i7-9700) using the Coffee Lake microarchitecture and an Intel Core processor (Intel Core i7-6700) using the Skylake microarchitecture, respectively. Their hardware configurations are shown in Table 1. The normal working workload includes eight scenarios: Black-Scholes option pricing calculation, file search and scanning, system idle, server-side script encryption module operation, open-source cryptographic library encryption and decryption, open-source cryptographic library performance testing, scripting language numerical computation, and scripting language scientific computing library operation, covering diverse execution profiles. The attack workload includes five attack primitives: flush + flush, flush + reload, padding + probe, Spectre, and Meltdown. The command to collect PT traces is the performance analysis tool command (perf record -e intel_pt / cyc=1,mtc=1,tsc=1,branch=1 / -p <process ID> -m ,4M -o <output file>). The parameter (cyc=1) enables Cycle Count Packet (CYC) to provide fine-grained timing information, the parameter (mtc=1) enables Micro Time Count Packet (MTC) to provide coarse-grained time base, the parameter (tsc=1) enables Timestamp Count Packet (TSC) to provide precise timestamps, the parameter (branch=1) enables branching packets such as Conditional Branch Packet (TNT), and the parameter (-m,4M) sets the buffer size to 4MB. The output is the raw PT trace file in the performance analysis tool data format (perf.data). To quantify the advantage of PT over Hardware Performance Counter (HPC), four HPC events were collected as baselines, including total cache references, cache misses, instructions executed, and CPU clock cycles. Based on these, two ratio features, cache miss rate and instructions per cycle, were derived to form a 6-dimensional HPC feature vector.All collected data are grouped by scenario and divided into training and test sets at a ratio of approximately 7:3 at the file level. All windows from the same file are placed as a whole in the training or test set to avoid data leakage between adjacent windows.
[0026] The data acquisition uses a process-by-process tracing method: the target process is started first, then the above command is used to attach to the process, and the acquisition is stopped by an interrupt signal (SIGINT) after the acquisition duration is reached. The parameter -p specifies that only the target process is tracked, and other processes are not written to the trace; the event is not limited to user mode (u) or kernel mode (k) and runs with administrator privileges, so both user mode and kernel mode execution of the target process are tracked. Only the above four parameters are explicitly set in the command. The cycle count packet threshold (cyc_thresh), micro time count packet period (mtc_period), synchronization packet interval (psb_period), and return compression (noretcomp) are not set separately, and the default values of the kernel Intel processor trace driver (intel_pt) are used. The configuration used is recorded along with the event attributes in each raw trace file (perf.data), which can be read using the performance analysis tool command (perf evlist -v). The bus ratio packet (CBR) does not need to be enabled separately. The processor automatically issues it within each synchronization packet group (PSB+) and when the core to bus frequency ratio changes.
[0027] The parameter "-m,4M" sets the AUX buffer to 4MB. This buffer operates in non-snapshot mode; data written by the processor is retrieved by the performance analysis tool (perf) and written to disk when the buffer reaches its watermark, preventing overwriting in the absence of records. If the retrieval speed cannot keep up with the generation speed, the processor will issue an overflow packet (OVF), and the performance analysis tool will report lost AUX data. The extent of data loss can be statistically analyzed; the buffer overflow packet count (ovf_count) is itself one of the 28 candidate features. In this embodiment, the trace write rate during process tracing is 72 to 103 MB / s. On an i7-9700 platform dataset containing all 28 features (38 collected files, 709,546 1-millisecond windows), 4,621 windows contained overflow packets, accounting for 0.65% of all windows. This indicates that buffer overflows occur occasionally but only affect a very small number of windows. The specific composition of normal and attack workloads is shown in Tables 1-1 and 1-2, respectively.
[0028] Table 1 Experimental Environment
[0029] Table 1-1 Normal Operating Load Composition
[0030] Note: The scripting language environment is Python 3.10, which comes with Ubuntu 22.04. The open-source cryptographic library (OpenSSL) 1.0.1f is compiled from source code, and the parallel benchmark suite (PARSEC) is version 3.0.
[0031] Table 1-2 Attack Workload Composition
[0032] Note: All five attack programs are rewritten versions based on publicly available implementations. They all call the evasion interface (evasion_after_iteration) after each round of attacks. When no evasion is applied, their behavior is the same as the original implementation. The circuit breaker (Meltdown) is based on the publicly available libkdump library. In the official dataset, each scenario was collected three times (file search and scanning, and server-side script encryption were collected twice), and the dataset was divided into training and test sets in approximately a 7:3 ratio based on the files.
[0033] Step S2 involves constructing and training the detection model, which includes three stages: feature construction, feature selection, and model training. Feature Construction: To construct a feature space that can distinguish attacks from normal normal workloads, we first analyze the packet distribution and timing behavior of five attacks in PT traces, summarizing four structural signatures using a 1-millisecond window as an example. For the flush + flush attack, repeated cache line flush instructions (clflush) act on a small number of target lines, generating concentrated indirect jump target packets (TIPs). Within a 1-millisecond window, over 90% of the indirect jump target packets fall into fewer than 10 different 256-byte address ranges, with a Herfindahl exponent of at least 0.4, while normal normal workloads only have exponents of 0.01 to 0.05, indicating concentrated target line signatures. For the flush + reload attack, it also repeatedly operates on fixed target lines, but each iteration only generates one indirect jump target packet related to the cache line flush instruction and one load delay branch. The PT trace is much sparser, and as the iteration rate decreases, its concentration and timing characteristics roughly decrease proportionally to the number of iterations within the window. Therefore, the clear + reload attack does not possess a structural signature that can be fully formed within a single iteration. This is precisely why this invention employs the worst-case pairing criterion to prevent the detector from failing on this attack type. For the fill + probe attack (Prime + Probe), the entire last-level cache eviction set is filled in eviction order during the fill phase. The PT trace presents a sequence of indirect jump target packets with large address strides. The ratio of the number of indirect jump target packets to the number of condition branch packets (TNT) exceeds 1, reflecting a pointer chasing access pattern, i.e., an eviction set traversal signature. For the Spectre attack, it relies on repeated branch mistraining followed by a transient out-of-bounds access, presenting a periodic pattern of five in-bounds training iterations followed by one out-of-bounds attack iteration. The condition branch packet stream exhibits high autocorrelation with a period of 6, i.e., a periodic mistraining cyclic branch signature. For Meltdown attacks, a general protection fault is triggered in each iteration, and the PT trace exhibits a burst pattern, meaning that multiple indirect jump target packets appear immediately after the Flow Update Packet (FUP). The proportion of indirect jump target packets within the next ten packets after the FUP is 0.6% to 0.8%, while the proportion for normal workload is only 0.05% to 0.1%, indicating anomaly-handling burst signatures. Based on these observations, a 28-dimensional PT feature is constructed, including a 24-dimensional aggregation layer feature and a 4-dimensional structural layer feature.The aggregation layer features are obtained by applying a general aggregation operator to the PT packet stream within the sliding window. Their design is independent of any specific attack pattern and is divided into five categories with a total of 24 dimensions based on the aggregation method: 6-dimensional count features, which count the occurrence frequency of each type of packet within the window, including conditional branch packet count (tnt_count), take-branch count (tnt_taken), indirect jump target packet count (tip_count), stream update packet count (fup_count), buffer overflow packet count (ovf_count), and synchronization boundary packet count (psb_count); 5-dimensional rate features, which normalize the counts to the number of packets per unit time according to the window duration, including total packet rate (pkt_rate), micro-time count packet rate (mtc_rate), timestamp count packet rate (tsc_rate), process switching packet rate (pip_rate), and period count packet rate (cyc_count_rate); and 5-dimensional inter-type ratio features, which characterize the composition ratio between different packet types, including the ratio of stream update packet count to total packet count (fup_ratio), indirect jump target packet count, and indirect jump target packet count. The ratio of target packets to conditional branch packets (tip_per_tnt), the ratio of process switch packets to indirect jump target packets (pip_per_tip), the ratio of micro-time-count packets to cycle-count packets (mtc_cyc_ratio), and the ratio of cycle-count packets to total packets (cyc_per_pkt); a 4-dimensional domain distribution feature characterizes the value distribution within a single packet type, including the ratio of the number of taken branches to the number of conditional branches (tnt_taken_ratio), and the ratio of the number of different target addresses to the number of target addresses. The features include the ratio of unique target addresses (tip_unique_ratio), the ratio of the most frequent target addresses to the total number of target addresses (tip_top1_ratio), and the Herfindahl exponent for 4096-byte target address bucketing (tip_hhi); a 4-dimensional payload statistical moment feature class, which calculates statistical moments for packets with numerical payloads, including the mean of cycle counts (cyc_mean), the coefficient of variation of cycle counts (cyc_cv), the mean of bus ratios (cbr_mean), and the binary entropy of branch ratios (tnt_entropy). The structural layer features include the Herfindahl exponent for target address bucketing and the mean of the proportion of indirect jumps to target packets after a flow update packet, specifically: The first is the Herfindahl index (tip_addr_cluster_256) for 256-byte target address bucketing. All target addresses of indirect jump target packets (TIPs) within the window are bucketed in 256-byte granularity. The Herfindahl index is calculated based on the frequency of each address within each bucket, with a value ranging from 0 to 1. A higher value indicates a more concentrated concentration of target addresses. The second is the average proportion of indirect jump target packets after a stream update packet (fup_tip_burst). This is achieved by traversing the packet sequence within the window, calculating the proportion of indirect jump target packets in a preset number of packets after each stream update packet, and then taking the arithmetic mean of this proportion for all stream update packets within the window. The preset number is, for example, 10. The third is the periodicity score of the conditional branch bit sequence (tnt_period_). The feature is denoted by score), which parses the conditional branch packet within the window into a binary bit sequence of branches and non-branches. Within a preset lag range, the normalized autocorrelation coefficient is calculated one by one. This is calculated by dividing the sum of the products of corresponding bits at lag k by the total number of branches in the bit sequence, and taking the maximum value across all lags. The preset lag range is exemplarily 2 to 16, with its upper limit not exceeding one-quarter of the bit sequence length. When the bit sequence length is less than 8 or the number of branches is less than 2, this feature is set to 0. The fourth feature is the target address stride regularity (tip_stride_regularity). The stride sequence is obtained by taking the first-order difference of the consecutive indirect jump target addresses within the window, and the coefficient of variation (CV) of this sequence is calculated. This feature is set to 1 / (1+CV), with a value range of 0 to 1. A larger value indicates a more regular stride. Feature selection: Traditional feature selection uses average discriminative power as the criterion. When a feature has strong discriminative power on four types of attacks but almost no discriminative power on the fifth type, its average score may still be high, but the detector will completely fail on the fifth type of attack. Therefore, this invention proposes the worst-case Cohen's d scheme. For each feature i, the Cohen's d is calculated for each scene pair (n,a) consisting of a normal scene n and an attack scene a. The minimum value among these is taken as the robustness score of feature i. The minimum Cohen's d after sorting the 28 features in descending order of normalized composite scores is as follows: Figure 2 As shown. The bar height represents the minimum effect size of each feature across all 40 normal-aggression scenario pairs. The horizontal axis order is determined by the composite score obtained by normalizing the minimum and average effect sizes and weighting them at 60% and 40%, respectively. The Cohen effect size is defined as the difference between the two group means divided by the pooled standard deviation. For features... Scene Assume a normal scenario All window values for this feature are a set. Attack scenarios All window values for this feature are a set. The sample sizes of the two sets are respectively , The mean values are respectively , Sample standard deviation (degrees of freedom taken) ) are respectively , Then the effect size of this scenario on the upper part is Combined standard deviation when season To avoid being overly conservative by using only the worst-pair criterion, the average effect size is introduced as an auxiliary indicator, and a comprehensive score with a 60 / 40 weighting is constructed. It should be noted that since the worst-pair criterion uses the minimum effect size of each feature across all normal-attack scenario pairs, this minimum value is naturally much lower than the average effect size of the same feature. Therefore, this invention does not use a fixed effect size value as a screening threshold, but rather uses the relative ranking of the comprehensive scores as the basis for feature selection.
[0034] Where j is the index of the 28-dimensional PT feature, and in this embodiment j∈{1,2,...,28}; max j m j The maximum value among all 28 PT features is max. j d̄ j The maximum value among the auxiliary scores of the 28-dimensional PT features; The weight w of the robustness score and the weight 1−w of the auxiliary score are determined as follows: First, w≥0.5 is taken so that the discrimination ability of the worst scenario pairing dominates in the ranking; Second, the scan is performed with a step size of 0.05 on w∈[0,1], and the top K features of each w are taken according to the comprehensive score. The w interval in which the set of the top K features remains unchanged is found, and the value is taken in the interval. The scanning results of this embodiment are shown in Table 2-1: When w is between 0.50 and 0.65, the selected 8 features are completely identical; when w ≤ 0.45, the binary entropy (tnt_entropy) based on the branch ratio will be among the top 8, with a minimum effect size of only 0.0015, which has almost no discriminative power in the worst scenario pairing; when w ≤ 0.25, the mean of the cycle count (cyc_mean, minimum effect size 0.0042) will also be included; when w ≥ 0.70, the indirect jump target packet count (tip_count) will replace the ratio of the cycle count packet number to the total number of packets (cyc_per_pkt). Therefore, in this embodiment, w = 0.6 is taken within this interval, corresponding to 1 - w = 0.4. The two scores are normalized separately and then used in the weighted calculation. It should be noted that the robustness score is taken from the minimum effect size of all scenario pairs, and the auxiliary score is taken from the average effect size. The two usually differ in value by about one to two orders of magnitude. If the two scores are directly weighted and summed, the average effect size term will completely dominate the ranking result, rendering the constraint of "no weak points" invalid. Therefore, this invention first divides each score by its maximum value across all features, mapping it to the 0-1 interval before weighting, thus ensuring that 60% of the weights actually apply to the robustness dimension. The principle for choosing K is to minimize the number of features while maintaining detection performance saturation: the 28 features are arranged in descending order of their comprehensive scores, increasing the number of features from 1 to 28. For each number of features, an extreme gradient boosting (XGBoost) classifier is trained, and the area under the receiver operating characteristic curve (AUC), recall, and specificity are evaluated. The detection performance changes with the selected number of features K as follows: Figure 3 As shown; the saturation criterion is quantitatively defined as follows: using the recall and specificity when using all 28 features as a reference, the difference between the recall and specificity and the reference value is less than 1×10. -4 The minimum number of features is taken as the saturation point K_sat. In this embodiment, the recall rate is 0.99973 when K=6, which differs from the reference value by approximately 2×10. -4 The condition is not met; when K=7, the recall rate is 0.99987, the specificity is 0.99990, and the area under the receiver operating characteristic curve (AUC) is 0.9999999, which meets the condition, therefore K_sat=7; after K≥7, for each increase of K by 1, the change in recall and specificity is less than 5×10. -5The curve tends to flatten. To retain a margin for a feature beyond the saturation point, this embodiment uses K=K_sat+1=8. The point-by-point results for K=1 to 28 are shown in Table 2-2. The eight features finally selected, in descending order of comprehensive score, are: the ratio of indirect jump target packets to conditional branch packets (tip_per_tnt), the ratio of taken branches to conditional branches (tnt_taken_ratio), the periodicity score of the conditional branch bit sequence (tnt_period_score), the mean of bus ratio values (cbr_mean), the regularity of the target address stride (tip_stride_regularity), the cycle count packet rate (cyc_count_rate), the ratio of cycle count packets to the total number of packets (cyc_per_pkt), and the flow update packet count (fup_count). The selected features include six aggregation layer features and two structural layer features. Among them, the condition branch bit sequence periodicity score describes the periodicity of the condition branch bit sequence, and the target address step size regularity describes the regularity of the target address step size of continuous indirect jumps.
[0035] Table 2-1 Relationship between robustness weight w and the selected top 8 features
[0036] Table 2-2 Feature Count K and Detection Performance
[0037] Model Training: Five candidate classifiers—Random Forest, Decision Tree, Logistic Regression, Extreme Gradient Boosting (XGBoost), and Lightweight Gradient Boosting Machine (LightGBM)—were compared on an 8-dimensional feature set. The results, under the same dataset and evaluation protocol, are shown in Table 2. Both Extreme Gradient Boosting and Random Forest achieved 99.99% accuracy, but Extreme Gradient Boosting had significantly shorter training time than Random Forest (specific values are shown in Table 2). Considering accuracy, training efficiency, and subsequent robustness evaluation, Extreme Gradient Boosting was selected as the final classifier. The hyperparameters of the Extreme Gradient Boosting classifier were set to 300 trees, a maximum depth of 6, a learning rate of 0.1, and a row-column subsampling rate of 0.8. The positive sample weight parameter (scale_pos_weight) was set according to the ratio of negative samples to positive samples, approximately 0.75 (212,241 normal windows and 283,517 attack windows in the training set), where the positive class represents the attack windows. A robust scaler based on median and interquartile range is used for normalization to address the significant differences in temporal feature dimensions between different normal scenarios. The decision threshold τ is fixed at 0.5. Since the output probability of the extreme gradient boosting classifier for normal windows is concentrated between 0.0 and 0.05, and for attack windows it is concentrated between 0.95 and 1.0, with a wide gap between the two, τ=0.5 is naturally at the optimal separation point. After training, the threshold is frozen and will not be readjusted during adversarial evaluation and online detection to prevent artificially inflated robustness caused by scene-by-scene threshold adjustment.
[0038] Table 2 Comparison of Candidate Classifiers
[0039] Step S3, Online Detection: Deploy the trained detection model, normalizer, and threshold in the online phase. Using the per-second switch output file parameter (perf record --switch-output=1s) of a performance analysis tool, continuous PT traces are segmented into independent file units. This embodiment sets up a processing pool containing 4 worker processes, each pre-loading the detection model and normalizer. The number of worker processes P is determined by P ≥ "T_proc / Δt", where T_proc is the average processing time for a single file unit, and Δt is the file switching interval. Each worker process loads the detection model and normalizer only once at startup, and then reuses them for multiple file units, without reloading the model for each file. In this embodiment, Δt = 1 second. The measured feature extraction time for each file unit is 1.08 seconds (Spectre attack) and 1.60 seconds (openssl_enc cryptographic library encryption payload), and the model inference time is 7 milliseconds and 3 milliseconds. According to the above formula, P ≥ 2 can cover the average load. Considering the fluctuation of file unit size, this embodiment uses P = 4. The main process checks the file write status and submits files that meet the stable file size condition to the processing pool. Each worker process then performs feature extraction, normalization, and model inference, enabling parallel processing of different file units. The online detection main loop reads the file size of each trace file unit twice at a preset time interval (e.g., 0.5 seconds). When the sizes obtained from the two reads are equal, the file is considered to have been written successfully. Feature extraction, normalization, and inference are then performed. The specific aggregation process is as follows: First, the detection model outputs an attack probability between 0 and 1 for each window within the file unit; this is called the window-level output probability. The window-level output probability is compared with a fixed decision threshold τ. If it is not less than τ, the window is determined to be an attack window; otherwise, it is a normal window. This is the window-level detection result.
[0040] Secondly, the proportion of attack windows within the file unit to the total number of windows is calculated as the window-level detection rate. Simultaneously, the M windows with the highest output probabilities within the file unit are selected, and their average output probabilities are calculated as the confidence level, where M is a preset positive integer, defaulting to 5 in this invention. It is evident that the window-level detection rate and the window-level output probability are not the same quantity: the former is the proportion of windows with probabilities exceeding a threshold, representing a statistical result at the file unit level; the latter is the raw probability of a single window.
[0041] Finally, the confidence level is compared with the fixed decision threshold τ. If the confidence level is not less than τ, a system-level alarm is triggered for the file unit, indicating a cache side-channel attack; otherwise, it is considered normal. After processing, the file is deleted to control disk usage.
[0042] Baseline detection performance evaluation: With fixed models, normalizers, and thresholds, the baseline detection performance of Processor Tracking (PT) and Hardware Performance Counters (HPC) was evaluated on two devices. To ensure fairness in comparison with the PT detector, the HPC detector was trained using the same grouping hold-out protocol and the same classifier as Processor Tracking (PT). Table 3 shows that both Processor Tracking (PT) and HPC used a threshold of 0.5; in the adversarial evaluation in Table 5, the HPC used the threshold corresponding to a false positive rate of 1% on its normal test set (0.9204 for i7-9700, 0.9345 for i7-6700), which was also frozen after training. Five attacks and five window scales from 1 microsecond to 10 milliseconds were examined, and the detection metrics for each attack within a 1-millisecond window are shown in Table 3. For the PT detector, the output probability of the Extreme Gradient Boosting (XGBoost) classifier shows a clear separation between normal and attack samples. A comparison of the receiver operating characteristic (ROC) curves of PT and the hardware performance counter (HPC) within a 1-millisecond window is shown below. Figure 4 As shown in Table 3, PT, combined with a 1-millisecond window, achieved near-perfect detection of five attacks on both devices: on the i7-9700 platform, the accuracy for all five attacks was 99.99%, the recall was 99.96% to 99.99%, and the false positive rate was 0.007% (8 false positives out of 113,244 normal test windows); on the i7-6700 platform, the recall was 99.98% to 100.00%, and the false positive rate was 0.009%. In stark contrast, the Hardware Performance Counter (HPC) had a false negative rate of 16.93% to 36.80% and a false positive rate of 7.42% to 9.55% at a 1-millisecond window and a threshold of 0.5 (Table 3). Increasing the threshold to make the false positive rate approximately 1% reduced the recall rate to 43.47% to 61.59%, directly demonstrating that the event count of the Hardware Performance Counter (HPC) is too sparse at sub-millisecond scales to maintain effective detection. When the window size is increased to 10 milliseconds, the recall of the Hardware Performance Counter (HPC) improves to 98.18% to 100.00%, but the temporal resolution degrades by an order of magnitude. For PT, the false positive rate is consistently well below 1% (i.e., no more than 0.106%) across all window granularities from 1 microsecond to 10 milliseconds, and the recall is consistently above 99.78%, maintaining near-perfect performance even at the 1 microsecond scale. This indicates that PT supports microsecond-level temporal resolution, while the Hardware Performance Counter (HPC) is not available at this scale. Complete results for each window scale are shown in Table 3-1, and the number of dataset windows for each scale is shown in Table 3-2.
[0043] Table 3. Attack-by-attack detection metrics for processor tracing (PT) and hardware performance counters (HPC) within a 1-millisecond window.
[0044] Table 3-1 Baseline detection performance of processor tracing (PT) and hardware performance counters (HPC) at various window scales
[0045] Note: Values are ranges for the five attacks. The minimum sampling interval for the Hardware Performance Counter (HPC) acquisition command (perf stat -I) is 1 millisecond, therefore there are no results for 1 microsecond to 100 microsecond intervals; the false positive rate is calculated on a common normal test set with the same configuration, and the five attacks share the same value.
[0046] Table 3-2 Number of dataset windows at each window scale on both platforms
[0047] Note: For each acquisition file at the 1 microsecond and 100 microsecond scales, only the top 10 data points are retrieved. 5 One window; at a 10-microsecond scale, the i7-9700 also takes the first 10. 5 The window size is set to 12500, with no upper limit for the i7-6700; both platforms have no upper limit for the 1ms and 10ms scales, using the full window. The training and test sets are divided according to the acquisition files, with a random seed of 42.
[0048] Robustness assessment against adversarial forces: This embodiment designs three types of evasion strategies, with a total of 137 adversarial sub-scenarios for each platform. Each sub-scenarios consists of an attack primitive, an evasion category, and a parameter value, as shown in Table 4. Among them, 25 are reference sub-scenarios, and 112 are evasion sub-scenarios. The reference sub-scenarios include: 5 sub-scenarios in timing evasion (E1) with a duty cycle of 100% (i.e., no pauses are inserted); 15 sub-scenarios in spatial noise injection (E2) with a noise intensity level of 0 (i.e., no noise is injected); and 5 sub-scenarios in timer replacement (E3-T) that retain the original timestamp read instruction (rdtsc). Timing evasion (E1) changes the attack duty cycle by inserting a pause after each round of attack using a microsecond-level sleep function (usleep), with duty cycles of 5%, 10%, 20%, 50%, and 100%. Spatial noise injection (E2) injects three benign loads into the attack process: computational noise (E2-C), control flow noise (E2-F), and memory access noise (E2-M), with noise intensity levels ranging from 0 to 4. Primitive substitution (E3) is divided into two categories. One is circuit breaker primitive substitution (E3-M), which sets the exception handling method of the circuit breaker attack (Meltdown) to either signal handling or transaction synchronization extension (TSX). It should be noted that the kernel vulnerability status file ( / sys / devices / system / cpu / vulnerabilities / tsx_async_abort) of both experimental platforms reports that transaction synchronization extension is disabled (TSXdisabled). In this state, when the transaction synchronization extension (TSX) variant executes the transaction start instruction (xbegin), the transaction is immediately aborted, unauthorized reads within the transaction body are not executed, and the program then executes the cache probing loop of flush + reload as usual. Therefore, the Transaction Synchronization Extension (TSX) sub-scenario in this embodiment tests whether the probe loop of the attack program can be detected after removing the exception and signal processing paths, and does not represent that kernel data was successfully read using Transaction Synchronization Extension (TSX). Furthermore, the i7-9700 is not affected by the circuit breaker vulnerability, and the i7-6700 has page table isolation (PTI) enabled. Circuit breaker attack programs on both platforms cannot actually read kernel data; the object of this invention is the execution behavior of the attack program. This variant runs normally and completes data collection on both platforms. The number of 1-millisecond windows is comparable to the signal processing variant (26,419 vs. 26,984 on i7-9700, and 57,380 vs. 57,106 on i7-6700), and no abnormal termination due to unsupported instructions occurred.Another type is timer replacement (E3-T), with 7 timing methods: original timestamp read instruction (rdtsc), monotonic counter (counter), noisy timer with the lower 4 bits cleared (noisy_4), noisy timer with the lower 8 bits cleared (noisy_8), and reduced-precision timer (reduced_4, reduced_8, reduced_16) that reads the real timer only once every 4, 8, and 16 iterations. Under fixed models and thresholds, the average detection rates of processor tracing (PT) and hardware performance counters (HPC) per attack within a 1-millisecond window are shown in Table 5. For processor tracing (PT), the average detection rate across all evasion dimensions is no less than 98.18% for the four attacks: flush+flush, prime+probe, spectre, and meltdown. The flush + reload approach is a significant weakness: under timing avoidance (E1), its average detection rate is 1.08% on i7-9700 and 5.01% on i7-6700; under computational noise injection (E2-C) on i7-6700, it is 25.03%. This is because each iteration of flush + reload only generates one indirect jump target packet (TIP) related to the cache line flush instruction (clflush) and one loading delay branch. The signature strength changes roughly linearly with the number of iterations within the window. Under low duty cycles, too few iterations fall into the 1-millisecond window, causing the relevant features to collapse towards the normal baseline. In 112 evasion sub-scenarios, the average detection rates of processor tracing (PT) on i7-9700 and i7-6700 were 95.91% and 93.23%, respectively, with an average of 94.57% across both platforms; the hardware performance counters (HPC) rates were 42.22% and 51.35%, respectively, with an average of 46.79% across both platforms; in 20 reference sub-scenarios, the detection rate of processor tracing (PT) was 100.00% on both platforms. The detection rates of PT and hardware performance counters (HPC) under various evasion strategies are shown below. Figure 5 and Figure 6 As shown, this indicates that PT captures the control flow structure rather than aggregated event counts. Although attackers can adjust the event density to bring the hardware performance counter (HPC) count into a normal range, it is difficult to conceal the structured control flow patterns recorded by PT.
[0049] Table 4 Summary of Adversarial Assessment Scenarios
[0050] Note: No evasion measures are applied to the reference sub-scenes (E1 duty cycle 100%, E2 intensity level 0, E3-T timestamp read command rdtsc), totaling 25; there are a total of 112 evasion sub-scenes.
[0051] Table 5. Processor Tracing (PT) and Hardware Performance Counter (HPC) Average Detection Rate per Attack (1-millisecond window)
[0052] Note: (1) Column E1 is the average of the four evasion settings of duty cycle 5%, 10%, 20% and 50%; the attack with a duty cycle of 100% is the unmodified attack, which is included in the 137 sub-scenes in Table 4. The detection results are shown in Table 3 and are not included in the statistics of this table. Therefore, this table counts 132 sub-scenes per platform. (2) Each column of E2 contains the reference sub-scene with strength level 0; column E3 contains 7 sub-scenes of timer replacement (E3-T) (of which the timestamp reading instruction rdtsc is the reference), and Meltdown also contains 2 sub-scenes of circuit breaker primitive replacement (E3-M). (3) The mean of each attack is weighted by the number of sub-scenes shown in the second row. For example, the mean of flush + reload on i7-9700 is (4×1.08% + 5×100.00% + 5×99.41% + 5×89.77% + 7×100.00%) / 26 = 82.70%. (4) Columns E1 and E2 in the "Overall Mean" row are the arithmetic mean of the five attacks. Column E3 is weighted by 7, 7, 7, 7, and 9. The mean column is equal to the total average weighted by 132 sub-scenes. (5) Individual sub-scenes did not obtain effective 1-millisecond processor tracking (PT) features (details in Table 5-1). When calculating, the mean of the other sub-scenes in the cell (same attack, same evasion dimension) is used instead.
[0053] Statistics by sub-scenario category: In 112 evasion sub-scenarios, the average detection rate of processor tracing (PT) on i7-9700 and i7-6700 was 95.91% and 93.23%, respectively, and the hardware performance counter (HPC) was 42.22% and 51.35%, respectively; In 20 reference sub-scenarios, the processor tracing (PT) was 100.00%, and the hardware performance counter (HPC) was 47.37% and 59.64%, respectively.
[0054] Table 5-1 Sub-scenes where no valid 1-millisecond processor tracking (PT) features were obtained
[0055] Online detection and system overhead assessment: The online experiment was conducted on an i7-9700 platform with the following parameters: detection window of 1 millisecond, step size of 0.5 milliseconds, file switching interval of 1 second, number of worker processes P=4, and both window threshold and segment threshold of 0.5. Three scenarios were set up: Scenario S0 was a clean system where the detector was resident but did not monitor any processes, running 3 times; Scenario S1 monitored normal open-source cryptographic library encryption load (openssl_enc), running 7 times; Scenario S2 monitored Spectre attack processes, running 3 times. Resource usage in the baseline state and the detection state was measured for 30 seconds each in each run, with the order of the two states alternating between runs to reduce the impact of turbo boost and temperature drift. In the detection state, after the detector started, it warmed up for 12 seconds (each worker process loaded the model, and performance analysis tools started), followed by 30 seconds of resource sampling. Processor tracing (PT) acquisition lasted for a total of 42 seconds, thus generating approximately 40 file units per run. Scenario S2 uses an attack procedure without any evasion measures, and its results correspond to the baseline conditions in Table 3, but not to the adversarial sub-scenarios in Table 5.
[0056] The detection results are as follows: S2 generated 128 segments, all of which triggered system-level alarms. The average window-level detection rate within each segment was 99.997%, and the lowest rate for a single segment was 99.94%. S1 generated 284 segments, none of which triggered alarms. Calculated using the precise Clopper-Pearson method, the 95% confidence upper bound for the segment-level false alarm rate is 1.29%. This false alarm rate is calculated on a segment-by-segment basis, which differs from the window-by-window false alarm rate in Table 3. Confidence level is defined as the arithmetic mean of the output probabilities of the five windows with the highest output probabilities within a segment. It is a dimensionless quantity, ranging from 0 to 1. The confidence levels for each segment in S2 range from 0.9999989 to 0.9999995, and for each segment in S1 range from 0.0002 to 0.2378, both far from the segment threshold of 0.5.
[0057] In terms of processing capacity, all file units generated in each run are processed (42 to 43 per run for S2, and 39 to 41 per run for S1); the peak number of tasks to be completed is 2 under Spectre attack and 3 to 4 under open-source cryptographic library encryption load, never exceeding P and showing no upward trend. Figure 7 As shown in the figure, "encrypted payload" and "specter attack" correspond to scenarios S1 and S2, respectively. The curves for each run are slightly offset vertically for differentiation. The dotted line represents the number of worker processes P=4. All processing is completed within 1.3 to 3.7 seconds after the data collection stops. The median time from submission to result is 1.16 seconds under the specter attack scenario, and 1.25 seconds at the 95th percentile. Under the open-source cryptographic library encrypted payload scenario, the median time is 1.61 seconds and 3.40 seconds, respectively. Resource overhead is shown in Table 6. Figure 8 As shown, Figure 8The terms "clean system", "encrypted payload" and "specter attack" correspond to scenarios S0, S1 and S2 respectively. The CPU usage of the detector process tree is given in three parts: data collection by the performance analysis tool (perf), feature extraction and inference and main process. The total number of cores and the proportional set size (PSS) are also marked.
[0058] Table 6. Resource overhead for online detection of a complete pipeline (i7-9700, number of worker processes P=4)
[0059] Note: Each row of the detector is a process tree consisting of the main process, worker processes, performance analysis tool (perf), and feature extraction subprocess; each row of the entire system is the detection state minus the baseline state; the sampling tool is the process and system monitoring library (psutil), which samples once every 1 second.
[0060] Comparison with existing detection methods: Table 7 compares this invention with representative existing detection methods across six dimensions: data source, attack coverage, temporal resolution, adversarial assessment scale, cross-hardware verification, and online deployment. Existing methods almost entirely rely on Hardware Performance Counters (HPC) as their data source, resulting in limited attack coverage, temporal resolution ranging from milliseconds to seconds, small adversarial assessment scale, and a general lack of cross-hardware verification and online deployment. In contrast, this invention uses Intel Processor Tracing (PT) as its data source, covering five types of attacks, supporting multi-scale windows from 1 microsecond to 10 milliseconds, completing systematic evaluation across 137 adversarial sub-scenarios (including 112 evasion sub-scenarios) on each platform, verifying consistency across two generations of Intel microarchitectures, and supporting online deployment. It is worth noting that Processor Tracing (PT) has previously been used for security tasks such as control flow integrity verification, Software Protection Extensions (SGX) enclave analysis, and transient execution attack investigation, but these works have not addressed runtime cache side-channel detection. A search revealed no existing solutions that systematically utilize Processor Tracing (PT) for runtime cache side-channel attack detection.
[0061] Table 7 Comparison with existing detection methods
[0062] The cache side-channel attack detection method and system based on Intel-Processor-Trace provided in this invention replaces the aggregated event counts of Hardware Performance Counters (HPC) with instruction-level control flow and time-series data packets from processor trace (PT), capturing the attack as a structural invariant; it constructs a 28-dimensional feature through structural signature analysis of five types of attacks and uses the worst-case pair Cohen effect (Cohen's...) d) The criteria are compressed to 8 dimensions to train an Extreme Gradient Boosting (XGBoost) detector. Under baseline conditions without evasion measures, the recall rate for five attacks within a 1-millisecond detection window is no less than 99.96%, and the false positive rate is no more than 0.009% (Table 3). In 112 evasion sub-scenarios per platform, the average detection rate of processor tracking (PT) across both platforms is 94.57%, and the hardware performance counter (HPC) rate is 46.79% (Table 5). Among these, the detection rate of flush + reload significantly decreases under low duty cycles. During online deployment, monitoring a process consumes 1.09 to 1.49 CPU cores, the proportional set size (PSS) of the detector process tree is 420 to 449 MB, and the normal load throughput of the monitored system decreases by 28.6% (Table 6). This invention can accurately and robustly achieve real-time detection of cache side-channel attacks and is suitable for security monitoring scenarios such as cloud computing and multi-tenant systems.
[0063] The above-disclosed embodiments are merely preferred embodiments of the present invention and should not be construed as limiting the scope of the invention. Those skilled in the art will understand that implementing all or part of the above-described embodiments and making equivalent changes in accordance with the claims of the present invention are still within the scope of the invention.
Claims
1. A cache side-channel attack detection method based on Intel-Processor-Trace, characterized in that, include: Step S1, Data Acquisition: Using Intel Processor Trace (PT) as the detection data source, hardware tracing is performed on normal working workloads and attack workloads to collect raw PT trace files containing control flow and timing information. The original PT trace file contains a Conditional Branch Packet (TNT) that records the direction of conditional branch jumps, an Indirect Jump Target Packet (TIP) that records the target address of indirect jumps, a Stream Update Packet (FUP), a Cycle Count Packet (CYC) that provides clock cycle timing, and a Micro Time Count Packet (MTC) that provides a periodic coarse-grained time base. Step S2, construct and train the cached side-channel attack detection model: decode the original PT trace file and segment it according to a multi-scale sliding window, extract multi-dimensional features describing the control flow and timing patterns from each window to form the original feature space; The multidimensional features include at least: the target address bucketing Herfindahl index, which is obtained by bucketing the target addresses of indirect jump target packets within the window according to a preset byte granularity; and the average proportion of indirect jump target packets after the stream update packet, which is to calculate the proportion of indirect jump target packets in a preset number of packets after each stream update packet within the window, and take the arithmetic mean of this proportion of all stream update packets within the window. For each feature, the Cohen effect is calculated for each scene pair consisting of a normal scene and an attack scene. The minimum value across all scene pairs is taken as the robustness score, and the mean value is taken as the auxiliary score. The robustness score and the auxiliary score are divided by the maximum value among all feature scores, and then weighted and summed according to a 60% weighting for the robustness score and a 40% weighting for the auxiliary score to obtain a comprehensive score. The top K features in descending order of comprehensive score are selected as a feature subset. Based on the feature subset, under the grouping leave-out protocol, the median and interquartile range of each feature are first calculated on the training data to obtain a feature normalizer. The feature normalizer is then used to normalize the features, and a gradient boosting classifier is trained based on the normalized features with a fixed decision threshold to obtain the detection model. The multi-scale sliding window includes five window scales: 1 microsecond, 10 microsecond, 100 microsecond, 1 millisecond, and 10 millisecond, with the step size set to half of the window scale. Step S3, Online Detection: The target process is monitored by real-time acquisition of PT traces through output files switched at fixed time intervals. The continuous trace stream is divided into independent file units that can be processed in parallel. For each independent file unit, its size is read twice at preset intervals, and the results are compared to determine if the writing is complete. Independent file units deemed to have completed writing are submitted to a processing pool consisting of P resident worker processes. Each resident worker process pre-loads the detection model and the feature normalizer and processes different independent file units in parallel, where P ≥ [T_proc / Δt]. T_proc is the processing time for a single independent file unit, and Δt is the fixed time interval. Each of the resident working processes extracts features according to the multi-scale sliding window and normalizes them through the feature normalizer before inputting them into the detection model. The window-level output probability is compared with the fixed decision threshold to obtain the window-level detection result. The proportion of windows whose output probability exceeds the fixed decision threshold is used as the window-level detection rate, and the average output probability of the M windows with the highest output probability is taken as the confidence level. Based on the comparison result of the confidence level and the fixed decision threshold, it is determined whether to trigger a system-level alarm, where M is a preset positive integer.
2. The cache side-channel attack detection method based on Intel-Processor-Trace as described in claim 1, characterized in that, In step S2, the multidimensional features are constructed based on the structural signature analysis of the PT traces of five types of attacks, namely, Flush+Flush, Flush+Reload, Prime+Probe, Spectre, and Meltdown.
3. The cache side-channel attack detection method based on Intel-Processor-Trace as described in claim 2, characterized in that, The multidimensional features are 28-dimensional PT features, including 24-dimensional aggregation layer features and 4-dimensional structural layer features. The aggregation layer features include count-type, rate-type, inter-type ratio-type, intra-domain distribution-type, and load statistical moment-type features. The structural layer features include: the target address bucket Herfindahl exponent (tip_addr_cluster_256) obtained by dividing the target address of the indirect jump target packet into 256-byte intervals and calculating the Herfindahl exponent of the resulting address distribution; the mean of the proportion of indirect jump target packets after the stream update packet (fup_tip_burst); the conditional branch bit sequence periodic score (tnt_period_score) obtained by calculating the maximum normalized autocorrelation of the conditional branch packet (TNT) bit sequence within a preset lag range; and the target address stride regularity (tip_stride_regularity) obtained by adding one to the coefficient of variation of the difference sequence of continuous indirect jump target addresses and taking the reciprocal.
4. The cache side-channel attack detection method based on Intel-Processor-Trace as described in claim 3, characterized in that, Step S2 selects a feature subset using the worst-paired Cohen effect size criterion, including: For each feature i, calculate the Cohen effect for each scene pair (n, a) consisting of a normal scene n and an attack scene a; take the minimum effect of feature i across all scene pairs. The robustness score of feature i is the mean of the effect sizes of feature i across all scenario pairs. As an auxiliary scorer; The normalized robustness score is obtained by dividing the robustness score of each feature by the maximum value among all feature robustness scores; the normalized auxiliary score is obtained by dividing the auxiliary score of each feature by the maximum value among all feature auxiliary scores; and a comprehensive score is constructed by weighting the scores with the normalized robustness score accounting for 60% and the normalized auxiliary score accounting for 40%. ;j is the index of the 28-dimensional PT feature, max j m j The maximum value among all 28 PT features is max. j d̄ j The maximum value among the auxiliary scores of the 28-dimensional PT features; All features are sorted in descending order of their overall scores, and the top K features are selected as the feature subset.
5. The cache side-channel attack detection method based on Intel-Processor-Trace as described in claim 4, characterized in that, The value of K was determined through a performance scanning experiment: all features were sorted in descending order of their overall scores, and the number of features was increased from 1 to the original dimension. A classifier was trained for each number of features, and the area under the receiver operating characteristic curve (AUC), recall, and specificity were evaluated on the test set. Using the recall and specificity of all features as a reference, the minimum number of features for which the difference between the recall and specificity and the reference value was less than the preset tolerance was taken as the saturation point K_sat, and K = K_sat + 1 was set.
6. The cache side-channel attack detection method based on Intel-Processor-Trace as described in claim 5, characterized in that, K is set to 8, and the preset tolerance is 1×10. -4 The eight features selected, in descending order of their comprehensive scores, are: the ratio of indirect jump target packets to conditional branch packets (tip_per_tnt), the ratio of taken branches to conditional branches (tnt_taken_ratio), the periodicity score of the conditional branch bit sequence (tnt_period_score), the mean of bus ratio values (cbr_mean), the regularity of the target address stride (tip_stride_regularity), the cycle count packet rate (cyc_count_rate), the ratio of cycle count packets to the total number of packets (cyc_per_pkt), and the flow update packet count (fup_count).
7. The cache side-channel attack detection method based on Intel-Processor-Trace as described in claim 6, characterized in that, In step S2: When collecting PT traces, the Cycle Count Packet (CYC), Mini Time Count Packet (MTC), Time Stamp Count Packet (TSC), Conditional Branch Packet (TNT), and Indirect Jump Target Packet (TIP) are enabled simultaneously. The gradient boosting classifier is an extreme gradient boosting classifier (XGBoost), and the feature normalizer is a robust scaler based on the median and interquartile range. The grouping leaveout protocol is as follows: the collected data is grouped by scenario and divided into training set and test set according to file level ratio, and all windows from the same file are placed in the training set or test set as a whole. The fixed decision threshold is set to 0.5 and is frozen after training is completed. It will not be readjusted during adversarial evaluation and online detection.
8. The cache side-channel attack detection method based on Intel-Processor-Trace as described in claim 7, characterized in that, In step S3: the fixed time interval is 1 second; M is 5; P is 4; the file unit is deleted after the reasoning for a certain independent file unit is completed.
9. A cache side-channel attack detection system based on Intel-Processor-Trace, characterized in that, For implementing the method according to any one of claims 1-8, comprising: The data acquisition module is used to perform hardware tracing on normal and attack workloads using Intel Processor Trace (PT) as the detection data source, and to collect raw PT trace files containing control flow and timing information. The feature construction module is used to decode the original PT traces and segment them according to a multi-scale sliding window. From each window, multi-dimensional features describing the control flow and temporal patterns are extracted to form the original feature space. The feature selection module is used to calculate the Cohen effect for each feature in each scene pair. The minimum value is used as the robustness score and the mean value is used as the auxiliary score. The two scores are normalized by their respective maximum values and then weighted by 60% and 40% to obtain the comprehensive score. The top K features are selected as the feature subset in descending order of the comprehensive score. The model training module is used to first calculate the median and interquartile range of each feature on the training data based on the feature subset under the grouping leave-out protocol, to obtain a feature normalizer, then use the feature normalizer to normalize the features, and train a gradient boosting classifier based on the normalized features with a fixed decision threshold to obtain a detection model. The online detection module is used to collect PT traces of the target process in real time. P resident processes, preloaded with the detection model and the normalizer, process each independent file unit in parallel. Features are extracted according to the multi-scale sliding window and normalized by the normalizer before being input into the detection model. The window-level output probability is compared with the fixed decision threshold to obtain the window-level detection result. The proportion of windows with output probabilities exceeding the fixed decision threshold is counted as the window-level detection rate. The average output probability of the M windows with the highest output probabilities is taken as the confidence level. The system-level alarm is determined based on the comparison result of the confidence level and the fixed decision threshold.
