Software security defense method, device and equipment
Through binary disassembly and analysis of software, combined with multi-dimensional evaluation methods, the problem of low generalization and performance overhead of vulnerability patching strategies in software security defense is solved, and high security and low-cost software defense effects are achieved.
Patent Information
- Application Number
- CN202410833781.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-26
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2044-06-26
AI Technical Summary
The existing technology has low generalization and high cost in vulnerability patching strategies in software security defense. Binary file rewriting leads to increased performance overhead, making it difficult to comprehensively improve software security without sacrificing performance.
By performing binary disassembly of the target software, analyzing and identifying semantic information and function body boundaries, performing binary rewriting processing, and conducting multi-dimensional evaluations to determine the implementability and security defense performance of the rewritten binary program.
It achieves high security defense performance for software, significantly improves runtime security and reliability, and provides a low-cost, low-overhead defense method with a wide range of applications.
Smart Images

Figure CN118733003A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of security defense, and specifically relates to a software security defense method, device and equipment. Background Art
[0002] With the rapid development and widespread application of computer technology, computer software has surpassed the simple tool attribute and become the "nerve center" that supports the operation of modern society, playing a core role in promoting the progress of all walks of life. However, in this process, the security issues of computer software have become increasingly prominent, posing a severe challenge to us. Since the software may be affected by the inherent security defects of its programming language during the development process, as well as the negligence of developers, this may lead to security vulnerabilities in the software. Once these vulnerabilities are discovered and exploited by malicious attackers, they may cause serious economic and property losses. Therefore, how to prevent attackers from exploiting vulnerabilities in the software to attack is a crucial research issue in the current field of computer security.
[0003] Direct patching is undoubtedly the most direct and effective method for software security vulnerabilities. However, due to the different characteristics of vulnerabilities in different software, and the fact that vulnerability discovery itself is challenging for defenders, it is difficult to ensure that all potential vulnerabilities in the software are fully identified. In addition, vulnerability patching often requires high costs, and the patching strategy for a specific vulnerability is often difficult to directly apply to other vulnerabilities, which further increases the difficulty of defense.
[0004] In many cases, the source code of software is not available, especially for Commercial-Off-the-Shelf (COTS) and legacy software, whose source code may not be public or has been lost, and security experts can only access the binary files of the program. The unavailability of source code undoubtedly brings additional challenges to defense work. In the absence of source code, the strategy usually adopted by defenders is to rewrite the binary file to modify its function to achieve the purpose of fixing the vulnerability. However, this binary rewriting method may introduce additional performance overhead, resulting in a decrease in the performance of the rewritten program, which requires finding an appropriate balance between security and performance.
[0005] In summary, the current solutions for software-level attack defense have the following defects and shortcomings:
[0006] (1) Defense strategies based on vulnerability patching have low generalizability and high costs;
[0007] (2) The vulnerability patching strategy for binary files using the rewriting strategy introduces additional performance overhead.
[0008] Therefore, defenders need to explore new ways to prevent attackers from exploiting vulnerabilities when they cannot fully discover or patch all vulnerabilities. At the same time, they also need to consider how to effectively improve software security without sacrificing too much performance to protect computer systems from attack threats. Summary of the invention
[0009] The technical problem to be solved by the present invention is to provide a software security defense method, device and equipment that can accurately and effectively detect vulnerabilities in the binary disassembly information of the software and automatically rewrite the program of the vulnerable part to ensure that the software has high security defense performance.
[0010] The present invention provides a software security defense method, including:
[0011] Disassemble the target software to obtain binary disassembly information;
[0012] Analyze and identify the binary disassembly information to determine corresponding semantic information and function body boundaries;
[0013] Determine the target code in the binary disassembly information based on the semantic information and the function body boundary;
[0014] performing a binary rewriting process on the target code;
[0015] Correct the rewritten code to obtain a rewritten binary program;
[0016] Performing a multi-dimensional evaluation on the rewritten binary program;
[0017] Based on the multi-dimensional evaluation results, at least the feasibility and security defense performance of the rewritten binary program data are determined.
[0018] In some embodiments, the method further comprises:
[0019] Constructing an analysis and recognition model, wherein the analysis and recognition model is used to analyze and recognize the binary disassembly information to determine the corresponding semantic information and function body boundaries;
[0020] The analyzing and identifying the binary program content to determine the corresponding semantic information and function body boundaries includes:
[0021] The binary program content is analyzed and identified based on the analysis and identification model to determine corresponding semantic information and function body boundaries.
[0022] In some embodiments, the constructing of the analysis and recognition model includes:
[0023] Build an initial model;
[0024] Constructing a training data set, wherein the data set is composed of open source known program source code and compiled data obtained by compiling the known program source code with a known compiler;
[0025] The initial model is trained based on the data set so that the initial model learns the compilation process of the program source code, so as to be used for disassembling or decompiling the binary disassembly information, and identifying the semantic information and function body boundaries corresponding to the binary program content based on the disassembly or decompilation result analysis.
[0026] In some embodiments, the initial model is composed of a BERT model;
[0027] The compiled data includes a binary file obtained by compiling a known program source code, data during the compilation process, semantics of marked binary statements, and function boundary information;
[0028] Training the initial model based on the data set includes two training stages. The first training stage is to learn the embedding of semantic information and function boundary information in binary data by means of cloze test and following prediction. The second training stage is to predict the semantic information and function boundary of binary data based on the embedded information.
[0029] In some embodiments, performing a binary rewriting process on the target code includes:
[0030] A binary rewriting process is performed on the target code based on at least one of a heuristic software rewriting method, a randomized software rewriting method, and a program semantic rewriting software rewriting method.
[0031] In some embodiments, the method further comprises:
[0032] Analyzing the target code based on prior knowledge to determine data features of the target code, wherein the prior knowledge is related to the attack type and the corresponding data features of the attacked data;
[0033] Based on the data features, a method for performing binary rewriting processing on the target code is determined from the heuristic software rewriting method, the randomized software rewriting method, and the software rewriting method of program semantic rewriting.
[0034] In some embodiments, the multi-dimensional evaluation of the rewritten binary program includes:
[0035] Performing a correctness evaluation on the binary disassembly information and the rewritten binary program by using a fuzz testing method;
[0036] Performing validity evaluation on the binary disassembly information and the rewritten binary program by using a CVE testing method;
[0037] Based on the binary visualization method, the binary disassembly information and the rewritten binary program are respectively converted into domains of visual representation, and the binary data in each domain is marked with different colors in combination with the binary function recognition method, so as to evaluate the code difference between the binary disassembly information and the rewritten binary program based on the marking results;
[0038] The binary disassembly information and the rewritten binary program are tested based on the SPEC test set, and the performance overhead and defense performance of the program during runtime are compared based on the test results to evaluate the security defense performance of the rewritten binary program. The performance overhead and defense performance at least include the rewriting overhead when the corresponding software is loaded, the rewriting overhead under active attack, the memory saving degree when the software is running, the performance evaluation of the software system, and the memory saving degree of the software system as a whole.
[0039] Another embodiment of the present invention also provides a software security defense device, including:
[0040] The first acquisition module is used to disassemble the target software and obtain binary disassembly information;
[0041] An identification module, used to analyze and identify the binary disassembly information, and determine corresponding semantic information and function body boundaries;
[0042] A first determination module, used for determining the target code in the binary disassembly information according to the semantic information and the function body boundary;
[0043] A rewriting module, used for performing a binary rewriting process on the target code;
[0044] A correction module, used for correcting the rewritten code to obtain a rewritten binary program;
[0045] An evaluation module, used for performing a multi-dimensional evaluation on the rewritten binary program;
[0046] The second determination module is used to determine at least the feasibility and security defense performance of the rewritten binary program according to the multi-dimensional evaluation results.
[0047] Another embodiment of the present invention further provides an electronic device, which includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps in the software security defense method described in any of the above embodiments are implemented.
[0048] Another embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps in the software security defense method described in any of the above embodiments are implemented.
[0049] The beneficial effects of the present invention include being able to detect the binary program content of the target software, determine the vulnerabilities or errors in the binary program content by performing semantic analysis and function boundary determination, then automatically perform binary rewriting on the area with the vulnerability, and make corrections based on the rewritten content to form a rewritten binary program. The security defense performance of the rewritten binary program is significantly improved at runtime, and the operation is safer. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings in the following description are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0051] Figure 1 The figure is a flowchart of the software security defense method in an embodiment of the present invention.
[0052] Figure 2 The figure is a schematic diagram of the application process of the software security defense method in an embodiment of the present invention.
[0053] Figure 3 The figure is another application flow diagram of the software security defense method in the embodiment of the present invention.
[0054] Figure 4 The figure is a structural block diagram of a software security defense device in an embodiment of the present invention. DETAILED DESCRIPTION
[0055] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings, but are not intended to limit the present invention.
[0056] It should be understood that various modifications may be made to the embodiments disclosed herein. Therefore, the following description should not be considered as limiting, but merely as an example of an embodiment. Other modifications within the scope of the present disclosure will occur to those skilled in the art.
[0057] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments of the present disclosure and, together with the general description of the present disclosure given above and the detailed description of the embodiments given below, serve to explain the principles of the present disclosure.
[0058] These and other characteristics of the invention will become apparent from the following description of a preferred form of embodiment given as a non-limiting example, with reference to the accompanying drawings.
[0059] It should also be understood that, although the invention has been described with reference to some specific examples, those skilled in the art will be able to realize many other equivalent forms of the invention that have the characteristics recited in the claims and are therefore within the scope of protection defined thereby.
[0060] The above and other aspects, features and advantages of the present disclosure will become more apparent from the following detailed description when taken in conjunction with the accompanying drawings.
[0061] Specific embodiments of the present disclosure are described hereinafter with reference to the accompanying drawings; however, it should be understood that the disclosed embodiments are merely examples of the present disclosure, which may be implemented in a variety of ways. Well-known and / or repeated functions and structures are not described in detail to avoid obscuring the present disclosure with unnecessary or redundant details. Therefore, the specific structural and functional details disclosed herein are not intended to be limiting, but merely serve as a basis and representative basis for the claims to teach those skilled in the art to use the present disclosure in a variety of ways with substantially any suitable detailed structure.
[0062] This specification may use the phrases "in one embodiment," "in another embodiment," "in a further embodiment," or "in other embodiments," all of which may refer to one or more of the same or different embodiments according to the present disclosure.
[0063] The embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0064] like Figure 1 and Figure 2 As shown, an embodiment of the present invention provides a software security defense method, including:
[0065] S1: Disassemble the target software to obtain binary disassembly information;
[0066] S2: Analyze and identify the binary disassembly information to determine corresponding semantic information and function body boundaries;
[0067] S3: determining the target code in the binary disassembly information based on the semantic information and the function body boundary;
[0068] S4: performing binary rewriting processing on the target code;
[0069] S5: Modify the rewritten code to obtain a rewritten binary program;
[0070] S6: performing a multi-dimensional evaluation on the rewritten binary program;
[0071] S7: Based on the multi-dimensional evaluation results, at least determine the feasibility and security defense performance of the rewritten binary program.
[0072] The target software described in this embodiment can be any program software that needs to be security tested, and it is not unique. After the system obtains the binary disassembly information of the target software, it will analyze and identify the binary disassembly information to analyze and determine its semantic information and function body boundaries. Then the system can analyze and determine the content with security vulnerabilities or program errors based on the semantic information and function body boundaries, that is, determine the target code that needs to be rewritten, and the target code is part or all of the binary disassembly information. Of course, if there is no data that needs to be rewritten, the system will output a corresponding prompt. When there is a target code that needs to be rewritten, the system will automatically perform a binary rewrite process on the target code, obtain the corresponding rewrite data, and based on the rewrite data, the corresponding data in the rewritten binary program is obtained to obtain the rewritten binary program. In order to ensure that the new binary disassembly information runs stably, the overall software performance is stable, and the security defense level is high, the system will conduct a multi-dimensional evaluation of the rewritten binary program. For example, through memory attacks such as code injection and code reuse, it can be verified whether the rewritten binary disassembly information can crash immediately, block the attack link, or verify the effectiveness of the rewritten binary program. Finally, based on the evaluation results, the feasibility and security defense performance of the rewritten binary program are determined, and the corresponding result information is output for user reference.
[0073] Based on the contents of the above embodiments, it can be known that the scheme described in this embodiment can detect the binary program content of the target software, determine the vulnerabilities or errors in the binary program content by performing semantic analysis and function boundary determination, and then automatically perform binary rewriting on the area with vulnerabilities or errors, and correct the rewritten content to form a rewritten binary program. The security defense performance of the rewritten binary program is significantly improved during runtime, and the operation is safer. That is, the method in this embodiment can greatly improve the security and reliability of the software, and provide a "low-cost", "low-overhead", and "widely applicable" defense method for key software systems.
[0074] Furthermore, based on the above content, it can be known that the software security defense method deployed in this embodiment can be configured as a software tool, which consists of three modules. The first module is a binary software analysis module, which is designed to identify semantic information and function body boundaries in binary code, and provide a target carrier for binary content that needs to be rewritten. The second module is a software rewriting module, which uses binary rewriting technology to rewrite part or all of the content of a binary file. The third module is an evaluation and verification module, which is used to evaluate the correctness of the rewritten binary software, the overall running performance of the software, the effectiveness of attack defense, etc.
[0075] In some embodiments, the method further comprises:
[0076] S8: constructing an analysis and recognition model, wherein the analysis and recognition model is used to analyze and recognize the binary disassembly information to determine the corresponding semantic information and function body boundary;
[0077] The analyzing and identifying the binary program content to determine the corresponding semantic information and function body boundaries includes:
[0078] S9: Analyze and identify the binary program content based on the analysis and identification model to determine corresponding semantic information and function body boundaries.
[0079] For example, the first module is a model, which is an analysis and recognition model. By constructing the model, the binary disassembly information of the target software can be input into the model to implement semantic analysis of the binary disassembly information and determination of function body boundaries based on the model.
[0080] Specifically, the construction of the analysis and recognition model includes:
[0081] S10: Build the initial model;
[0082] S11: constructing a training data set, wherein the data set is composed of open source known program source code and compiled data obtained by compiling the known program source code with a known compiler;
[0083] S12: Training the initial model based on the data set so that the initial model learns the compilation process of the program source code, so as to be used for disassembling or decompiling the binary disassembly information, and identifying the semantic information and function body boundaries corresponding to the binary program content according to the disassembly or decompilation result analysis.
[0084] Wherein, in some embodiments, the initial model is composed of a BERT model;
[0085] The compiled data includes a binary file obtained by compiling a known program source code, data during the compilation process, semantics of marked binary statements, and function boundary information;
[0086] Training the initial model based on the data set includes two training stages. The first training stage is to learn the embedding of semantic information and function boundary information in binary data by means of cloze test and following prediction. The second training stage is to predict the semantic information and function boundary of binary data based on the embedded information.
[0087] Exemplarily, first choose to build an initial model, which can be, for example, but not limited to, a BERT model, and then the system will build training data, for example, by obtaining the source code program data of the open source software, and then compiling it to obtain a binary program file, and can record the data in the compilation process, such as the symbol table, etc., while recording the semantic information of each binary statement or source code statement and the function boundary information involved. By collecting the above data, a training data set can be obtained. In order to strengthen the generalization ability of the model, when building the data set, the source code program of each software can be compiled using different compilers and optimization schemes, and the intermediate compiled data can be recorded as a training data set.
[0088] When the model is trained, the training data obtained in the previous step, that is, the binary data, is input into the model for learning after disassembly, and the training of the model is realized by using the marked semantics, function boundaries and other information as labels. Specifically, in order to enhance the generalization ability of the model and enable the model to be used for different downstream tasks, the training is divided into two stages in this embodiment, including: a model pre-training stage and a specific downstream task training stage. In the pre-training stage, the BERT model is used to learn the embedding of semantic information and function boundary information in the binary by methods such as cloze (Mask LM) and following prediction (NSP). In the specific downstream task stage, the semantic information and function boundary information of the corresponding binary disassembly information are predicted according to the embedded information. That is, the first stage is responsible for converting the binary file into assembly instructions or intermediate representations through technologies such as disassembly, and using it as the input of the machine learning model to learn to embed the data in the binary file. The second stage is to use these embedded expressions as inputs based on the function body boundary recognition technology of code semantics to predict the semantic information and function body boundary information in the binary file. After the training of the model is completed by the above method, the model has the ability to infer the semantic information and function boundary information in the binary disassembly information. For example, when applying, a binary file is used as the input of the model. After disassembly, it is input into the machine learning module of the model. The machine learning module can then perform inference and prediction on the input binary file to obtain the semantic information and function boundary information of the corresponding binary file.
[0089] In some other embodiments, performing binary rewriting on the target code includes:
[0090] S13: Perform binary rewriting processing on the target code based on at least one of a heuristic software rewriting method, a randomized software rewriting method, and a program semantic rewriting software rewriting method.
[0091] Optionally, the method further comprises:
[0092] S14: Analyze the target code based on prior knowledge to determine data features of the target code, where the prior knowledge is related to the attack type and the corresponding data features of the attacked data;
[0093] S15: Determine a method for performing binary rewriting processing on the target code from among the heuristic software rewriting method, the randomized software rewriting method, and the software rewriting method of program semantic rewriting based on the data features.
[0094] For example, a model can be constructed, which is used to analyze the target code according to prior knowledge and determine the data characteristics of the target code. The data characteristics match a certain type of attack method, such as attack method A is mainly used to attack a data area with data characteristic B, such as function B, etc. Based on this, the system can find and determine a rewriting method that can keep the source code content unchanged and avoid attack method A to rewrite the target code, thereby improving the software security defense performance after rewriting. The rewriting method in this embodiment includes but is not limited to a software rewriting method of heuristic method, a randomized software rewriting method, and a software rewriting method of program semantic rewriting. For the software rewriting method of heuristic method, attack model modeling and feature extraction can be used to construct a heuristic for rewriting. Specifically, firstly, the memory attack behavior is modeled to characterize the code injection and code reuse attack behaviors; based on the memory attack behavior model and the actual attack code, the behavior and code characteristics are extracted, and the heuristic is designed based on these characteristics; then, through the binary rewriting technology, the heuristic implementation code is injected into the target code corresponding to the binary disassembly information, so that when the attack code is executed, the code itself will directly enter the crash state. For example, for code injection attacks, we can use a heuristic that sets the stack frame to be non-executable, so that the attack code will directly enter a crash state when it is executed. In code reuse attacks, since the attacker needs to constantly search the memory space to construct the attack chain, the end of these attack chains is generally achieved by the execution of the interrupt function, and the layout in the memory is jumping, which is different from the normal control flow. Therefore, the system can design a heuristic based on this to use the crash mechanism to induce the software to crash when the software executes abnormal instructions. For the randomized software rewriting method, address space randomization is involved, and address space randomization will make it difficult for the attack instruction to jump to the function at a specific location in the memory. When the attacker jumps to an illegal address area, the software will crash, thereby preventing buffer overflow attacks. Since parsing instructions from different locations may have different results, different instruction equivalence conversion methods can be used for different types of short instruction fragments, such as ret type instructions, Jmp type instructions, and Call type instructions to achieve randomized software rewriting.
[0095] In other embodiments, after obtaining the rewritten binary program, the system will evaluate it in different dimensions to determine whether the rewritten binary program can support the successful operation of the software and the overall performance and security defense capabilities during operation. Specifically, the multi-dimensional evaluation of the rewritten binary program includes:
[0096] S16: Performing a correctness evaluation on the binary disassembly information and the rewritten binary program by using a fuzz testing method;
[0097] S17: Evaluate the validity of the binary disassembly information and the rewritten binary program by using a CVE testing method;
[0098] S18: based on the binary visualization method, respectively converting the binary disassembly information and the rewritten binary program into visual representation domains, and combining the binary function recognition method to mark the binary data in each domain with different colors, so as to evaluate the code difference between the binary disassembly information and the rewritten binary program based on the marking results;
[0099] S19: Test the binary disassembly information and the rewritten binary program based on the SPEC test set, and compare the performance overhead and defense performance of the program during runtime based on the test results to evaluate the security defense performance of the rewritten binary program. The performance overhead and defense performance at least include the rewriting overhead when the corresponding software is loaded, the rewriting overhead under active attack, the memory saving degree of the software during runtime, the performance evaluation of the software system, and the memory saving degree of the software system as a whole.
[0100] Exemplarily, the multi-dimensional evaluation in this embodiment mainly involves four aspects: First, the correctness evaluation of the rewritten binary program can be performed by the fuzz test method to perform the same input on the binary file before rewriting and the binary file after rewriting, and then compare their outputs. If the degree of similarity of their outputs is higher, it means that the rewritten software retains the semantics of the original binary file under correct execution. The correctness test experiment in this embodiment verifies that all allocations of the system can be executed normally and that these allocated memories are real and valid by checking the memory addresses allocated after rewriting. Second, the effectiveness evaluation of the rewritten binary program: the effectiveness evaluation is based on real software or test sets for testing, and typical CVEs are selected for effectiveness testing, and the elasticity of the software rewriting defense method to the existing attacker model is compared and analyzed. Third, based on the visual code difference comparison, the binary visualization method can convert the software binary code into another domain that can be visualized (usually a two-dimensional space), and then use different colors to represent the binary code at different positions in the domain. Considering the difficulty of binary visualization annotation of binary disassembly information after rewriting, this embodiment realizes the annotation of the rewritten binary code by combining binary function recognition, that is, binary visualization. Fourth, the performance overhead of the rewritten software is evaluated. This embodiment conducts testing through the SPEC test set, and compares the performance overhead of the binary disassembly information before and after the rewrite by inputting the test set. At the same time, the rewrite overhead when loading the rewritten binary program, the rewrite delay, the rewrite overhead under active attack, the degree of memory saving during runtime, the performance evaluation of the entire system, the system-wide memory saving estimation, etc. are further compared and analyzed to analyze the defense performance of the software.
[0101] like Figure 3 As shown, when the solution in this embodiment is actually applied, the specific steps include:
[0102] In the first stage, the analysis and recognition model training is carried out. The trained model can recognize the semantic information and function boundary information of binary files.
[0103] The first step is to compile the binary file of the training source code and record the intermediate compilation process data.
[0104] In the second step, the information obtained in the previous step is input into the model for training to obtain an embedded representation (feature vector). At the same time, the feature vector is used as the input of the downstream task to train the model's ability to analyze and recognize function boundaries and semantic information.
[0105] The second stage is model reasoning and binary rewriting.
[0106] In the third step, the binary files that need to be rewritten through analysis are disassembled to obtain intermediate representation data.
[0107] The fourth step is to input the intermediate representation data into the trained analysis and recognition model to obtain the function boundary information and semantic information in the binary file.
[0108] In the fifth step, based on the function boundary information and semantic information in the binary file, a matching rewriting method is selected to rewrite part or all of the contents in the binary file.
[0109] The sixth step is to conduct a multi-dimensional evaluation of the rewritten binary file to determine whether the rewritten binary file can support the safe and stable operation of the software.
[0110] like Figure 4 As shown, another embodiment of the present invention also provides a software security defense device 100, including:
[0111] The first acquisition module is used to disassemble the target software and obtain binary disassembly information;
[0112] An identification module, used to analyze and identify the binary disassembly information, and determine corresponding semantic information and function body boundaries;
[0113] A first determination module, used for determining the target code in the binary disassembly information according to the semantic information and the function body boundary;
[0114] A rewriting module, used for performing a binary rewriting process on the target code;
[0115] A correction module, used for correcting the rewritten code to obtain a rewritten binary program;
[0116] An evaluation module, used for performing a multi-dimensional evaluation on the rewritten binary program;
[0117] The second determination module is used to determine at least the feasibility and security defense performance of the rewritten binary program according to the multi-dimensional evaluation results.
[0118] In some embodiments, the apparatus further comprises:
[0119] A construction module is used to construct an analysis and recognition model, wherein the analysis and recognition model is used to analyze and recognize the binary disassembly information to determine the corresponding semantic information and function body boundaries;
[0120] The analyzing and identifying the binary program content to determine the corresponding semantic information and function body boundaries includes:
[0121] The binary program content is analyzed and identified based on the analysis and identification model to determine corresponding semantic information and function body boundaries.
[0122] In some embodiments, the constructing of the analysis and recognition model includes:
[0123] Build an initial model;
[0124] Constructing a training data set, wherein the data set is composed of open source known program source code and compiled data obtained by compiling the known program source code with a known compiler;
[0125] The initial model is trained based on the data set so that the initial model learns the compilation process of the program source code, so as to be used for disassembling or decompiling the binary disassembly information, and identifying the semantic information and function body boundaries corresponding to the binary program content based on the disassembly or decompilation result analysis.
[0126] In some embodiments, the initial model is composed of a BERT model;
[0127] The compiled data includes a binary file obtained by compiling a known program source code, data during the compilation process, semantics of marked binary statements, and function boundary information;
[0128] Training the initial model based on the data set includes two training stages. The first training stage is to learn the embedding of semantic information and function boundary information in binary data by means of cloze test and following prediction. The second training stage is to predict the semantic information and function boundary of binary data based on the embedded information.
[0129] In some embodiments, performing a binary rewriting process on the target code includes:
[0130] A binary rewriting process is performed on the target code based on at least one of a heuristic software rewriting method, a randomized software rewriting method, and a program semantic rewriting software rewriting method.
[0131] In some embodiments, the apparatus further comprises:
[0132] An analysis module, configured to analyze the target code according to prior knowledge to determine data features of the target code, wherein the prior knowledge is related to the attack type and the corresponding data features of the attacked data;
[0133] A selection module is used to determine a method for performing binary rewriting processing on the target code from the heuristic software rewriting method, the randomized software rewriting method, and the software rewriting method of program semantic rewriting according to the data characteristics.
[0134] In some embodiments, the multi-dimensional evaluation of the rewritten binary program includes:
[0135] Performing a correctness evaluation on the binary disassembly information and the rewritten binary program by using a fuzz testing method;
[0136] Performing validity evaluation on the binary disassembly information and the rewritten binary program by using a CVE testing method;
[0137] Based on the binary visualization method, the binary disassembly information and the rewritten binary program are respectively converted into domains of visual representation, and the binary data in each domain is marked with different colors in combination with the binary function recognition method, so as to evaluate the code difference between the binary disassembly information and the rewritten binary program based on the marking results;
[0138] The binary disassembly information and the rewritten binary program are tested based on the SPEC test set, and the performance overhead and defense performance of the program during runtime are compared based on the test results to evaluate the security defense performance of the rewritten binary program. The performance overhead and defense performance at least include the rewriting overhead when the corresponding software is loaded, the rewriting overhead under active attack, the memory saving degree when the software is running, the performance evaluation of the software system, and the memory saving degree of the software system as a whole.
[0139] Another embodiment of the present invention further provides an electronic device, which includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps in the software security defense method described in any of the above embodiments are implemented.
[0140] Another embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps in the software security defense method described in any of the above embodiments are implemented.
[0141] It should be noted that the computer storage medium of the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access storage medium (RAM), a read-only storage medium (ROM), an erasable programmable read-only storage medium (EPROM or flash memory), an optical fiber, a portable compact disk read-only storage medium (CD-ROM), an optical storage medium, a magnetic storage medium, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate or transmit a program configured to be used by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, antenna, optical cable, RF, etc., or any suitable combination of the above.
[0142] A person skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to imply that the scope of protection of the present application is limited to these examples. In line with the concept of the present application, the technical features in the above embodiments or different embodiments may be combined, the steps may be implemented in any order, and there are many other variations of different aspects of one or more embodiments of the present application as described above, which are not provided in detail for the sake of simplicity.
[0143] One or more embodiments of the present application are intended to cover all such substitutions, modifications and variations that fall within the broad scope of the present application. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of one or more embodiments of the present application should be included in the protection scope of the present application.
Claims
1. A software security defense method, characterized in that: include: Disassemble the target software to obtain binary disassembly information; Analyzing and identifying the binary disassembly information to determine corresponding semantic information and function body boundaries; Determining target code in the binary disassembly information based on the semantic information and function body boundaries; performing a binary rewriting process on the target code; Correct the rewritten code to obtain a rewritten binary program; Performing a multi-dimensional evaluation on the rewritten binary program; Based on the multi-dimensional evaluation results, at least the feasibility and security defense performance of the rewritten binary program are determined.
2. The software security defense method according to claim 1, characterized in that: The method further comprises: Constructing an analysis and recognition model, wherein the analysis and recognition model is used to analyze and recognize the binary program data to determine the corresponding semantic information and function body boundaries; The analyzing and identifying the binary program content to determine the corresponding semantic information and function body boundaries includes: The binary disassembly information is analyzed and identified based on the analysis and identification model to determine corresponding semantic information and function body boundaries.
3. The software security defense method according to claim 2, characterized in that: The construction of the analysis and recognition model comprises: Build an initial model; Constructing a training data set, wherein the data set is composed of open source known program source code and compiled data obtained by compiling the known program source code with a known compiler; The initial model is trained based on the data set so that the initial model learns the compilation process of the program source code for disassembly or decompilation of the binary program, and the semantic information and function body boundaries corresponding to the binary program content are identified based on the disassembly or decompilation result analysis.
4. The software security defense method according to claim 3, characterized in that: The initial model is composed of a BERT model; The compiled data includes a binary file obtained by compiling a known program source code, data during the compilation process, semantics of marked binary statements, and function boundary information; Training the initial model based on the data set includes two training stages. The first training stage is to learn the embedding of semantic information and function boundary information in binary data by means of cloze test and following prediction. The second training stage is to predict the semantic information and function boundary of binary data based on the embedded information.
5. The software security defense method according to claim 1, characterized in that: The performing of binary rewriting processing on the target code comprises: A binary rewriting process is performed on the target code based on at least one of a heuristic software rewriting method, a randomized software rewriting method, and a program semantic rewriting software rewriting method.
6. The software security defense method according to claim 5, characterized in that: The method further comprises: Analyzing the target code based on prior knowledge to determine data features of the target code, wherein the prior knowledge is related to the attack type and the corresponding data features of the attacked data; Based on the data features, a method for performing binary rewriting processing on the target code is determined from the heuristic software rewriting method, the randomized software rewriting method, and the software rewriting method of program semantic rewriting.
7. The software security defense method according to claim 1, characterized in that: The multi-dimensional evaluation of the rewritten binary program includes: Performing a correctness evaluation on the binary disassembly information and the rewritten binary program by using a fuzz testing method; Performing validity evaluation on the binary disassembly information and the rewritten binary program by using a CVE testing method; Based on the binary visualization method, the binary disassembly information and the rewritten binary program are respectively converted into domains of visual representation, and the binary data in each domain is marked with different colors in combination with the binary function recognition method, so as to evaluate the code difference between the binary disassembly information and the rewritten binary program based on the marking results; The binary disassembly information and the rewritten binary program are tested based on the SPEC test set, and the performance overhead and defense performance of the program during runtime are compared based on the test results to evaluate the security defense performance of the rewritten binary program. The performance overhead and defense performance at least include the rewriting overhead when the corresponding software is loaded, the rewriting overhead under active attack, the memory saving degree when the software is running, the performance evaluation of the software system, and the memory saving degree of the software system as a whole.
8. A software security defense device, characterized in that: include: The first acquisition module is used to disassemble the target software and obtain binary disassembly information; An identification module, used to analyze and identify the binary disassembly information, and determine corresponding semantic information and function body boundaries; A first determination module, used for determining the target code in the binary disassembly information according to the semantic information and the function body boundary; A rewriting module, used for performing a binary rewriting process on the target code; A correction module, used for correcting the rewritten code to obtain a rewritten binary program; An evaluation module, used for performing a multi-dimensional evaluation on the rewritten binary program; The second determination module is used to determine at least the feasibility and security defense performance of the rewritten binary program according to the multi-dimensional evaluation results.
9. An electronic device, characterized in that: The electronic device includes a memory and a processor, the memory stores a computer program, and when the processor executes the computer program, the steps in the software security defense method described in any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by the processor, the steps in the software security defense method described in any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
ROP defense method and device based on function scrambling
CN105787368A
Binary function boundary detection method and system based on semantic features and electronic equipment
CN114138273A
Binary function level software randomization method
CN114637988A
Multi-variant-based software security defense method and system
CN114791801A
Code reuse attack defense system and method based on function grouping dynamic activation
CN116401668A
Cited By
Comprehensive detection method and device for software supply chain security
CN119903528A
Detection method and device of terminal security product, equipment and storage medium
CN120850258A
