A method for detecting remote code execution vulnerabilities in smart devices based on static analysis
Detecting remote code execution vulnerabilities in smart devices through static analysis methods solves the problem of inability to automatically detect in existing technologies, enables efficient vulnerability detection and reporting, and reduces security risks.
Patent Information
- Application Number
- CN202311668718.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-07
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2043-12-07
AI Technical Summary
Existing technology cannot automatically detect remote code execution vulnerabilities in the Lua-based web framework of smart devices, leading to increased security risks.
Using a method based on static analysis, we define abstract syntax trees, generate control flow graphs, perform data flow analysis and taint analysis, detect vulnerabilities in applications, identify data flow paths that may cause vulnerabilities, and report the location of the vulnerabilities.
It realizes automated detection of remote code execution vulnerabilities in smart devices, improves detection efficiency and coverage, and reduces the false positive rate of vulnerability reports and the workload of manual verification.
Smart Images

Figure CN117744087B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of industrial Internet of Things security technology, and in particular to a method for detecting remote code execution vulnerabilities of smart devices based on static analysis. Background Art
[0002] The Internet of Things is an important part of the new generation of information technology. Its basic characteristics can be summarized as holistic perception, reliable transmission and intelligent processing. IoT devices are non-standard computing devices that can be wirelessly connected to the network and have the ability to transmit data. The Internet of Things extends the scope of Internet connectivity from standard devices such as desktops, laptops, smartphones and tablets to any range of physical devices and daily necessities that are not Internet-enabled. The areas involved include smart homes, enterprise IoT, smart manufacturing, industrial IoT, etc.
[0003] IoT devices are smart devices that support Internet connection. With the increasing demand for 5G networks, more IoT devices are being put into use. Based on the "Internet of Everything", smart devices have many advantages: efficient resource utilization: understanding the functions and working methods of each device can improve the effective utilization of resources and monitor natural resources; saving manpower and time: when IoT devices interact and communicate with each other to complete tasks, manpower can be minimized and time can be saved; enhanced data collection: networking and collecting large amounts of data. It is precisely because of the interconnected nature of the IoT system that, despite the adoption of security measures, the system provides almost no control, which may cause various security issues such as network attacks or privacy leaks. Embedded system firmware Web vulnerabilities have been continuously disclosed in recent years, and embedded devices have gradually become one of the main targets of malicious attack incidents. Among all IoT devices, routers and network cameras suffer more attacks than other embedded devices. The key reason is that these devices expose Web services and network services that often contain exploitable vulnerabilities. More than 81% of the configuration files of the Web server in the firmware run with the privileges of the root user. This unnecessary high-level privilege will bring great security risks to the device. It is possible to attack the entire device by simply exploiting a vulnerability in the Web component. In addition, the system architecture of IoT devices is not a universal platform and lacks traditional security mechanisms. Once destroyed, it will cause huge losses. Therefore, the security of IoT devices inevitably becomes a key issue that needs to be considered. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide a method for detecting remote code execution vulnerabilities of smart devices based on static analysis, so as to solve the technical problem in the related art that remote code execution vulnerabilities in the Lua-based Web framework of smart devices cannot be automatically detected.
[0005] According to a first aspect of an embodiment of the present application, a method for detecting a remote code execution vulnerability of an intelligent device based on static analysis is provided, comprising:
[0006] Define an abstract syntax tree for the Lua source code files in the embedded firmware Web framework, and perform lexical analysis and syntax analysis to generate an abstract syntax tree;
[0007] Traversing all nodes in the abstract syntax tree and creating a control flow graph node on each node, generating a control flow graph consisting of the control flow graph nodes, wherein the control flow graph nodes are connected by two attributes, an inbound node and an outbound node;
[0008] Using the scheduling rules of the Web framework, the control flow graph nodes of all called functions are added to the control flow graph to form a complete program control flow graph;
[0009] Performing data flow analysis on the program control flow graph, and finally determining the result of the data flow constraint relationship according to the fixed point algorithm and the defined reachability analysis, wherein the data flow analysis consists of a lattice with a finite height and a data flow constraint system;
[0010] Taint analysis is performed on the data flow constraint relationship results to detect vulnerabilities in the application. The data flow between the pollution source and the taint convergence point is tracked through taint analysis. If the data comes from an untrusted or contaminated source and eventually flows into the convergence point through the data flow, it is considered that this data flow may cause vulnerabilities. If the data is processed by a disinfection function during the data transmission process to make the originally untrusted data safe and reliable, it will not cause vulnerabilities.
[0011] Optionally, perform lexical analysis and grammatical analysis to generate an abstract syntax tree, including:
[0012] Use the abstract syntax tree parser to define all possible statement and expression nodes in Lua grammar and the traversal rules of various nodes;
[0013] Lua file extraction and Lua file text preprocessing are performed on a Lua language-based Web framework; and an abstract syntax tree is generated for the Lua file using an abstract syntax tree parser.
[0014] Optionally, traversing all nodes in the abstract syntax tree and creating a control flow graph node on each node to generate a control flow graph consisting of the control flow graph nodes includes:
[0015] An inbound node and an outbound node are defined for each control flow graph node to form a control flow graph node;
[0016] The control flow graph nodes are connected through inbound nodes and outbound nodes to form a control flow graph.
[0017] Optionally, the control flow graph nodes of all called functions are added to the control flow graph using the scheduling rules of the Web framework to form a complete program control flow graph, including:
[0018] A final control flow graph is generated from a program with multiple function calls in a context-sensitive manner by gluing the function body into the main control flow graph each time the function is called;
[0019] To perform accurate assignment propagation for function calls, multivariate analysis is implemented by creating copies of function bodies for call sites.
[0020] Optionally, perform data flow analysis on the control flow graph, and finally determine the convergence result of the convergent data flow constraint system based on the fixed point algorithm and defined reachability analysis, including:
[0021] Build the lattice using the power set of all assignment statements in the control flow graph;
[0022] Use data flow constraints to associate each node with its neighboring nodes;
[0023] The fixed point algorithm is used to calculate the final converged data flow constraint relationship, so as to detect when the input reaches the critical point in the code through the definition of reachability analysis, and then infer whether there may be dangerous flow in the code.
[0024] Optionally, perform taint analysis on the data flow constraint relationship results to detect vulnerabilities in the application. The taint analysis is used to track the data flow between the taint source and the taint convergence point, including:
[0025] Abstracting taint analysis into a triple<sources,sinks,sanitizers> , that is, sources represent pollution sources, sinks represent pollution collection points, and sanitizers represent harmless treatment;
[0026] In the process of finding and reporting vulnerabilities, the input of the Web framework and the user's interaction and the trigger function of the vulnerability, i.e., the pollution source and the pollution convergence point, will be defined as the trigger word for reporting the vulnerability;
[0027] Retrieve the data flow analysis results and report the path data flow that meets the vulnerability trigger word.
[0028] According to a second aspect of an embodiment of the present application, a smart device remote code execution vulnerability detection device based on static analysis is provided, comprising:
[0029] The first generation module is used to define an abstract syntax tree for a Lua source code file in an embedded firmware Web framework, and to perform lexical analysis and syntax analysis to generate an abstract syntax tree;
[0030] A second generation module is used to traverse all nodes in the abstract syntax tree and create a control flow graph node on each node to generate a control flow graph composed of the control flow graph nodes, wherein the control flow graph nodes are connected by two attributes of an inbound node and an outbound node;
[0031] A third generation module is used to add the control flow graph nodes of all called functions to the control flow graph by using the scheduling rules of the Web framework to form a complete program control flow graph;
[0032] An analysis module, used for performing data flow analysis on the program control flow graph, and finally determining the result of the data flow constraint relationship according to the fixed point algorithm and the defined reachability analysis, wherein the data flow analysis consists of a lattice with a finite height and a data flow constraint system;
[0033] The detection module is used to perform taint analysis on the data flow constraint relationship results to detect vulnerabilities in the application. The data flow between the pollution source and the taint convergence point is tracked through taint analysis. If the data comes from an untrusted or contaminated source and eventually flows into the convergence point through the data flow, it is considered that this data flow may cause vulnerabilities; if the data is processed by a disinfection function during the data transmission process so that the originally untrusted data becomes safe and reliable, it will not cause vulnerabilities.
[0034] According to a third aspect of an embodiment of the present application, there is provided an electronic device, including:
[0035] one or more processors;
[0036] A memory for storing one or more programs;
[0037] When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in the first aspect.
[0038] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, on which computer instructions are stored, characterized in that when the instructions are executed by a processor, the steps of the method described in the first aspect are implemented.
[0039] The technical solution provided by the embodiments of the present application may have the following beneficial effects:
[0040] It can be seen from the above embodiments that the present application provides an automated detection method for remote code execution vulnerabilities in embedded firmware Web frameworks based on a static taint analysis method. Compared with the traditional manual audit method for source code, the method of the present invention can automatically detect remote code execution vulnerabilities in Lua-based Web frameworks of smart devices, and the vulnerability detection efficiency is greatly improved. The method of the present invention has high availability and wide coverage.
[0041] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0043] Figure 1 The present invention is a flowchart of a method for detecting remote code execution vulnerabilities of smart devices based on static analysis according to an exemplary embodiment.
[0044] Figure 2 The figure is a diagram of a static analysis vulnerability detection framework according to an exemplary embodiment.
[0045] Figure 3 is a flow chart of a fixed point algorithm according to an exemplary embodiment.
[0046] Figure 4 The present invention is a block diagram of a smart device remote code execution vulnerability detection device based on static analysis according to an exemplary embodiment. DETAILED DESCRIPTION
[0047] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0048] The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit this application. The singular forms of "a", "said" and "the" used in this application and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0049] It should be understood that although the terms first, second, third, etc. may be used in the present application to describe various information, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0050] Figure 1 is a flowchart of a method for detecting remote code execution vulnerabilities of smart devices based on static analysis according to an exemplary embodiment. Figure 2 is a static analysis vulnerability detection framework diagram according to an exemplary embodiment. Figure 1 and Figure 2 As shown, the method may include the following steps:
[0051] S1: Define an abstract syntax tree for the Lua source code file in the embedded firmware Web framework, and perform lexical analysis and syntax analysis to generate an abstract syntax tree;
[0052] Specifically, the collected firmware to be analyzed is unpacked. Usually, the firmware file is packaged in bin, zip, LZMA, arj and other file compression types, among which bin and zip formats are the most common. The bin file is in binary image form, and the squashsf file system needs to be extracted using binwalk.
[0053] Then the Lua source code file is lexically analyzed and parsed to generate an abstract syntax tree, including:
[0054] S11: Use the abstract syntax tree parser to define all possible statement and expression nodes in Lua grammar and the traversal rules of various nodes;
[0055] S12: Extract Lua files and preprocess Lua file text for Lua language-based Web framework;
[0056] S13: Generate an abstract syntax tree for the Lua file using an abstract syntax tree parser.
[0057] The abstract syntax tree is a tree representation of the abstract syntax structure of the source code. Each node in the abstract syntax tree represents a structure in the source code. The abstract syntax tree can more accurately locate the function call relationship, assignment statement, operation statement, etc. in the code. Compared with the intermediate representation, the abstract syntax tree is closer to the syntax structure and is suitable for fast type checking.
[0058] S2: traverse all nodes in the abstract syntax tree and create a control flow graph node on each node, generating a control flow graph composed of the control flow graph nodes, wherein the control flow graph nodes are connected by two attributes, namely, an inbound node and an outbound node; this step may include the following sub-steps:
[0059] S21: define an inbound node and an outbound node for each control flow graph node to form a control flow graph node;
[0060] Specifically, the control flow analysis creates different visit_functions for different types of nodes in the abstract syntax tree, visits each abstract syntax tree node through the visit_function, and adds id, label, line number, inbound node and outbound node attributes to the node to form a control flow graph node.
[0061] S22: Connecting the control flow graph nodes through inbound nodes and outbound nodes to form a control flow graph.
[0062] Specifically, the control flow graph nodes are traversed and a decision is made based on the node type whether to add the node to the control flow graph. The final output is a list structure consisting of the control flow graph nodes.
[0063] Full coverage of program statements can be achieved by traversing the control flow graph nodes.
[0064] S3: using the scheduling rules of the Web framework to add the control flow graph nodes of all called functions to the control flow graph to form a complete program control flow graph; this step may include the following sub-steps:
[0065] S31: adopt a context-sensitive approach to generate a final control flow graph from a program with multiple function calls by gluing the function body into the main control flow graph each time the function is called;
[0066] Specifically, the control flow graph obtained in S2 is the main control flow graph of the analyzed file, but does not include the function definition part. This method adopts a context-sensitive data flow analysis method, and only when a function is called will its control flow graph be spliced into the main control flow graph node list.
[0067] S32: To achieve accurate assignment propagation for function calls, multivariate analysis is implemented by creating copies of function bodies for call sites;
[0068] Specifically, context-sensitive analysis needs to consider the impact of context in procedure calls, that is, calling the same function at different locations needs to be distinguished. Here, we perform unique calculations at context-sensitive call locations by creating a copy of the called function at each call site.
[0069] It adopts a context-sensitive approach to analyze and creates copies of called functions, which improves the analysis efficiency and makes the calls in different places unconnected.
[0070] S4: performing data flow analysis on the program control flow graph, and finally determining the result of the data flow constraint relationship according to the fixed point algorithm and the defined reachability analysis, wherein the data flow analysis consists of a lattice with a finite height and a data flow constraint system; this step may include the following sub-steps:
[0071] S41: Construct a lattice using the power set of all assignment statements in the control flow graph;
[0072] Specifically, since only assignment statements can change the reachability between nodes in a control flow graph, a lattice is constructed from all assignment statements in the control flow graph. The lattice used for this analysis is the power set lattice of all assignment statements in the program.
[0073] S42: Associating each node with its neighboring nodes using data flow constraints;
[0074] Specifically, in order to analyze the data flow relationship between each node in the control flow graph of the program, the data flow constraint equation is used to describe the constraint relationship between each control flow graph node, and the value of the node is associated with its adjacent nodes.
[0075] S43: Use the fixed point algorithm to calculate the final converged data flow constraint relationship, so as to detect when the input reaches the critical point in the code by defining the reachability analysis, and then infer whether there may be dangerous flow in the code.
[0076] Specifically, the fixed point algorithm is used to iteratively solve the data flow constraint equation until the calculation results of two adjacent iterations no longer change, that is, the fixed point is reached. The reachability analysis is defined to use the Worklist algorithm to determine whether a variable is not covered when it is assigned to the current position in the program.
[0077] Figure 3 It is the fixed point algorithm flow chart. The initial input is a complete control flow graph, and then the data flow constraint system needs to be initialized. The data flow constraint system performs backward analysis by adding the constraints of the forward nodes of all nodes. Traverse the control flow graph nodes to determine whether the current node is an assignment node. If it is not an assignment node, the current node only adds all the constraints of its forward node; if it is an assignment node, all previous assignments to the variable are discarded and replaced by the current assignment node. After a round of traversal, the current data flow constraint system is compared with the value of the previous round. If they are equal, the process ends. If they are not equal, the new assignment node is added to the current control flow graph for a new round of traversal until they are equal. According to the fixed point theorem, this process will always reach a convergence result.
[0078] The reachability analysis defined based on the fixed point algorithm and the Worklist algorithm can avoid repeated calculations and more efficiently determine the data flow constraint relationship results of the current system.
[0079] S5: Perform taint analysis on the data flow constraint relationship results to detect vulnerabilities in the application. The data flow between the pollution source and the taint convergence point is tracked through taint analysis. If the data comes from an untrusted or contaminated source and eventually flows into the convergence point through the data flow, it is considered that this data flow may cause vulnerabilities. If the data is processed by the disinfection function during the data transmission process so that the originally untrusted data becomes safe and reliable, it will not cause vulnerabilities.
[0080] Specifically, the last step is to consider the characteristics of the Web framework to find vulnerabilities. Given a vulnerability trigger keyword definition file containing the Web framework, the trigger word indicates where in the program flow dangerous data may be introduced. This method locates the external input and attack point of the remote code execution vulnerability in the embedded firmware based on the abstract syntax tree node. Finally, the detected vulnerability is reported to the developer, and the report information includes the location of the vulnerability taint source, the label of the taint parameter, the final location of the taint data, and the execution function that triggers the vulnerability.
[0081] The taint analysis of the data flow constraint relationship results is used to detect vulnerabilities in the application. The data flow between the pollution source and the taint convergence point is tracked through taint analysis, including:
[0082] Abstracting taint analysis into a triple<sources,sinks,sanitizers> , that is, sources represent pollution sources, sinks represent pollution collection points, and sanitizers represent harmless treatment;
[0083] In the process of finding and reporting vulnerabilities, the input of the Web framework and the user's interaction and the trigger function of the vulnerability, i.e., the pollution source and the pollution convergence point, will be defined as the trigger word for reporting the vulnerability;
[0084] Retrieve the data flow analysis results and report the path data flow that meets the vulnerability trigger word.
[0085] Locating the external input and attack point of remote code execution vulnerabilities in embedded firmware based on abstract syntax tree nodes can achieve more accurate positioning compared to regular matching.
[0086] It can be seen from the above embodiments that the present application implements a remote code execution vulnerability detection method for smart devices based on static analysis through static taint analysis. This method can automatically detect vulnerabilities in the Web management interface in the firmware after the firmware is unpacked, thereby promoting developers to repair these vulnerabilities as soon as possible. Specifically, a comprehensive analysis of the program can be achieved by traversing the abstract syntax tree nodes; static taint analysis combined with Web framework scheduling rules can define the data propagation method in a more fine-grained manner, which can greatly reduce the false alarm rate of vulnerability reports in the automated vulnerability detection process, thereby greatly reducing the manual workload in the final vulnerability verification process.
[0087] Corresponding to the aforementioned embodiment of the method for detecting remote code execution vulnerabilities of smart devices based on static analysis, the present application also provides an embodiment of an apparatus for detecting remote code execution vulnerabilities of smart devices based on static analysis.
[0088] Figure 4 1 is a block diagram of a smart device remote code execution vulnerability detection device based on static analysis according to an exemplary embodiment. Figure 4 , the device comprises:
[0089] The first generation module 1 is used to define an abstract syntax tree for a Lua source code file in an embedded firmware Web framework, and to perform lexical analysis and syntax analysis to generate an abstract syntax tree;
[0090] A second generation module 2 is used to traverse all nodes in the abstract syntax tree and create a control flow graph node on each node, generating a control flow graph composed of the control flow graph nodes, wherein the control flow graph nodes are connected by two attributes of an inbound node and an outbound node;
[0091] The third generating module 3 is used to add the control flow graph nodes of all called functions to the control flow graph by using the scheduling rules of the Web framework to form a complete program control flow graph;
[0092] Analysis module 4, used for performing data flow analysis on the program control flow graph, and finally determining the result of data flow constraint relationship according to the fixed point algorithm and defined reachability analysis, wherein the data flow analysis consists of a lattice with a finite height and a data flow constraint system;
[0093] Detection module 5 is used to perform taint analysis on the data flow constraint relationship results to detect vulnerabilities in the application. The data flow between the pollution source and the taint convergence point is tracked through taint analysis. If the data comes from an untrusted or contaminated source and eventually flows into the convergence point through the data flow, it is considered that this data flow may cause vulnerabilities; if the data is processed by the disinfection function during the data transmission process so that the originally untrusted data becomes safe and reliable, it will not cause vulnerabilities.
[0094] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0095] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present application scheme. A person of ordinary skill in the art can understand and implement it without paying any creative work.
[0096] Correspondingly, the present application also provides an electronic device, comprising: one or more processors; a memory for storing one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors implement the above-mentioned smart device remote code execution vulnerability detection method based on static analysis.
[0097] Correspondingly, the present application also provides a computer-readable storage medium on which computer instructions are stored. When the instructions are executed by a processor, the above-mentioned smart device remote code execution vulnerability detection method based on static analysis is implemented.
[0098] Those skilled in the art will readily appreciate other embodiments of the present application after considering the description and practicing the contents disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The description and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the claims.
[0099] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A method for detecting remote code execution vulnerabilities in smart devices based on static analysis, characterized in that: include: Define an abstract syntax tree for the Lua source code files in the embedded firmware Web framework, and perform lexical analysis and syntax analysis to generate an abstract syntax tree; Traversing all nodes in the abstract syntax tree and creating a control flow graph node on each node, generating a control flow graph consisting of the control flow graph nodes, wherein the control flow graph nodes are connected by two attributes, an inbound node and an outbound node; Using the scheduling rules of the Web framework, the control flow graph nodes of all called functions are added to the control flow graph to form a complete program control flow graph; Performing data flow analysis on the program control flow graph, and finally determining the result of the data flow constraint relationship according to the fixed point algorithm and the defined reachability analysis, wherein the data flow analysis consists of a lattice with a finite height and a data flow constraint system; Performing taint analysis on the data flow constraint relationship results to detect vulnerabilities in the application, tracking the data flow between the pollution source and the taint convergence point through taint analysis, if the data comes from an untrusted or contaminated source and eventually flows into the convergence point through the data flow, it is considered that this data flow may cause vulnerabilities; if the data is processed by the disinfection function during the data transmission process so that the originally untrusted data becomes safe and trustworthy, then no vulnerability will be caused; Among them, the data flow analysis is performed on the control flow graph, and the convergence result of the convergent data flow constraint system is finally determined according to the fixed point algorithm and defined reachability analysis, including: Build the lattice using the power set of all assignment statements in the control flow graph; Use data flow constraints to associate each node with its neighboring nodes; The fixed point algorithm is used to calculate the final converged data flow constraint relationship, so as to detect when the input reaches the critical point in the code through the definition of reachability analysis, and then infer whether there may be dangerous flow in the code.
2. The method according to claim 1, characterized in that Perform lexical analysis and syntax analysis to generate an abstract syntax tree, including: Use the abstract syntax tree parser to define all possible statement and expression nodes in Lua grammar and the traversal rules of various nodes; Lua file extraction and Lua file text preprocessing are performed on a Lua language-based Web framework; and an abstract syntax tree is generated for the Lua file using an abstract syntax tree parser.
3. The method according to claim 1, characterized in that Traversing all nodes in the abstract syntax tree and creating a control flow graph node on each node to generate a control flow graph consisting of the control flow graph nodes, including: An inbound node and an outbound node are defined for each control flow graph node to form a control flow graph node; The control flow graph nodes are connected through inbound nodes and outbound nodes to form a control flow graph.
4. The method according to claim 1, characterized in that The control flow graph nodes of all called functions are added to the control flow graph using the scheduling rules of the Web framework to form a complete program control flow graph, including: A final control flow graph is generated from a program with multiple function calls in a context-sensitive manner by gluing the function body into the main control flow graph each time the function is called; To perform accurate assignment propagation for function calls, multivariate analysis is implemented by creating copies of function bodies for call sites.
5. The method according to claim 1, characterized in that Perform taint analysis on the data flow constraint relationship results to detect vulnerabilities in the application. The taint analysis tracks the data flow between the pollution source and the taint convergence point, including: Abstracting taint analysis into a triple<sources, sinks, sanitizers> , that is, sources represent pollution sources, sinks represent pollution collection points, and sanitizers represent harmless treatment; In the process of finding and reporting vulnerabilities, the input of the Web framework and the user's interaction and the trigger function of the vulnerability, i.e., the pollution source and the pollution convergence point, will be defined as the trigger word for reporting the vulnerability; Retrieve the data flow analysis results and report the path data flow that meets the vulnerability trigger word.
6. A smart device remote code execution vulnerability detection device based on static analysis, characterized in that: include: The first generation module is used to define an abstract syntax tree for a Lua source code file in an embedded firmware Web framework, and to perform lexical analysis and syntax analysis to generate an abstract syntax tree; A second generation module is used to traverse all nodes in the abstract syntax tree and create a control flow graph node on each node to generate a control flow graph composed of the control flow graph nodes, wherein the control flow graph nodes are connected by two attributes of an inbound node and an outbound node; A third generation module is used to add the control flow graph nodes of all called functions to the control flow graph by using the scheduling rules of the Web framework to form a complete program control flow graph; An analysis module, used for performing data flow analysis on the program control flow graph, and finally determining the result of the data flow constraint relationship according to the fixed point algorithm and the defined reachability analysis, wherein the data flow analysis consists of a lattice with a finite height and a data flow constraint system; A detection module is used to perform taint analysis on the data flow constraint relationship result to detect vulnerabilities in the application program. The data flow between the pollution source and the taint convergence point is tracked through taint analysis. If the data comes from an untrusted or contaminated source and eventually flows into the convergence point through the data flow, it is considered that this data flow may cause vulnerabilities; if the data is processed by the disinfection function during the data transmission process so that the originally untrusted data becomes safe and trustworthy, then no vulnerability will be caused; Among them, the data flow analysis is performed on the control flow graph, and the convergence result of the convergent data flow constraint system is finally determined according to the fixed point algorithm and defined reachability analysis, including: Build the lattice using the power set of all assignment statements in the control flow graph; Use data flow constraints to associate each node with its neighboring nodes; The fixed point algorithm is used to calculate the final converged data flow constraint relationship, so as to detect when the input reaches the critical point in the code through the definition of reachability analysis, and then infer whether there may be dangerous flow in the code.
7. An electronic device, characterized in that: include: one or more processors; A memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 5.
8. A computer-readable storage medium having computer instructions stored thereon, characterized in that: When the instruction is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
