Software backdoor candidate area positioning method and system based on multi-granularity feature matching
Through multi-grained feature matching and structured feature database, the software backdoor candidate area is identified, which solves the problems of low efficiency and poor robustness in the existing technology, and realizes efficient and accurate backdoor positioning and automated detection.
Patent Information
- Application Number
- CN202410286095.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-13
- Publication Date
- 2024-11-29
AI Technical Summary
The existing software backdoor detection methods are inefficient, poorly robust, easy to miss reports, and difficult to identify complex backdoor candidates, especially when the software scale is large, dynamic debugging complexity increases.
Using a multi-grained feature matching method, by extracting the software structured features, creating a trusted industrial software feature database, converting binary files into a unified intermediate language, performing structural matching of function call diagrams and control flow diagrams, and identifying different code blocks as Backdoor candidate area.
It improves the efficiency and accuracy of the positioning of the software backdoor candidate area, reduces the rate of omission, enhances robustness, and can automatically process large-scale software, adapt to the positioning of new backdoor candidate areas, and is not subject to specific input restrictions.
Smart Images

Figure CN119046938A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of network security technology, and in particular to a method and system for locating a software backdoor candidate area based on multi-granularity feature matching. Background Art
[0002] A software backdoor is a hidden, undocumented function contained in software that bypasses security verification mechanisms or performs undocumented malicious operations through triggers. Currently, software backdoor detection and discovery is a key research issue in the field of information security. Figure 1 As shown in the figure, attackers usually insert malicious code into software during the development, testing, distribution or update of software, thereby allowing attackers to achieve illegal purposes and operations such as establishing remote connections, downloading and executing code, reading and writing files, and monitoring peripherals. Software backdoor detection aims to discover hidden malicious functions hidden in the software. Through detection, the security of the system can be effectively improved and potential software security threats can be reduced.
[0003] The location of the candidate code for the backdoor determines the efficiency and accuracy of the software backdoor detection. Accurately locating the candidate code area helps to quickly discover the backdoor and reduce the workload of security analysis. At the same time, the code in the candidate area should include the software backdoor as completely as possible. Therefore, the research on the location technology of the candidate area for the software backdoor has high social significance and application prospects.
[0004] The 2013 CCS conference paper "Towards Reducing the Attack Surface of Software Backdoors" provides a solution for identifying candidate areas for binary software backdoors. The author Felix Schuster et al. simulated and generated user input in batches through standard FTP and SSH server protocols, and implemented a GDB client in the system to connect to the remote gdbserver instance for dynamic debugging of suspicious software. The solution uses control flow tracing technology to model the execution path of specific inputs and construct call graphs and decision trees. The decisions related to authentication and command scheduling in the decision tree are identified through heuristic methods and specified as candidate code areas where the backdoor function is located. However, the solution relies on specific standard protocols or input specifications to generate inputs in a targeted manner, and the positioning method is inefficient and not robust; by identifying specific types of functions or specific control flow feature code areas as detection candidate areas, the positioning type is single and prone to missed reports; as the software scale increases, the complexity of dynamic debugging increases further. Summary of the invention
[0005] The purpose of the present invention is to propose a method and system for locating a software backdoor candidate area based on multi-granularity feature matching, so as to improve the efficiency of locating the software backdoor candidate area, reduce the false negative rate and enhance the robustness.
[0006] The technical solution adopted by the present invention to achieve the above-mentioned purpose is as follows:
[0007] A method for locating a software backdoor candidate area based on multi-granularity feature matching comprises the following steps:
[0008] Extract the software structured features of trusted industrial software and create a trusted industrial software feature database TISSDB;
[0009] Convert the binary file of the software to be tested into a unified intermediate language;
[0010] Extracting structural features of the software to be tested based on the converted intermediate language;
[0011] Perform initial function mapping between the software structured feature file of the software to be detected and the software structured feature file of TISSDB based on the function call graph CG to obtain a set of similar function mappings between the two files;
[0012] According to the similar function mapping set, the control flow graph CFG corresponding to each function is structurally matched to find the difference code blocks and use them as candidate areas for software backdoors.
[0013] Furthermore, the RetDec tool is used to extract the software structural features of trusted industrial software.
[0014] Furthermore, the software structured features include 11 attributes: the number of instructions contained in a function, the number of constants contained in a function, the number of strings contained in a function, the number of basic blocks contained in a function CFG, the number of edges contained in a function CFG, the number of subcalls contained in a function CFG, the number of strings contained in a basic block, the shortest path length from a basic block to the CFG entry, the shortest path length from a basic block to the CFG exit, the number of subcalls within a basic block, and the instruction mnemonics contained in a basic block.
[0015] Furthermore, the intermediate language specifically adopts a low-level virtual machine intermediate language representation LLVM IR.
[0016] Furthermore, McSema, RetDec or Dagger tools are used for LLVM IR conversion.
[0017] Furthermore, the lightweight database SQLite is used to store the software structured features in the form of independent disk files.
[0018] Furthermore, the step of performing initial function mapping based on the function call graph CG includes:
[0019] A triple consisting of the number of nodes, edges, and subcalls in the function CG graph is used as the selector;
[0020] Through a set of attributes including the number of function calls, the number of function calls, the function name and the number of strings contained in the function and the above selectors, the functions in CG are structurally matched to obtain a set of initial function matching fixed points;
[0021] Starting from the initial function matching fixed point, combined with CG, the predecessor and successor relationships of the fixed point are used to propagate nodes to expand the mapping and obtain a set of similar function mappings.
[0022] Furthermore, the step of performing structural matching on the CFG corresponding to each function includes:
[0023] The selector is a triple consisting of the number of basic blocks on the entry shortest path, the number of basic blocks on the exit shortest path, and the number of subcalls;
[0024] Through a set of attributes including the number of basic block strings and the small prime product SPP of the basic blocks and the above selectors, the function control flow graphs CFG of the two files are structurally matched to obtain a set of initial function matching fixed points;
[0025] Starting from the initial function matching fixed point, combined with CFG, the predecessor and successor relationships of the fixed point are used to propagate nodes to expand the mapping and obtain a set of similar function mappings.
[0026] Furthermore, by assigning a corresponding small prime number to each instruction in the basic block, calculating the product of the prime numbers corresponding to all instructions in the basic block can generate an SPP value representing the basic block; if the prime number products of two basic blocks are the same, based on the unique decomposition form of the prime number product and the commutative multiplication factors, it can be determined that the prime number sets of the multiplied products are the same, that is, the corresponding basic block instruction sets are the same.
[0027] A software backdoor candidate area positioning system based on multi-granularity feature matching, comprising:
[0028] The data preprocessing module is used to extract the software structured features of the trusted industrial software and create the trusted industrial software feature database TISSDB; convert the binary files of the software to be tested into a unified intermediate language;
[0029] A structured feature extraction module, used to extract the software structured features of the software to be detected based on the converted intermediate language;
[0030] The differential code analysis module is used to perform initial function mapping between the software structured feature file of the software to be tested and the software structured feature file of TISSDB based on the function call graph CG, and obtain a set of similar function mappings of the two files; based on the similar function mapping set, the control flow graph CFG corresponding to each function is structurally matched to find the differential code blocks and use them as candidate areas for the software backdoor.
[0031] Compared with the prior art, the technical solution proposed by the present invention has the following advantages:
[0032] (1) The present invention is supported by a complete industrial software feature database, which can better discover potential backdoor areas other than specific functions and special control flow feature codes, and solve the problem of single positioning type of current technology.
[0033] (2) The present invention converts the problem of locating the backdoor of the software to be detected into a code similarity detection problem at the LLVM intermediate language level, converts binary software of different architectures into a unified intermediate language representation, and extracts the code features of the functions, basic blocks and instructions of the software to be detected in the intermediate language. The binary code similarity detection technology based on structure matching is used to identify the difference function and basic block granularity code changes in the software to be detected, thereby obtaining the backdoor candidate code area of the software and avoiding direct detection within the entire software. It can be seen that the present invention is not limited to surface features, but realizes multi-granularity feature extraction, taking into account various features from micro code fragments (such as a single instruction or operation) to macro structures (such as the entire function or module), providing rich information for in-depth analysis.
[0034] (3) The present invention converts the code matching problem into a graph isomorphism problem based on structure matching, i.e., an NP problem, by converting features into function call graphs and control flow graphs, which greatly reduces the difficulty of comparison and has stronger generalization ability.
[0035] (4) The prior art relies on dynamic debugging to generate execution paths for specific inputs, which is not automated enough. In contrast, the present invention processes large-scale industrial software without the need for in-depth manual intervention, improves the automation and scalability of backdoor candidate area positioning, and adapts to new backdoor candidate area positioning by updating and expanding the trusted industrial software feature database.
[0036] (5) The prior art triggers and identifies the backdoor candidate area code by simulating user input, which requires accurate prediction or reproduction of the input that triggers the backdoor, and may not cover all potential backdoor triggering situations. In contrast, the present invention can more comprehensively identify potential backdoor candidate areas by combining a priori trusted industrial software feature database for similarity calculation and difference analysis, without being limited to the prediction or simulation of specific inputs.
[0037] (6) The prior art uses heuristic methods to identify decision points related to authentication and command scheduling, which limits the effectiveness in detecting new or complex backdoors. In contrast, the present invention builds a complete trusted industrial software feature database, which can more comprehensively discover complex backdoor candidate areas other than specific functions and special control flows. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 It is a schematic diagram of the main links of software backdoor implantation from software development to distribution.
[0039] Figure 2 The present invention is a flowchart of a method and system for locating a software backdoor candidate area based on multi-granularity feature matching.
[0040] Figure 3 It is a flow chart for building a trusted industrial software feature database.
[0041] Figure 4 These are example graphs of LLVM IR generated by assembly language and translation under different architectures.
[0042] Figure 5 This is a schematic diagram of the ProFTPD software backdoor code location.
[0043] Figure 6 This is a schematic diagram of the basic blocks for implementing the ProFTPD software backdoor. DETAILED DESCRIPTION
[0044] In order to make the various technical features and advantages or technical effects in the above technical solutions of the present invention more obvious and easy to understand, they are described in detail below with reference to the accompanying drawings.
[0045] The embodiment of the present invention specifically discloses a method and system for locating a software backdoor candidate area based on multi-granularity feature matching. The overall process is as follows: Figure 2 As shown, it is used to locate the backdoor candidate area of binary industrial software. The processing steps of this method are specifically processed and executed by the following three modules.
[0046] The data preprocessing module includes two aspects: the construction of a trusted industrial software signature database (TISSDB) and the conversion of the intermediate language of the software to be detected (LLVM). The present invention first pre-creates a trusted industrial software signature database TISSDB, which contains software structural features (SSF) extracted from the intermediate language code level of each type of secure industrial software. After that, the present invention uses the code conversion tool RetDec to convert the LLVM IR intermediate language code of the software to be detected, and obtains the SSF corresponding to the version of the software to be detected in TISSDB.
[0047] The structured feature extraction module selects and defines the attribute set of the software structured features and uses LLVMPython to extract the predefined SSF of the software to be detected.
[0048] The difference code analysis module first uses the SSF of the software to be tested and the SSF in the corresponding TISSDB to perform structural matching between the function call graphs, creates an initial similar function bidirectional mapping set to realize difference function identification, and serves as the basis for fine-grained difference code identification. After that, for each similar function mapping, structural matching between function control flow graphs is performed in turn to identify the code differences at the basic block granularity of the software to be tested, and obtain the candidate code area for the software backdoor.
[0049] The specific processing contents of the above three modules are described in detail as follows:
[0050] 1. Data preprocessing module
[0051] 1.1 Construction of Trusted Industrial Software Feature Database
[0052] The data preprocessing module is responsible for two parts: pre-creating a trusted industrial software feature database and converting the binary code of the software to be tested into the LLVM intermediate language.
[0053] First, a TISSDB is created for the identification of the difference code of the software to be detected. A complete TISSDB is constructed by extracting a large number of trusted industrial software SSFs, which is the premise of the present invention. The TISSDB construction process is as follows: Figure 3 As shown. In order to quickly and automatically extract the structured features corresponding to each software from the binary code of a large number of industrial software, the present invention uses Python scripts to realize the automatic call of the RetDec tool, and extracts a set of software structured features containing 11 attributes (see Table 1) for each trusted industrial software with version information, and stores these SSFs in the database corresponding to the software version. The TISSDB construction module uses Python language to realize the batch automatic call of the intermediate language conversion tool and the extraction of industrial software structured features. In addition, since industrial software usually has a large amount of code, such as the code amount of mainstream CAD software such as SolidWorks, SolidEdge, Inventor, etc. is about 30 to 45 million lines of code, it is necessary to select a suitable database system to effectively and completely save the code features. The present invention uses the lightweight database SQLite to access software structured features. SQLite does not require the support of a separate server process or system. It stores the software structured features of each specific version as an independent disk file corresponding to it, thereby building the TISSDB data foundation for experimental research.
[0054] 1.2 Conversion of LLVM intermediate language
[0055] Since binary software is usually compiled by different processor architecture platforms, different processor architectures have different instruction sets and registers, making it difficult to perform unified analysis. The present invention solves the cross-architecture problem by converting binary executable files of different architectures into a unified intermediate language, and using the intermediate language as a basis to implement software feature extraction and cross-architecture binary software similarity detection.
[0056] The intermediate language abstract representation aims to convert binary code under different architectures into a unified, architecture-independent code format, making similarity comparison more direct and accurate. Chris Lattner [1] LLVM IR (Intermediate Representation) was proposed. By using LLVM IR, the details of specific hardware can be abstracted and binary programs of different architectures can be converted into the same intermediate representation. [2] Based on the LLVM IR intermediate language, a static binary program analysis framework across multiple architectures was studied and implemented. Bai et al. [3] Based on LLVM, we perform labeling analysis on vulnerability feature program slices and implement a fine-grained vulnerability location method for C++ programs. [4] 、SATURN [5] The binary program is converted into LLVM IR to perform similarity analysis of obfuscated binary code. In addition, there are many implementation tools that support the conversion of binary files to LLVM IR, such as McSema, RetDec, Dagger, etc. Among them, the RetDec tool supports binary files in ELF, PE, Mach-O and other formats under Intel x86, ARM, MIPS and other architectures, which can solve the intermediate code conversion problem well. In view of the fact that LLVM IR has a wide range of applications in security research and has mature conversion technology, the present invention first implements the conversion of binary files to LLVM IR through RetDec, and completes the intermediate language conversion preprocessing process of binary code.
[0057] LLVM IR addresses the differences between different architectures by proposing the following representations.
[0058] 1) Virtual Registers
[0059] Since the number and names of registers in different architectures are different, LLVM IR replaces physical registers in traditional machine instructions with digital virtual registers. Virtual registers do not correspond to any specific hardware registers and are assigned unique values when defined. Registers with the same function, such as the EAX register in the x86 architecture, R0 in the ARM architecture, and $8 in the MIPS architecture, are represented by the same global variables in LLVM IR and are considered to be the same type of digital registers.
[0060] 2) Unified grammar representation
[0061] LLVM IR defines unified syntax rules for different architectures, so that different assembly codes can be abstractly represented as the same syntax. LLVM uses expressions to represent operands in a code statement, including the results of operations such as memory loading, register reading, and arithmetic operations. For example, "%result = add i32%a,%b" can represent the result of adding integers "%a" and "%b" and storing it in "%result". LLVM uses instructions to represent the state changes caused by an operation on registers and memory. For example, LLVM's instruction statement "%addr = alloca i32" can represent the allocation of memory space for a 32-bit integer and store it in "%addr".
[0062] Through the defined grammar rules and intermediate representation objects, LLVM IR can translate assembly languages of different instruction sets into intermediate representations represented by the same grammar rules. Figure 4 It shows the compilation results of a piece of source code under different compilation architectures, ARM and X86, as well as the LLVM IR results obtained by converting the assembly code of the corresponding architecture. The same color codes in the figure represent the same semantics.
[0063] In the data preprocessing module of the present invention, the present invention automatically calls RetDec through a script, extracts SSF from a large number of trusted industrial software binary files, generates corresponding feature files and stores them in the database, thereby creating a complete TISSDB. On the other hand, the binary code of the software is translated into LLVM intermediate language representation through the RetDec tool.
[0064] 2. Structured feature extraction module
[0065] In order to identify the difference code in the software to be detected, the present invention extracts representative features of software functions, basic blocks, instructions, etc. by analyzing the program structure information and the control flow inside the function. The software program itself has multiple features, such as constant features such as function names and variable names inside the program, instruction features such as program assembly instructions, basic block assembly code, function pseudocode, and structural features such as function control flow charts and function call relationship diagrams. The structured feature extraction module extracts and saves the fingerprint of the program by selecting appropriate program constant features, instruction features, and structural features, thereby serving as the basis for subsequent code similarity detection technology based on structural matching.
[0066] Software structural characteristics by Flake [6] and Thomas [7] et al. proposed to abstract binary programs into two types of structured graphs: function call graph (CG) and function control flow graph (CFG), which can intuitively show the internal structure of the program. CG represents the calling relationship between functions within the program, which can be represented by a set Represents, where V represents the set of each function node in the binary file, assuming that function v i Called v j , then the function two functions v i and v j The directed edges between them are used (v i ,v j )∈E. CFG represents the execution order and execution flow of instructions in a function. The nodes in CFG represent basic blocks, and the directed edges inside CFG represent the jump relationship between basic blocks. [8] The cross-architecture function attributes and basic block attributes selected by related work finally selected 11 attributes as shown in Table 1 as the attribute set representing the structural characteristics of binary software. The attributes selected by the present invention include three categories. The first category is the quantitative characteristics representing the logical structure in the function code block. The number of instructions, the number of constants, and the number of strings can describe the function code block from the data level of the code. The number of basic blocks, the number of edges, and the number of subcalls contained in CFG can describe the CFG graph structure information inside the function. The second category is the quantitative characteristics in the basic block code, including the number of strings, the number of subcalls, the shortest paths of entry and exit, which can describe the quantitative characteristics in the function basic block code and the location information of each basic block in CFG. The third category is the instruction mnemonics, which represent the most basic instruction characteristics contained in the basic block.
[0067] Table 1 Attribute table of software structured feature selection
[0068]
[0069] By extracting the SSF of the software to be tested, we can extract the graph structure information representing the function calls in the program and the structure information, function quantity information and function instruction information of each function, so as to use the structural data features to represent the binary software program. This module is written using the LLVM Python library to process the binary software files converted by the RetDec tool and obtain 11 attributes of the software structural features at the intermediate code data level.
[0070] 3. Differential code analysis module based on structure matching
[0071] After obtaining the software structured features of the software to be detected, the present invention uses the code similarity detection technology based on structure matching based on the trusted software feature database. [9] Identify the difference code in the software to be detected. By analyzing the structural features of the code in the binary software, the similarity detection problem is transformed into a structural match between two abstract graphs, CG and CFG, which represent the characteristics of the software code. The difference code analysis module of the present invention is divided into two parts. The first part is the initial function mapping, which is used to create an initial similar function bidirectional mapping set between two executable files and used as the basis for subsequent matching. The second part is CFG structural matching, which is used to identify similar basic blocks between the CFGs of each similar function mapping. Each part is described in detail below.
[0072] 3.1 Function initial mapping generation
[0073] The initial function mapping refers to the function mapping of the two executable files to be identified, the SSF file of the software to be tested and the SSF file in the TISSDB. Specifically, by performing structural matching on the function call graphs CG of the two executable files to be identified, an initial similar function mapping set between binary files is created, and V is used as the starting point for subsequent structural matching between CGs. This is the first step of the structural matching difference code analysis module of the present invention. The present invention defines the function call graph representing a binary file as G = (V, E), which is composed of a point set V and an edge set E, where V = {v 1 , ..., v n} represents a non-empty finite point set, E = {e 1 , ..., e n} represents a finite edge set, up: V→(V) represents the mapping from the point set V to its predecessor node, and down: V→(V) represents the mapping from the point set V to its successor node. At the same time, define the selector s: V 1 ×(V 2 )→V 2 , which means finding the same set as v from the given set iThe most similar and unique node. To reduce the size of the set input to the selector and increase the possibility that the selector returns a non-empty set, define attribute u as a 1 and G 2 The mapping relationship between the subsets contained in their point sets is expressed as (G 1 , G 2 )→(V′ 1 , V′ 2 ), where V′ 1 ∈′V 1 , V′ 2 ∈′V 2 .
[0074] The process of generating the initial function mapping of the present invention is shown in Algorithm 1. The process of establishing the initial function mapping first performs structural matching on the functions in the CG through a set of attributes u and selectors s, thereby obtaining a set of initial function matching fixed points. The significance of this step is to select some related functions from a large number of functions as fixed points that are relied on in subsequent node propagation, avoiding global comparison work and thus improving the efficiency of the overall matching algorithm. The inputs of the algorithm are selector s, attribute set u={u 1 , ..., u i}, and G representing the function call graph of the two binaries 1 and G 2 , where G 1 =(V 1 , E 1 ), G 2 =(V 2 , E 2 ). For the CG graph, the present invention uses the number of function calls, the number of function calls, the function name, and the number of strings contained in the function as the attribute set u. The triple consisting of the number of nodes, the number of edges, and the number of subcalls in the function CG graph is used as the selector s, and the selector is regarded as a three-dimensional space vector, as shown in Formula 3-1:
[0075]
[0076] The similar function mapping created by the attribute u and the selector s is only a small subset of the final similar function mapping set, so this mapping set needs to be improved and expanded. As described in Algorithm 1, the present invention starts from the initial function matching fixed point selected in the previous step, combines the file function call graph, uses the predecessor and successor relationship of the fixed point to perform node propagation to expand the mapping, and finally creates a CG isomorphism between two binary programs, that is, a similar function mapping set. At this point, the function initial mapping generation process ends. The output of Algorithm 1 includes V′ 1 , V′ 2 and p, where V′ 1and V′ 2 Represents the set of all similar functions in two files, p: V′ 1 →V′ 2 Represents the relationship between functions.
[0077]
[0078] 3.2 Control Flow Graph Structure Matching
[0079] By continuously performing iterative operations of fixed point generation and node propagation on the function call graph CG, a similar function mapping containing the maximum number of matches can be generated in the end. In order to identify the structural changes in the granularity of basic code blocks in the software to be detected, the present invention performs structural matching on the control flow graph CFG corresponding to each function based on the similar function mapping set, and completes the CFG isomorphism between two similar associated functions. The algorithm idea of this step is similar to that of Algorithm 1, and the whole is also divided into two processes of establishing the initial basic block matching fixed point and basic block node propagation through the selector s and the attribute set u, but the input of the algorithm is different.
[0080] The inputs of the CFG structure matching algorithm are selector s, attribute set u = {u 1 ,...,u i} and G representing the control flow graph of the two functions 1 and G 2 , where G 1 =(V 1 ,E 1 ), G 2 =(V 2 ,E 2 ). For the CFG structure matching between a group of similar function mappings, the present invention uses a triple consisting of the number of entry shortest path basic blocks, the number of exit shortest path basic blocks and the number of subcalls as the selector s, and the attribute set u is composed of the number of basic block strings and the basic block SPP, where the basic block SPP is obtained by multiplying the odd prime numbers assigned to each node.
[0081] Since the target binary file generated by source code compilation under different compilation environments will produce instruction reordering in the basic block after intermediate language conversion, when the number of nodes in the function CFG is too large, the feature matching between basic blocks is prone to mismatching due to instruction reordering, that is, the selector information of the two basic blocks is consistent but the instruction contents contained are irrelevant. Therefore, in order to ensure the consistency of basic block matching in the process of similar function mapping CFG isomorphism, the present invention extracts the basic block instruction mnemonics as the program instruction granularity feature and introduces the Small Primes Product (SPP) algorithm. As shown in Algorithm 3, by assigning a corresponding small prime number to each instruction in the basic block, calculating the product of the corresponding prime numbers of all instructions in the basic block, an SPP value representing the basic block can be generated. If the prime products of two basic blocks are the same, according to the unique decomposition form of the prime product and the commutative multiplication factors, it can be determined that the prime sets of the multiplied products are the same, that is, the corresponding basic block instruction sets are the same. The basic block SPP, to a certain extent, represents the precise characteristics of the instruction set contained in a basic block. By adding the basic block SPP attributes to the attribute set used by the fixed point selection algorithm, the mismatch problem caused by instruction reordering can be effectively solved.
[0082]
[0083] Experimental test:
[0084] This experiment is used to verify the effect of the technical solution of the present invention (hereinafter referred to as SCBL) on the backdoor positioning of industrial software. To this end, the present invention first reproduces the real backdoor case in the normal FTP server software through software modification and recompilation, simulates the backdoor implantation attack encountered by industrial software, and uses this data as the experimental basis to evaluate and analyze the SCBL backdoor positioning effect. Next, the hardware and software environment in which the experiment is carried out is first introduced, and then the experimental data, experimental process and result analysis used in the SCBL industrial software backdoor positioning experiment are described in detail.
[0085] 1) Experimental environment setup
[0086] The detailed experimental environment of SCBL of the research method proposed in the present invention is shown in Table 2.
[0087] Table 2 SCBL experimental environment setting table
[0088]
[0089] 2) SCBL industrial software backdoor location experiment
[0090] In order to verify the locating effect of SCBL on real industrial software backdoors, this experiment selected ProFTPD software as experimental data. ProFTPD is an FTP server software that supports SSL / TLS encryption and is widely used in industrial facilities and systems that have high requirements for data confidentiality, such as file transfer, data sharing, and remote monitoring.
[10] . It was revealed that the software had a pre-made backdoor with specific command parameters. Through this backdoor, attackers can execute any remote command, resulting in a series of security hazards such as illegal access and control of the server, leakage of sensitive data and file tampering, which seriously affected the security of the application system. After detailed investigation, we implanted the Help command backdoor in this case into the 1.3.6 version of the ProFTPD software by modifying the software source code, and recompiled the modified backdoor software to generate the binary executable file of the software. This process describes the process of industrial software encountering backdoor implantation attacks in the source code library and compilation stage of the software. After that, the present invention took the ProFTPD backdoor software as the research object to conduct relevant follow-up experiments.
[0091] The results of SCBL operation are as follows Figure 5 As shown in the figure, the experiment analyzed a total of 2075 functions and 23753 basic blocks in the ProFTPD backdoor software. The industrial software backdoor candidate area positioning method based on multi-granularity feature matching identified two different function code blocks, pr_help_add_response() and core_help(), at the function level. Among them, core_help() contains X basic blocks. The pr_help_add_response() function analyzed a total of 16 basic blocks, including 2 new basic blocks and 3 modified basic blocks. Subsequently, this experiment manually analyzed the candidate area code and found the "ACIDBITCHEZ" backdoor in the located difference function pr_help_add_response(). The specific principle is that the core_help() function is the upper-level execution entry of the Help command, responding to the cmd command received by the server software and passing the corresponding command parameters to the internal call function pr_help_add_response(), and the pr_help_add_response() function is mainly used to process the Help parameters. ProFTPD implements the Help command prefabricated backdoor by defining special parameters corresponding to the code execution branch in pr_help_add_response(). Figure 6As shown in the figure, the execution effect of the ProFTPD software backdoor is achieved by two new basic blocks inside the function. When the passed parameter is equal to ACIDBITCHEZ, the system automatically executes the open shell behavior for the attacker. The attacker can execute any remote command through the shell, which leads to a series of consequences such as server hijacking and sensitive data leakage.
[0092] This experiment simulates the backdoor implantation attack of industrial software by implementing the real backdoor exposed by ProFTPD. From the experimental results, the industrial software backdoor candidate area positioning method based on multi-granularity feature matching effectively detects the code changes of difference functions and basic blocks in binary industrial software, and accurately identifies the backdoor candidate code area in a large amount of code. The experimental results verify the help of locating the candidate area code in simplifying the software backdoor detection work and the actual effect of SCBL.
[0093] References:
[0094] [1]Lattner C,Adve V.LLVM:A compilation framework for lifelong program analysis&transformation[C] / / International symposium on code generation and optimization,2004.CGO 2004.IEEE,2004:75-86.
[0095] [2]Di Federico A, Payer M, Agosta G.rev.ng: a unified binary analysis framework to recover CFGs and function boundaries[C] / / Proceedings of the 26thInternational Conference on Compiler Construction.2017:131-141.
[0096] [3]Bai W,Du C,Zhang L,et al.Fine-Grained Vulnerability Location Basedon LLVM[C] / / 2023IEEE 11th Joint International Information Technology and Artificial Intelligence Conference(ITAIC).IEEE,2023,11:496-500.[4]Tang K,ShanZ,Zhang C,et al.DFSGraph:Data Flow Semantic Model for IntermediateRepresentation Programs Based on Graph Network[J].Electronics,2022,11(19):3230.
[0097] [5]Garba P,Favaro M.Saturn-software deobfuscation framework based onllvm[C] / / Proceedings of the 3rd ACM Workshop on Software Protection.2019:27-38.
[0098] [6]Flake H.Structural comparison of executable objects[J].DIMVA 2004,July 6-7,Dortmund,Germany,2004.
[0099] [7]Dullien T,Rolles R.Graph-based comparison of executable objects(english version)[J].Sstic,2005,5(1):3.
[0100] [8]Github.joxeankoret.diaphora.[EB / OL].[2024-02-05].https: / / github.com / joxeanko ret / diaphora.
[0101] [9] Liu Chunhong, Guo Tao, Cui Baojiang, et al. Structural similarity calculation for binary file homology detection[J]. Journal of Beijing University of Posts and Telecommunications, 2012, 35(3):56.
[0102]
[10] Github.proftpd.Proftpd.diaphora.[EB / OL].[2024-02-05].https: / / github.com / proftpd / proftpd.
[0103] Although the present invention has been disclosed as above by way of embodiments, it is not intended to limit the present invention. Appropriate modifications or equivalent substitutions of the technical solutions of the present invention made by ordinary technicians in the field should all be included in the protection scope of the present invention. The protection scope of the present invention shall be based on what is defined in the claims.
Claims
1. A method for locating a candidate area of a software backdoor based on multi-granularity feature matching, characterized in that: The following steps are involved: Extract the software structured features of trusted industrial software and create a trusted industrial software feature database TISSDB; Convert the binary file of the software to be tested into a unified intermediate language; Extracting structural features of the software to be tested based on the converted intermediate language; Perform initial function mapping between the software structured feature file of the software to be detected and the software structured feature file of TISSDB based on the function call graph CG to obtain a set of similar function mappings between the two files; According to the similar function mapping set, the control flow graph CFG corresponding to each function is structurally matched to find the difference code blocks and use them as candidate areas for software backdoors.
2. The method according to claim 1, characterized in that Use the RetDec tool to extract software structural features of trusted industrial software.
3. The method according to claim 1, characterized in that The software structural features include 11 attributes: the number of instructions contained in the function, the number of constants contained in the function, the number of strings contained in the function, the number of basic blocks contained in the function CFG, the number of edges contained in the function CFG, the number of subcalls contained in the function CFG, the number of strings contained in the basic block, the shortest path length from the basic block to the CFG entry, the shortest path length from the basic block to the CFG exit, the number of subcalls in the basic block, and the instruction mnemonics contained in the basic block.
4. The method according to claim 1, characterized in that The intermediate language specifically uses the low-level virtual machine intermediate language to represent LLVM IR.
5. The method according to claim 4, characterized in that Use McSema, RetDec or Dagger tools for LLVMIR conversion.
6. The method according to claim 1, characterized in that The lightweight database SQLite is used to store software structured features in the form of independent disk files.
7. The method according to claim 1, characterized in that The steps of performing initial function mapping based on the function call graph CG include: A triple consisting of the number of nodes, edges, and subcalls in the function CG graph is used as the selector; Through a set of attributes including the number of function calls, the number of function calls, the function name and the number of strings contained in the function and the above selectors, the functions in CG are structurally matched to obtain a set of initial function matching fixed points; Starting from the initial function matching fixed point, combined with CG, the predecessor and successor relationships of the fixed point are used to propagate nodes to expand the mapping and obtain a set of similar function mappings.
8. The method according to claim 1, characterized in that The steps for structural matching of the CFG corresponding to each function include: The selector is a triple consisting of the number of basic blocks on the entry shortest path, the number of basic blocks on the exit shortest path, and the number of subcalls; Through a set of attributes including the number of basic block strings and the small prime product SPP of the basic blocks and the above selectors, the function control flow graphs CFG of the two files are structurally matched to obtain a set of initial function matching fixed points; Starting from the initial function matching fixed point, combined with CFG, the predecessor and successor relationships of the fixed point are used to propagate nodes to expand the mapping and obtain a set of similar function mappings.
9. The method according to claim 8, characterized in that By assigning a corresponding small prime number to each instruction in the basic block, calculating the product of the prime numbers corresponding to all instructions in the basic block can generate an SPP value representing the basic block; if the prime number products of two basic blocks are the same, based on the unique decomposition form of the prime number product and the commutative multiplication factors, it can be determined that the prime number sets of the multiplied products are the same, that is, the corresponding basic block instruction sets are the same.
10. A software backdoor candidate area positioning system based on multi-granularity feature matching, used to implement the method described in any one of claims 1 to 9, characterized in that: include: The data preprocessing module is used to extract the software structured features of the trusted industrial software and create the trusted industrial software feature database TISSDB; convert the binary files of the software to be tested into a unified intermediate language; A structured feature extraction module, used to extract the software structured features of the software to be detected based on the converted intermediate language; The differential code analysis module is used to perform initial function mapping between the software structured feature file of the software to be tested and the software structured feature file of TISSDB based on the function call graph CG, and obtain a set of similar function mappings of the two files; based on the similar function mapping set, the control flow graph CFG corresponding to each function is structurally matched to find the differential code blocks and use them as candidate areas for the software backdoor.
