Fuzzy testing method, electronic equipment, and media based on virtual CPU generated by intelligent instructions.
By using natural language processing to generate context-sensitive instruction sequence sets from the Intel instruction set manual, and combining this with a fuzzer to optimize instruction generation, the problem of low efficiency in virtual CPU fuzzing was solved, resulting in more efficient vulnerability discovery.
Patent Information
- Application Number
- CN202310579825.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-22
- Publication Date
- 2026-11-17
- Estimated Expiration
- 2043-05-22
AI Technical Summary
Traditional virtual CPU fuzzing methods generate instruction sequences randomly, resulting in low efficiency and poor effectiveness, making it difficult to effectively discover security vulnerabilities in virtual CPUs.
By using natural language processing to generate a context-sensitive instruction sequence set from the Intel instruction set manual, a seed set for virtual CPU fuzzing is created. The fuzzer is then used to obtain the branch coverage of the CPU program, and new instruction sequences are iteratively generated until the coverage stabilizes, thereby improving testing efficiency.
It significantly improves branch coverage of virtual CPU code, discovers more vulnerabilities, and enhances the efficiency and effectiveness of fuzz testing.
Smart Images

Figure CN116860599B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of network security technology, specifically the field of virtualization security, and specifically relates to a context-sensitive virtual CPU fuzzing method, electronic device, and medium. Background Technology
[0002] In the era of cloud computing, the security of hypervisors is crucial to the overall security of the cloud. Hypervisors must provide necessary security guarantees, such as isolation between virtual machines; otherwise, user security will be compromised, especially in multi-tenant data centers. In particular, the security of CPU virtualization within the hypervisor is critical, as it is implemented in the most privileged CPU mode. Therefore, how to accurately and efficiently discover security vulnerabilities in virtual CPUs is a problem worthy of research.
[0003] Traditional fuzzing has a problem: the generation of instruction sequences for fuzzing virtual CPUs is random, which results in a large number of invalid and repetitive instruction sequences, greatly reducing the efficiency and effectiveness of fuzzing.
[0004] Therefore, there is an urgent need to propose a virtual CPU fuzzing method to improve the efficiency of fuzzing. Summary of the Invention
[0005] The purpose of this invention is to address the shortcomings of existing technologies by providing a virtual CPU fuzzing test method, electronic device, and medium based on intelligent instruction generation.
[0006] The objective of this invention is achieved through the following technical solution:
[0007] A first aspect of this invention provides a virtual CPU fuzzing method based on intelligent instruction generation. The method specifically includes the following steps:
[0008] S1 generates an instruction sequence set through natural language processing of the Intel instruction set manual, which serves as the seed set for virtual CPU fuzzing.
[0009] S2, input the seed set obtained in step S1 into the fuzz tester, and obtain the branch coverage of the CPU program through the fuzz tester; and,
[0010] Based on the branch coverage of the CPU program, a new instruction sequence is generated and input into the fuzz tester for testing; this process is repeated iteratively until the branch coverage of the CPU program stabilizes.
[0011] A second aspect of the present invention provides an electronic device, including a memory and a processor, wherein the memory is coupled to the processor; wherein the memory is used to store program data, and the processor is used to execute the program data to implement the above-described virtual CPU fuzzing method based on intelligent instruction generation.
[0012] A third aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the above-described virtual CPU fuzzing method based on intelligent instruction generation.
[0013] Compared with the prior art, the present invention has the following beneficial effects:
[0014] This invention generates an instruction sequence set using natural language processing based on the Intel instruction set manual, serving as the seed set for virtual CPU fuzzing. A fuzzer is used to obtain the branch coverage of the CPU program, and new instruction sequences are generated based on this coverage. These new sequences are then input into the fuzzer for iterative testing, which can more quickly improve the branch coverage of the virtual CPU code, thereby enhancing the efficiency of fuzzing. This method can explore the boundary branches of the virtual CPU code, thus discovering more vulnerabilities and improving the effectiveness of fuzzing. Attached Figure Description
[0015] To more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0016] Figure 1 This is a flowchart of the method of the present invention;
[0017] Figure 2 This is a diagram illustrating the underlying architecture of fuzz testing.
[0018] Figure 3 This is a schematic diagram of an electronic device. Detailed Implementation
[0019] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0020] It should be noted that, unless otherwise specified, the features in the following embodiments and implementation methods can be combined with each other.
[0021] Natural Language Processing (NLP) is an important field within computer science and artificial intelligence, researching various theories and methods for computers to effectively understand and generate natural language. Fuzzing is a method for discovering software vulnerabilities by providing unexpected input to a target system and monitoring the abnormal results. This invention combines these two technologies, and after in-depth research on QEMU-KVM, it was discovered that specific instruction sequences trigger different virtual CPU code processing functions. Therefore, a virtual CPU fuzzing method based on intelligent instruction generation is designed, enabling fuzzing to reach deeper code branches more quickly, thus improving the efficiency and effectiveness of fuzzing.
[0022] like Figure 1 and Figure 2 As shown in the figure, this invention provides a virtual CPU fuzzing method based on intelligent instruction generation. This method extracts a set of context-sensitive instruction sequences by parsing the Intel instruction set manual using natural language processing. The generated instruction sequence set is then input into a fuzz tester for fuzzing. The method specifically includes the following steps:
[0023] Step S1: Generate a context-sensitive instruction sequence set by natural language processing of the Intel instruction set manual, which serves as the seed set for virtual CPU fuzzing.
[0024] Specifically, privileged instructions, non-privileged instructions, and the legality between instructions in the Intel instruction set manual are analyzed to generate a context-sensitive instruction sequence set as a seed set for virtual CPU fuzzing.
[0025] The specific handling of the Intel instruction set manual is as follows:
[0026] Step S101: Classify instruction module types according to the instruction classification and instruction format in the Intel instruction set manual, as shown in Table 1 below. These mainly include instruction prefix, Opcode, ModR / M, SIB, offset, and immediate value.
[0027] Table 1: Instruction Module Types in the Intel Instruction Set Manual
[0028] instruction prefix Opcode ModR / M SIB Offset Immediate number
[0029] Step S102: Based on the instruction module type, denote the basic requirements of different types of instructions listed in the Intel instruction set manual as n. o ;
[0030] Step S103: Perform phrase structure analysis and semantic analysis tasks from Natural Language Processing (NLP) on the "Description" section of each instruction in the Intel instruction set manual. The focus is on extracting sentences where the subject is a word similar to the instruction module type and the object contains specific numerical or range requirements. Word vector similarity is used to compare similar words, and the results are recorded as additional requirements n of the instruction. e ;
[0031] Step S104: Perform phrase structure analysis and semantic analysis on other chapters in the Intel instruction set manual that contain instruction formats and specific instruction module specifications, analyze the condition-result statements, and record them as the condition requirements n of the instruction. c ;
[0032] Step S105, the above instruction category requirements n o Additional requirements n e Conditions and requirements n c The constraints are organized into a set C for each instruction, which is the specific numerical requirement of each instruction module type in step S101. Cartesian product is performed on the different constraint sets C for each instruction module type of each instruction, and the SMT solver obtains different legal generation schemes for each instruction.
[0033] Step S106: Convert all the legal generation schemes obtained above into the architecture specification language in code form, which is the initial instruction generated by natural language processing from the instruction set manual.
[0034] S2, input the seed set obtained in step S1 into the fuzz tester, and obtain the branch coverage of the CPU program through the fuzz tester; and,
[0035] Based on the feedback from the branch coverage of the CPU program, a new instruction sequence is generated and input into the fuzz tester for testing; this process is repeated iteratively until the branch coverage of the CPU program stabilizes.
[0036] It should be noted that step S2 also includes: monitoring whether the virtual CPU program crashes.
[0037] If the virtual CPU program crashes, it indicates a security vulnerability in the code that caused the crash, and this vulnerability can be triggered by the current sequence of input instructions. In this case, it is necessary to record the current program's call stack information and save the current instruction sequence for subsequent vulnerability analysis and patching.
[0038] If the virtual CPU program does not crash, a new instruction sequence is generated by mutation based on the branch coverage of the virtual CPU-related code, and the new instruction sequence is input into the fuzz tester.
[0039] Furthermore, in this example, the fuzz tester is implemented by calling the KVM_Intel module in the qemu virtual machine.
[0040] like Figure 3 As shown, this application provides an electronic device including a memory 101 for storing one or more programs and a processor 102. When the one or more programs are executed by the processor 102, they implement the method as described in any of the first aspects above.
[0041] The system also includes a communication interface 103. The memory 101, processor 102, and communication interface 103 are electrically connected directly or indirectly to each other to enable data transmission or interaction. For example, these components can be electrically connected to each other via one or more communication buses or signal lines. The memory 101 can be used to store software programs and modules, and the processor 102 executes various functional applications and data processing by executing the software programs and modules stored in the memory 101. The communication interface 103 can be used for signaling or data communication with other node devices.
[0042] The memory 101 may be, but is not limited to, random access memory (RAM), read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), etc.
[0043] Processor 102 can be an integrated circuit chip with signal processing capabilities. This processor 102 can be a general-purpose processor 102, including a central processing unit (CPU) 102 and a network processor 102.
[0044] (Network Processor, NP), etc.; it can also be a Digital Signal Processor (DSP), Application Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0045] In the embodiments provided in this application, it should be understood that the disclosed methods and systems can also be implemented in other ways. The method and system embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of methods and systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0046] In addition, the functional modules in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0047] On the other hand, embodiments of this application provide a computer-readable storage medium storing a computer program thereon. When executed by processor 102, the computer program implements the methods described in any of the first aspects above. If the functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory 101 (ROM), random access memory 101 (RAM), magnetic disks, or optical disks.
[0048] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the disclosure herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and embodiments are to be considered exemplary only.
[0049] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope.
Claims
1. A virtual CPU fuzzing method based on intelligent instruction generation, characterized in that, The method specifically includes the following steps: S1 generates an instruction sequence set through natural language processing of the Intel instruction set manual, which serves as the seed set for virtual CPU fuzzing. S2, input the seed set obtained in step S1 into the fuzz tester, and obtain the branch coverage of the CPU program through the fuzz tester; and, Based on the branch coverage of the CPU program, a new instruction sequence is generated and input into the fuzz tester for testing; this process is repeated iteratively until the branch coverage of the CPU program stabilizes.
2. The virtual CPU fuzzing test method based on intelligent instruction generation according to claim 1, wherein, Step S1, which generates an instruction sequence set through natural language processing of the Intel instruction set manual, includes: The privileged instructions, non-privileged instructions, and the legality of instructions in the Intel instruction set manual are analyzed to generate an instruction sequence set as a seed set for virtual CPU fuzzing.
3. The virtual CPU fuzzing method based on smart instruction generation of claim 2, wherein, Analysis of privileged instructions, non-privileged instructions, and the legality of instructions in the Intel instruction set manual includes: Step S101: Classify instruction module types according to the instruction classification and instruction format in the Intel instruction set manual; Step S102, according to the instruction module type, the instruction category requirement listed in the Intel instruction set manual is recorded as ; Step S103, the description part of each instruction in Intel instruction set manual is subjected to phrase structure analysis and semantic analysis tasks in natural language processing, the subject is the word with similar instruction module type, the object is the sentence containing specific numerical value or range requirement, the similar words are compared by calculating the word vector similarity, and the result is recorded as the additional requirements of the instruction ; Step S104: Perform phrase structure analysis and semantic analysis on other chapters in the Intel instruction set manual that contain instruction formats and specific instruction module specifications, analyze the condition-result statements, and record them as the condition requirements of the instructions. ; Step S105, specify the instruction category requirements. Additional requirements Conditions and requirements Organized into a set of constraints for each instruction The set of different constraints for each instruction module type for each instruction. Perform the Cartesian product, and the SMT solver obtains different valid generation schemes for each instruction; Step S106: Convert all valid generation schemes into instructions generated by natural language processing from the instruction set manual.
4. The virtual CPU fuzzing method based on intelligent instruction generation according to claim 3, characterized in that, The instruction module types include instruction prefix, Opcode, ModR / M, SIB, offset, and immediate value.
5. The virtual CPU fuzzing method based on intelligent instruction generation according to claim 1, characterized in that, Step S2 also includes: Monitor whether the virtual CPU program crashes.
6. The virtual CPU fuzzing method based on intelligent instruction generation according to claim 5, characterized in that, When the virtual CPU program crashes, record the current CPU program's call stack information and save the current instruction sequence; When the virtual CPU program does not crash, a new instruction sequence is generated based on the branch coverage variation of the virtual CPU-related code, and the new instruction sequence is input into the fuzz tester for testing.
7. The virtual CPU fuzzing method based on intelligent instruction generation according to claim 1 or 5, characterized in that, The fuzz tester calls the KVM_Intel module in the QEMU virtual machine.
8. An electronic device comprising a memory and a processor, characterized in that, The memory is coupled to the processor; wherein the memory is used to store program data, and the processor is used to execute the program data to implement the virtual CPU fuzzing test method based on intelligent instruction generation as described in any one of claims 1-7.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the virtual CPU fuzzing method based on intelligent instruction generation as described in any one of claims 1-7.
