Cryptographic function calling process detection method and device and computer equipment

By obtaining and correcting the call diagram of the password function and detecting it based on a predetermined model, the problem of incomplete execution process of the password mechanism is solved, ensuring the integrity and correct execution of the password function.

CN119312340AInactive Publication Date: 2025-01-14STATE GRID BEIJING ELECTRIC POWER CO +2
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411336151.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-24
Publication Date
2025-01-14
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In the prior art, due to human errors by developers, the overall execution process of the password mechanism is incomplete, and some key password functions are missing or functions can be bypassed and not executed, resulting in the password mechanism being unable to perform its due functions.

Method used

By obtaining the password function call diagram and execution data of the password function to be detected, extracting implicit call information and indirect jump information, correcting the call diagram, and detecting based on the predetermined password function model, ensuring the integrity and correct execution of the password function .

Benefits of technology

It realizes accurate verification of the integrity of the password function, ensures the complete execution process of the password mechanism, and solves the problem of incomplete overall execution process of the password.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119312340A_ABST
    Figure CN119312340A_ABST
Patent Text Reader

Abstract

The invention discloses a cryptographic function calling process detection method and device and computer equipment. The method comprises the following steps: acquiring a cryptographic function to be detected; extracting a cryptographic function call graph of the to-be-detected cryptographic function, and collecting execution data of the to-be-detected cryptographic function; extracting implicit call information and indirect jump information of the to-be-detected cryptographic function from the execution data, and correcting the cryptographic function call graph corresponding to the implicit call information and the indirect jump information of the to-be-detected cryptographic function to obtain a corrected cryptographic function call graph; and a detection result is determined based on the corrected cryptographic function call graph and a predetermined cryptographic function model, and the predetermined cryptographic function model at least comprises a complete cryptographic function call process. The technical problem that the overall password execution process is incomplete in the prior art is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of encryption technology, and in particular to a method, device and computer equipment for detecting a cryptographic function call process. Background Art

[0002] At present, in related technologies, it is often the case that due to human errors by developers, the overall execution process of the cryptographic mechanism is incomplete, some key cryptographic functions are missing or the functions can be bypassed and not executed, or even the entire cryptographic mechanism is missing, resulting in the cryptographic mechanism being unable to perform its due functions. Summary of the invention

[0003] The embodiments of the present application provide a cryptographic function call process detection method, apparatus and computer equipment to at least solve the technical problem of incomplete overall cryptographic execution process in the related art.

[0004] According to one aspect of an embodiment of the present application, a cryptographic function call process detection method is provided, comprising: obtaining a cryptographic function to be detected; extracting a cryptographic function call graph of the cryptographic function to be detected, and collecting execution data of the cryptographic function to be detected; extracting implicit call information and indirect jump information of the cryptographic function to be detected from the execution data, and using the implicit call information and indirect jump information of the cryptographic function to be detected to correct the cryptographic function call graph corresponding to the cryptographic function call graph to obtain a corrected cryptographic function call graph; determining a detection result based on the corrected cryptographic function call graph and a predetermined cryptographic function model, wherein the predetermined cryptographic function model at least includes a complete cryptographic function call process.

[0005] Optionally, determining the detection result based on the revised cryptographic function call graph and a predetermined cryptographic function model includes: obtaining the predetermined cryptographic function model, the predetermined cryptographic function model contains a node sequence, each node in the node sequence represents a cryptographic function in the cryptographic function call process, the node sequence contains three types of nodes, the first type of node represents a node whose function is called only once at the current position in the node sequence, the second type of node represents a node whose function is called more than once at the current position in the node sequence, and the third type of node represents nodes belonging to the same family, and the calling order between the third type of nodes can be interchanged; determining the cryptographic function dominating tree according to the revised cryptographic function call graph; determining the detection result according to the cryptographic function dominating tree and the predetermined cryptographic function model.

[0006] Optionally, determining a cryptographic function dominator tree according to the revised cryptographic function call graph includes: determining the dominance relationship between each node starting from the entry point in the revised cryptographic function call graph; determining the immediate dominator of each node from the dominance relationship, the immediate dominator representing the node closest to the node to be determined; determining the entry point as the root node of the cryptographic function dominator tree, connecting each node with the immediate dominator corresponding to each node, and obtaining the cryptographic function dominator tree.

[0007] Optionally, the method further includes: determining the backward dominance relationship between each node starting from the exit point in the modified cryptographic function call graph; determining the backward immediate dominator of each node from the dominance relationship, the backward immediate dominator representing the node closest to the node to be determined; determining the exit point as the root node of the cryptographic function backward dominator tree, connecting each node with the backward immediate dominator corresponding to each node, and obtaining the backward cryptographic function dominator tree.

[0008] Optionally, the detection result is determined according to the cryptographic function dominator tree and the predetermined cryptographic function model, including: extracting a calling sequence corresponding to the cryptographic function to be detected from the cryptographic function dominator tree, the calling sequence being used to characterize the execution order of multiple cryptographic functions in the cryptographic function to be detected; comparing a node sequence corresponding to the predetermined cryptographic function model with the calling sequence to obtain a comparison result; and determining the detection result according to the comparison result.

[0009] Optionally, extracting a call sequence corresponding to the cryptographic function to be detected from the cryptographic function dominator tree includes: converting the cryptographic function dominator tree into a dominator sequence, removing non-critical cryptographic function nodes in the dominator sequence, and obtaining a processed dominator sequence, wherein the processed dominator sequence is used to represent the dominance order between the cryptographic functions in the cryptographic function to be detected; obtaining all branch nodes in the processed dominator sequence, traversing the branch nodes, and determining the critical cryptographic function passed by the branch path corresponding to each branch node; and inserting the critical cryptographic function passed by the branch path into the dominator sequence to obtain the call sequence.

[0010] Optionally, the node sequence corresponding to the predetermined cryptographic function model is compared with the calling sequence to obtain a comparison result, including: comparing the sorting order of each node in the calling sequence with the arrangement order of each node in the node sequence in turn to obtain a first comparison result; comparing the type of each node in the calling sequence with the type of each node in the node sequence to obtain a second comparison result; and combining the first comparison result and the second comparison result to obtain the comparison result.

[0011] According to another aspect of an embodiment of the present application, a cryptographic function call process detection device is also provided, including: a receiving module, used to receive an interface call request, the interface call request contains a query text, and the query text is used to represent the description information of the target application program interface API; an extraction module, used to extract multiple data nodes in the process of obtaining and calling the target interface from the query text, and the multiple data nodes include multiple operation steps for obtaining data from the outside during the process of calling the target interface; a matching module, used to match the operation steps corresponding to the multiple data nodes with the operations corresponding to the target platform to determine the operation information of the multiple data nodes in the target platform; a determination module, used to determine the target interface based on the operation information of the multiple data nodes in the target platform.

[0012] According to another aspect of the embodiment of the present application, a computer device is also provided, including: a memory and a processor, wherein the memory is used to store program instructions; and the processor is connected to the memory and is used to execute the above-mentioned cryptographic function call process detection method.

[0013] According to another aspect of the embodiments of the present application, a non-volatile storage medium is provided, which includes a stored computer program, wherein the device where the non-volatile storage medium is located executes the above-mentioned cryptographic function call process detection method by running the computer program.

[0014] According to another aspect of the embodiments of the present application, a computer program product is also provided, including computer instructions, which implement the above-mentioned cryptographic function call process detection method when executed by a processor.

[0015] In an embodiment of the present application, a cryptographic function to be detected is obtained; a cryptographic function call graph of the cryptographic function to be detected is extracted, and execution data of the cryptographic function to be detected is collected; implicit call information and indirect jump information of the cryptographic function to be detected are extracted from the execution data, and the cryptographic function call graph is corrected using the implicit call information and indirect jump information of the cryptographic function to be detected to obtain a corrected cryptographic function call graph; a detection result is determined based on the corrected cryptographic function call graph and a predetermined cryptographic function model, wherein the predetermined cryptographic function model at least includes a complete cryptographic function call process, thereby achieving the purpose of obtaining implicit call information and indirect jump information of the cryptographic function, thereby realizing the technical effect of accurately verifying the integrity of the cryptographic function, and further solving the technical problem of incomplete overall cryptographic execution process in related technologies. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0017] Figure 1 It is a hardware structure block diagram of a computer terminal for implementing a cryptographic function call flow detection method according to an embodiment of the present application;

[0018] Figure 2 It is a flow chart of a cryptographic function call process detection method according to an embodiment of the present application;

[0019] Figure 3 is a schematic diagram of a predetermined cryptographic function model structure according to an embodiment of the present application;

[0020] Figure 4 is a schematic diagram of a cryptographic function call graph according to an embodiment of the present application;

[0021] Figure 5 It is a schematic diagram of a cryptographic function call graph correction process according to an embodiment of the present application;

[0022] Figure 6 is a schematic diagram of a cryptographic function dominance graph according to an embodiment of the present application;

[0023] Figure 7 A flowchart of another cryptographic function call process detection method according to an embodiment of the present application;

[0024] Figure 8 It is a structural diagram of a cryptographic function call process detection device according to an embodiment of the present application. DETAILED DESCRIPTION

[0025] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.

[0026] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0027] The information collected in the embodiments of the present application is information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data comply with the relevant laws, regulations and standards of the relevant regions, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entrances for users to choose to authorize or reject automated decision-making results; if the user chooses to reject, the expert decision-making process will be entered.

[0028] In order to solve the problems existing in the related art, the embodiment of the present application provides a cryptographic function call process detection method, which can be run on Figure 1 In the computer terminal shown, the computer terminal is explained below.

[0029] The cryptographic function call process detection method embodiment provided in the embodiment of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 The hardware structure block diagram of a computer terminal for implementing a cryptographic function call flow detection method is shown. Figure 1 As shown, the computer terminal 10 may include one or more (102a, 102b, ..., 102n are used to illustrate) processors (the processor may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data, and a transmission module 106 for communication functions connected via a wired and / or wireless network. In addition, it may also include: a display, a keyboard, a cursor control device, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, and a BUS bus. Those skilled in the art can understand that Figure 1 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 1More or fewer components as shown, or with Figure 1 Different configurations are shown.

[0030] It should be noted that the one or more processors and / or other data processing circuits described above may generally be referred to herein as "data processing circuits". The data processing circuits may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuit may be a single independent processing module, or may be incorporated in whole or in part into any of the other components in the computer terminal 10. As described in the embodiments of the present application, the data processing circuit acts as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).

[0031] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the cryptographic function call process detection method in the embodiment of the present application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, the above-mentioned cryptographic function call process detection method is realized. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor, and these remote memories may be connected to the computer terminal 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.

[0032] The transmission module 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission module 106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission module 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0033] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the computer terminal 10 .

[0034] It should be noted that, in some optional embodiments, the above Figure 1 The computer terminal shown may include hardware elements (including circuits), software elements (including computer code stored on a computer-readable medium), or a combination of hardware elements and software elements. It should be noted that Figure 1 This is merely one example of a particular embodiment and is intended to illustrate the types of components that may be present in the computer terminal described above.

[0035] In the above-mentioned operating environment, an embodiment of the present application provides an embodiment of a cryptographic function call process detection method. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0036] Figure 2 is a flow chart of a cryptographic function call process detection method according to an embodiment of the present application, such as Figure 2 As shown, the method comprises the following steps:

[0037] Step S202, obtaining the cryptographic function to be detected;

[0038] Step S204, extracting the cryptographic function call graph of the cryptographic function to be detected, and collecting execution data of the cryptographic function to be detected;

[0039] Step S206, extracting implicit call information and indirect jump information of the cryptographic function to be detected from the execution data, and modifying the cryptographic function call graph corresponding to the cryptographic function using the implicit call information and indirect jump information of the cryptographic function to be detected, to obtain a modified cryptographic function call graph;

[0040] Step S208, determining a detection result based on the modified cryptographic function call graph and a predetermined cryptographic function model, wherein the predetermined cryptographic function model at least includes a complete cryptographic function call process.

[0041] Through the above steps S202 to S208, the following steps are achieved: obtaining the cryptographic function to be detected; extracting the cryptographic function call graph of the cryptographic function to be detected, and collecting the execution data of the cryptographic function to be detected; extracting the implicit call information and indirect jump information of the cryptographic function to be detected from the execution data, and using the implicit call information and indirect jump information of the cryptographic function to be detected to correct the cryptographic function call graph, and obtaining the corrected cryptographic function call graph; determining the detection result based on the corrected cryptographic function call graph and a predetermined cryptographic function model, wherein the predetermined cryptographic function model at least includes a complete cryptographic function call process, achieving the purpose of obtaining the implicit call information and indirect jump information of the cryptographic function, thereby achieving the technical effect of accurately verifying the integrity of the cryptographic function, and further solving the technical problem of incomplete overall cryptographic execution process in the related art. The following is a detailed description.

[0042] It should be noted that the predetermined cryptographic function model is established based on the cryptographic functions in the cryptographic function library CryptoAPI and OpenSSL. The overall structure of the model is as follows: Figure 3 As shown in the figure, according to the functional purpose of the cryptographic function, it is divided into three layers of framework, from bottom to top, they are the function library support layer, the cryptographic algorithm layer and the protocol layer. The specific contents of each layer are as follows: The support layer refers to the basic data structure and function operation defined in each set of cryptographic function libraries to realize the functions of this function library, such as X509 certificate, PEM information format, ASN1 encoding library, random number generator, etc. The cryptographic function layer refers to the cryptographic algorithm implemented by each cryptographic function library. Different cryptographic function libraries have slight differences in the types and number of cryptographic algorithms. The protocol layer refers to more specific high-level protocols implemented for different application scenarios based on the functions provided by the first two layers, such as the identity authentication and key exchange protocol represented by the SSL protocol.

[0043] The three-layer framework is a classification of the contents of the cryptographic function library from the perspective of functional purpose, but not all current cryptographic function libraries have three-layer functions. Most of the common cryptographic function libraries currently focus on the implementation of the functions of the cryptographic function layer. Within each layer, the contents contained in different cryptographic function libraries are also different. Therefore, on the basis of the hierarchical division, each layer is further divided into different cryptographic modules. The cryptographic module is a complete set of cryptographic function call processes that use the cryptographic function library to implement a certain function.

[0044] In step S202 of the above-mentioned cryptographic function call process detection method, the detection result is determined based on the revised cryptographic function call graph and the predetermined cryptographic function model, including: obtaining the predetermined cryptographic function model, the predetermined cryptographic function model contains a node sequence, each node in the node sequence represents a cryptographic function in the cryptographic function call process, the node sequence contains three types of nodes, the first type of node represents a node with only one function call number at the current position in the node sequence, the second type of node represents a node with more than one function call number at the current position in the node sequence, and the third type of node represents nodes belonging to the same family, and the calling order between the third type of nodes can be interchanged; determining the cryptographic function dominating tree according to the revised cryptographic function call graph; determining the detection result according to the cryptographic function dominating tree and the predetermined cryptographic function model.

[0045] It should be noted that the cryptographic module in the predetermined cryptographic function model is a sequence of nodes, each node represents an indispensable cryptographic function in the process, and the order in the sequence represents the order relationship of the key cryptographic functions when they are called. For a complete set of cryptographic function processes, the number of times and order of calls of some of the cryptographic functions are different, so the nodes in the cryptographic module are divided into the following three basic nodes: α node: The cryptographic function of this node has one and only one function call at the current position in the entire cryptographic module. β node: The cryptographic function of this node has more than one function call at the current position in the entire cryptographic module. γ node: Multiple cryptographic functions belonging to the same γ family can have their calling order reversed.

[0046] Obviously, a node can be both an α and γ node, or a β and γ node, but not both an α and β node. Through the definition of the cryptographic module, a set of cryptographic function call processes can be well described. The absence of any node in a cryptographic module means the absence of a key cryptographic function, which makes it impossible to complete the established functions of this module, that is, there are defects in the function implementation and there are misuse vulnerabilities.

[0047] In an optional manner, the node sequence of the cryptographic module is as follows:

[0048] α(A)→αγ(B)→β(C)→αγ(D)→α(E)

[0049] Where, ABCDE are all nodes in the node sequence, α nodes represent the first type of nodes, β nodes represent the second type of nodes, and γ nodes represent the third type of nodes.

[0050] Table 1

[0051] Node sequence illustrate ABCDDE correct ADCBE correct ABBCCDE Error (Node B cannot be called multiple times) ABCCCED Error: The number of calls to nodes D and E is reversed.

[0052] In some embodiments of the present application, with the cryptographic application integrity model as a reference, the next step is to be able to extract the complete cryptographic function call flow inside the encryption application, and detect misuse vulnerabilities through comparison and analysis between the two. Extraction of the cryptographic function call flow is essentially to restore the cryptographic function call graph within the application through the control flow reconstruction method.

[0053] The definition of the function call graph is based on a directed graph G = (V, E), where V = (V, G) is a set of nodes in the graph, representing the cryptographic functions inside the program, and E = (E, G) is a set of directed edges, representing the call relationships between different functions.

[0054] Among them, V represents a node, E represents an edge, and V×V represents the connection relationship between nodes.

[0055] like Figure 4 As shown in Figure 1, the Cryptographic Function Call Graph (CFCG) is a high-level abstract structure of the cryptographic application mechanism, which can intuitively reflect the calling process of the cryptographic function in the encryption and decryption process. In various cryptographic application software, the program implements specific symmetric encryption, hash operation, signature and verification functions by calling the cryptographic API sequence. The key component of the entire process is the cryptographic API, which is the node in the cryptographic function call graph.

[0056] The specific correction method is as follows: Figure 5 As shown in the figure, the input encrypted application sample is preprocessed, and the shelled sample (shelled cryptographic function) is unshelled using the corresponding unpacking tool; static control flow analysis is performed based on IDA Pro SDK, on ​​the one hand, the initial CFCG is generated, and on the other hand, the implicit call and indirect jump information collected in the control flow analysis is passed to the dynamic analysis module; the dynamic analysis module uses dynamic binary instrumentation technology to perform dynamic analysis, basic block trajectory tracking and function call monitoring, and feeds back the collected runtime information to the original CFCG; the initial CFCG corrects the graph structure according to the feedback information obtained, adds new cryptographic function nodes or generates new path branches, so as to obtain the corrected CFCG.

[0057] In some embodiments of the present application, a cryptographic function dominator tree is determined based on the modified cryptographic function call graph, including: determining the dominance relationship between each node starting from the entry point in the modified cryptographic function call graph; determining the immediate dominator of each node from the dominance relationship, the immediate dominator representing the node closest to the node to be determined; determining the entry point as the root node of the cryptographic function dominator tree, connecting each node to the immediate dominator corresponding to each node, and obtaining the cryptographic function dominator tree.

[0058] Specifically, starting from the exit point in the modified cryptographic function call graph, the backward dominance relationship between each node is determined; the backward immediate dominator of each node is determined from the dominance relationship, and the backward immediate dominator represents the node closest to the node to be determined; the exit point is determined as the root node of the cryptographic function backward dominator tree, and each node is connected to the backward immediate dominator corresponding to each node to obtain the backward cryptographic function dominator tree.

[0059] On the basis of CFCG, we further analyze the dominance dependency relationship between nodes, construct the corresponding Cryptographic Function Dominator Tree (CFDT), and perform misuse vulnerability detection on CFDT. Dominator tree is a commonly used data structure in control flow analysis, which is used to describe the dominance relationship between nodes. This dominance relationship is mainly reflected in the execution order logic of each node in the application execution trajectory. Studying dominance relationships is of great value to some program analysis and is widely used in program specification inspection. The most common application is memory leak detection, that is, analyzing whether the memory operations malloc and free comply with the calling specifications. Other applications include detecting the correspondence between lock and unlock in multi-threaded programs and detecting whether the use of variables occurs before initialization. The relevant definitions of dominance relationships are as follows:

[0060] Definition 1: If the cryptographic function call process starts from the entry point start to v q Any path to a node must contain v p , node, then it is called v p Dominate v q , denoted as v p dominate q Obviously, dominate is reflexive, transitive, and antisymmetric.

[0061] Definition 2: If v p dominate q And satisfy v p ≠v q When the condition is p Strictly controlled q , denoted as v p strictly dominate q .

[0062] Definition 3: If v p strictly dominate (immediately dominate) q , but for any other strictly governed v q , the node, v p If v does not have a strict dominance relationship with these nodes, then v p , immediately dominate v q , denoted as v p immdediatedominate v q Intuitively, the immediate dominance relationship represents the distance v in the dominance relationship chain. q The nearest node.

[0063] Obviously, the dominance relationship represents the path information from the entry point to a certain node in the program execution trajectory. The dual relationship of the dominance relationship is the post-dominate relationship, which represents the path information from a certain node to the exit point end. Its related definitions are as follows:

[0064] Definition 4: If from node v q Any path to the program exit point end must contain the node v p , then v p Backward Domination q , denoted as v p post-dominate q .

[0065] Definition 5: If v p post-dominate q And v p ≠v q When p Strict backward dominance q , denoted as v p strictly post-dominate q .

[0066] Definition 6: If v p post-dominate q , but for any other strictly backward-dominant v q The node, v p does not strictly backward dominate these nodes, then v p , immediately backward dominates v q , recorded as v p immdediate post-dominatev q .

[0067] For example: In a directed graph, where node (A) points to node (B), and node (B) points to node (C), the sequence (A, B, C) is a backward dominance sequence because (A) dominates (B), and (B) dominates (C).

[0068] For the same graph, if node (C) points to node (B), and node (B) points to node (A), then the sequence (C, B, A) is a forward dominating sequence.

[0069] Figure 6A cryptographic function dominance tree and a cryptographic function backward dominance tree are shown. CFDT can clearly reflect the order dominance relationship between cryptographic functions in the execution trajectory of the cryptographic application, and the calling process of each cryptographic function has been defined in the cryptographic application integrity defined above. Combining these two, the detection of integrity misuse vulnerabilities can be realized.

[0070] In some embodiments of the present application, the detection result is determined based on the cryptographic function dominator tree and the predetermined cryptographic function model, including: extracting a calling sequence corresponding to the cryptographic function to be detected from the cryptographic function dominator tree, the calling sequence being used to characterize the execution order of multiple cryptographic functions in the cryptographic function to be detected; comparing the node sequence corresponding to the predetermined cryptographic function model with the calling sequence to obtain a comparison result; and determining the detection result based on the comparison result.

[0071] Among them, the specific method of extracting the call sequence corresponding to the cryptographic function to be detected from the cryptographic function dominator tree is as follows: converting the cryptographic function dominator tree into a dominator sequence, eliminating non-critical cryptographic function nodes in the dominator sequence, and obtaining a processed dominator sequence, wherein the processed dominator sequence is used to represent the dominance order between the cryptographic functions in the cryptographic function to be detected; obtaining all branch nodes in the processed dominator sequence, traversing the branch nodes, and determining the critical cryptographic function passed by the branch path corresponding to each branch node; inserting the critical cryptographic function passed by the branch path into the dominator sequence to obtain the call sequence.

[0072] The node sequence corresponding to the predetermined cryptographic function model is compared with the call sequence to obtain the comparison result. The specific implementation steps are as follows: the sorting order of each node in the call sequence is compared with the arrangement order of each node in the node sequence in turn to obtain a first comparison result; the type of each node in the call sequence is compared with the type of each node in the node sequence to obtain a second comparison result; the first comparison result and the second comparison result are combined to obtain the comparison result.

[0073] According to the characteristic mechanism of application integrity misuse vulnerability, a misuse vulnerability detection method based on cryptographic function dominator tree is designed. The detection method is divided into two parts. On the one hand, a hierarchical and modular cryptographic application integrity model is established, and a complete set of cryptographic functions called to implement specific functions are characterized by cryptographic modules; on the other hand, based on the idea of ​​control flow reconstruction, the cryptographic function call graph in the encryption application is extracted by combining static analysis and dynamic analysis methods, and a dominator tree generation algorithm is designed to process CFCG to obtain CFDT. Finally, an application integrity misuse vulnerability detection algorithm is designed, and the information of CFCG and CFDT is reprocessed to obtain the cryptographic function call sequence from the program entry point to the exit point, and the sequence is compared and analyzed with the sequence of the corresponding cryptographic module to realize the detection of misuse vulnerability.

[0074] The present application also provides another cryptographic function call process detection method, such as Figure 7 As shown, it includes: input 1, CFGG, 2, CFDT, 3, an integrity cryptographic module (including node sequence), and outputs whether there is a vulnerability. The specific steps include: Step 1, extract all the dominant sequences S1, S2, ... S from CFDT n , where S1, S2, … S n Respectively represent a dominating sequence; step 2, process the dominating sequence, remove non-critical cryptographic function nodes, obtain the processed dominating sequence, select the sequence from the program entry point to the program exit point in the processed dominating sequence, record it as the target sequence, determine the critical cryptographic function for each branch node in the target sequence, and obtain the final sequence.

[0075] The cryptographic function detection method provided by this application, on the one hand, establishes a hierarchical and modular cryptographic application integrity model (predetermined cryptographic function model), and uses cryptographic modules to characterize a complete set of cryptographic functions called to implement specific functions; on the other hand, it is based on the idea of ​​control flow reconstruction, combined with static analysis and dynamic analysis methods, to extract the cryptographic function call graph in the encryption application, and design a dominator tree generation algorithm, and process CFCG to obtain CFDT. Finally, an application integrity misuse vulnerability detection algorithm is designed, and the information of CFCG and CFDT is reprocessed to obtain the cryptographic function call sequence from the program entry point to the exit point, and compared and analyzed with the sequence of the corresponding cryptographic module to realize the detection of misuse vulnerabilities.

[0076] Figure 8 is a structural diagram of a cryptographic function call flow detection device according to an embodiment of the present application, such as Figure 8 As shown, the device comprises:

[0077] An acquisition module 60 is used to acquire the cryptographic function to be detected;

[0078] An extraction module 62, used to extract a cryptographic function call graph of the cryptographic function to be detected, and collect execution data of the cryptographic function to be detected;

[0079] A correction module 64 is used to extract the implicit call information and indirect jump information of the cryptographic function to be detected from the execution data, and use the implicit call information and indirect jump information of the cryptographic function to be detected to correct the cryptographic function call graph to obtain a corrected cryptographic function call graph;

[0080] The detection module 66 is used to determine the detection result based on the modified cryptographic function call graph and the predetermined cryptographic function model, wherein the predetermined cryptographic function model includes at least a complete cryptographic function call process.

[0081] Through the above-mentioned cryptographic function call process detection device, the cryptographic function to be detected is obtained; the cryptographic function call graph of the cryptographic function to be detected is extracted, and the execution data of the cryptographic function to be detected is collected; the implicit call information and indirect jump information of the cryptographic function to be detected are extracted from the execution data, and the implicit call information and indirect jump information of the cryptographic function to be detected are used to correct the cryptographic function call graph corresponding to the cryptographic function call graph to obtain the corrected cryptographic function call graph; the detection result is determined based on the corrected cryptographic function call graph and a predetermined cryptographic function model, wherein the predetermined cryptographic function model at least includes a complete cryptographic function call process, thereby achieving the purpose of obtaining the implicit call information and indirect jump information of the cryptographic function, thereby realizing the technical effect of accurately verifying the integrity of the cryptographic function, and further solving the technical problem of incomplete overall cryptographic execution process in related technologies.

[0082] The detection module 66 in the above-mentioned cryptographic function call process detection device includes: a determination submodule, which is used to determine the detection result based on the revised cryptographic function call graph and a predetermined cryptographic function model, including: obtaining the predetermined cryptographic function model, the predetermined cryptographic function model contains a node sequence, each node in the node sequence represents a cryptographic function in the cryptographic function call process, and the node sequence contains three types of nodes, the first type of node represents a node with only one function call number at the current position in the node sequence, the second type of node represents a node with more than one function call number at the current position in the node sequence, and the third type of node represents nodes belonging to the same family, and the calling order between the third type of nodes can be interchanged; determining the cryptographic function dominating tree according to the revised cryptographic function call graph; determining the detection result according to the cryptographic function dominating tree and the predetermined cryptographic function model.

[0083] A determination submodule determines a cryptographic function dominator tree according to the modified cryptographic function call graph, including: determining the dominance relationship between each node starting from the entry point in the modified cryptographic function call graph; determining the immediate dominator of each node from the dominance relationship, the immediate dominator representing the node closest to the node to be determined; determining the entry point as the root node of the cryptographic function dominator tree, connecting each node with the immediate dominator corresponding to each node, and obtaining the cryptographic function dominator tree.

[0084] The determination submodule includes: a determination unit, which is used to determine the backward dominance relationship between each node starting from the exit point in the modified cryptographic function call graph; determine the backward immediate dominator of each node from the dominance relationship, and the backward immediate dominator represents the node closest to the node to be determined; determine the exit point as the root node of the cryptographic function backward dominator tree, and connect each node with the backward immediate dominator corresponding to each node to obtain the backward cryptographic function dominator tree.

[0085] The determination submodule also includes: a comparison unit, which is used to determine the detection result based on the cryptographic function dominator tree and the predetermined cryptographic function model, including: extracting a call sequence corresponding to the cryptographic function to be detected from the cryptographic function dominator tree, and the call sequence is used to characterize the execution order of multiple cryptographic functions in the cryptographic function to be detected; comparing the node sequence corresponding to the predetermined cryptographic function model with the call sequence to obtain a comparison result; and determining the detection result based on the comparison result.

[0086] The comparison unit includes: an extraction subunit and a comparison subunit, the extraction subunit is used to extract the call sequence corresponding to the cryptographic function to be detected from the cryptographic function dominator tree, including: converting the cryptographic function dominator tree into a dominator sequence, eliminating non-critical cryptographic function nodes in the dominator sequence, and obtaining a processed dominator sequence, the processed dominator sequence is used to represent the dominance order between each cryptographic function in the cryptographic function to be detected; obtaining all branch nodes in the processed dominator sequence, traversing the branch nodes, and determining the critical cryptographic function passed by the branch path corresponding to each branch node; inserting the critical cryptographic function passed by the branch path into the dominator sequence to obtain the call sequence.

[0087] A comparison subunit is used to compare the node sequence corresponding to the predetermined cryptographic function model with the call sequence to obtain a comparison result, including: comparing the sorting order of each node in the call sequence with the arrangement order of each node in the node sequence in turn to obtain a first comparison result; comparing the type of each node in the call sequence with the type of each node in the node sequence to obtain a second comparison result; and combining the first comparison result and the second comparison result to obtain the comparison result.

[0088] It should be noted that Figure 8 The cryptographic function call flow detection device shown is used to execute Figure 2 The cryptographic function call process detection method shown, therefore the relevant explanations in the above-mentioned cryptographic function call process detection method are also applicable to the cryptographic function call process detection device, and will not be repeated here.

[0089] An embodiment of the present application also provides a computer device, including: a memory and a processor, wherein the memory is used to store program instructions; and the processor is connected to the memory and is used to execute the above-mentioned cryptographic function call process detection method.

[0090] The program executed by the above-mentioned computer device obtains a cryptographic function to be detected; extracts a cryptographic function call graph of the cryptographic function to be detected, and collects execution data of the cryptographic function to be detected; extracts implicit call information and indirect jump information of the cryptographic function to be detected from the execution data, and uses the implicit call information and indirect jump information of the cryptographic function to be detected to correct the cryptographic function call graph corresponding to the cryptographic function call graph to obtain a corrected cryptographic function call graph; determines a detection result based on the corrected cryptographic function call graph and a predetermined cryptographic function model, wherein the predetermined cryptographic function model at least includes a complete cryptographic function call process, thereby achieving the purpose of obtaining implicit call information and indirect jump information of the cryptographic function, thereby realizing the technical effect of accurately verifying the integrity of the cryptographic function, and further solving the technical problem of incomplete overall cryptographic execution process in related technologies.

[0091] An embodiment of the present application also provides a non-volatile storage medium, which includes a stored computer program, wherein the device where the non-volatile storage medium is located executes the above-mentioned cryptographic function call process detection method by running the computer program.

[0092] An embodiment of the present application also provides a computer program product, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the cryptographic function call process detection method in the present application are implemented.

[0093] An embodiment of the present application also provides a computer program product, including computer instructions, which, when executed by a processor, implement the steps of the cryptographic function call process detection method in the present application.

[0094] An embodiment of the present application also provides a computer program, which, when executed by a processor, implements the steps of the cryptographic function call process detection method in the present application.

[0095] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0096] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0097] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0098] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0099] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0100] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.

[0101] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A cryptographic function call process detection method, characterized in that: include: Get the password function to be tested; Extracting a cryptographic function call graph of the cryptographic function to be detected, and collecting execution data of the cryptographic function to be detected; Extracting implicit call information and indirect jump information of the cryptographic function to be detected from the execution data, and modifying the cryptographic function call graph corresponding to the cryptographic function using the implicit call information and indirect jump information of the cryptographic function to be detected to obtain a modified cryptographic function call graph; A detection result is determined based on the modified cryptographic function call graph and a predetermined cryptographic function model, wherein the predetermined cryptographic function model at least includes a complete cryptographic function call process.

2. The method according to claim 1, characterized in that Determining a detection result based on the modified cryptographic function call graph and a predetermined cryptographic function model includes: Obtaining the predetermined cryptographic function model, wherein the predetermined cryptographic function model includes a node sequence, each node in the node sequence represents a cryptographic function in a cryptographic function call flow, and the node sequence includes three types of nodes, wherein the first type of node represents a node whose function call times at the current position in the node sequence are only once, the second type of node represents a node whose function call times at the current position in the node sequence are more than once, and the third type of node represents nodes belonging to the same family, and the calling order between the third type of nodes can be interchanged; Determine a cryptographic function dominator tree according to the modified cryptographic function call graph; A detection result is determined according to the cryptographic function dominator tree and the predetermined cryptographic function model.

3. The method according to claim 2, characterized in that Determining a cryptographic function dominator tree according to the modified cryptographic function call graph includes: Determine the dominance relationship between each node starting from the entry point in the modified cryptographic function call graph; Determine the immediate dominator of each node from the dominance relationship, wherein the immediate dominator represents the node closest to the node to be determined; The entry point is determined as the root node of the cryptographic function dominator tree, and each node is connected to the immediate dominator corresponding to each node to obtain the cryptographic function dominator tree.

4. The method according to claim 3, characterized in that The method further comprises: Determine the backward dominance relationship between each node starting from the exit point in the modified cryptographic function call graph; Determine the immediate backward dominator of each node from the dominance relationship, wherein the immediate backward dominator represents the node closest to the node to be determined; The exit point is determined as the root node of the backward dominator tree of the cryptographic function, and each node is connected with the backward immediate dominator corresponding to each node to obtain the backward dominator tree of the cryptographic function.

5. The method according to claim 2, characterized in that: Determining a detection result according to the cryptographic function dominator tree and the predetermined cryptographic function model includes: Extracting a call sequence corresponding to the cryptographic function to be detected from the cryptographic function dominator tree, wherein the call sequence is used to represent the execution order of multiple cryptographic functions in the cryptographic function to be detected; Comparing the node sequence corresponding to the predetermined cryptographic function model with the call sequence to obtain a comparison result; The detection result is determined according to the comparison result.

6. The method according to claim 5, characterized in that Extracting a call sequence corresponding to the cryptographic function to be detected from the cryptographic function dominator tree includes: Converting the cryptographic function dominator tree into a dominator sequence, removing non-critical cryptographic function nodes in the dominator sequence, and obtaining a processed dominator sequence, wherein the processed dominator sequence is used to represent the dominator order between the cryptographic functions in the cryptographic function to be detected; Obtain all branch nodes in the processed dominating sequence, traverse the branch nodes, and determine the key cryptographic function through which the branch path corresponding to each branch node passes; The key cryptographic function passed by the branch path is inserted into the dominating sequence to obtain the calling sequence.

7. The method according to claim 5, characterized in that Comparing the node sequence corresponding to the predetermined cryptographic function model with the call sequence to obtain a comparison result, including: Comparing the sorting order of each node in the call sequence with the arrangement order of each node in the node sequence in turn to obtain a first comparison result; Comparing the type of each node in the call sequence with the type of each node in the node sequence to obtain a second comparison result; The first comparison result and the second comparison result are combined to obtain the comparison result.

8. A cryptographic function call process detection device, characterized in that: include: Get the module and the password function to be tested; An extraction module, used for extracting a cryptographic function call graph of the cryptographic function to be detected, and collecting execution data of the cryptographic function to be detected; A correction module, used for extracting the implicit call information and indirect jump information of the cryptographic function to be detected from the execution data, and correcting the cryptographic function call graph corresponding to the cryptographic function using the implicit call information and indirect jump information of the cryptographic function to be detected, so as to obtain a corrected cryptographic function call graph; A detection module is used to determine a detection result based on the modified cryptographic function call graph and a predetermined cryptographic function model, wherein the predetermined cryptographic function model includes at least a complete cryptographic function call process.

9. A computer device, characterized in that: include: A memory and a processor, wherein the memory is used to store program instructions; The processor is connected to the memory and is used to execute the cryptographic function call process detection method described in any one of claims 1 to 7.

10. A computer program product comprising computer instructions, characterized in that When the computer instructions are executed by a processor, the cryptographic function call process detection method described in any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Function call relation detection method and device

    CN113076244A