Semantic enhanced embedded firmware static analysis method and device
Patent Information
- Application Number
- CN202410892703.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-04
- Publication Date
- 2024-10-29
Smart Images

Figure CN118862068A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a binary program static analysis technology, and more particularly to a static analysis method and device for a WEB service backend binary program in an embedded firmware. Background Art
[0002] Static analysis technology is a program analysis technology that analyzes the data flow in the code without running the source code or binary program to discover potential security vulnerabilities. In recent years, vulnerabilities in embedded firmware WEB services have emerged in an endless stream, and the scope of impact has become increasingly larger. The vulnerabilities also mainly exist in the backend programs of WEB services. Therefore, discovering these vulnerabilities in advance is of great significance to the operation security and vulnerability protection of embedded firmware, and can effectively help build a good embedded ecosystem.
[0003] Taint analysis technology is a commonly used technology for static analysis of data flow, which mainly consists of three parts: taint source, taint sink and taint propagation. Among them, the taint source represents the direct introduction of untrusted data or confidential data into the system; the taint sink represents the operation that directly generates security-sensitive operations (violation of data integrity) or leaks private data to the outside world (violation of data confidentiality); taint propagation represents the process of data processing or escape, which includes the process of data harmlessness. In embedded firmware WEB services, the taint source is usually a controllable HTTP request. Different configuration or debugging functions in WEB system services usually correspond to different HTTP requests, and an HTTP request may contain multiple different inputs. The taint sink represents the operation that may trigger the vulnerability, but there will be input checks (such as length checks, format checks, etc.) in the code to constrain the content of user input. Taint propagation mainly analyzes whether there is a data flow path from the taint source to the taint sink, but due to the lack of source code in the firmware, the existing analysis methods are mainly analyzed through pseudo code generated by decompilation.
[0004] However, the existing static analysis tools lack in-depth analysis and summary of HTTP requests processed by the embedded WEB service backend binary program, and do not fully combine the large amount of semantic information in the program. There are problems with inaccurate identification of taint sources and taint convergence points, which leads to a large number of false positives in the tool identification results, and some vulnerabilities cannot be discovered. Therefore, if the current static analysis method is directly applied to the analysis of the backend binary program of the embedded firmware WEB service, there will be the following main problems:
[0005] (1) Existing static analysis methods have a high false positive rate. The main reason is that some string semantic information is incorrectly identified as taint sources, resulting in a large number of results that are not security vulnerabilities.
[0006] (2) Existing static analysis methods have the problem of underreporting. The main reason is that they ignore the semantic relationship of the binary program in the backend of the WEB service, lose a large amount of semantic information related to the taint source and taint aggregation points, resulting in many vulnerabilities being unable to be identified.
[0007] There are a large number of semantic relationships between the code and data in the embedded firmware WEB service. The complexity makes it difficult for traditional static analysis methods to accurately discover security vulnerabilities, which reduces the efficiency of security personnel in mining embedded firmware vulnerabilities and brings hidden dangers to the security of embedded devices. Summary of the invention
[0008] In order to overcome the difficulties of applying existing static analysis methods to vulnerability mining in embedded firmware WEB service backend binary programs, the present invention provides a semantically enhanced static analysis method and device for embedded firmware WEB service backend binary programs. Based on the summarized fixed code patterns and with the help of a large model to analyze the semantic relationship between code and data, more and more accurate taint sources and taint convergence points are identified, thereby supporting taint analysis of the embedded firmware WEB service backend binary program and reducing the false positive rate and missed negative rate of static analysis.
[0009] The present invention designs and implements three modules, namely, taint source identification, taint convergence point identification and taint analysis, to support static analysis of user input data streams in a WEB service backend program in an embedded firmware, and proposes a static analysis technology based on a fixed code pattern and a large model-assisted analysis technology to fully utilize the semantic relationship between code and data in the embedded firmware to improve the accuracy and efficiency of static analysis of the embedded firmware, reduce false positives and false negatives in the analysis results, and support researchers to efficiently detect known vulnerabilities and mine unknown vulnerabilities.
[0010] The technical solution of the present invention includes:
[0011] A static analysis method for an embedded firmware WEB service backend binary program, the steps of which include:
[0012] 1) Extract all front-end files related to the WEB service and all back-end binary programs with main functions from the unpacked embedded firmware file system. Identify the data URI and key related to the user input in the front-end file, and record them as a set u containing multiple URIs and a set k containing multiple keys respectively;
[0013] 2) Repeat steps 3 to 7 for each extracted embedded firmware WEB service backend binary program with main functions.
[0014] 3) Based on each URI in the extracted URI set u, the fixed code pattern and the large model are combined to assist in analyzing the URI processing pattern in the selected embedded firmware WEB service backend binary program with main functions. The URI processing pattern in the embedded firmware WEB service backend binary program of different manufacturers or different device models is different, and the URI processing pattern includes three key semantic information: URI data, URI processing function, and the semantic relationship between URI data and URI processing function.
[0015] 4) According to each key in the extracted key set k, the key processing mode is analyzed in the selected embedded firmware WEB service backend binary program with main functions by combining the fixed code mode and the large model. The key processing mode in the embedded firmware WEB service backend binary program of different manufacturers or different device models is different, and the semantic information of the key processing mode is mainly manifested in the key data, the key processing function for parsing the key data, and the semantic relationship between the key data and the key processing function.
[0016] 5) According to the URI processing mode obtained by step 3 and the semantic relationship between the URI data and URI processing functions contained therein, the URI processed in the selected WEB service backend binary program and the corresponding URI processing function are identified through static analysis, and then in each URI processing function, according to the key processing mode obtained in step 4, multiple keys corresponding to each URI are identified through static analysis. All URIs identified in the selected WEB service backend binary program are denoted as set U, all URI processing function sets are denoted as UF, and all keys are denoted as set K. Among them, URI data U i and URI processing function UF i One-to-one correspondence, and a URI data U i Corresponding to a key data set K i .
[0017] 6) Extract multiple shared library files called by the selected WEB service backend binary program, analyze the semantic information between the dangerous function and the wrapper function that calls it in the shared library file based on data flow analysis and control flow analysis, including the calling relationship and the parameter controllable conditions in the dangerous function and the wrapper function, and extract the wrapper function set S that meets the vulnerability triggering conditions;
[0018] 7) Perform taint analysis on the embedded firmware WEB service backend binary program. The taint source is all key sets K, and the taint convergence point is the predefined basic library dangerous functions and the identified packaging function set S. i and key K i The corresponding relationship, in each URI U iCorresponding URI processing function UF i For each key K i Perform separate taint propagation analysis and document potential vulnerabilities and triggering paths.
[0019] Furthermore, the URI corresponds to the resource identifier field in the HTTP request, and the key corresponds to the string identifier field in the body part of the HTTP request.
[0020] Furthermore, the front-end files include: WEB front-end page files with html, js, asp, and xml as suffixes.
[0021] Furthermore, the main functions include: WEB service code or public operation support code.
[0022] Furthermore, the semantic relationship includes: the correspondence between different data, the calling relationship and reachability between codes, the calling relationship between data and code, and the symbolic information in the code.
[0023] Furthermore, dangerous functions refer to functions defined in C or C++ standard libraries that have dangerous operations, such as system function and strcpy function. These dangerous functions are identified in shared library files by matching function names.
[0024] Furthermore, satisfying the vulnerability triggering condition includes: the data flow from the wrapper function to the dangerous function in the shared library file is reachable.
[0025] Furthermore, the URI set u and key set k identified in the front-end file are obtained through the following steps:
[0026] 1) In files with html, asp, and xml as suffixes, standard syntax tags are matched to obtain the URIs and keys defined in these files respectively;
[0027] 2) Convert the code into a syntax tree in a file with a suffix of js, and use the symbol label " / " in the syntax tree to identify the URI and the standard function interface to identify its parameters as keys.
[0028] Furthermore, before analyzing the embedded firmware WEB service backend binary program, the binary program process is first decompiled to obtain a C-type pseudo code and generate a corresponding syntax tree.
[0029] Furthermore, the URI processing mode in the backend binary program is identified by the following steps:
[0030] 1) According to the URI extracted by the front end, the URI processing mode in the back end binary program is identified. The URI processing mode is divided into three types: registration function, fixed data segment and new process. The URI and the corresponding URI processing function are extracted according to different processing modes;
[0031] 2) If the URI extracted by the front end has the same name as a back-end binary program, the URI processing mode is considered to be a new process, and the main function of the binary program is used as the corresponding URI processing function;
[0032] 3) If the URI extracted by the front end is called as a parameter by a function in the back-end binary program, the URI processing mode is considered to be a registered function, and the parameters of each reference position of the registered function are parsed. The parameters are the address of a string and the entry address of a function, where the string is used as the URI, and the function corresponding to the function entry address in the parameter is used as the corresponding URI processing function;
[0033] 4) If the reference address of the URI extracted by the front end in the back end binary program is in the data segment, the URI processing mode is considered to be a fixed data segment, and the data segment is traversed to parse the instructions for calling the URI string and the corresponding URI processing function corresponding to the calling function.
[0034] Furthermore, the key processing mode in the backend binary program is identified through the following steps:
[0035] 1) Identify the key processing mode in the backend binary program based on the key extracted by the frontend. The key processing mode is to use a key processing function that parses and extracts the input corresponding to the key;
[0036] 2) Call the function that takes key as a parameter as the key processing function.
[0037] Furthermore, the following steps are performed to identify the multi-layer wrapper functions in the shared library file that meet the vulnerability triggering conditions:
[0038] 1) Find the calling address of dangerous function A, and perform taint analysis in wrapper function B where the calling address is located, using function parameters as taint sources, to determine whether there are potential vulnerabilities in the use of dangerous function A, and record them;
[0039] 2) If there is a potential security vulnerability in the wrapper function B, use the same method to analyze whether there is a potential vulnerability when the wrapper function C that calls function B uses function C, and record it;
[0040] 3) Repeat the above steps until no new wrapper functions suspected of having potential vulnerabilities are found.
[0041] A storage medium stores a computer program, wherein the computer program is configured to execute any of the above methods when running.
[0042] An electronic device comprises a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute any of the above methods.
[0043] Compared with the prior art, the present invention adopts the above technical solution and has the following advantages:
[0044] (1) The present invention is directed to a static analysis method for an embedded firmware WEB service backend binary program. By enhancing the identification of taint sources and the extraction of dangerous functions, the method can effectively improve the accuracy of static analysis.
[0045] (2) The present invention analyzes the semantic relationship between URI, key and processing code based on fixed code patterns and large models, reduces false positives and false negatives in taint source identification, and effectively improves the accuracy of taint analysis.
[0046] (3) The present invention analyzes the calling relationship between dangerous functions and their wrapper functions in the shared library, which can effectively avoid underreporting of vulnerability identification caused by ignoring the calling of dangerous functions in the shared library, and effectively improves the effect of taint analysis;
[0047] (4) The present invention greatly reduces the workload of static analysis of embedded firmware WEB service backend binary files, improves the accuracy of vulnerability mining, and can correct the false positive and false negative problems of existing static analysis tools to a certain extent;
[0048] (5) The present invention implements a prototype system Lara. Static analysis experiments on 203 real firmwares show that the present invention is superior to the current advanced comparison tools SaTC and Karonte in terms of positioning efficiency and accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Figure 1 This is the overall flow chart of the Lara tool. DETAILED DESCRIPTION
[0050] In order to make the technical solution of the present invention more obvious and easy to understand, examples are given and combined with the drawings to clearly and completely describe the technical solution in the embodiments of the present invention.
[0051] Embedded firmware WEB services are usually divided into front-end pages and back-end programs. The front-end pages are usually code files with suffixes such as html, js, asp, and xml, and the back-end programs are usually executable binary programs written in C or C++. These front-end pages and back-end programs cover all management planes, control planes, and data planes of WEB services. WEB services are one of the most important services in embedded firmware. They have high-authority device configuration and management functions, can modify the configuration of other services, monitor device conditions, and can be accessed remotely. The vulnerabilities of embedded firmware WEB services are mainly distributed in the back-end binary programs. Using static taint analysis technology to mine their potential security vulnerabilities is of great significance to ensure the security of embedded firmware.
[0052] The method of the present invention is mainly aimed at embedded firmware WEB services, and implements a static analysis method Lara for the back-end binary program of the WEB service. Firstly, the semantic relationship between the URI and key in the back-end binary program and the processing code is identified based on the URI and key extracted from the front-end page, so as to identify and extract more accurate taint sources. Then, the calling relationship between the dangerous function and its wrapper function in the shared library file is analyzed to extract the wrapper function that meets the vulnerability triggering condition. Finally, taint analysis is performed on the back-end binary program to identify potential security vulnerabilities therein.
[0053] Implementing static analysis of embedded firmware WEB service backend binary programs requires solving the following key issues:
[0054] Key question 1: How to identify the source of taint by combining the semantic relationship between URI and key and processing code
[0055] The taint source is the basis of static analysis, and the taint source of the embedded firmware WEB service backend binary program is directly manifested as controllable user input in the HTTP request. The front-end page groups the information submitted and modified by the user into an HTTP request data packet, and the back-end binary program parses and processes the content in the HTTP request data packet. There are two key fields URI and key-Value in the data packet, where URI represents the user's operation, key corresponds to the user's input one by one, and there is a one-to-many correspondence between URI and key. The existing methods for identifying the taint source of the embedded firmware WEB service backend binary program can be mainly divided into heuristic methods based on keyword matching and methods based on function modeling and feature matching. The former only focuses on the key, ignores the correspondence between URI and key and the processing mode of the back-end code, and is difficult to discover the unique user input in the back-end binary program, and cannot fully identify the user input identified in the front-end, which also leads to a large number of vulnerabilities that cannot be discovered. The latter, based on function modeling and feature matching, will cause a large number of false positives because it does not combine the semantic information of the front-end and back-end inputs.
[0056] Through the analysis of a large number of embedded firmware WEB service backend binary programs, we summarized the URI and key processing code patterns, among which the URI processing patterns are divided into three types: registration function, fixed data segment and new process; the key processing pattern is that different keys are parsed by the same key processing function. These processing patterns summarize the semantic relationship between URI and key and their processing codes. Each URI corresponds to a URI processing function. In each URI processing function, the key processing function parses the key and extracts the user input. The key parsed in each URI processing function is different, so the key set corresponding to each URI is different. In addition, the correspondence between URI and key can also effectively eliminate some false positives caused by key parsing codes that cannot be triggered. The correspondence between URI and URI processing function in each URI processing mode is different: in the registration function mode, URI and URI processing function are both used as parameters of the registration function; in the fixed data segment mode, URI and URI processing function are continuously placed in the data segment of the binary program and read through a loop matching method; in the new process mode, URI represents a separate binary program, and the main function of the program is the corresponding URI processing function. For the key processing code mode, different keys are parsed by the same key processing function, and the user input corresponding to the key is passed in the form of the return value or parameter of the key processing function, but the key processing functions in embedded firmware of different manufacturers or different models may be different. The present invention is based on the means of static analysis, and identifies the URI processing mode and key processing function adopted in the back-end binary program according to the URI and key extracted from the front-end file, and then extracts the URI processing function corresponding to each URI according to different URI processing modes, and then identifies the corresponding key set in the URI processing function according to the key processing function, and uses each key as the taint source in the subsequent taint analysis.
[0057] Key question 2: How to use large model-assisted analysis technology to correct the false positives and false negatives of existing static analysis
[0058] Due to the limitations of static analysis itself, errors caused by fixed code pattern analysis are inevitable. However, there is a lot of semantic information in the code, such as string information, code statements, etc., which can easily help eliminate these errors. Based on the three key time, ledCloseType and PWD_password extracted from the front-end page, the code pattern analysis extracted four input source processing functions websGetVar, strncmp, respCgiSendResp and sub_1BB34 in the back-end, but only the function websGetVar is correct. With the help of semantic information such as function name, function location, parameters, etc. in the code, researchers can easily filter out these three false positives and get the only correct result. Combining semantic information in the code can effectively help reduce false positives in identifying input source processing functions. By providing a better understanding of code semantics, large models can effectively help reduce false positives and false negatives caused by static analysis technology. The present invention also discovered a phenomenon that supports the effectiveness of large model-assisted analysis technology: both pattern-based static analysis technology and large model-assisted analysis technology will produce false positives, but because the sources of the false positives are different, the false positives of both can be eliminated by simply taking the intersection method, and only the correct results are retained. The cause of static analysis false positives is due to the code pattern itself, while the false positives of large model-assisted analysis results are mainly due to the misleading code semantic information, such as symbol information.
[0059] We designed corresponding big model-assisted analysis models, including a big model-assisted analysis model for identifying URI registration functions and a big model-assisted analysis model for identifying key processing functions. In the model, the query field combines prompt with Python programming statements, and adds CoT (Chain-of-Thought) statements to make the analysis more accurate; the from field is used to specify the selected big model type; the where field is used to limit the big model's answer statements at the token level. The big model interaction model for extracting URI registration functions identifies functions with registration functions (relationship between a field and a function) in code snippets as URI registration functions. The big model interaction model for extracting key processing functions first determines and identifies the functions in the code snippets that have the function of parsing information sources as HTTP requests, and then analyzes whether the function of the function is related to parsing or querying information, and finally uses the matching results as key processing functions.
[0060] This embodiment discloses a static analysis method and device for embedded firmware WEB service backend binary program. The specific module composition of this device is as follows Figure 1As shown, it is mainly divided into three stages: taint source identification, taint convergence point identification and taint analysis. That is, according to the characteristics of the embedded firmware WEB service backend binary program, the present invention first extracts the WEB service-related files from the firmware, then identifies the taint source in the backend binary program based on the information of the front-end file, and then uses the packaging function identified in the shared library file as the taint convergence point, and finally performs taint analysis on the backend binary program. The specific implementation of this method is as follows:
[0061] Step 1: Analyze the unpacked firmware file system and extract the front-end files, back-end binary programs and related shared library files related to the WEB service as the target of subsequent analysis.
[0062] This step is a preprocessing operation for the embedded file system. The purpose of this step is to filter out the analysis targets from the contents of the embedded file system. These files are mainly front-end files, back-end binary programs, and related shared libraries. There are three types of front-end files in IoT devices: HTML files, XML files, and JavaScript files. The preprocessor traverses the file system of the firmware and matches the file type to extract these front-end files. For the back-end binary program, the preprocessor uses path matching, file type matching, and keyword matching for extraction. The file name of the related shared library file can be obtained through the "readelf -d" command.
[0063] Step 2: Use the URI extracted from the front-end file to identify the URI processing mode in the back-end binary program, and combine fixed code pattern analysis and large model-assisted analysis to extract URIs and corresponding URI processing functions for different URI processing modes.
[0064] This step belongs to the first part of the operation of the backend binary program taint source phase. The purpose of this step is to accurately identify the mode of processing URIs and extract URIs and corresponding URI processing functions as the basis for subsequent key extraction. This method first identifies the URI processing mode and then extracts the URI. If the URI extracted by the front end is the same as the name of a backend binary program, the URI processing mode is considered to be a newly started process, and the processing function corresponding to the URI is the main function of the corresponding binary program; if the URI extracted by the front end is called as a parameter by a function in the backend binary program, the URI registration function is identified through the fixed code pattern and the large model interaction model-assisted analysis, and the URI and the corresponding URI processing function are extracted based on the identified URI registration function; if the reference address of the URI extracted by the front end in the backend binary program is in the data segment, the URI and the corresponding URI processing function are extracted by traversing upward and downward respectively until it does not meet the fixed code pattern and then ends. When identifying the URI registration function, the results of the large model assisted analysis are combined. We first take the intersection of the static analysis results based on the fixed code pattern and the large model assisted analysis results, and then evaluate any other results determined by the large model assisted analysis to determine whether they meet the code pattern, that is, using a string and a function as parameters.
[0065] Step 3: Use the keys extracted from the front-end files combined with fixed code pattern analysis and large model-assisted analysis to identify the key processing functions in the back-end binary program and extract the set of keys corresponding to each URI.
[0066] This step belongs to the second part of the operation of the stage of identifying the taint source of the backend binary program. The purpose of this step is to identify the reachable key based on the URI extracted in step 2 as the taint source for subsequent taint analysis. This method first identifies the key processing function and then extracts the key. For the key processing function, we directly use the intersection of the large model-assisted analysis and the pattern-based static analysis results. Then we analyze in each URI registration function, extract the key corresponding to each URI and record it as the taint source for subsequent taint analysis.
[0067] Step 4: Analyze the shared library files called by the backend binary program to identify the wrapper functions as the taint aggregation points.
[0068] This step belongs to the stage of identifying the wrapper function in the shared library file. The purpose of this step is to identify the wrapper function in the shared library that may trigger the vulnerability, which serves as the taint convergence point for the subsequent taint analysis. We first locate the wrapper function that calls the dangerous function of the basic library, and use the function parameters as input in the wrapper function for data flow analysis to determine whether there is a potential vulnerability in the use of the dangerous function. It is worth noting that if the wrapper function has multiple parameters, only one parameter is used as input for data flow analysis each time, and finally the return value of the function is recorded to which parameter is related and which parameter can cause the potential vulnerability. If a wrapper function that may trigger a potential vulnerability is obtained, the function that calls the wrapper function is repeatedly analyzed, and finally a summary of all possible wrapper functions that may only have potential vulnerabilities is input.
[0069] Step 5: Perform taint analysis on the backend binary program to discover potential security vulnerabilities.
[0070] This step belongs to the stage of taint analysis of the backend binary file. The purpose of this step is to perform static analysis on the embedded firmware WEB service backend binary program, discover potential vulnerabilities and record them. We use the taint analysis engine built on IDAPython to analyze the embedded firmware WEB service backend binary program and track the data flow of user input passed through the key to detect potential vulnerabilities. Among them, the taint source of the taint analysis is each key corresponding to each URI, and the taint convergence points are divided into two categories: a set of dangerous functions and wrapper functions, and dangerous operations caused by direct assignment. The taint propagation rules of taint analysis include inter-procedural propagation and intra-procedural propagation. Intra-procedural propagation is path-sensitive and uses syntax trees and forward analysis to track data flows. We perform separate taint propagation on different branches and summarize the results at the branch convergence point. If a variable is tainted in a branch, the taint state is assigned to the tainted state. Inter-procedural propagation follows the following rules: only function calls with tainted attribute parameters are analyzed, and functions are divided into dangerous types, import types, and general types, and each type is analyzed separately. Dangerous type functions (including dangerous functions and their wrapper functions) are used as receivers and analyzed according to predefined rules. For imported type functions, we force the taint attributes of return values and parameters to be tainted. For general type functions, we decompile them according to their entry addresses and perform taint analysis on the ast, propagating taint to the variables corresponding to the function parameters with tainted attributes.
[0071] Experimental data
[0072] This paper mainly evaluates the performance of Lara method from the aspects of test time, number of known vulnerability results, number of unknown vulnerability results, result accuracy, etc. In the experiment, two widely used static analysis tools SaTC and Karonte were selected for comparison, both of which are open source tools.
[0073] Table 1 Comparison of known vulnerability identification effects
[0074]
[0075] Table 1 presents the results of Lara, SaTC, and Karonte for identifying known vulnerabilities on 203 firmware samples.
[0076] Lara found 780 potential vulnerabilities with a precision of 81.8%. It missed 8 vulnerabilities with a recall of 98.8%. On the other hand, SaTC reported 331 potential vulnerabilities with a precision of 24.8%. In addition, SaTC had a low recall of only 12.7%. Karonte reported 131 potential vulnerabilities with a precision of 27.5% and a recall of 5.6%. In particular, all vulnerabilities detected by SaTC and Karonte were covered by Lara. In summary, Lara significantly outperformed SaTC and Karonte in terms of accuracy and recall of detecting vulnerabilities in firmware samples; namely, it improved SaTC's precision by 57.0%, Karonte's by 54.3%, and its recall by 86.1% and 93.2%.
[0077] Table 2 Comparison of unknown vulnerability identification effects
[0078]
[0079]
[0080] As shown in Table 2, Lara found a total of 245 unknown vulnerabilities. SaTC and Karonte were also applied for analysis, and they detected 36 and 11 vulnerabilities, respectively.
[0081] The above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit the same. A person skilled in the art may modify or replace the technical solutions of the present invention with equivalents. The protection scope of the present invention shall be subject to the claims.
Claims
1. A semantically enhanced embedded firmware static analysis method, the steps of which include: 1) Extract the front-end files and back-end binary programs related to the WEB service from the embedded firmware file system; Obtaining the URI and key related to the user input from each of the front-end files, and obtaining a set u recording each URI and a set k recording each key; wherein the URI is the resource identifier field value in the HTTP request, and the key is the string identifier field value in the body part of the HTTP request; 2) Execute steps 21) to 25) for each of the backend binary programs; 21) For each URI in the set u, a processing mode of the URI is obtained by combining a fixed code mode and a large model to assist in analysis in the current backend binary program; wherein the fixed code mode includes a URI processing mode and a key processing mode, and the URI processing mode is divided into three types: a registration function mode, a fixed data segment mode, and a new process mode; in the key processing mode, different keys are parsed by the same key processing function; in the registration function mode, the URI and its processing function are both used as parameters of the registration function; in the fixed data segment mode, the URI and its processing function are continuously placed in the data segment of the current backend binary program and read through a loop matching method; in the new process mode, the URI represents a separate binary program, and the main function of the binary program is the corresponding URI processing function; 22) For each key in the set k, obtain a processing mode for the key by combining the fixed code mode and the large model-assisted analysis in the current backend binary program; 23) According to the URI processing mode obtained in step 21) and the semantic relationship between the URI data and the URI processing function contained therein, identify the URI processed in the current backend binary program and its corresponding URI processing function through static analysis; then, in the URI processing function corresponding to each URI, identify multiple keys corresponding to each URI through static analysis according to the key processing mode obtained in step 22); wherein all URIs identified from the backend binary program are recorded as a set U, all URI processing functions identified from the backend binary program are recorded as a set UF, and all keys identified from the backend binary program are recorded as a set K; each data U in the URI i A processing function UF in the URI i Correspondingly, each data U i Corresponding to a key data set K i ; 24) extracting the shared library files called by the current backend binary program, obtaining the calling relationship between the dangerous function and the wrapper function that calls the dangerous function and the parameter controllable conditions in each shared library file based on data flow analysis and control flow analysis, and extracting the wrapper function set S that meets the vulnerability triggering conditions; 25) Perform taint analysis on the current backend binary program, the taint source is the entire data set K obtained in step 23), the taint convergence point is the predefined basic library dangerous function and the identified packaging function set S, according to each data U in the current URI i and key data set K i The corresponding relationship, in each data U i The corresponding processing function UF i For each key data set K i Perform separate taint propagation analysis and document potential vulnerabilities and triggering paths.
2. The method according to claim 1, characterized in that: The method of combining the fixed code mode and the large model-assisted analysis in the current backend binary program to obtain the processing mode of the URI is as follows: identifying the processing mode of the URI in the current backend binary program according to the current URI, and extracting the URI and the corresponding URI processing function according to different processing modes; a) If the current URI is the same as the name of the current backend binary program, the processing mode of the URI is considered to be a new process, and the main function of the current backend binary program is used as the URI processing function corresponding to the current URI; b) If the current URI is called as a parameter by a function in the current backend binary program, the processing mode of the URI is considered to be a registered function, and the parameters of each reference position of the registered function are parsed, and the function corresponding to the function entry address in the parameter is used as the URI processing function corresponding to the current URI; c) If the current URI is in the data segment at the reference address of the current backend binary program, it is considered that the processing mode of the URI is a fixed data segment, and the data segment is traversed to obtain the URI processing function corresponding to the current URI.
3. The method according to claim 1, 2 or 3, characterized in that: The method for obtaining the key processing mode by combining the fixed code pattern and the large model-assisted analysis in the current backend binary program is: first, identify the key processing mode in the current backend binary program according to the current key, and the key processing mode is to use a key processing function that parses and extracts the input corresponding to the key; then call the function that takes the key as a parameter as the key processing function.
4. The method according to claim 1, characterized in that The information in the URI processing mode includes URI data, URI processing function, and the semantic relationship between URI data and URI processing function; the semantic information of the key processing mode includes key data, key processing function for parsing key data, and the semantic relationship between key data and key processing function.
5. The method according to claim 1 or 4, characterized in that: The semantic relationship includes: the corresponding relationship between different data, the calling relationship and reachability between codes, the calling relationship between data and code, and the symbol information in the code.
6. The method according to claim 1, characterized in that The dangerous function is a function with dangerous operations defined in a C or C++ standard library; the dangerous function is identified in the shared library file by a function name matching method.
7. The method according to claim 1, characterized in that The vulnerability triggering conditions include: the data flow from the package function to the dangerous function in the shared library file is reachable; the front-end file is a WEB front-end page file with html, js, asp, xml as suffix; the back-end binary program is a back-end binary program containing WEB service code or public operation support code.
8. An electronic device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, the computer program is configured to be executed by the processor, and the computer program comprises instructions for executing each step in the method according to any one of claims 1 to 7.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Man-machine collaborative static vulnerability mining method and system based on large model
CN119203138A
Method and system for detecting login request forgery vulnerability after third-party verification based on data flow analysis
CN120281578A
LLM-based semantic embedded system vulnerability detection method and device
CN122153899A
