An x86 processor vulnerability instruction mining method that can bypass kernel address space randomization protection

By designing an automated analysis method, abstracting it into a four-stage process and combining assembly and machine instruction patterns, we can uncover vulnerable instructions that can bypass kernel address space randomization protection. This solves the problem of the difficulty in systematically bypassing kernel address space randomization protection in existing technologies, and achieves more efficient security assessment and analysis.

CN123177879APending Publication Date: 2026-11-27BEIJING UNIV OF POSTS & TELECOMM
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510679058.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-26
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

Existing technologies struggle to systematically bypass the vulnerability of x86 processors protected by kernel address space randomization. They lack comprehensive instruction mining methods, rely on the exploitation of single instructions, and cannot effectively bypass kernel address space randomization protection.

Method used

An automated analysis method is designed, which abstracts the attack process into four stages: environment preparation, memory probing, microarchitectural information recording, and differential analysis. Combining assembly instruction mode and machine instruction mode, the method dynamically traverses the opcode space by modifying the code to discover vulnerable instructions that can bypass the randomization protection of the kernel address space. A semaphore mechanism is used to suppress probing anomalies, and a mean-variance iterative algorithm is used to filter noisy data.

Benefits of technology

It implements a general framework that does not rely on reverse engineering of specific instructions or microarchitectures, improves the ability to bypass kernel address space randomization protection, enhances analysis accuracy and robustness, and provides a standardized toolchain for processor microarchitecture security assessment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123177879A_ABST
    Figure CN123177879A_ABST
Patent Text Reader

Abstract

The application discloses a kind of software can be implemented, general can bypass kernel address randomization protection x86 processor vulnerability instruction mining method.Processor microarchitecture side channel can leak the page table information of kernel code segment, and then can be used to bypass kernel address space randomization by modern operating system using kernel address space randomization technology to resist kernel code reuse attack.The present application starts from instruction diversity, without the implementation details of reverse microarchitecture components, focuses on attack task itself, first abstracts attack flow as four stages of environment preparation, memory detection, microarchitecture information recording and differential analysis, then locates the key attack code of kernel address space randomization bypass, finally studies the attack effect of different instructions after replacing key code.In addition, the present application respectively proposes a kind of vulnerability instruction mining method with assembly instruction as core and with machine instruction as core and can bypass kernel address randomization protection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of processor microarchitecture security, and more particularly to a method for mining vulnerable instructions in x86 processors by bypassing kernel address space randomization protection. Background Technology

[0002] Kernel address space randomization increases the difficulty of exploiting kernel vulnerabilities by assigning random virtual addresses to kernel code and data segments during system startup, effectively defending against kernel code reuse attacks. This randomization makes it difficult for attackers to predict the specific location of critical kernel components, thus preventing many attack methods that rely on fixed addresses. It is a standard security feature of modern operating systems, mainly comprising three key elements: the granularity of randomization, the range of randomization, and the relocation mechanism. In the x86_64 architecture with four-level page tables, the Linux kernel image typically uses a randomization granularity of 2MB page alignment, mapping to a 1GB address space of 0xffffffff80000000-0xffffffffc0000000, with 512 possible offsets. The code distribution within the image is related to the Linux kernel version, providing sufficient randomness while ensuring system performance. The security of kernel address space randomization largely depends on the complete isolation of address information. Once an attacker can deduce the actual load address of a kernel component through some means, the defense effect is significantly weakened.

[0003] Modern processors, designed with multi-issue pipelines and shared microarchitectural units to optimize performance, introduce side-channel threats. Processor microarchitectural side-channel attacks utilize caches, TLBs, branch predictors, instruction fetch target queues, and hardware prefetch units to collect microarchitectural traces and recover sensitive information. A key attack target is kernel address space randomization. Attackers bypass kernel address space randomization protection by relying on three microarchitectural differences: mapped and unmapped memory, 2MB and 4KB page granularity, and executable and non-executable memory pages. By collecting microarchitectural traces from kernel address probing, attackers can distinguish kernel code segments from other memory regions, thus bypassing kernel address space randomization. Related research innovations focus on three aspects: memory probing instruction selection, exception handling, and microarchitectural trace extraction. Research on memory probing instructions focuses on carefully crafted attacks using single instructions, including MOV, CLDEMOTE, and JCC. Research on exception handling falls into two categories: one focuses on handling exception signals, such as using semaphore mechanisms and transaction synchronization extensions; the other attempts to prevent exceptions from being triggered, such as using the CMASKMOV instruction with a mask set to all zeros, the software prefetch PREFETCHNTA instruction, masking mechanisms, and transient execution windows generated by speculative execution mechanisms. Furthermore, while the KPTI mechanism separates user page tables from kernel page tables, the system call and interrupt handling pages retained in the user page tables can still be bypassed by circumventing kernel address space randomization. Additionally, some attackers use interrupt mechanisms to collect microarchitectural traces or exploit hot interrupt triggering to bypass kernel address space randomization protection. Summary of the Invention

[0004] Modern operating systems rely on kernel address space randomization to defend against code reuse attacks, but their security is limited by side-channel leaks in the processor microarchitecture (such as cache state and page granularity differences). Existing research mostly focuses on the exploitation of single instructions, lacking systematic mining methods. The purpose of this invention is to design an automated analysis method based on instruction diversity to systematically mine vulnerable instructions that can bypass kernel address space randomization protection. This method does not require reverse engineering the implementation details of microarchitecture components, focusing instead on the attack task itself. First, the attack process is abstracted into four stages: environment preparation, memory probing, microarchitecture information recording, and differential analysis. Then, the key attack code that can bypass kernel address space randomization protection is located. Finally, the attack effects of different instructions after replacing the key code are studied from the perspectives of assembly instructions and machine instructions.

[0005] The core innovations of this invention lie in its general framework, bimodal mining, and robustness enhancement. The general framework refers to the method's abstraction of the attack process into four stages: environment preparation, memory probing, trace recording, and differential analysis, eliminating reliance on reverse engineering of specific instructions or microarchitectures. Bimodal mining refers to the invention's use of a mining method combining assembly instruction patterns and machine instruction patterns. It utilizes the Intel instruction set specification to automatically generate variants of memory operation instructions (e.g., operands are replaced with boundary values) to achieve assembly instruction pattern mining; and dynamically traverses the opcode space through self-modifying code to explore potential attack surfaces of undocumented instructions in machine instruction pattern mining. Robustness enhancement refers to the invention's introduction of a semaphore mechanism to suppress probing anomalies and the use of a mean-variance iterative algorithm to filter noisy data, improving analysis accuracy. Furthermore, this invention provides a standardized toolchain for processor microarchitecture security assessment.

[0006] To achieve the above objectives, the present invention provides the following technical method:

[0007] In a first aspect, the present invention provides a software-implementable and universal method for mining vulnerabilities in x86 processor instructions that can bypass kernel address randomization protection, comprising the following steps:

[0008] S1. Prepare the hardware and software environment and experimental parameters for vulnerability instruction mining;

[0009] S2. Use the memory probing module to process each kernel address to be probed 1000 times;

[0010] S3. Use the anomaly analysis module to distinguish microarchitectural traces and locate vulnerable instructions in the x86 processor.

[0011] Further, in step S1, the hardware and software environment for vulnerability instruction mining is prepared, a kernel function is selected, the corresponding low-order offset is designed based on the kernel address of the function, and 512 2MB aligned memory addresses to be probed are generated starting from a unified kernel address base address.

[0012] Furthermore, in step S2, the memory probing module processes each kernel address to be probed 1000 times; a semaphore mechanism is added to the kernel address probing behavior to suppress anomalies; a timing instruction is used to record the time information of the kernel memory address probing process and the execution of the semaphore control code, and the information is saved with the probed address as the index and packaged and sent to the anomaly analysis module.

[0013] Furthermore, in step S3, the anomaly analysis module is used to distinguish between normal and abnormal cases of the 512 microarchitectural traces, and to analyze whether there are differences in the experimental data recorded by the memory probe module. If there are differences, the kernel address corresponding to the difference data is compared with the actual kernel address selected in step S1. If a match is found, the instruction can bypass the kernel address randomization protection.

[0014] Secondly, the present invention also provides a method for mining vulnerabilities in x86 processors in the form of assembly code that can bypass kernel address randomization protection, comprising the following steps:

[0015] S1. Referring to the x86 instruction set architecture description provided in the Intel manual as the instruction source and instruction format reference, model the x86 assembly instructions, extract all assembly instructions related to memory operations, and replace each operand that can be a memory address with the address to be detected one by one;

[0016] S2. Use a memory probing module to record all microarchitectural traces generated by the inline assembly attack code generated in the previous step when probing 512 kernel addresses;

[0017] S3. Use the anomaly analysis module to distinguish microarchitectural traces and locate vulnerable instructions in the x86 processor.

[0018] Furthermore, in step S1, firstly, all assembly instructions involving memory access are located, then suffixes are added to the assembly instructions to accommodate operands of different lengths, and finally, all operands of the assembly instruction that can be filled with memory addresses are located. Each time, one of them is set as the target memory address to be tested, and the remaining operands are boundary values ​​such as 0, maximum value, and minimum value, and adjusted to the inline assembly format of AT&T.

[0019] Further, in step S2, a KASLR attack template that uses CLFLUSH to probe the target address and an automated script are prepared. An item is selected from the list of inline assembly attack code, and the line of code that uses CLFLUSH to probe the memory address is located by pattern matching. This line of code is then replaced with the inline assembly attack code generated in the previous step.

[0020] Thirdly, the present invention also provides a method for mining vulnerabilities in x86 processors in the form of machine code that can bypass kernel address randomization protection, comprising the following steps:

[0021] S1. A basic kernel address randomization bypass attack is performed using a memory probing module. Based on this, the system uses self-modified code to traverse all possible cases of single-byte, double-byte, and triple-byte opcodes, and records the microarchitectural traces of each instruction accessing 512 kernel addresses.

[0022] S2. Use the anomaly analysis module to distinguish microarchitectural traces and locate vulnerable instructions in the x86 processor.

[0023] Furthermore, in step S1, the KASLR attack template based on CLFLUSH is improved by skipping the compilation check stage. After the program completes an attack evaluation, self-modifying code is used to modify the byte opcode corresponding to CLFLUSH in the attack template at runtime to perform memory probing and record microarchitectural traces in a timely manner.

[0024] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0025] This invention proposes a software-implementable and universal method for mining vulnerabilities in x86 processors that can bypass kernel address space randomization protection. It does not require reverse engineering the implementation details of microarchitectural components, focusing instead on the attack task itself. First, the attack process is abstracted into four stages: environment preparation, memory probing, microarchitectural information recording, and differential analysis. Then, the key attack code for KASLR bypass is located. Finally, the attack effects of different instructions after replacing the key code are studied. Two specific methods for mining vulnerabilities in x86 processors are proposed, starting from assembly code and machine code respectively, to mine numerous assembly and machine instructions that can be used to bypass kernel address space randomization. Attached Figure Description

[0026] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this invention. For those skilled in the art, other drawings can be obtained based on these drawings.

[0027] Figure 1 This is an overview diagram of a software-implementable, general-purpose method for mining vulnerable instructions in x86 processors that can bypass kernel address randomization protection, as provided by the present invention.

[0028] Figure 2 The distribution of x86 instruction types to be evaluated in the x86 processor vulnerability instruction mining method in assembly code form provided by the present invention, which can bypass kernel address randomization protection. Figure 3This invention provides experimental data on vulnerable single-byte instructions in x86 processors, presented in machine code form, that can bypass kernel address randomization protection. Each square represents a single byte of machine code, where the row number represents the high 4 bits of the single-byte machine code in hexadecimal form, and the column number represents the low 4 bits in hexadecimal form. The color of the square indicates whether the instruction can bypass kernel address randomization protection; darker colors indicate that it can be bypassed, and lighter colors indicate that it cannot. Detailed Implementation

[0029] To better understand this technical solution, the technical solution of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described examples are only a part of the embodiments of the present invention, and not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art based on this application are within the scope of protection of the present invention.

[0030] This invention proposes a software-implementable and universal method for mining vulnerable instructions in x86 processors that can bypass kernel address randomization protection, such as... Figure 1 As shown. This method designs three main modules, describing a general approach to assessing instruction vulnerability. Among them:

[0031] The three modules include an environment preparation module, a memory detection module, and an anomaly analysis module, such as... Figure 1 As shown.

[0032] (1) Environment Preparation Module. This module prepares the hardware and software environment for vulnerability instruction mining, selects a suitable target kernel function, designs the corresponding low-order offset based on the kernel address of the function, and generates 512 2MB-aligned memory addresses to be probed, starting from a unified kernel address base. In addition, referring to the instruction format, it generates legitimate attack code and assembles it into the attack template.

[0033] (2) Memory Probing Module. This module uses the attack program and hardware / software environment provided by the environment preparation module to perform memory access. To ensure the uniformity of the experimental environment, the memory probing module uses a semaphore mechanism to capture possible abnormal signals. The key to bypassing kernel address randomization comes from the differences between mapped kernel code segments and other memory regions, such as mapping status, page granularity, and page table permissions. The memory probing module uses timing instructions to collect microarchitectural traces of the memory probing process.

[0034] (3) Anomaly Analysis Module. For a single instruction, this method collects microarchitectural data from 512 probe addresses and performs differential analysis in the anomaly analysis module. Specifically, each address corresponds to 1000 probes of microarchitectural data. This module first integrates these 1000 data points, calculates the mean and variance, and filters out anomaly data. It then calculates the mean and variance again until no anomaly data is filtered out. Finally, the mean of the data is used as the value for each address, and the memory address of the kernel code segment function is determined by finding the minimum and maximum values ​​of the 512 values.

[0035] Example 1

[0036] This invention proposes a method for mining vulnerable instructions in x86 processors in assembly code form that can bypass kernel address randomization protection, wherein the assembly instructions to be tested are constructed from the reference instruction format as follows: Figure 2 The distribution is shown. Among them, the instruction set extensions of AVX and AVX512 series introduce a large number of memory access instructions, which are the main source of kernel address randomization vulnerability instructions.

[0037] Example 2

[0038] This invention proposes a method for mining vulnerabilities in x86 processor instructions in machine code form that can bypass kernel address randomization protection. Experimental results for single-byte opcodes are as follows: Figure 3 As shown.

[0039] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention are included within the scope of protection of the present invention.

Claims

1. A software-implementable and universal method for mining vulnerabilities in x86 processor instructions that can bypass kernel address randomization protection, characterized in that, This method probes kernel addresses and records processor microarchitectural traces (such as execution time differences) using x86 instructions, without needing to reverse engineer the microarchitectural implementation details. It employs a modular process: environment preparation (generating 512 2MB aligned addresses), memory probing (1000 times / address, semaphore suppression anomalies), and anomaly analysis (differential location of vulnerable instructions). It supports both assembly and machine instruction mining modes. Attackers use common instructions to probe a series of kernel addresses and collect microarchitectural differences through timing instructions, enabling the discovery of vulnerabilities in x86 processors that can bypass kernel address randomization protection. This method does not require reverse engineering the implementation details of microarchitectural components, focusing solely on the attack task itself. The steps include: S1. Prepare the hardware and software environment and experimental parameters for vulnerability instruction mining; S2. Use the memory probing module to process each kernel address to be probed 1000 times; S3. Use the anomaly analysis module to distinguish microarchitectural traces and locate vulnerable instructions in the x86 processor.

2. The software-implementable and universal method for mining vulnerable instructions in x86 processors that can bypass kernel address randomization protection, as described in claim 1, is characterized in that... In step S1, prepare the hardware and software environment for vulnerability instruction mining, select a suitable target kernel function, design the corresponding low-order offset based on the kernel address of the function, and generate 512 2MB aligned memory addresses to be probed starting from a unified kernel address base address.

3. The software-implementable and universal method for mining vulnerable instructions in x86 processors that can bypass kernel address randomization protection, as described in claim 1, is characterized in that... In step S2, the memory probing module is used to process each kernel address to be probed 1000 times, and the collected microarchitectural traces are saved with the corresponding address as the index; a semaphore mechanism is added to the kernel address probing behavior to suppress anomalies; a timing instruction is used to record the time information of the kernel memory address probing process and the execution of the semaphore control code, and the information is saved with the probe address as the index.

4. The software-implementable and universal method for mining vulnerable instructions in x86 processors that can bypass kernel address randomization protection, as described in claim 1, is characterized in that... In step S3, the anomaly analysis module is used to distinguish between normal and abnormal cases of 512 microarchitecture traces, and to analyze whether there are differences in a series of experimental data recorded by the memory probing module. If a discrepancy exists, the kernel address corresponding to the discrepancy data is compared with the actual kernel address selected in step S1. If a match is found, the x86 processor instruction can be used to bypass kernel address randomization protection.

5. A method for exploiting x86 processor vulnerabilities in assembly code form, capable of bypassing kernel address randomization protection, characterized in that... This study focuses on the assembly form of x86 processor instructions to bypass kernel address randomization in modern operating systems. It models memory-related assembly instructions based on Intel manuals, replaces operands with the addresses to be tested, and generates AT&T-formatted inline code. A KASLR attack template is integrated, and an automated script replaces instructions and records microarchitectural traces. Specifically, this method includes the following steps: S1. Referring to the x86 instruction set architecture description provided in the Intel manual as the instruction source and instruction format reference, model the x86 assembly instructions, extract all assembly instructions related to memory operations, and replace each operand that can be a memory address with the address to be detected one by one; S2. Use a memory probing module to record all microarchitectural traces generated by the inline assembly attack code generated in the previous step when probing 512 kernel addresses; S3. Use the anomaly analysis module to distinguish microarchitectural traces and locate vulnerable instructions in the x86 processor.

6. The method for mining x86 processor vulnerability instructions in assembly code form, capable of bypassing kernel address randomization protection, as described in claim 5, is characterized in that... In step S1, firstly, all assembly instructions involving memory access are located, then suffixes are added to the assembly instructions to accommodate operands of different lengths, and finally, all operands of the assembly instruction that can be filled with memory addresses are located. Each time, one of them is set as the target memory address to be tested, and the remaining operands are boundary values ​​such as 0, maximum value, and minimum value, and adjusted to the inline assembly format of AT&T.

7. The method for mining x86 processor vulnerability instructions in assembly code form, capable of bypassing kernel address randomization protection, as described in claim 5, is characterized in that... In step S2, prepare a KASLR attack template that uses CLFLUSH to probe the target address and an automated script. Select an item from the list of inline assembly attack code, locate the line of code that uses the CLFLUSH instruction to probe the memory address through pattern matching, and replace it with the inline assembly attack code generated in the previous step.

8. A method for mining vulnerabilities in x86 processor instructions in machine code form that can bypass kernel address randomization protection, characterized in that, This study focuses on the byte format of x86 processor instructions to bypass kernel address randomization in modern operating systems. It improves the CLFLUSH template, dynamically modifying byte opcodes at runtime to traverse single / double / triple byte combinations and record microarchitectural traces at address 512. Specifically, the method includes the following steps: S1. A basic kernel address randomization bypass attack is performed using a memory probing module. Based on this, the system uses self-modified code to traverse all possible cases of single-byte, double-byte, and triple-byte opcodes, and records the microarchitectural traces of each instruction accessing 512 kernel addresses. S2. Use the anomaly analysis module to distinguish microarchitectural traces and locate vulnerable instructions in the x86 processor.

9. A method for mining vulnerabilities in x86 processor instructions in machine code form, capable of bypassing kernel address randomization protection, as described in claim 8, characterized in that... In step S1, the KASLR attack template based on CLFLUSH is improved by skipping the compilation check stage. After the program completes an attack evaluation, self-modifying code is used to modify the byte opcode corresponding to CLFLUSH in the attack template at runtime to perform memory probing and record microarchitectural traces in a timely manner.