An android malware universal adversarial sample generation method

By constructing a target function call graph of Android malware, injecting target API perturbations and new nodes, and generating adversarial samples, the limitations and practicality issues of traditional methods are solved, achieving efficient generation and wide applicability of adversarial samples.

CN121637496BActive Publication Date: 2026-04-10NANCHANG UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
NANCHANG UNIV
Filing Date
2026-02-04
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

In existing Android malware detection methods, traditional adversarial attack methods usually design perturbations for specific detection models, which means that attack strategies need to be recalculated and retrained when facing different detection models, which consumes a lot of time and resources and lacks practical software code-level attack capabilities.

Method used

By constructing a target function call graph for Android malware, we can identify custom functions, non-custom functions, and APIs. By referencing frequency statistics from a database of benign application features and a corpus of malicious applications, we can inject a set of target API perturbations and new nodes to generate adversarial samples, ensuring that malicious applications are not affected in terms of functionality.

Benefits of technology

The generated adversarial samples can effectively evade multiple detection methods with a success rate of 85.26%, while remaining completely functionally intact. The PS_ASR index reaches 100%, solving the limitations and practicality issues of traditional methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121637496B_ABST
    Figure CN121637496B_ABST
Patent Text Reader

Abstract

The application provides an Android malware universal adversarial sample generation method, and the method specifically comprises the following steps: receiving a user-uploaded malicious APK file, and constructing a target function call graph corresponding to the APK file; traversing all nodes in the target function call graph, and identifying custom functions, non-custom functions and APIs in all nodes; determining a target API disturbance set to be injected, and the number of new nodes to be added for each non-custom function; and integrating the file generated after injecting the target API disturbance set and the new non-custom function, so as to generate an adversarial sample. The application focuses on universal disturbance from three angles of nodes, edges and application programming interfaces, so that the generated adversarial sample can effectively evade multiple typical detection methods based on different feature sets. In addition, the application has the advantages of practicability and function losslessness.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application relates to the technical field of software security, and particularly relates to an Android malicious software universal adversarial sample generation method. BACKGROUND

[0002] In a detection method based on semantic features, FCG (function call graph) is a core semantic carrier, and its structural features are indispensable key analysis elements. Researchers integrate FCG topological features and API call sequence information, and construct a sample feature subset with discrimination ability through feature engineering screening. With the breakthrough progress of adversarial sample technology in the image field, the academic circle has begun to focus on the adversarial attack problem in the static detection scene of Android malicious applications - attackers realize detection bypass by constructing adversarial samples.

[0003] Adversarial attacks can enable defenders to understand their own defects, better understand the nature of attacks, and design more effective detection methods. Existing attack methods mostly stop at shuffling feature vectors to deceive the classifier (i.e., feature space attack), and lack corresponding malicious software code modification schemes (i.e., problem space attack).

[0004] In addition, traditional adversarial attacks, such as methods based on Jacobian matrix or reinforcement learning, usually design perturbations for the quadratic features of a specific detection model, resulting in the need to recalculate and train the attack strategy when facing different detection models, which consumes a large amount of time and resources. SUMMARY

[0005] The application aims to improve and innovate in view of the shortcomings and problems in the background art, and provides an Android malicious software universal adversarial sample generation method.

[0006] According to a first aspect of the application, an Android malicious software universal adversarial sample generation method is provided, which specifically comprises the following steps:

[0007] Step S1, receiving a malicious APK file uploaded by a user, and constructing a target function call graph corresponding to the APK file;

[0008] Step S2, traversing all nodes in the target function call graph, identifying custom functions, non-custom functions and APIs in all nodes, and outputting an initial feature vector according to the total number of custom functions and non-custom functions, and the API set and global parameters of the target function call graph;

[0009] Step S3, according to the output initial feature vector, reference the frequency of occurrence of each application programming interface in the benign application feature database and the malicious application corpus and the total number of node statistics results, determine the target API disturbance set to be injected, the number of new nodes to be added for each non-custom function, and output the feature disturbance vector;

[0010] Step S4, according to the output feature disturbance vector, create new classes and static methods that do not execute and inject the target API disturbance set; locate each non-custom function identified and, according to the calculated number of nodes to be added, inject a corresponding number of new non-custom functions and build the call relationship between each non-custom function identified and the new non-custom function; integrate the file generated after injecting the target API disturbance set and the new non-custom function to generate an adversarial sample.

[0011] Further, the step S1 specifically includes:

[0012] Perform unpacking operation on the malicious APK file to convert it into a Smali file set; and the generated Smali file set is organized into a directory structure accessible to the program;

[0013] Perform comprehensive inter-process analysis on the Smali file set to track all function-to-function and function-to-API call relationships in the program to build a target function call graph; wherein the target function call graph is a directed graph, each node in which represents a function or an API in the Smali file set, and each edge represents an explicit call relationship.

[0014] Further, the step S2 specifically includes:

[0015] Step S21, traverse all nodes in the target function call graph, and determine the custom function, non-custom function and API in all nodes according to the characteristics of the nodes;

[0016] Step S22, count the number n cus of custom functions and the number n noncus of non-custom functions;

[0017] Step S23, extract the API set and count the global parameters of the target function call graph;

[0018] Step S24, encapsulate all the counted parameters and data to build an initial feature vector X.

[0019] Further, the step S3 specifically includes:

[0020] querying the average frequency of each application programming interface in the benign application feature database G = {g1, g2,..., g i};

[0021] querying the average frequency of each application programming interface in the malicious application corpus M = {m1, m2,..., m i};

[0022] calculating the frequency ratio R i of each application programming interface API i in the API set in the benign and malicious applications; wherein the calculation formula of the ratio R i is as follows:

[0023] ;

[0024] screening out the application programming interface API i corresponding to R i ≥ 1 to form a target API disturbance set A add to be injected.

[0025] Further, the step S3 specifically further comprises:

[0026] querying the benign application feature database to obtain the average node total number F of the function call graph corresponding to each benign application;

[0027] obtaining the original node total number N and the non-custom function node number n noncus of the uploaded malicious APK file;

[0028] calculating the new node number d that each non-custom function in the malicious APK file needs to add in order to reach the average node size of the benign application, and the calculation formula of the new node number d is as follows:

[0029]

[0030] wherein the new node number d is rounded up

[0031] Further, the step S4 specifically comprises:

[0032] creating a brand new Smali file and a new class in the decompiled directory structure of the uploaded malicious APK file;

[0033] defining one or more new static methods in the newly created class; and injecting all API call codes corresponding to the determined target API disturbance set A add in the form of Smali assembly instructions into the inside of these new static methods;

[0034] Add these new static methods to a brand new Smali file.

[0035] Further, the step S4 specifically comprises:

[0036] Locate the Smali file set where the identified non-custom function is located;

[0037] According to the number of new nodes that each non-custom function needs to add, inject a corresponding number of new non-custom functions in the Smali file set;

[0038] Insert a call instruction between the newly injected non-custom function and the identified non-custom function;

[0039] Integrate the brand new Smali file and the modified Smali file set into the decompiled directory structure corresponding to the malicious APK file to form a final set of adversarial codes, and repack it as a final adversarial sample.

[0040] According to a second aspect of the present application, a computer readable storage medium is provided, which stores computer instructions, the instructions being executed by a processor to implement the steps of the method according to any one of the above aspects.

[0041] According to a third aspect of the present application, a computer device is provided, which comprises a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the method according to any one of the above aspects when executing the program.

[0042] Compared with the prior art, the present application has the beneficial effects that the present application discloses an Android malware universal adversarial sample generation method, and the method has significant and multi-faceted beneficial effects compared with the prior art. The most prominent advantage is its high universality and robustness. Traditional adversarial attacks, such as methods based on Jacobian matrix or reinforcement learning, usually design perturbations for the quadratic characteristics of specific detection methods, resulting in the need to recalculate and train the attack strategy when facing different detection methods, which consumes a large amount of time and resources. The present application focuses on imitating the underlying basic features-function call graph, and through universal perturbation from the perspectives of nodes, edges and application programming interfaces, the generated adversarial samples can effectively evade multiple typical detection methods based on different feature sets at the same time, with a minimum evasion rate of 85.26%, which greatly surpasses the targeted limitations of the prior art. Secondly, the beneficial effects of the present application are reflected in the practicality and functional integrity. It successfully designs a Smali code modification mapping scheme from the feature space to the problem space, and through the addition of new non-custom functions and application programming interfaces that are not called or only perform simple operations, it ensures that the malicious application is completely unaffected in terms of function and operation, solving the defect of many previous theoretical attack schemes that lack practical software code-level attack capabilities, so that the PS_ASR index can reach 100%. BRIEF DESCRIPTION OF DRAWINGS

[0043] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed in the embodiments will be briefly introduced as follows. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0044] Figure 1 A flowchart of an Android malware universal adversarial sample generation method provided by the first embodiment of the present application;

[0045] Figure 2 A schematic diagram of the modifier provided by the first embodiment of the present application injecting d new non-custom functions in the Smali file;

[0046] Figure 3 An experimental result graph of attack success rate under different addition amounts provided by the first embodiment of the present application. DETAILED DESCRIPTION

[0047] In order to make the purpose, features and advantages of the present application more obvious and easy to understand, the specific embodiments of the present application will be described in detail below with reference to the drawings.

[0048] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used in the description herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used herein, the term "and / or" includes any and all combinations of one or more of the associated listed items.

[0049] Embodiment 1

[0050] Referring to Figure 1 The application provides an Android malware universal adversarial sample generation method, specifically comprising the following steps:

[0051] Step S1, receiving a user uploaded malicious APK file, and constructing a target function call graph corresponding to the APK file;

[0052] Firstly, the application adopts a web application platform based on Flask and Vue framework as a core technical scheme carrier. The platform constructs an intuitive and professional client interface, realizes the safe uploading and management of the to-be-detected malicious APK (Android application package) file, and allows the user to configure key attack parameters, such as the expected evasion rate, the maximum feature perturbation budget, etc. After the platform receives the user uploaded malicious APK file, it immediately performs file format verification and integrity check, and generates a unique identifier thereof, so as to track and avoid repeated processing in the subsequent stage. This operation ensures that the subsequent analysis is based on an effective input sample.

[0053] Then, the code structure is converted and parsed. The system calls Apktool, dex2jar or similar decompilation tools to perform unpacking operation on the malicious APK file, converts it into readable and modifiable Smali code file, and all generated Smali files are organized into a directory structure accessible to the program. It should be noted that Smali code, as an assembly language used by Dalvik virtual machine, is an essential intermediate representation form for realizing the mapping from feature space to problem space.

[0054] Subsequently, the platform enters the preparation stage of extracting core static feature information: preparing mature static program analysis framework; these frameworks are configured to process large-scale Smali code file sets and perform inter-process control flow and data flow analysis. Based on the prepared code files and analysis framework, the system starts to construct a target function call graph.

[0055] The static analysis framework is used to perform comprehensive inter-process analysis on the Smali code file set, track the calling relationship between all functions in the program, and build a target function call graph (FCG) corresponding to the APK file. The target function call graph is a directed graph, each node in the graph represents a function or an API in the Smali code file, and each edge represents an explicit calling relationship.

[0056] Step S2, traverse all nodes in the target function call graph, identify all custom functions, non-custom functions and APIs in the nodes, and output an initial feature vector according to the total number of custom functions and non-custom functions, and the global parameters of the API set and the target function call graph;

[0057] Specifically, the step S2 specifically includes:

[0058] Step S21, traverse all nodes in the target function call graph (FCG), and determine the custom functions, non-custom functions and APIs in all nodes according to the characteristics of the nodes;

[0059] For example, the characteristics of the nodes include characteristic information such as the function name, package name and class name of the nodes; when the characteristic information of the node includes the function name, it indicates that the node is a custom function or a non-custom function; otherwise, it indicates that the node is an API. Further, if it is determined that the node is a function node derived from the Android system framework, a third-party library or a commonly used software development kit (SDK), it indicates that the node is a non-custom function; otherwise, it indicates that the node is a code function written by an application developer.

[0060] Step S22, count the number n cus of custom functions and the number n noncus of non-custom functions.

[0061] After traversing all nodes in the FCG, the code functions written by the application developer are determined, and the number n cus of custom functions can be counted; similarly, after traversing all nodes in the FCG, the function nodes derived from the Android system framework, third-party libraries or commonly used SDKs are determined, and the number n noncus of non-custom functions can be counted.

[0062] Step S23, extract the API set and count the global parameters of the target function call graph;

[0063] Specifically, all APIs belonging to Google's official definition and available for counting are collected to form an API set A malMeanwhile, the platform counts the global parameters of the FCG; wherein, the global parameters of the FCG include the total number of original nodes N and the total number of edges E.

[0064] Step S24, encapsulating all the counted parameters and data to construct an initial feature vector X;

[0065] Wherein, the initial feature vector is a structured data set, which contains the key parameters of A mal , n cus , n noncus , N and E. The platform takes the initial feature vector X as data input and outputs to the next stage.

[0066] Step S3, according to the output initial feature vector, referring to the usage frequency of each application programming interface in the benign application feature database and the malicious application corpus and the total number of nodes statistics, determining the target API disturbance set to be injected and the number of new nodes to be added for each non-custom function, to output a feature disturbance vector;

[0067] Specifically, the platform first queries the benign application feature database, which pre-stores the average frequency G={g1, g2,..., g i} of each application programming interface (API) in a large number of benign applications, and the average frequency M={m1, m2,..., m i} of each application programming interface (API) in the malicious application corpus.

[0068] Meanwhile, the platform obtains the API set A mal extracted in step S23. For each application programming interface API i in the API set, the platform calculates its frequency ratio R i in benign and malicious applications, which is used to quantify its simulation value. The higher the ratio R i , the more the API represents the characteristics of benign applications and the less likely it is to be used by malicious applications. The calculation formula of the ratio R i is as follows:

[0069] ;

[0070] In the formula, g i represents the average frequency of the application programming interface API i in the benign application feature database; m i represents the average frequency of the application programming interface API i in the malicious application corpus.

[0071] Further, the platform determines the target API disturbance set to be injected and the number of new nodes to be added for each non-custom function according to R ithe value of the screening operation is executed, the target API disturbance set A to be injected is determined add : R i ≥1 corresponding application programming interface API i is screened out to form the final target API disturbance set A to be injected add .

[0072] In addition, the platform also queries the benign application feature database to obtain the average node total number F of the benign application FCG, which represents the expected complexity of the benign application in structure. Secondly, based on the complexity F of the benign application and the original node total number N and the non-custom function node number n noncus corresponding to the malicious APK file uploaded in the last stage, the platform calculates the number d of new nodes that need to be added to each non-custom function in order to achieve the average node size of the benign application. The calculation formula of the new node number d is as follows:

[0073] ;

[0074] It should be noted that the new node number d must be rounded up to ensure the effectiveness of the disturbance.

[0075] Since the custom function node in the malicious application is frequently called, and the non-custom function in the benign application is more likely to be called or call other functions. Therefore, the calling relationship should be added to the non-custom function node to dilute the malicious features and imitate the benign features. Specifically, after determining the d new nodes to be added, the platform designs a specific calling chain structure to achieve the simultaneous injection of nodes and edges; that is, to determine how the d new nodes to be added will be called, and to build a chain calling structure to change the topology and node centrality of the FCG to the greatest extent while maintaining the structure and controllability. Finally, all the calculation and design results are packaged to form the feature disturbance vector ΔX.

[0076] Step S4, according to the output feature disturbance vector, create new classes and static methods that do not execute and inject the target API disturbance set; locate each non-custom function identified, and according to the calculated number of nodes to be added, inject a corresponding number of new non-custom functions, and build the calling relationship between each non-custom function identified and the new non-custom function; integrate the file generated after injecting the target API disturbance set and the new non-custom function to generate an adversarial sample;

[0077] Specifically, the platform first calls an API Smali injector. The injector creates a new Smali file and a new class in the decompiled directory of the uploaded malicious APK file according to the function lossless principle. The injector defines one or more new static methods in the newly created class. Subsequently, a determined target API perturbation set A add corresponding API call code in the form of Smali assembly instructions is injected into the interior of the new static methods, and finally the new static methods are added to the new Smali file. After the completion of the instruction injection, the injector must ensure the integrity of the isolation. That is, there cannot be any call instructions to the newly created methods and classes in the original malicious application code.

[0078] Secondly, the FGG structure modifier first locates to the Smali files in which the non-custom functions identified according to the above steps are located; as described above, the Smali files are obtained by performing the unpacking operation on the APK file. According to the number d of nodes to be added calculated according to the above steps, the FGG structure modifier injects d new non-custom functions in each Smali file, as shown in Figure 2 wherein, Figure 2 (a) in the above formula (1) indicates that the number of added new non-custom functions is 0; Figure 2 (b) in the above formula (1) indicates that the number of added new non-custom functions is 1; Figure 2 (c) in the above formula (1) indicates that the number of added new non-custom functions is 2; Figure 2 (d) in the above formula (1) indicates that the number of added new non-custom functions is 3.

[0079] It should be noted that after performing the unpacking operation on the uploaded APK file, a plurality of Smali files can be obtained; each Smali file includes a plurality of code blocks; and each code block includes a custom function or a non-custom function and a plurality of application programming interfaces.

[0080] It should be further noted that since it is necessary to ensure that all modifications are performed within a safe and controllable range, since some APIs and non-custom functions are not modifiable, we collectively refer to these nodes as FLF classes; they represent the hard limit of code modification and cannot be modified at the application layer; adding new non-custom functions to them can cause the application to crash; therefore, when the node belongs to the FLF class, even if the node is a non-custom function, in the present embodiment, no call relationship with the new non-custom function will be added.

[0081] Then, call instructions are sequentially inserted between the d newly injected non-custom functions. By way of example and not limitation, as shown in Figure 2 the call instruction to c1 is inserted at the end of the new function c2, and the call instruction to c3 is inserted at the end of the new function cd at the end of the call instruction of c d-1 call instruction of the identified non-custom function. For example, in (d) of Figure 2 For function 3, when multiple new function nodes (function 5, function 8 and function 10) need to be added, the identified non-custom function 3 will call all the new functions, and the new functions will also be called in sequence, function 10 calls function 8, function 8 calls function 5, thereby constructing a complex call chain structure that simulates the characteristics of benign applications without affecting the application function. Through the above method, the FCG structure of the malicious APK file is changed, making it similar to benign application programs in terms of node number, type, call frequency and call relationship, thereby completing the disturbance of the theoretical characteristics at the feature space level. Among them, the injected new non-custom function is a non-custom function that only performs simple arithmetic operations and a call chain to maintain the original malicious application function unchanged.

[0082] Finally, the Smali file generated by the API Smali injector and the Smali file modified by the FCG structure modifier are integrated into the decompiled directory structure corresponding to the uploaded malicious APK file to form the final set of countermeasures code, and then repackaged into the final countermeasures sample.

[0083] In summary, the present application provides a general anti-malware sample generation method for Android. First, the platform uses Vue.js to build an intuitive and professional client interface, enabling the secure upload and management of malicious APK files. In the platform backend, the uploaded APK files are first subjected to deep decompilation, converting the APK files into readable and modifiable Smali code files. A comprehensive inter-process analysis is performed on the Smali code file collection, tracing all function-to-function and function-to-API call relationships in the program, thereby constructing the target function call graph (FCG) corresponding to the APK file. Second, the platform iterates through all nodes in the target function call graph, identifying custom functions, non-custom functions, and APIs in all nodes. Then, by referencing the usage frequency of application programming interfaces in the benign application feature database and the malicious application corpus, as well as the node total number statistics, the target API disturbance set to be injected and the number of new nodes to be added to each non-custom function are determined. Subsequently, the backend performs a precise code mapping and repackaging process. At the Smali code level, a new class and method that do not execute are created to inject the target benign API disturbance set. Meanwhile, new non-custom functions that only perform simple arithmetic operations are added as nodes in existing non-custom functions, and a new call chain structure is constructed, ensuring that the malicious application functionality remains unchanged while the FCG structure and API statistics are effectively modified, thereby achieving general imitation of the underlying basic features. Since the added new functions and APIs are not called or only perform simple operations, it is ensured that the malicious application is completely unaffected in terms of functionality and operation, addressing the lack of practical software code-level attack capabilities in many previous theoretical attack schemes, enabling the PS_ASR index to reach 100%.

[0084] Experimental analysis

[0085] To comprehensively analyze the effectiveness of the present application method and its performance in different scenarios, the experiment will focus on the following five core objectives:

[0086] 1. On the existing static detection method for Android malicious applications, the effectiveness of the feature space and problem space scheme is verified through the experimental results of different mimetic objects.

[0087] 2. The attack effect when the number of modifications is different is verified, and the attack effect under different years of data is compared.

[0088] 3. Comparison and analysis of the effectiveness of the present application method and other attack methods.

[0089] 4. Attack effect verification under robust detection methods.

[0090] 5. Overhead and efficiency evaluation.

[0091] The CICInvesAndMal2017 dataset contains 426 malicious applications. These samples come from 42 unique malware families and categorize these malicious applications into four categories. This dataset collects malicious applications from 2015 to 2017.

[0092] The CICMalDroid2020 dataset contains 9803 malware, categorized into four categories: adware, banking malware, SMS malware, and riskware. This dataset collects malicious applications since 2018.

[0093] The Drebin dataset is a well-known dataset that has been used in many studies. This dataset contains 5560 applications from 179 different malware families. This dataset collects malicious applications from 2010 to 2012.

[0094] FS_ASR: This metric is used to measure the proportion of adversarial samples that successfully deceive the target detection model in the feature space. Among them represents the number of samples that can evade detection in the feature space. represents the total number of samples, as follows:

[0095] ;

[0096] PS_ASR: This metric is used to measure the proportion of successful adversarial samples in the feature space that, after actual repackaging, can still successfully evade the detection system and remain functional. represents the number of samples that can successfully repackaged in theoretical successful samples. represents the number of samples that can successfully run and ultimately successfully evade detection in successfully repackaged samples.

[0097] ;

[0098] 1.1 Comparison analysis of imitated objects

[0099] In the imitation scheme, we divide the imitated objects into nodes and edges. Among them, in the node imitation, we advocate increasing API (frequently appearing in benign applications) and non-custom function nodes. In the edge imitation, we advocate increasing the calls between non-custom function nodes, therefore, in order to verify the rationality of our implementation, we conduct a control test. According to the imitated objects, we divide into four cases:

[0100] A1: Increase the frequently appearing API in benign applications (advocate).

[0101] A2: Add other APIs.

[0102] B1: Add non-custom functions and add call relationships for non-custom functions (recommended).

[0103] B2: Add custom functions and add call relationships for custom functions.

[0104] The experimental results are shown in Table 1, which clearly shows that the attack effects of different simulation combinations are significantly different. Among them, the combination using the A1 node simulation scheme has a significant escape effect on API list or feature statistics methods (Drebin and FCSCNN). The combination of B1 edge simulation scheme is more prone to attack methods based on function call relationships or FCG semantics (Mamadroid and Malscan). The A1+B1 simulation scheme combination we recommend shows the best attack performance, and its attack success rate has a clear advantage compared to other control schemes. Therefore, by simultaneously simulating the nodes and edges of FCG, we can simultaneously attack syntax feature detection methods represented by API lists and semantic feature detection methods represented by function call relationships, thereby achieving a general attack on a wider range of AMD systems.

[0105] At the same time, we also verified the feasibility of the software code modification scheme, that is, the mapping ability from feature space to problem space. When mapping to problem space, we repackaged the code of the malicious application that successfully attacked the feature space. Due to the anti-repacking strategy contained in the application itself, there were 3.12% to 12.35% of the application programs that could not be successfully repackaged, but this was not caused by our operation. For all successfully repackaged application programs, we ran the verification on the emulator, and all could run normally. After re-detection, these samples achieved 100% escape success rate on all target detection methods. This strongly proves that our method successfully realizes the accurate mapping from feature space to problem space, and completes the software-level attack on the premise of not damaging the application function.

[0106] Table 1 Comparison and analysis experimental results of different simulation objects on multiple data sets

[0107]

[0108] 1.1 Attack effect and overhead analysis

[0109] In the simulation scheme, we analyze by comparing the attack success rate under different addition amounts, and take the experimental results on the CIC2020 dataset as an example, as shown in Figure 3The experimental results show that the attack effect is positively correlated with the disturbance amount. For detection methods that rely on API lists, such as Drebin and FCSCNN, the attack success rate continues to increase as the number of added APIs increases, and can reach 100% evasion rate when an average of about 400 APIs are added. At the same time, for methods that rely on FCG semantic features, such as Mamadroid, the increase in the number of newly added non-custom nodes also synchronously improves the attack rate. The data shows that in the ideal state without modification quantity limit, the attack success rate of all target detection methods can reach 100%. However, in order to make the adversarial sample closer to the benign application in the FCG structure, we cannot adopt the unlimited modification strategy. Therefore, after weighing the efficiency and concealment, we set a practical constraint. In the malicious application, only 20 new nodes are added around each non-custom node. This strategy is obtained through data analysis, which successfully ensures high attack efficiency while maximizing the structural concealment of the adversarial sample.

[0110] Embodiment 2

[0111] The application provides a computer readable storage medium, which stores computer instructions, and the instructions are executed by a processor to implement the steps of the method in embodiment 1.

[0112] Embodiment 3

[0113] The application provides a computer device, which comprises a memory, a processor and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the method in embodiment 1 when executing the program.

[0114] It should be understood that, for those skilled in the art, improvements or changes can be made according to the above description, and all these improvements and changes shall belong to the protection scope of the appended claims of the application. The parts not described in detail in the specification belong to the prior art known to those skilled in the art.

Claims

1. A method for generating universal adversarial samples of Android malware, characterized in that, Specifically comprising the following steps: Step S1, receiving a user uploaded malicious APK file, and constructing a target function call graph corresponding to the APK file; Step S2, traversing all nodes in the target function call graph, identifying custom functions, non-custom functions and APIs in all nodes, and outputting an initial feature vector according to the total number of custom functions and non-custom functions, and the global parameters of the API set and the target function call graph; Step S3, according to the output initial feature vector, referring to the frequency of occurrence of each application programming interface in the benign application feature database and the malicious application corpus and the node total number statistical result, determining the target API perturbation set to be injected and the number of new nodes to be added to each non-custom function, to output a feature perturbation vector; Step S4, according to the output feature perturbation vector, creating new classes and static methods that do not execute and injecting the target API perturbation set; locating each non-custom function identified, and according to the calculated number of nodes to be added, injecting a corresponding number of new non-custom functions, and constructing the call relationship between each non-custom function identified and the new non-custom function; The file generated after injecting the target API perturbation set and the new non-custom function is integrated to generate an adversarial sample; The step S3 specifically comprises: querying the average frequency of occurrence of each application programming interface in the benign application feature database G = {g1, g2,..., g i} query the average frequency of each application programming interface appearing in the malicious application corpus M = {m1, m2,..., m i}; for each application programming interface API in the set of APIs i , compute its frequency ratio R i in benign and malicious applications i ; wherein the ratio R i is computed as follows: ; R i ≥1 corresponding application programming interface, API i filtered out, constituting a target API perturbation set A to be injected add ; The step S3 specifically further comprises: Querying the benign application feature database to obtain the average node total number F of the function call graph corresponding to each benign application; Obtaining the total number N of original nodes and the number n of non-custom function nodes corresponding to the uploaded malicious APK file noncus ; The number d of new nodes to be added to each non-custom function in the malicious APK file to achieve the average node size of the benign application is calculated, and the calculation formula of the new node number d is as follows: ; Wherein, the new node number d is rounded up.

2. The method of claim 1, wherein the method further comprises: The step S1 specifically comprises: Performing unpacking operation on the malicious APK file to convert it into a Smali file set; and the generated Smali file set is organized into a directory structure for program access; Performing comprehensive inter-process analysis on the Smali file set to track all function-to-function and function-to-API call relationships in the program to construct a target function call graph; wherein the target function call graph is a directed graph, each node in which represents a function or an API in the Smali file set, and each edge represents an explicit call relationship. 3.The method of claim 1, wherein, The step S2 specifically comprises: Step S21, traversing all nodes in the target function call graph, and determining custom functions, non-custom functions and APIs in all nodes according to the characteristics of the nodes; Step S22, counting the number n of self-defined functions cus and the number n of non-self-defined function nodes noncus ; Step S23, extracting the API set and counting the global parameters of the target function call graph; Step S24, encapsulating all the counted parameters and data to construct an initial feature vector X.

4. The method of claim 2, wherein the method further comprises: The step S4 specifically comprises: Creating a new Smali file and a new class in the reverse compilation directory structure of the uploaded malicious APK file; Define one or more new static methods in this new class; and determine the target API perturbation set A add Corresponding all API calling codes are injected into the interior of these new static methods in the form of Smali assembly instructions; Add these new static methods to the new Smali file.

5. The method of claim 4, wherein the method further comprises: The step S4 specifically further comprises: Locating the Smali file set in which the non-custom function identified is located; According to the number of new nodes that each non-custom function needs to add, inject a corresponding number of new non-custom functions in the Smali file set; Insert a call instruction between the newly injected non-custom function and the identified non-custom function; Integrate the brand new Smali file and the modified Smali file set into the decompiled directory structure corresponding to the malicious APK file to form the final set of countermeasures code, and repack it as the final countermeasures sample.

6. A computer readable storage medium having stored thereon computer instructions, wherein, The instructions, when executed by a processor, implement the steps of the method of any one of claims 1-5.

7. A computer device comprising a memory, a processor, and a computer program stored on the memory and capable of running on the processor, characterized in that, The processor executes the program to implement the steps of the method of any one of claims 1-5.

Citation Information

Patent Citations

  • PE malicious software confrontation sample automatic generation method, system and equipment

    CN117609997A

  • Android malicious software adversarial sample generation method and computer program product

    CN118862071A