A code obfuscation effectiveness evaluation method and system based on LGF-Net

By introducing LGF-Net into the code obfuscation effectiveness evaluation, combined with the deep neural network and decision tree model, the problems of low accuracy and poor generalization ability in the existing technology are solved, and higher evaluation accuracy and performance are achieved.

CN118444917BActive Publication Date: 2024-10-01杨国军
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410380044.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-29
Publication Date
2024-10-01
Estimated Expiration
2044-03-29

AI Technical Summary

Technical Problem

Existing machine learning-based code obfuscation effectiveness evaluation models suffer from the problems of low accuracy and poor generalization ability, especially when faced with large sample and multi-feature evaluation tasks.

Method used

This paper proposes a code obfuscation effectiveness evaluation method based on LGF-Net (Local and Global Feature-Net), which combines deep neural networks and decision tree models, and performs feature selection and fusion through local feature modules and global feature modules to improve the accuracy of the evaluation model. Accuracy and generalization ability.

Benefits of technology

In the multi-feature and large-sample code obfuscation effectiveness evaluation task, LGF-Net significantly improves performance and accuracy. The local feature module captures dependencies through diverse feature combinations, and the global feature module supplements global feature information, improving the performance of the model. and generalization ability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118444917B_ABST
    Figure CN118444917B_ABST
Patent Text Reader

Abstract

The present invention discloses a code obfuscation effectiveness evaluation method and system based on LGF‑Net, and the specific implementation steps are as follows: (1) First, the obfuscated code and the deobfuscated code corresponding to the source code of each program in the data set are obtained; then, features are extracted from the source code, the obfuscated code and the deobfuscated code to obtain a first feature set; then, an obfuscation effect level is assigned to the first feature set, and the first feature set and its obfuscation effect level are represented as a sequence pair; finally, all the sequence pairs constitute a code obfuscation effectiveness evaluation data set, which is called the first data set. (2) Construct a code obfuscation effectiveness evaluation model LGF‑Net: LGF‑Net performs feature selection and processing through a local feature module, and performs feature fusion through a global feature module. (3) Use the first data set to train and test LGF‑Net to obtain a trained LGF‑Net. (4) Use the trained LGF‑Net to evaluate the code obfuscation algorithm to obtain the obfuscation effect level of the algorithm.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention is applied to the field of software protection code obfuscation, and specifically relates to a code obfuscation effectiveness evaluation method and system based on LGF-Net. Background Art

[0002] As a software protection technology, code obfuscation has been widely used in the fields of Internet of Things, cloud computing, and artificial intelligence due to its advantages of flexibility, convenience, and low cost. Since there are many types of code obfuscation algorithms and their effects vary greatly, it is difficult for developers to judge them when using them. Therefore, it is necessary to evaluate the effectiveness of code obfuscation algorithms and establish a comprehensive and objective method for evaluating the effectiveness of code obfuscation algorithms so that developers can get a relatively objective reference when using code obfuscation algorithms.

[0003] At present, the code obfuscation effectiveness evaluation methods can be roughly divided into three categories, namely, code obfuscation effectiveness evaluation based on attack metrics, code obfuscation effectiveness evaluation based on comprehensive evaluation methods, and code obfuscation effectiveness evaluation based on machine learning. Since the code obfuscation effectiveness evaluation based on attack metrics depends largely on the level of the attacker, the evaluation results are mixed and lack universality; while the code obfuscation effectiveness evaluation based on comprehensive evaluation methods and the code obfuscation effectiveness evaluation based on machine learning are both evaluated through classic indicators and have a high degree of reference.

[0004] Collberg et al. first proposed four evaluation indicators for the effectiveness of code obfuscation algorithms, namely strength, elasticity, overhead and concealment; based on these indicators, some scholars use comprehensive evaluation methods to build models. For example, Lin Shuiming et al. proposed a dynamic adaptive principal component analysis evaluation model to evaluate code obfuscation algorithms, Xie Xin et al. proposed a multi-level attribute weighted evaluation model to evaluate code obfuscation algorithms, and Karnick et al. used a linear weighted algorithm to score the effectiveness of code obfuscation algorithms; however, the above-mentioned code obfuscation effectiveness evaluation models based on comprehensive evaluation methods perform poorly when faced with large sample and multi-feature evaluation tasks, and have the problems of low accuracy and long time consumption.

[0005] Since machine learning algorithms have the ability to summarize and learn data and are relatively time-consuming, they can solve the problems of evaluation models based on comprehensive evaluation methods to a certain extent. They have been gradually introduced into the field of code obfuscation algorithm effectiveness evaluation. Aleieldin Salem et al. proposed an evaluation model based on random forest to evaluate code obfuscation algorithms, Wu et al. used a linear regression algorithm to evaluate the effect of code obfuscation algorithms, and Lin Zeming et al. constructed a model based on a voting ensemble algorithm to evaluate the effectiveness of code obfuscation algorithms. Although the above-mentioned code obfuscation effectiveness evaluation models based on machine learning are superior to the code obfuscation effectiveness evaluation models based on comprehensive evaluation methods when facing large sample and multi-feature evaluation tasks, most of the current code obfuscation effectiveness evaluation models based on machine learning use simple or single machine learning algorithms, which makes it impossible for the models to learn effectively from the training data comprehensively and deeply, and still have problems of low accuracy and poor generalization ability. Summary of the invention

[0006] The purpose of the present invention is to solve the problems of low accuracy and poor generalization ability of the current code obfuscation effectiveness evaluation model based on machine learning, and to provide a code obfuscation effectiveness evaluation method based on LGF-Net (Local and Global Feature-Net). LGF-Net combines the advantages of deep neural networks and decision tree models to improve the accuracy and generalization ability of code obfuscation effectiveness evaluation.

[0007] The present invention also provides a code obfuscation effectiveness evaluation system based on LGF-Net. After the code obfuscation algorithm to be evaluated is input into the system, the system can evaluate it with the help of the evaluation model and output the obfuscation effect level.

[0008] Terminology explanation:

[0009] Program: A program is a set of instructions that a computer can recognize and execute. These instructions consist of source code.

[0010] Source code: code written in a high-level programming language, either written by oneself or obtained from existing literature, code repositories, etc.

[0011] Obfuscated code: Obfuscated code refers to the result of obfuscating source code using a code obfuscation algorithm. The obfuscated code is functionally equivalent to the source code.

[0012] Deobfuscated code: Deobfuscated code refers to the result of deobfuscating obfuscated code using a deobfuscation tool.

[0013] Code obfuscation: Code obfuscation refers to the act of converting the code of a computer program into a functionally equivalent form that is difficult to read and understand.

[0014] Strength feature: Strength feature refers to the degree of difficulty that code obfuscation technology causes for people to understand the program.

[0015] Resilience feature: Resilience feature refers to the ability of a program to resist anti-obfuscation tools after being obfuscated.

[0016] Overhead feature: Overhead feature refers to the additional overhead caused by the program after code obfuscation, usually the additional time.

[0017] Hidden features: Hidden features refer to the similarity between a program before and after code obfuscation.

[0018] Control flow graph: It is an abstract representation of a process or program. It uses a graph to represent the possible execution flows of all basic blocks within a process and contains the control flow information of the source program.

[0019] Abstract syntax tree: It is a tree representation of the abstract syntax structure of the code. Each node in the tree represents a structure in the code.

[0020] Cyclomatic complexity: Cyclomatic complexity is a software metric that is determined by counting the number of independent paths in a program and is used to measure the complexity of the control flow in the program.

[0021] Program complexity: Measures the complexity of a program by counting the number of operations and operators.

[0022] Fan-in complexity: Fan-in refers to the number of parent modules that directly call the module. Fan-in complexity is used to measure the degree of reuse of the module.

[0023] Fan-out complexity: Fan-out refers to the number of lower-level modules directly called by the module. Fan-out complexity is used to measure the complexity of the module. A large fan-out means that the program lacks intermediate-level modules and some lower-level modules need to be merged into its upper-level modules.

[0024] Data flow complexity: Measures the complexity of program data flow by counting the number of variables used in a code block but defined outside the code block. If this indicator is high, it means that the program is too complex.

[0025] Token-based similarity: A token is the basic unit in text or code, and in programming languages ​​it often refers to keywords, variables, operators, punctuation marks, etc. The similarity between two pieces of code is calculated by breaking the code into a series of tokens and applying formulas.

[0026] Batch Normalization (BN): is an operation that performs normalization on the neural network input vector or intermediate layer vector. Batch normalization can increase the training speed of the neural network and accelerate the convergence of the neural network.

[0027] The technical solution of the present invention is:

[0028] A code obfuscation effectiveness evaluation method based on LGF-Net, the specific steps include data preprocessing, building a code obfuscation effectiveness evaluation model LGF-Net, training LGF-Net and code obfuscation effectiveness evaluation, the step flow chart is as follows Figure 1 shown.

[0029] S1: For each program in the data set, first obtain the obfuscated code and deobfuscated code corresponding to the source code of the program; then extract features from the source code, obfuscated code and deobfuscated code to obtain the first feature set F; then assign an obfuscation effect level y to F, and represent F and its corresponding y as an ordered pair; finally, all the ordered pairs form a code obfuscation effectiveness evaluation data set, called the first data set D, and divide D into a training set and a test set;

[0030] S2: Construct the code obfuscation effectiveness evaluation model LGF-Net; LGF-Net performs feature selection and processing through the local feature module LFTM, and performs feature fusion through the global feature module GFTM;

[0031] S3: Train the code obfuscation effectiveness evaluation model LGF-Net constructed in S2: Use the training set and test set to train and test LGF-Net respectively to obtain the trained LGF-Net;

[0032] S4: First, use the code obfuscation algorithm to be evaluated to confuse the source code in the program and obtain the corresponding obfuscated code; then use the deobfuscation tool to deobfuscate the obfuscated code and obtain the corresponding deobfuscated code; then, according to the feature extraction method in S1, extract features from the source code, obfuscated code and deobfuscated code to obtain the corresponding F; finally, input F into the LGF-Net trained in S3 to obtain the obfuscation effect level of the code obfuscation algorithm to be evaluated.

[0033] Further, step S1 is specifically as follows:

[0034] Combine multiple self-written programs or programs in existing public datasets into a dataset. For each program in the dataset,

[0035] S11: Obfuscate the source code of the program using a plurality of code obfuscation algorithms respectively to obtain a plurality of obfuscated codes; wherein the code obfuscation algorithms include but are not limited to an opaque predicate algorithm, a string encryption algorithm, a control flow flattening algorithm, and inserting junk instructions.

[0036] S12: De-obfuscate each obfuscated code using an anti-obfuscation tool to obtain a corresponding de-obfuscated code; wherein the anti-obfuscation tool includes but is not limited to Anti-proguard and Generic Automatic De-obfuscation.

[0037] S13: For each pair of obfuscated code and the deobfuscated code corresponding to the obfuscated code, combine them with the source code to obtain a first binary. and the second tuple , where ori represents the source code, obf represents the obfuscated code, and deo represents the deobfuscated code corresponding to the obfuscated code; then the first two-tuple is analyzed from four aspects: strength, flexibility, overhead, and concealment. and the second tuple Perform feature extraction to obtain the corresponding first feature set ,in represents the intensity characteristic, Represents elastic characteristics, represents the overhead characteristics, Represents concealment characteristics.

[0038] Furthermore, the first binary is analyzed from four aspects: strength, flexibility, cost and concealment. and the second tuple The specific steps for feature extraction are as follows:

[0039] S131: Extracting intensity features : Calculate the first two-tuple The difference between the first element ori and the second element obf in code complexity and the number of nodes in the abstract syntax tree; It can be expressed as formula (1):

[0040] (1)

[0041] In formula (1), express The difference between ori and obf in code complexity, express The set of differences in the number of nodes between ori and obf in the abstract syntax tree; It can be expressed as formula (2):

[0042] (2)

[0043] In formula (2), express The difference between ori and obf in code complexity; code complexity can be divided into cyclomatic complexity , Program complexity , Fan-in complexity , Fan-out complexity , data flow complexity Five; among them, cyclomatic complexity The calculation formula is

[0044] (3)

[0045] In formula (3), To control the number of edges in the flow graph, is the number of nodes in the control flow graph;

[0046] Program complexity The calculation formula is

[0047] (4)

[0048] In formula (4), is the number of operands, is the number of operators;

[0049] Fan-in complexity The calculation formula is

[0050] (5)

[0051] In formula (5), is the number of control flow modules entering the code module, is the number of data stream modules;

[0052] Fan-out complexity The calculation formula is

[0053] (6)

[0054] In formula (6), The number of control flow modules exported for the code module, is the number of data stream modules;

[0055] Data flow complexity The calculation formula is

[0056] (7)

[0057] In formula (7), The number of variables used in the program module but not defined in the block;

[0058] in addition, It can be expressed as formula (8):

[0059] (8)

[0060] In formula (8), express The difference between ori and obf in the abstract syntax tree; the abstract syntax tree nodes are divided into declaration nodes and expression nodes. Declaration nodes are divided into block declaration, basic For loop declaration, enhanced For loop declaration, conditional IF declaration, conditional Else declaration, While loop declaration, Break declaration and selection declaration, a total of 8 types; expression nodes are divided into method definition, variable definition, constant, selection mark, expression name, assignment, method call and parameter list, a total of 8 types.

[0061] S132: Extracting elastic features : Calculate the second tuple The difference in the number of nodes between the first element ori and the second element deo in the abstract syntax tree and the similarity based on the control flow graph; It can be expressed as formula (9):

[0062] (9)

[0063] In formula (9), express The similarity between ori and deo is based on the control flow graph. express The set of differences in the number of nodes between ori and deo in the abstract syntax tree; The calculation formula is

[0064] (10)

[0065] In formula (10), and Respectively represent The control flow graph of ori and deo, and Respectively represent and The total number of nodes, The function is to calculate and The number of nodes in the largest common subgraph between The function is to calculate and The maximum number of nodes between

[0066] in addition, It can be expressed as formula (11):

[0067] (11)

[0068] In formula (11), express The difference between ori and deo in the abstract syntax tree; the node type of the abstract syntax tree here is the same as the node type of the abstract syntax tree listed in S131.

[0069] S133: Extracting Cost Features : Calculate the first two-tuple The difference in execution time between the first element ori and the second element obf; The calculation formula is

[0070] (12)

[0071] In formula (12), and Respectively represent The execution time of ori and obf.

[0072] S134: Extracting hidden features : Calculate the first two-tuple The first element ori and the second element obf are based on the similarity of tokens; The calculation formula is

[0073] (13)

[0074] In formula (13), and Respectively represent The token frequency vector of ori and obf, and The subscript i in represents the i-th token.

[0075] S14: Assign a confusion effect level y to each F, and represent F and its corresponding y as an ordered pair ; Among them, the obfuscation effect level is set by manual marking, usually by experts based on F; the obfuscation effect level represents the effectiveness of the code obfuscation algorithm, which is divided into three levels: weak, medium and strong.

[0076] When all programs in the data set have executed the above steps, all the sequence pairs d constitute a code obfuscation effectiveness evaluation data set, and the code obfuscation effectiveness evaluation data set is called the first data set , where w is the product of the number of programs in the dataset a and the number of code obfuscation algorithms used b; then D is divided into a training set and a test set.

[0077] S2: Construct the code obfuscation effectiveness evaluation model LGF-Net; LGF-Net performs feature selection and processing through the local feature module LFTM, and performs feature fusion through the global feature module GFTM; the LGF-Net model architecture is as follows Figure 2 shown.

[0078] Further, step S2 is specifically as follows:

[0079] S21: For the first feature set F, first use the batch normalization operation BN to normalize F to obtain the second feature set ; then It is passed to the local feature module LFTM for feature selection and processing; then It is passed to the global feature module GFTM for feature fusion.

[0080] S22: It is passed to LFTM for feature selection and processing: LFTM includes feature processing module FT, first decision step, second decision step and third decision step; first, feature processing module FT is used to select Then, after the feature selection and processing of the first decision step, the second decision step and the third decision step, the output corresponding to each decision step is obtained, which are the first feature vector , the second eigenvector and the third eigenvector ;

[0081] Further, The specific steps of inputting to LFTM for feature selection and processing include:

[0082] S221: Use the feature processing module FT to process the second feature set Feature processing: FT consists of a basic block block, a first residual basic block SVRblock1 and a second residual basic block SVRblock2; the structural diagram of FT is shown in Figure 3 As shown;

[0083] The steps of FT include: first, Input to the basic block block, through the fully connected layer FC and batch normalization operation BN Perform feature abstraction and normalization, and use the gated linear unit GLU to perform feature processing on the normalized result to obtain the output of the block ; Then, Input to the first residual basic block SVRblock1, through FC and BN Perform feature abstraction and normalization, and use GLU to perform feature processing on the normalized results. After element-by-element summation and multiplication by α, we get the output of SVRblock1 ; Finally, Input to the second residual basic block SVRblock2, and after feature processing of SVRblock2, the output of SVRblock2 is obtained ;

[0084] in, and The calculation formula is as follows:

[0085] (14)

[0086] In formula (14), represents the output of the mth residual basic block, stands for Gated Linear Unit GLU, Represents batch normalization operation BN, represents the fully connected layer FC, represents the element-by-element summation of eigenvectors, To prevent the coefficients of the model variance from changing too dramatically, in general, Pick ; Wherein, the value of m is 1 or 2; It is the output of the basic block.

[0087] S222: Feature selection and processing through the first decision step: The first decision step includes an attention module AT, a feature processing module FT and a ReLu function; wherein, in the attention module AT, feature selection is performed by learning a mask MASK; the structural diagram of AT is shown in Figure 4 As shown;

[0088] The execution steps of the first decision step include: first, Input to the attention module AT, use the self-attention mechanism SA to Perform feature weight assignment, perform feature abstraction and normalization through FC and BN, and compare the normalized results with the initial prerequisite selection Perform a dot multiplication operation and use the Sparsemax function to calculate the mask for the first decision step , while passing To update the current first decision step's prerequisite choice ; then and Multiply to realize the feature selection of the first decision step, and pass the result of feature selection into FT for feature processing to obtain the output of FT in the first decision step ; Finally, use the ReLu function to Perform nonlinear transformation to obtain the first eigenvector .

[0089] The calculation formula of the mask MASK is as follows:

[0090] (15)

[0091] In formula (15), represents the mask MASK of the t-th decision step, represents the Sparsemax function, represents the prior choice of the t-1th decision step, Represents batch normalization operation BN, represents the fully connected layer FC, represents the self-attention mechanism SA, represents the output of FT in the t-1th decision step; where t is 1, 2, or 3; the initial prerequisite choice is a vector of all 1s; the output of FT in the initial decision step For S221 ;

[0092] Among them, the prerequisite choice The calculation formula is as follows:

[0093] (16)

[0094] In formula (16), represents the prior choice of the t-th decision step, and the prior choice refers to the usage of features in all past decision steps; is a scalar that controls the use of features in the decision step. In general, Take 1; Represents the mask MASK of the tth decision step; where the value of t is 1, 2, or 3.

[0095] S223: Feature selection and processing through the second decision step: The second decision step includes AT, FT and ReLu functions; The execution steps of the second decision step include: first, Enter into AT, use SA to Perform feature weight assignment, perform feature abstraction and normalization through FC and BN, and compare the normalized results with the prior choice of the first decision step Perform a dot multiplication operation and use the Sparsemax function to calculate the mask for the second decision step , while passing To update the current second decision step's prerequisite choice ; then and Multiply to realize the feature selection of the second decision step, and pass the result of feature selection into FT for feature processing to obtain the output of FT in the second decision step ; Finally, use the ReLu function to Perform nonlinear transformation to obtain the second eigenvector .

[0096] S224: Through the third decision step Perform feature selection and processing: The third decision step includes AT, FT and ReLu functions; The execution steps of the third decision step include: first, Enter into AT, use SA to Perform feature weight assignment, perform feature abstraction and normalization through FC and BN, and compare the normalized results with the prior choice of the second decision step Perform a dot multiplication operation and use the Sparsemax function to calculate the mask for the third decision step , while passing To update the current third decision step's prerequisite choice ; then and Multiply to realize the feature selection of the third decision step, and pass the result of feature selection into FT for feature processing to obtain the output of FT in the third decision step ; Finally, use the ReLu function to Perform nonlinear transformation to obtain the third eigenvector .

[0097] S23: Passed to GFTM for feature fusion: GFTM includes the first residual connection block Resblock1, the second residual connection block Resblock2 and the third residual connection block Resblock3; through the three residual connection blocks Resblock1, Resblock2 and Resblock3, and , and Perform feature fusion and finally get the output of GFTM .

[0098] Further, The specific steps of transferring features to GFTM for feature fusion include:

[0099] S231: Use the first residual connection block Resblock1 to the second feature set Perform feature fusion: Resblock1 includes vector concatenation operation and the first fully connected layer , the second fully connected layer and ReLu function; the execution steps of Resblock1 include: first, Input into Resblock1, With the first eigenvector Perform vector concatenation; then pass through the first fully connected layer The concatenated feature vector is abstracted and nonlinearly transformed using the ReLu function; finally, the second fully connected layer The results of nonlinear transformation are abstracted and The output of Resblock1 is obtained by summing the result after feature abstraction element by element. ;

[0100] Among them, the output of the kth residual connection block The calculation formula is as follows:

[0101] (17)

[0102] In formula (17), represents the output of the kth residual connection block, represents the second fully connected layer, represents the ReLu function, represents the first fully connected layer, Represents a vector concatenation operation, represents the kth eigenvector, represents the element-by-element summation of the eigenvector; where k is 1, 2, or 3; The second feature set .

[0103] S232: Use the second residual connection block Resblock2 to Perform feature fusion: Resblock2 includes vector concatenation operations, , and ReLu function; the execution steps of Resblock2 include: first, Input into Resblock2, With the second eigenvector Perform vector concatenation; then pass The concatenated feature vector is abstracted and nonlinearly transformed using the ReLu function. The results of nonlinear transformation are abstracted and The output of Resblock2 is obtained by summing the result after feature abstraction element by element. .

[0104] S233: Use the third residual connection block Resblock3 to Perform feature fusion: Resblock3 includes vector concatenation operations, , and ReLu function; the execution steps of Resblock3 include: first, Input into Resblock3, With the third eigenvector Perform vector concatenation; then pass The concatenated feature vector is abstracted and nonlinearly transformed using the ReLu function. The results of nonlinear transformation are abstracted and The output of Resblock3 is obtained by summing the result after feature abstraction element by element. ; This is the output of GFTM .

[0105] S24: Use the fully connected layer FC pair The conversion is performed and the converted result is processed by the Softmax function to obtain the final prediction result.

[0106] The present invention also provides a code obfuscation effectiveness evaluation system based on LGF-Net, including a data preprocessing module, a code obfuscation effectiveness evaluation model construction module, a code obfuscation effectiveness evaluation model training module and a code obfuscation effectiveness evaluation module:

[0107] The data preprocessing module: for each program in the data set, first obtain the obfuscated code and the deobfuscated code corresponding to the source code of the program; then extract features from the source code, the obfuscated code and the deobfuscated code to obtain a first feature set; then assign an obfuscation effect level to the first feature set, and represent the first feature set and its obfuscation effect level as an ordered pair; finally, all the ordered pairs constitute a code obfuscation effectiveness evaluation data set, called the first data set, and divide the first data set into a training set and a test set;

[0108] The code obfuscation effectiveness evaluation model construction module: constructing the code obfuscation effectiveness evaluation model LGF-Net: LGF-Net performs feature selection and processing through a local feature module and performs feature fusion through a global feature module;

[0109] The code obfuscation effectiveness evaluation model training module: uses the training set and the test set to train and test LGF-Net respectively to obtain the trained LGF-Net;

[0110] The code obfuscation effectiveness evaluation module: firstly, uses the code obfuscation algorithm to be evaluated to confuse the source code in the program to obtain the corresponding obfuscated code; then uses the deobfuscation tool to deobfuscate the obfuscated code to obtain the corresponding deobfuscated code; then, according to the method of extracting features in the data preprocessing module, extracts features from the source code, the obfuscated code and the deobfuscated code to obtain the corresponding first feature set; finally, inputs the first feature set into the trained LGF-Net to obtain the obfuscation effect level of the code obfuscation algorithm to be evaluated.

[0111] A computer device includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of a method for evaluating the effectiveness of code obfuscation based on LGF-Net are implemented.

[0112] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of a method for evaluating the effectiveness of code obfuscation based on LGF-Net.

[0113] The beneficial effects of the present invention are:

[0114] (1) This paper proposes a deep neural network model, LGF-Net, which has higher performance and accuracy than traditional machine learning models when facing the task of evaluating the effectiveness of code obfuscation with multiple features and large samples.

[0115] (2) The local feature module LFTM proposed in the present invention uses multiple decision steps for feature selection and processing. It captures the dependencies between input features through diverse feature combinations, which helps the model discover related features and thus improves the accuracy of the model.

[0116] (3) The global feature module GFTM proposed in the present invention can not only supplement the global feature information, but also fuse the global features with the local features to obtain a better feature representation, thereby improving the performance and generalization ability of the model. BRIEF DESCRIPTION OF THE DRAWINGS

[0117] Figure 1This is a flowchart of the steps of the code obfuscation effectiveness evaluation method based on LGF-Net;

[0118] Figure 2 This is a schematic diagram of the model architecture of LGF-Net;

[0119] Figure 3 It is a structural diagram of the feature processing module FT;

[0120] Figure 4 Schematic diagram of the structure of the attention module AT. DETAILED DESCRIPTION

[0121] The present invention will be further defined below in conjunction with the accompanying drawings and embodiments, but is not limited thereto.

[0122] Example 1

[0123] Those skilled in the art will appreciate that the following examples are only used to illustrate the present invention and should not be considered to limit the scope of the present invention. If no specific techniques or conditions are specified in the examples, the techniques or conditions described in the literature in the art or the product specifications are used. If the manufacturer of the materials or equipment used is not specified, they are all conventional products that can be purchased.

[0124] A code obfuscation effectiveness evaluation method based on LGF-Net, the specific steps are as follows:

[0125] S1: For each program in the data set, first obtain the obfuscated code and deobfuscated code corresponding to the source code of the program; then extract features from the source code, obfuscated code and deobfuscated code to obtain the first feature set F; then assign an obfuscation effect level y to F, and represent F and its corresponding y as an ordered pair; finally, all the ordered pairs form a code obfuscation effectiveness evaluation data set, called the first data set D, and divide D into a training set and a test set;

[0126] Preferably, step S1 specifically includes:

[0127] Combine multiple self-written programs or programs in existing public datasets into a dataset. For each program in the dataset,

[0128] S11: Obfuscate the source code of the program using a plurality of code obfuscation algorithms respectively to obtain a plurality of obfuscated codes; wherein the code obfuscation algorithms include but are not limited to an opaque predicate algorithm, a string encryption algorithm, a control flow flattening algorithm, and inserting junk instructions.

[0129] S12: De-obfuscate each obfuscated code using an anti-obfuscation tool to obtain a corresponding de-obfuscated code; wherein the anti-obfuscation tool includes but is not limited to Anti-proguard and Generic Automatic De-obfuscation.

[0130] S13: For each pair of obfuscated code and the deobfuscated code corresponding to the obfuscated code, combine them with the source code to obtain a first binary. and the second tuple , where ori represents the source code, obf represents the obfuscated code, and deo represents the deobfuscated code corresponding to the obfuscated code; then the first two-tuple is analyzed from four aspects: strength, flexibility, overhead, and concealment. and the second tuple Perform feature extraction to obtain the corresponding first feature set ,in represents the intensity characteristic, Represents elastic characteristics, represents the overhead characteristics, Represents concealment characteristics.

[0131] Preferably, the first binary is evaluated from four aspects: strength, flexibility, cost and concealment. and the second tuple The specific steps for feature extraction are as follows:

[0132] S131: Extracting intensity features : Calculate the first two-tuple The difference between the first element ori and the second element obf in code complexity and the number of nodes in the abstract syntax tree; It can be expressed as formula (1):

[0133] (1)

[0134] In formula (1), express The difference between ori and obf in code complexity, express The set of differences in the number of nodes between ori and obf in the abstract syntax tree; It can be expressed as formula (2):

[0135] (2)

[0136] In formula (2), express The difference between ori and obf in code complexity; code complexity can be divided into cyclomatic complexity , Program complexity , Fan-in complexity , Fan-out complexity , data flow complexity Five; among them, cyclomatic complexity The calculation formula is

[0137] (3)

[0138] In formula (3), To control the number of edges in the flow graph, is the number of nodes in the control flow graph;

[0139] Program complexity The calculation formula is

[0140] (4)

[0141] In formula (4), is the number of operands, is the number of operators;

[0142] Fan-in complexity The calculation formula is

[0143] (5)

[0144] In formula (5), is the number of control flow modules entering the code module, is the number of data stream modules;

[0145] Fan-out complexity The calculation formula is

[0146] (6)

[0147] In formula (6), The number of control flow modules exported for the code module, is the number of data stream modules;

[0148] Data flow complexity The calculation formula is

[0149] (7)

[0150] In formula (7), The number of variables used in the program module but not defined in the block;

[0151] in addition, It can be expressed as formula (8):

[0152] (8)

[0153] In formula (8), express The difference between ori and obf in the abstract syntax tree; the abstract syntax tree nodes are divided into declaration nodes and expression nodes. Declaration nodes are divided into block declaration, basic For loop declaration, enhanced For loop declaration, conditional IF declaration, conditional Else declaration, While loop declaration, Break declaration and selection declaration, a total of 8 types; expression nodes are divided into method definition, variable definition, constant, selection mark, expression name, assignment, method call and parameter list, a total of 8 types.

[0154] S132: Extracting elastic features : Calculate the second tuple The difference in the number of nodes between the first element ori and the second element deo in the abstract syntax tree and the similarity based on the control flow graph; It can be expressed as formula (9):

[0155] (9)

[0156] In formula (9), express The similarity between ori and deo based on control flow graph, express The set of differences in the number of nodes between ori and deo in the abstract syntax tree; The calculation formula is

[0157] (10)

[0158] In formula (10), and Respectively represent The control flow graph of ori and deo, and Respectively represent and The total number of nodes, The function is to calculate and The number of nodes in the largest common subgraph between The function is to calculate and The maximum number of nodes between

[0159] in addition, It can be expressed as formula (11):

[0160] (11)

[0161] In formula (11), express The difference between ori and deo in the abstract syntax tree; the node type of the abstract syntax tree here is the same as the node type of the abstract syntax tree listed in S131.

[0162] S133: Extracting Cost Features : Calculate the first two-tuple The difference in execution time between the first element ori and the second element obf; The calculation formula is

[0163] (12)

[0164] In formula (12), and Respectively represent The execution time of ori and obf.

[0165] S134: Extracting hidden features : Calculate the first two-tuple The first element ori and the second element obf are based on the similarity of tokens; The calculation formula is

[0166] (13)

[0167] In formula (13), and Respectively represent The token frequency vector of ori and obf, and The subscript i in represents the i-th token.

[0168] S14: Assign a confusion effect level y to each F, and represent F and its corresponding y as an ordered pair ; Among them, the obfuscation effect level is set by manual marking, usually by experts based on F; the obfuscation effect level represents the effectiveness of the code obfuscation algorithm, which is divided into three levels: weak, medium and strong.

[0169] When all programs in the data set have executed the above steps, all the sequence pairs d constitute a code obfuscation effectiveness evaluation data set, and the code obfuscation effectiveness evaluation data set is called the first data set , where w is the product of the number of programs in the dataset a and the number of code obfuscation algorithms used b; then D is divided into a training set and a test set.

[0170] Specifically, taking the JAVA algorithm data set as an example, there are 102 programs in the data set; first, the string encryption algorithm, the flattened control flow-1 algorithm, the flattened control flow-2 algorithm, the opaque predicate-1 algorithm, the opaque predicate-2 algorithm, the opaque predicate-3 algorithm and the insertion of flower instructions algorithm are used to obfuscate the 102 programs in the JAVA algorithm data set, and 714 obfuscated codes are obtained; then, the Anti-proguard anti-obfuscation tool is used to deobfuscate the above 714 obfuscated codes to obtain the corresponding deobfuscated codes; then, for each pair of obfuscated codes and the deobfuscated codes corresponding to the obfuscated codes, they are combined with the source code respectively to obtain the first two-tuple and the second tuple , and evaluate the first binary from four aspects: strength, flexibility, cost and concealment and the second tuple Perform feature extraction and obtain 714 first feature sets ; Then, experts assign a confusion effect level y to each F, and express F and its corresponding y as an ordered pair ; In this example, y is "0" for weak, y is "1" for strong, and y is "2" for strong; Finally, the 714 sequence pairs form a code obfuscation effectiveness evaluation data set, and this data set is called the first data set ; Divide D into training set and test set in a ratio of 8 to 2.

[0171] S2: Construct the code obfuscation effectiveness evaluation model LGF-Net; LGF-Net performs feature selection and processing through the local feature module LFTM, and performs feature fusion through the global feature module GFTM;

[0172] Preferably, step S2 is specifically as follows:

[0173] S21: For the first feature set F, first use the batch normalization operation BN to normalize F to obtain the second feature set ; then It is passed to the local feature module LFTM for feature selection and processing; then It is passed to the global feature module GFTM for feature fusion.

[0174] S22: It is passed to LFTM for feature selection and processing: LFTM includes feature processing module FT, first decision step, second decision step and third decision step; first, feature processing module FT is used to select Then, after the feature selection and processing of the first decision step, the second decision step and the third decision step, the output corresponding to each decision step is obtained, which are the first feature vector , the second eigenvector and the third eigenvector .

[0175] Preferably, The specific steps of inputting to LFTM for feature selection and processing include:

[0176] S221: Use the feature processing module FT to process the second feature set Feature processing: FT consists of a basic block block, a first residual basic block SVRblock1 and a second residual basic block SVRblock2; the structural diagram of FT is shown in Figure 3 As shown;

[0177] The steps of FT include: first, Input to the basic block block, through the fully connected layer FC and batch normalization operation BN Perform feature abstraction and normalization, and use the gated linear unit GLU to perform feature processing on the normalized result to obtain the output of the block ; Then, Input to the first residual basic block SVRblock1, through FC and BN Perform feature abstraction and normalization, and use GLU to perform feature processing on the normalized results. After element-by-element summation and multiplication by α, we get the output of SVRblock1 ; Finally, Input to the second residual basic block SVRblock2, and after feature processing of SVRblock2, the output of SVRblock2 is obtained .

[0178] in, and The calculation formula is as follows:

[0179] (14)

[0180] In formula (14), represents the output of the mth residual basic block, stands for Gated Linear Unit GLU, Represents batch normalization operation BN, represents the fully connected layer FC, represents the element-by-element summation of eigenvectors, To prevent the coefficients of the model variance from changing too dramatically, in general, Pick ; Wherein, the value of m is 1 or 2; It is the output of the basic block.

[0181] S222: Feature selection and processing through the first decision step: The first decision step includes an attention module AT, a feature processing module FT and a ReLu function; wherein, in the attention module AT, feature selection is performed by learning a mask MASK; the structural diagram of AT is shown in Figure 4 As shown;

[0182] The execution steps of the first decision step include: first, Input to the attention module AT, use the self-attention mechanism SA to Perform feature weight assignment, perform feature abstraction and normalization through FC and BN, and compare the normalized results with the initial prerequisite selection Perform a dot multiplication operation and use the Sparsemax function to calculate the mask for the first decision step , while passing To update the current first decision step's prerequisite choice ; then and Multiply to realize the feature selection of the first decision step, and pass the result of feature selection into FT for feature processing to obtain the output of FT in the first decision step ; Finally, use the ReLu function to Perform nonlinear transformation to obtain the first eigenvector .

[0183] The calculation formula of the mask MASK is as follows:

[0184] (15)

[0185] In formula (15), represents the mask MASK of the t-th decision step, represents the Sparsemax function, represents the prior choice of the t-1th decision step, Represents batch normalization operation BN, represents the fully connected layer FC, represents the self-attention mechanism SA, represents the output of FT in the t-1th decision step; where t is 1, 2, or 3; the initial prerequisite choice is a vector of all 1s; the output of FT in the initial decision step For S221 .

[0186] Among them, the prerequisite choice The calculation formula is as follows:

[0187] (16)

[0188] In formula (16), represents the prior choice of the t-th decision step, and the prior choice refers to the usage of features in all past decision steps; is a scalar that controls the use of features in the decision step. In general, Take 1; Represents the mask MASK of the tth decision step; where the value of t is 1, 2, or 3.

[0189] S223: Feature selection and processing through the second decision step: The second decision step includes AT, FT and ReLu functions; The execution steps of the second decision step include: first, Enter into AT, use SA to Perform feature weight assignment, perform feature abstraction and normalization through FC and BN, and compare the normalized results with the prior choice of the first decision step Perform a dot multiplication operation and use the Sparsemax function to calculate the mask for the second decision step , while passing To update the current second decision step's prerequisite choice ; then and Multiply to realize the feature selection of the second decision step, and pass the result of feature selection into FT for feature processing to obtain the output of FT in the second decision step ; Finally, use the ReLu function to Perform nonlinear transformation to obtain the second eigenvector .

[0190] S224: Through the third decision step Perform feature selection and processing: The third decision step includes AT, FT and ReLu functions; The execution steps of the third decision step include: first, Enter into AT, use SA to Perform feature weight assignment, perform feature abstraction and normalization through FC and BN, and compare the normalized results with the prior choice of the second decision step Perform a dot multiplication operation and use the Sparsemax function to calculate the mask for the third decision step , while passing To update the current third decision step's prerequisite choice ; then and Multiply to realize the feature selection of the third decision step, and pass the result of feature selection into FT for feature processing to obtain the output of FT in the third decision step ; Finally, use the ReLu function to Perform nonlinear transformation to obtain the third eigenvector .

[0191] S23: Passed to GFTM for feature fusion: GFTM includes the first residual connection block Resblock1, the second residual connection block Resblock2 and the third residual connection block Resblock3; through the three residual connection blocks Resblock1, Resblock2 and Resblock3, and , and Perform feature fusion and finally get the output of GFTM .

[0192] Preferably, The specific steps of transferring features to GFTM for feature fusion include:

[0193] S231: Use the first residual connection block Resblock1 to the second feature set Perform feature fusion: Resblock1 includes vector concatenation operation and the first fully connected layer , the second fully connected layer and ReLu function; the execution steps of Resblock1 include: first, Input into Resblock1, With the first eigenvector Perform vector concatenation; then pass through the first fully connected layer The concatenated feature vector is abstracted and nonlinearly transformed using the ReLu function; finally, the second fully connected layer The results of nonlinear transformation are abstracted and The output of Resblock1 is obtained by summing the result after feature abstraction element by element. ;

[0194] Among them, the output of the kth residual connection block The calculation formula is as follows:

[0195] (17)

[0196] In formula (17), represents the output of the kth residual connection block, represents the second fully connected layer, represents the ReLu function, represents the first fully connected layer, Represents a vector concatenation operation, represents the kth eigenvector, represents the element-by-element summation of the eigenvector; where k is 1, 2, or 3; The second feature set .

[0197] S232: Use the second residual connection block Resblock2 to Perform feature fusion: Resblock2 includes vector concatenation operations, , and ReLu function; the execution steps of Resblock2 include: first, Input into Resblock2, With the second eigenvector Perform vector concatenation; then pass The concatenated feature vector is abstracted and nonlinearly transformed using the ReLu function. The results of nonlinear transformation are abstracted and The output of Resblock2 is obtained by summing the result after feature abstraction element by element. .

[0198] S233: Use the third residual connection block Resblock3 to Perform feature fusion: Resblock3 includes vector concatenation operations, , and ReLu function; the execution steps of Resblock3 include: first, Input into Resblock3, With the third eigenvector Perform vector concatenation; then pass The concatenated feature vector is abstracted and nonlinearly transformed using the ReLu function. The results of nonlinear transformation are abstracted and The output of Resblock3 is obtained by summing the result after feature abstraction element by element. ; This is the output of GFTM .

[0199] S24: Use the fully connected layer FC pair The conversion is performed and the converted result is processed by the Softmax function to obtain the final prediction result.

[0200] Specifically, in this example, the code obfuscation effectiveness evaluation model LGF-Net is constructed according to step S2; the LGF-Net model architecture is as follows: Figure 2 shown.

[0201] S3: Train the code obfuscation effectiveness evaluation model LGF-Net constructed in S2: Use the training set and test set to train and test LGF-Net respectively to obtain the trained LGF-Net;

[0202] Specifically, in this example, the training set and test set are used to train and test LGF-Net, respectively, to obtain the trained LGF-Net; F in is used as input and y is used as label.

[0203] S4: First, use the code obfuscation algorithm to be evaluated to confuse the source code in the program and obtain the corresponding obfuscated code; then use the deobfuscation tool to deobfuscate the obfuscated code and obtain the corresponding deobfuscated code; then, according to the feature extraction method in S1, extract features from the source code, obfuscated code and deobfuscated code to obtain the corresponding F; finally, input F into the LGF-Net trained in S3 to obtain the obfuscation effect level of the code obfuscation algorithm to be evaluated.

[0204] Specifically, in this example, the code obfuscation algorithm to be evaluated is the Flattened Control Flow-3 algorithm; the Flattened Control Flow-3 algorithm is used to obfuscate the source code of a program in the JAVA algorithm dataset to obtain the corresponding obfuscated code; then the obfuscated code is deobfuscated using an anti-obfuscation tool to obtain the corresponding deobfuscated code; then feature extraction is performed on the source code, obfuscated code and deobfuscated code from four aspects: strength, flexibility, overhead and concealment to obtain the corresponding F; finally, F is input into the trained LGF-Net to obtain the obfuscation effect level of the Flattened Control Flow-3 algorithm.

[0205] Example 2

[0206] The present invention also provides a code obfuscation effectiveness evaluation system based on LGF-Net, including a data preprocessing module, a code obfuscation effectiveness evaluation model construction module, a code obfuscation effectiveness evaluation model training module and a code obfuscation effectiveness evaluation module:

[0207] The data preprocessing module: for each program in the data set, first obtain the obfuscated code and the deobfuscated code corresponding to the source code of the program; then extract features from the source code, the obfuscated code and the deobfuscated code to obtain a first feature set; then assign an obfuscation effect level to the first feature set, and represent the first feature set and its obfuscation effect level as an ordered pair; finally, all the ordered pairs constitute a code obfuscation effectiveness evaluation data set, called the first data set, and divide the first data set into a training set and a test set;

[0208] The code obfuscation effectiveness evaluation model construction module: constructing the code obfuscation effectiveness evaluation model LGF-Net: LGF-Net performs feature selection and processing through a local feature module and performs feature fusion through a global feature module;

[0209] The code obfuscation effectiveness evaluation model training module: uses the training set and the test set to train and test LGF-Net respectively to obtain the trained LGF-Net;

[0210] The code obfuscation effectiveness evaluation module: firstly, uses the code obfuscation algorithm to be evaluated to confuse the source code in the program to obtain the corresponding obfuscated code; then uses the deobfuscation tool to deobfuscate the obfuscated code to obtain the corresponding deobfuscated code; then, according to the method of extracting features in the data preprocessing module, extracts features from the source code, the obfuscated code and the deobfuscated code to obtain the corresponding first feature set; finally, inputs the first feature set into the trained LGF-Net to obtain the obfuscation effect level of the code obfuscation algorithm to be evaluated.

[0211] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0212] In the embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the system embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as 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 an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0213] 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 network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0214] In addition, each functional unit in each embodiment of the present invention 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.

[0215] 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 invention is essentially 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. The computer software product is stored in a storage medium, including several instructions for 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 invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0216] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A code obfuscation effectiveness evaluation method based on LGF-Net, characterized in that: include: S1: For each program in the data set, first obtain the obfuscated code and deobfuscated code corresponding to the source code of the program; then extract features from the source code, obfuscated code and deobfuscated code to obtain the first feature set F; then assign an obfuscation effect level y to F, and represent F and its corresponding y as an ordered pair; finally, all the ordered pairs form a code obfuscation effectiveness evaluation data set, called the first data set D, and divide D into a training set and a test set; S2: Construct the code obfuscation effectiveness evaluation model LGF-Net; LGF-Net performs feature selection and processing through the local feature module LFTM, and performs feature fusion through the global feature module GFTM; The specific steps include: S21: For the first feature set F, use the batch normalization operation BN to normalize F to obtain the second feature set ; S22: It is passed to LFTM for feature selection and processing: LFTM includes feature processing module FT, first decision step, second decision step and third decision step; first, feature processing module FT is used to select Then, after the feature selection and processing of the first decision step, the second decision step and the third decision step, the output corresponding to each decision step is obtained, which are the first feature vector , the second eigenvector and the third eigenvector ; S23: Passed to GFTM for feature fusion: GFTM includes the first residual connection block Resblock1, the second residual connection block Resblock2 and the third residual connection block Resblock3; through the three residual connection blocks Resblock1, Resblock2 and Resblock3, and , and Perform feature fusion and finally get the output of GFTM ; S24: Use the fully connected layer FC pair Convert and process the converted results through the Softmax function to obtain the final prediction result; S3: Train the code obfuscation effectiveness evaluation model LGF-Net constructed in S2: Use the training set and test set to train and test LGF-Net respectively to obtain the trained LGF-Net; S4: first, use the code obfuscation algorithm to be evaluated to obfuscate the source code in the program to obtain the corresponding obfuscated code; Then, the obfuscated code is deobfuscated using an anti-obfuscation tool to obtain the corresponding deobfuscated code. Then, according to the feature extraction method in S1, features are extracted from the source code, obfuscated code, and deobfuscated code to obtain the corresponding F. Finally, F is input into the LGF-Net trained in S3 to obtain the obfuscation effect level of the code obfuscation algorithm to be evaluated.

2. The code obfuscation effectiveness evaluation method based on LGF-Net according to claim 1 is characterized in that: The said The steps of feature selection and processing passed to LFTM include: S221: Use the feature processing module FT to process the second feature set Perform feature processing: First, Input to the basic block block, through the fully connected layer FC and batch normalization operation BN Perform feature abstraction and normalization, and use the gated linear unit GLU to perform feature processing on the normalized result to obtain the output of the block ; Then, Input to the first residual basic block SVRblock1, through FC and BN Perform feature abstraction and normalization, and use GLU to perform feature processing on the normalized results. After element-by-element summation and multiplication by α, we get the output of SVRblock1 ; Finally, Input to the second residual basic block SVRblock2, and after feature processing of SVRblock2, the output of SVRblock2 is obtained ; S222: Feature selection and processing through the first decision step: First, the Input to the attention module AT, use the self-attention mechanism SA to Perform feature weight assignment, perform feature abstraction and normalization through FC and BN, and compare the normalized results with the initial prerequisite selection Perform a dot multiplication operation and use the Sparsemax function to calculate the mask for the first decision step , while passing To update the current first decision step's prerequisite choice ; then and Multiply to realize the feature selection of the first decision step, and pass the result of feature selection into FT for feature processing to obtain the output of FT in the first decision step ; Finally, use the ReLu function to Perform nonlinear transformation to obtain the first eigenvector ; S223: Feature selection and processing through the second decision step: First, Enter into AT, use SA to Perform feature weight assignment, perform feature abstraction and normalization through FC and BN, and compare the normalized results with the prior choice of the first decision step Perform a dot multiplication operation and use the Sparsemax function to calculate the mask for the second decision step , while passing To update the current second decision step's prerequisite choice ; then and Multiply to realize the feature selection of the second decision step, and pass the result of feature selection into FT for feature processing to obtain the output of FT in the second decision step ; Finally, use the ReLu function to Perform nonlinear transformation to obtain the second eigenvector ; S224: Feature selection and processing through the third decision step: First, Enter into AT, use SA to Perform feature weight assignment, perform feature abstraction and normalization through FC and BN, and compare the normalized results with the prior choice of the second decision step Perform a dot multiplication operation and use the Sparsemax function to calculate the mask for the third decision step , while passing To update the current third decision step's prerequisite choice ; then and Multiply to realize the feature selection of the third decision step, and pass the result of feature selection into FT for feature processing to obtain the output of FT in the third decision step ; Finally, use the ReLu function to Perform nonlinear transformation to obtain the third eigenvector .

3. The code obfuscation effectiveness evaluation method based on LGF-Net according to claim 1 is characterized in that: The said The steps of transferring features to GFTM for feature fusion include: S231: Use the first residual connection block Resblock1 to the second feature set Perform feature fusion: First, Input into Resblock1, With the first eigenvector Perform vector concatenation; then pass through the first fully connected layer The concatenated feature vector is abstracted and nonlinearly transformed using the ReLu function; finally, the second fully connected layer The results of nonlinear transformation are abstracted and The output of Resblock1 is obtained by summing the result after feature abstraction element by element. ; S232: Use the second residual connection block Resblock2 to Perform feature fusion: First, Input into Resblock2, With the second eigenvector Perform vector concatenation; then pass The concatenated feature vector is abstracted and nonlinearly transformed using the ReLu function. The results of nonlinear transformation are abstracted and The output of Resblock2 is obtained by summing the result after feature abstraction element by element. ; S233: Use the third residual connection block Resblock3 to Perform feature fusion: First, Input into Resblock3, With the third eigenvector Perform vector concatenation; then pass The concatenated feature vector is abstracted and nonlinearly transformed using the ReLu function. The results of nonlinear transformation are abstracted and The output of Resblock3 is obtained by summing the result after feature abstraction element by element. ; This is the output of GFTM .

4. The code obfuscation effectiveness evaluation method based on LGF-Net according to claim 2 is characterized in that: The and The calculation formula is: In the above formula, represents the output of the mth residual basic block, stands for Gated Linear Unit GLU, Represents batch normalization operation BN, represents the fully connected layer FC, represents the element-by-element summation of eigenvectors, A coefficient to prevent the model variance from changing too drastically; the value of m is 1 or 2; It is the output of the basic block.

5. The code obfuscation effectiveness evaluation method based on LGF-Net according to claim 2 is characterized in that: The , and as well as , and The calculation formula is: The calculation formula of the mask MASK is as follows: In the above formula, represents the mask MASK of the t-th decision step, represents the Sparsemax function, represents the prior choice of the t-1th decision step, Represents batch normalization operation BN, represents the fully connected layer FC, represents the self-attention mechanism SA, represents the output of FT in the t-1th decision step; where t is 1, 2, or 3; the initial prerequisite choice is a vector of all 1s; the output of FT in the initial decision step For S221 ; Among them, the prerequisite choice The calculation formula is as follows: In the above formula, represents the prior choice of the t-th decision step, and the prior choice refers to the usage of features in all past decision steps; is a scalar that controls the use of features in the decision step; Represents the mask MASK of the tth decision step; where the value of t is 1, 2, or 3.

6. According to the LGF-Net-based code obfuscation effectiveness evaluation method of claim 3, it is characterized in that: The , and The calculation formula is In the above formula, represents the output of the kth residual connection block, represents the second fully connected layer, represents the ReLu function, represents the first fully connected layer, Represents a vector concatenation operation, represents the kth eigenvector, represents the element-by-element summation of the eigenvector; where k is 1, 2, or 3; The second feature set .

7. A code obfuscation effectiveness evaluation system based on LGF-Net, used to run the code obfuscation effectiveness evaluation method based on LGF-Net according to any one of claims 1 to 6, characterized in that: Including data preprocessing module, code obfuscation effectiveness evaluation model construction module, code obfuscation effectiveness evaluation model training module, code obfuscation effectiveness evaluation module: The data preprocessing module: for each program in the data set, first obtain the obfuscated code and the deobfuscated code corresponding to the source code of the program; then extract features from the source code, the obfuscated code and the deobfuscated code to obtain a first feature set; then assign an obfuscation effect level to the first feature set, and represent the first feature set and its obfuscation effect level as an ordered pair; finally, all the ordered pairs constitute a code obfuscation effectiveness evaluation data set, called the first data set, and divide the first data set into a training set and a test set; The code obfuscation effectiveness evaluation model construction module: constructing the code obfuscation effectiveness evaluation model LGF-Net: LGF-Net performs feature selection and processing through a local feature module and performs feature fusion through a global feature module; The code obfuscation effectiveness evaluation model training module: uses the training set and the test set to train and test LGF-Net respectively to obtain the trained LGF-Net; The code obfuscation effectiveness evaluation module: firstly uses the code obfuscation algorithm to be evaluated to obfuscate the source code in the program to obtain the corresponding obfuscated code; Then, the obfuscated code is deobfuscated using an anti-obfuscation tool to obtain a corresponding deobfuscated code; then, according to the method of extracting features in the data preprocessing module, features are extracted from the source code, the obfuscated code and the deobfuscated code to obtain a corresponding first feature set; finally, the first feature set is input into the trained LGF-Net to obtain the obfuscation effect level of the code obfuscation algorithm to be evaluated.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the code obfuscation effectiveness evaluation method based on LGF-Net are implemented in any one of claims 1-6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for evaluating the effectiveness of code obfuscation based on LGF-Net according to any one of claims 1 to 6 are implemented.

Citation Information

Cited By

  • Apparatus and method for protecting against unauthorized targeted influence of a program

    EP4826577A1