Android malicious software detection method based on multi-feature deep fusion
Through the multi-feature deep fusion model combined with sensitive permissions, opcodes and function call graph features, the problem of incomplete coverage of single feature detection is solved, the accuracy and adaptability of malware detection is improved, and the missed detection and false alarm rates are reduced, so as to achieve More efficient malware identification.
Patent Information
- Application Number
- CN202410938326.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-13
- Publication Date
- 2024-11-01
AI Technical Summary
Existing Android malware detection methods have problems with incomplete coverage and low feature utilization when using a single feature, especially when facing complex and changing malware behavior, resulting in high false alarms and missed response rates, and multiple features are directly Splicing leads to high-dimensionality and information redundancy.
Using a method based on multi-feature deep fusion, the function call graph features are extracted through the improved graph attention network, and combined with sensitive permission features and opcode features, a multi-feature deep fusion model MFDF is constructed to carry out multi-level feature fusion and nonlinear transformation. , malware detection using XGBoost classification model.
It significantly improves the accuracy and adaptability of malware detection, reduces the rates of missed detection and false alarms, can more comprehensively capture the multi-dimensional characteristics of malware, enhances the ability to identify complex behaviors, and improves the robustness of the detection system. Sex and efficiency.
Smart Images

Figure CN118886009A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of information security technology, and in particular to Android malware detection. Specifically, it is an Android malware detection method based on multi-feature deep fusion, which is used for identifying and preventing malware in the field of mobile device security. Background Art
[0002] With the development of the Internet and communications industry, the usage rate of mobile phones has increased rapidly. Smart phones have also entered thousands of households and are playing an increasingly important role in people's lives. Various mobile applications such as navigation, recruitment, food delivery, and audio-visual entertainment have provided great convenience for people's lives. The rapid development momentum in the mobile phone field has not only attracted many developers and investors, but also attracted the attention of many attackers. More and more network hackers and illegal organizations are focusing their attacks on mobile users.
[0003] In the ecosystem of Android malware, malicious behaviors are mainly concentrated in three aspects: software installation methods, behaviors that trigger malicious payloads, and the manifestations of malicious payloads after they are triggered. First, malware can spread rapidly through installation methods such as repackaging, update packages, and drive-by downloads. Second, in order to trigger malicious payloads, malware uses a variety of means, including inducing users to click on false advertisements or deceptive links, and monitoring event triggers to trigger subsequent malicious operations by monitoring specific user behaviors. Remote control, phone bill absorption, privacy theft, and self-protection mechanisms. This diversity of malicious behavior strategies makes malware more deceptive and harmful, posing a threat to user privacy and device security. These malwares pose a major threat to user property safety through various fraud scenarios such as order brushing, online loans, false investment and financial management, and extortion. These data intuitively reflect the depth of the malware's harm and the wide range of its impact.
[0004] In recent years, deep learning technology has been widely used in the field of Android malware detection, which has significantly improved the detection speed and accuracy of Android malware compared with traditional identification methods. The detection methods mainly include dynamic analysis methods and static analysis methods. Dynamic analysis is a powerful Android malware detection technology. Its core lies in running applications in real time in a controlled environment and observing and analyzing their runtime behaviors, system interactions, network communications and other key behaviors to identify potential malicious behaviors. Static analysis is an efficient Android malware detection technology. Its core lies in identifying potential malicious behaviors by analyzing static information such as source code, binary files, and configuration files without actually running the application. This method focuses on in-depth analysis of the internal structure and logic of the application, including code structure, function calls, data flow, etc.
[0005] For the research on Android malware detection methods, dynamic methods usually provide high detection accuracy and ensure the ability to detect unknown malware. However, the detection process is complex and requires a lot of computing resources. In addition, dynamic methods usually cannot traverse all possible execution paths of the application, which may lead to missed detections. Static methods do not need to run the application, so the detection efficiency is high and can be effectively used for large-scale Android application detection. However, existing static analysis methods often rely on a single feature, which has incomplete coverage and is difficult to fully describe the diverse behaviors of malware, resulting in a high missed detection rate. Although a few static analysis methods attempt to overcome this limitation by combining multiple features, they often simply concatenate these features. Although this method seems comprehensive on the surface, it may actually lead to the curse of dimensionality and information redundancy, which not only increases the computational burden, but also may have a negative impact on the performance and interpretability of the model. Summary of the invention
[0006] The purpose of the present invention is to propose an Android malware detection method based on multi-feature deep fusion with higher accuracy and stronger adaptability in view of the existing problems and shortcomings of the prior art.
[0007] The present invention is an Android malware detection method based on multi-feature deep fusion, which is characterized by improving the graph attention network for extracting function call graph features, constructing a multi-feature deep fusion model MFDF for fusing sensitive permission features, operation code features and function call graph features, and comprising the following steps:
[0008] Step 1) Obtain a data set containing malware samples and benign software samples: obtain Android malware samples and benign software samples, mark each sample according to whether it has malicious behavior, and finally obtain an Android software sample data set with annotations, where all malware samples and benign software samples are APK files;
[0009] Step 2) Decompile the APK file to obtain a decompiled resource file: Use the decompilation tool Apktool to process the annotated Android software sample data set to obtain a decompiled resource file, which includes a configuration file AndroidManifest.xml, a source code file, and a bytecode file Dalvik executable file;
[0010] Step 3) Extract and generate sensitive permission feature vector: parse the AndroidManifest.xml file, extract the requested permissions and construct a permission list, then extract the sensitive permission features in the permission list according to StormDroid's sensitive permission list, and generate a sensitive permission feature vector P;
[0011] Step 4) Extract and generate an opcode feature vector: parse the Dalvik executable file, extract the opcode features, embed the opcode features and input them into the bidirectional long short memory network BiLSTM for training to generate the opcode feature vector O;
[0012] Step 5) Construct an improved graph attention network and extract the function call graph feature vector: introduce a maximum pooling operation module into the graph attention network GAT; place the module after the graph attention network GAT to form an improved graph attention network architecture; under this architecture, extract the features of the function call graph; the function call graph represents the calling relationship between functions, each node represents a function, and the edge between nodes is a directed edge, indicating that one function calls another function; embed the function call graph using node embedding and edge embedding; first extract local features from the function call graph through the graph attention network GAT; then aggregate the output of GAT through the maximum pooling operation to obtain the global features of the function call graph; concatenate the two features to generate the function call graph feature vector F;
[0013] Step 6) construct a multi-feature deep fusion model MFDF and perform multi-feature deep fusion: the constructed multi-feature deep fusion model MFDF is a neural network with a multi-level fully connected architecture, which includes a mapping layer, a fusion layer and an output layer in sequence; the input of the multi-feature deep fusion model MFDF is a sensitive permission feature vector P, an operation code feature vector O and a function call graph feature vector F, and multi-feature deep fusion is performed in the fusion layer of the multi-feature deep fusion model MFDF to obtain a feature fusion vector R, which contains a description of malicious behavior of malware. After fusion, the feature fusion vector R is output through the output layer of the multi-feature deep fusion model MFDF to output a feature vector suitable for classification tasks; the multi-feature deep fusion model MFDF is used to perform multi-feature deep fusion; the multi-feature deep fusion model MFDF uses a multi-level fully connected layer architecture to perform feature dimension reduction, nonlinear transformation and multi-feature fusion of features in the fusion layer;
[0014] Step 7) Training the XGBoost classification model: Use the XGBoost classification model to train the feature fusion vector R; after the training is completed, the XGBoost classification model accurately detects Android malware based on the feature fusion vector R, that is, outputs the category to which the detection sample belongs;
[0015] Step 8) Detect Android malware: After the Android software to be detected is processed through the above steps 2-5, it is passed into the trained multi-feature deep fusion model MFDF for fusion and classified through the XGBoost classification model, and the category to which the sample belongs is output to complete the Android malware detection.
[0016] The present invention solves the problems of incomplete coverage and low feature utilization rate faced by static methods using a single feature in Android malware detection, the inadequacy of adapting to diverse malicious samples, and the high dimensionality and information redundancy caused by directly splicing multiple features.
[0017] Compared with the existing Android malware inspection method, the present invention has the following advantages:
[0018] Higher accuracy: The present invention proposes an Android malware detection method based on multi-feature deep fusion, which can capture the semantic information, structural information and behavioral information of malware by combining sensitive permissions, opcodes, and function call graph features and performing deep fusion processing, and can more effectively identify the multi-dimensional characteristics of malware, ensuring comprehensive coverage of malicious behaviors, thereby improving the accuracy of detection. In traditional detection methods, analysis often relies on a single feature, which can easily lead to false positives and missed positives, especially when faced with complex and changeable malware behaviors. The present invention combines the semantic information of sensitive permissions, the behavioral information of opcodes, and the structural information of function call graphs through multi-feature deep fusion, thereby improving the accuracy of Android malware detection.
[0019] Stronger adaptability: The present invention designs a composite-level feature deep fusion model MFDF, which enhances the adaptability of Android malware detection by fusing multiple features, including opcode features that reveal the behavioral information of the execution logic of Android malware, sensitive permission features that provide semantic information of Android malware, and function call graph features that represent the calling relationship and structural information between internal functions of Android malware. The feature deep fusion model MFDF processes these features step by step through a series of fully connected layers, each layer inherits features from the previous layer and further mines deeper information, which not only enhances the expressiveness of features, but also enhances adaptability to the diversity of malware.
[0020] Lower missed detections and false alarms: The present invention can comprehensively characterize Android malware and reduce missed detections and false alarms by deeply fusing multiple features. Each layer in the feature fusion process performs dimensional adaptation and nonlinear transformation to ensure the effective fusion of different features, enhance the complementarity between features, and avoid the high dimensionality and information redundancy problems caused by direct splicing. The present invention not only improves the information utilization between features, but also improves the accuracy of Android malware detection and reduces the missed detection and false alarm rates in the Android malware detection process through the feature deep fusion model MFDF. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 It is a flowchart of the present invention;
[0022] Figure 2 This is the overall framework diagram of the multi-feature fusion Android malware detection technical solution of the present invention;
[0023] Figure 3 It is a structural framework diagram of the multi-feature deep fusion model MFDF of the present invention;
[0024] Figure 4 It is a bar graph of the accuracy and F1 value of different feature combinations of the present invention.
[0025] To more clearly describe the purpose, method and advantages of the present invention, an Android malware detection method based on multi-feature fusion will be described below with reference to the accompanying drawings. DETAILED DESCRIPTION
[0026] Example 1: In the current digital age, with the popularity of mobile devices, the malware threats faced by the Android platform are also increasing. Although the field of Android security has developed a certain degree of automated detection technology, such as signature matching and behavioral analysis, these technologies are effective in identifying and isolating known malware, greatly improving processing speed and reducing dependence on manpower. However, when faced with the identification and classification of new Android malware, traditional methods often seem inadequate due to the diversity and complexity of Android malware. The present invention uses expansive thinking, through analysis, research and experiments, to propose an Android malware detection method based on multi-feature deep fusion.
[0027] The present invention is an Android malware detection method based on multi-feature deep fusion. The present invention improves the graph attention network to extract function call graph features and constructs a multi-feature deep fusion model MFDF to fuse sensitive permission features, operation code features and function call graph features. Figure 1 , Figure 1 The flowchart of the present invention includes the following steps:
[0028] Step 1) Obtain a dataset containing malware samples and benign software samples: Obtain Android malware samples and benign software samples, obtain the corresponding data usage license and API access rights from the AndroZoo official website, and write a crawler script. Through the API provided by the website and the hash value of each Android software, you can download sample data containing malware and benign software. Then, mark each sample based on whether it has malicious behavior, use VirusTotal, an online security service platform, to perform a comprehensive security test on each Android software sample, and delete invalid or damaged Android software samples based on the analysis report of VirusTotal to ensure that all samples in the dataset are valid. In addition, each Android software sample is accurately marked for malicious behavior. Android software samples with malicious behavior are marked as 1, and Android malware without malicious behavior is marked as 0. Finally, a dataset of labeled Android software samples is obtained, in which all malware samples and benign software samples are APK files.
[0029] Step 2) Decompile the APK file to obtain the decompiled resource file: Use the decompilation tool Apktool to process the annotated Android software sample data set to obtain the decompiled resource file, see Figure 1 , which includes the configuration file AndroidManifest.xml, source code files and bytecode files Dalvik executable files. AndroidManifest.xml, this configuration file records the basic information of the application and the permissions requested in detail, providing a basis for understanding the behavior of the application, which contains sensitive permission characteristics. Although the source code file does not contain direct business logic, it is crucial for analyzing the application structure and potential security issues. The Dalvik bytecode file is an intermediate representation unique to the Android platform, which provides a basis for understanding how the application interacts with the system, and contains opcode characteristics and function call graph characteristics.
[0030] Step 3) Extract and generate sensitive permission feature vectors: parse the AndroidManifest.xml file and extract the <uses-permission>The permission field corresponding to the tag is used to obtain all permissions applied by the application and construct a permission list N. The sensitive permission features in the permission list N are extracted according to the sensitive permission list of StormDroid. The sensitive permissions described include: the permission to access location information, the permission to read contacts, and the permission to access call records. The permission to access location information refers to the API in the Android system that requires permission to obtain the user's geographic location. The permission to read contacts refers to the method that may access or modify the user's contact data. The permission to access call records includes the function of obtaining the user's call history and details. In addition, sensitive permissions also cover functional permissions involving user privacy information such as sending text messages, reading text messages, using the camera, and recording. According to the above sensitive permission content, a sensitive permission list M containing a total of 59 sensitive permissions is constructed and a 59-dimensional sensitive permission feature vector with all initial values set to 0 is set. Finally, by traversing the sensitive permission list M, check whether each permission exists in the permission list N. If it exists, the dimension corresponding to the sensitive permission feature vector is set to 1. If it does not exist, no setting is made. Through this process, a 59-dimensional feature vector P is formed to characterize the characteristics of sensitive permissions requested by the application. It can accurately characterize the sensitive permissions applied for by the application and achieve fine-grained analysis of sensitive permission characteristics.
[0031] Step 4) Extract and generate opcode feature vectors: Parse the Dalvik executable file and extract all opcodes, which essentially map the lowest-level behavior patterns of the application. Give each unique opcode a unique integer code, and use a dynamic padding strategy to automatically calculate and pad to the length of the longest sequence in each batch of data based on the length difference of the opcode sequence in each batch of data, ensuring that the model can uniformly process inputs from different batches. Construct a BiLSTM network. First, use an embedding layer to map the integer-coded opcodes to a dense vector of 512 dimensions, which can effectively capture the semantic relationship between opcodes and improve the quality of feature representation. Next, pack the padded sequence so that the BiLSTM network can correctly handle indefinite-length sequences and process it through a BiLSTM layer, which contains 2 hidden layers, each with 256 hidden units, and uses a dropout rate of 0.3 to capture the forward and backward information of the sequence. After passing through the BiLSTM layer, unpack the packed sequence, restore the padded sequence form, and obtain the last non-padded element of each sequence as the feature representation extracted by the BiLSTM. The forward and backward information of the opcode sequence is captured through the BiLSTM network to fully reflect the behavioral characteristics of the application. Then, the extracted features are further processed through a fully connected layer, which maps the 512-dimensional features to 64 dimensions and uses the Tanh activation function. Next, the Tanh activation function is applied to generate a feature vector as the final output of the model. This method of further processing features through a fully connected layer and a Tanh activation function can effectively reduce dimensions and capture nonlinear relationships, thereby providing a more compact and meaningful representation for feature fusion. Finally, a 64-dimensional feature vector O is generated for feature fusion.
[0032] Step 5) Construct an improved graph attention network and extract the function call graph feature vector: introduce the maximum pooling operation module in the graph attention network GAT. This module is placed after the graph attention network GAT to form an improved graph attention network architecture. Under this architecture, the features of the function call graph are extracted. The function call graph represents the calling relationship between functions, each node represents a function, and the edges between nodes are directed, indicating that one function calls another function. The function call graph is embedded using node embedding and edge embedding. The function call graph first extracts local features through the graph attention network GAT. Then the output of GAT is aggregated by the maximum pooling operation to obtain the global features of the function call graph. The present invention splices the two features to generate a function call graph feature vector F, and combines the global features and local features to make the function call graph feature representation more comprehensive and detailed. The present invention not only provides a more comprehensive description of the behavior model of Android software by improving the graph attention network GAT, but also improves the accuracy and efficiency of malware detection.
[0033] Step 6) Construct a multi-feature deep fusion model MFDF and perform multi-feature deep fusion: The constructed multi-feature deep fusion model MFDF is a neural network with a multi-level fully connected architecture, which includes a mapping layer, a fusion layer and an output layer in sequence. By fusing sensitive permissions, opcodes and function call graph features, Android software can be described more comprehensively. The input of the multi-feature deep fusion model MFDF is the sensitive permission feature vector P, the opcode feature vector O and the function call graph feature vector F. In the fusion layer of the multi-feature deep fusion model MFDF, multi-feature deep fusion is performed to obtain a feature fusion vector R, which contains a description of malicious behavior of malware. After fusion, the feature fusion vector R is output through the output layer of the multi-feature deep fusion model MFDF to output a feature vector suitable for classification tasks. The vector provides a more meaningful and compact representation, which helps to improve the accuracy and efficiency of malware detection. Use the multi-feature deep fusion model MFDF for multi-feature deep fusion. The multi-feature deep fusion model MFDF uses a multi-level fully connected layer architecture to perform feature dimension adaptation, nonlinear transformation and multi-feature fusion in the fusion layer. The multi-feature deep fusion model MFDF constructed by the present invention can combine features from different sources and better capture potential malicious behavior patterns.
[0034] Step 7) Train the XGBoost classification model: Use the XGBoost classification model to train the feature fusion vector R. During the training process, XGBoost gradually optimizes the model by stacking multiple decision trees. Each tree further refines the prediction based on the previous round, and enhances the accuracy and generalization of the model by adjusting the following parameters: the learning rate is 0.2, which helps to avoid overfitting, improves the generalization of the model, and controls the contribution of each tree to the model; the depth of the tree is 12, and the relatively high depth enables the model to capture more complex data patterns; in order to provide a stronger model and avoid and prevent overfitting, the number of trees is 80, which is inversely proportional to the learning rate; the minimum child weight is 1, which determines the minimum sample weight and of each leaf node; the sampling ratio is 1 and 0.6. Using different sampling ratios can increase the diversity of the model, thereby improving the generalization of the model. A sampling ratio of 1 means using all data, while 0.6 means using 60% of the data, which helps reduce overfitting; setting L1 regularization to 0 helps to produce a sparse model and reduce model complexity; and L2 regularization is 0.1, so that the model focuses on reducing variance, thereby improving the stability of the model. By fine-tuning these parameters, the XGBoost classification model can better capture the characteristics of the data and improve the accuracy and robustness of detection. After training, the XGBoost classification model accurately detects Android malware based on the feature fusion vector R, that is, outputs the category to which the detection sample belongs.
[0035] Step 8) Detect Android malware: The Android software to be detected is processed through the above steps 2-5, and sensitive permission features, operation code features, and function call graph features are extracted and fused; then, these original features are converted into high-dimensional dense vectors through feature processing and mapping layers, and then input into the trained multi-feature deep fusion model MFDF for deep feature fusion and nonlinear transformation, further improving the robustness and distinguishing ability of feature expression; finally, the fused feature vector is classified using the optimized XGBoost classification model. Output the detection result, identify whether the sample is malware or benign software, and complete Android malware detection.
[0036] The present invention is an overall technical solution. In order to solve the problems of incomplete coverage, low feature utilization, and adaptability to diverse malicious samples faced by traditional static methods using single features in Android malware detection, and the problems of high dimensionality and information redundancy caused by direct splicing of multiple features, the present invention integrates multiple features, uses advanced algorithms such as deep learning to perform deep fusion processing on features from different sources, uses BiLSTM networks and improved graph attention networks GAT to extract deep features, and uses a multi-feature deep fusion model MFDF to perform deep fusion on features from different sources through its multi-level fully connected architecture, which significantly improves the accuracy and adaptability of detection, and also optimizes the robustness of the detection process. The present invention can not only effectively adapt to and identify newly emerging malware, but also provide a powerful method for malware detection on the Android platform that is accurate, efficient, and scalable.
[0037] Embodiment 2: An Android malware detection method based on multi-feature fusion is the same as that in Embodiment 1, the improved graph attention network constructed in step 5 includes the following steps:
[0038] Step 5.1) Get the Graph Attention Network GAT: Load the Graph Attention Network GAT from the predefined model library PyTorch Geometric.
[0039] Step 5.2) Configure the multi-head attention mechanism in the graph attention network GAT: assign independent parameters to each head, and for each head k, calculate the attention weight e between nodes ij (k) , update the feature representation of the node, the specific formula is as follows:
[0040]
[0041] Where k represents the kth head, and these weights reflect the relationship between nodes i and j. The attention weight of each head is normalized using the softmax function to obtain the normalized attention weight α ij (k) , α ij (k) The calculation process is as follows:
[0042]
[0043] According to the normalized attention weights, the features of the adjacent nodes are weighted summed to obtain the node feature representation x under the attention head i (k) , the calculation process is as follows:
[0044]
[0045] Where σ is the nonlinear activation function ReLU. The multi-head attention mechanism is used to stabilize the training effect and capture diverse feature representations. Each head k performs the above attention calculation independently, and the features x output by all heads are i (k) Perform an averaging operation to obtain the comprehensive node feature x i .
[0046] The multi-head attention mechanism allows the model to learn the relationship between nodes from different perspectives. Each head can capture different features and patterns, thereby enhancing the model's ability to understand complex data structures. Through independent parameter allocation and normalization, the model can balance the contributions of different attention heads and avoid the dominant role of certain heads, thereby improving the generalization and stability of the model.
[0047] Step 5.3) Obtain the global features of the function call graph: Introducing the maximum pooling layer in the graph attention network GAT can retain the most important information in the node features and ignore redundant or noisy data, thereby enhancing the model's sensitivity to key features. Apply the maximum pooling layer on the node feature dimension, and select the maximum value on each feature dimension through the maximum pooling operation to obtain the global feature h of the function call graph. i .
[0048] Step 5.4) Get the function call graph feature vector: Introduce the average pooling layer in the graph attention network GAT. The average pooling layer can capture the global information of the entire graph by aggregating the concatenated vectors of all nodes, which helps the model understand the global structure and pattern in the graph. i and the global feature h i The concatenation is performed to form a concatenation vector of the node. The concatenation vectors of all nodes are aggregated using an average pooling operation to obtain a function call graph feature vector F.
[0049] The present invention constructs an improved graph attention network model, which learns the relationship between nodes from different perspectives through a multi-head attention mechanism. Each head can capture different features and patterns, thereby enhancing the model's ability to understand complex data structures. Through maximum pooling and average pooling operations, it can focus on local key information and global structure respectively, which helps the model understand and identify malicious behavior from multiple levels. The present invention constructs an improved graph attention network model that can extract local features and global features in the function call graph and combine them, thereby improving the accuracy of the model in detecting unknown Android malware.
[0050] Example 3: An Android malware detection method based on multi-feature fusion is similar to Example 1-2, and embedding is performed on the function call graph using node embedding and edge embedding, including the following steps:
[0051] Step 5.a) Node Embedding: Use the TF-IDF model to preprocess the node information. For each APK file, extract all the contents of its source code to form the original text, followed by a series of preprocessing steps: remove irrelevant characters, convert to lowercase, segment, remove stop words, and stem or restore to purify the data and standardize the text format. Based on these preprocessed texts, create a dictionary and corpus, where the dictionary contains all unique terms, and the corpus is a frequency representation of each document. Using the corpora.Dictionary class of the Gensim library, build a dictionary and filter out terms with extreme frequency, train the TF-IDF model, and convert the node information into a TF-IDF vector.
[0052] Build an LSI model and use it to process the TF-IDF vector of each node. The core of LSI is singular value decomposition, which is a method of decomposing matrices to extract and reduce the key features of data, retain the main structure and pattern of the data, and help reduce the complexity of subsequent processing. Perform singular value decomposition on the TF-IDF vector:
[0053] A=U∑V T
[0054] Among them, U and V are left and right singular vector matrices respectively, ∑ is a diagonal matrix, and the elements on its diagonal are singular values, arranged in descending order. The size of the singular value represents the energy or amount of information in the data. The largest singular values and their corresponding singular vectors contain the main structure and pattern of the data. Therefore, when performing data compression or feature extraction, usually only the first k largest singular values and their corresponding vectors are selected.
[0055] Calculate the minimum k value k min :Let n i Represents the number of Java files in the i-th APK file. Perform the operation on all m APK files and get a set N containing the number of all Java files:
[0056] N={n1,n2……n m }
[0057] Sort the elements in set N in ascending order to get N sorted , calculate the median Median(N):
[0058]
[0059] Given a preset maximum timestamp ts max , the minimum k value k min Calculate by the following formula and ensure that k min ≥1:
[0060]
[0061] In order to effectively reduce the data dimension and capture the most critical graph structure information, the selected k min singular values and corresponding singular vectors to construct a low-dimensional vector representation of each node. The vector representation of each node i can be obtained by the first k corresponding singular values in the matrix U. min The column vectors are given. These vectors provide the nodes in the most important k min The projection on the latent semantic dimension finally obtains the vector representation of each node feature.
[0062] Step 5.b) Edge Embedding: For edge information, use the function call relationship to generate an adjacency matrix A, which is used to represent the direct call relationship between functions. First, determine the total number of functions N and initialize an N×N matrix A. Then, traverse the function call relationship information list, and for each pair of direct call relationships (i, j), set the corresponding element A[i][j] in matrix A to 1, indicating that function i directly calls function j. The adjacency matrix reflects the direct call relationship between functions. This binary relationship helps to identify direct dependencies between functions.
[0063] The present invention preprocesses node information through TF-IDF and LSI models, accurately extracts and reduces the dimension of key features, makes the semantic information of each node clearer, thereby improving the feature expression and reducing the computational complexity. At the same time, an adjacency matrix is constructed to represent the direct call relationship between functions, accurately captures the structural information in the function call graph, and ensures the comprehensiveness and accuracy of feature extraction. The combination of the two can not only fully capture the semantic and structural characteristics of malware, but also greatly improve the accuracy and adaptability of detection, and effectively respond to the challenges of the continuous evolution of malware.
[0064] Example 4: An Android malware detection method based on multi-feature fusion. As in Examples 1-3, the multi-feature deep fusion model MFDF is constructed and formed in step 6 of the present invention. The feature deep fusion network model MFDF is a multi-level fully connected layer that fuses features of different dimensions through a layer-by-layer progressive fusion strategy. Figure 3 , Figure 3 The multi-feature deep fusion model MFDF of the present invention comprises the following steps:
[0065] Step 6.1) Construct the mapping layer: The mapping layer consists of three fully connected layers. These layers are responsible for receiving the sensitive permission feature vector P, the operation code feature vector O, and the function call graph feature vector F, and mapping them from the original feature space to a dense vector in a high-dimensional space, which helps the model capture more complex feature relationships. The nonlinear activation function ReLU is used in the fully connected layer so that the model can learn nonlinear combinations between features. A Dropout layer is followed by the fully connected layer to reduce the risk of overfitting. By randomly discarding some network connections, the model is prompted to learn more robust feature representations. Output the sensitive permission feature vector P′, the operation code feature vector O′, and the function call graph feature vector F′.
[0066] Step 6.2) Construct the fusion layer: The fusion layer is composed of multiple layers of fully connected layers, each of which uses a nonlinear activation function ReLU and is followed by a Dropout layer. The fusion layer begins with two fully connected modules, which are composed of a fully connected layer for fusing the output of the mapping layer and three fully connected layers for performing nonlinear changes and feature dimensionality reduction on the sensitive permission feature vector P′, the opcode feature vector O′, and the function call graph feature vector F′. The fusion layer ends with a fully connected layer, which is used to perform the final fusion and nonlinear change on the three dense vectors in the high-dimensional space obtained by the two fully connected modules and a fused feature vector. Fusion and dimensionality reduction through multiple layers of fully connected layers enable the model to fuse features at different levels of abstraction, enhance the model's ability to learn complex relationships between features, help remove redundant information, and extract more critical and representative features. The output is a unified feature fusion vector that integrates all input feature information.
[0067] Step 6.3) Construct the output layer: The output layer consists of a fully connected layer, using the nonlinear activation function ReLU. A Dropout layer is placed immediately after the fully connected layer to reduce the risk of overfitting. This layer performs feature dimensionality reduction and nonlinear transformation on the high-dimensional feature vector output by the fusion layer to generate a compact feature vector. Finally, the feature vector suitable for classification tasks is output.
[0068] The present invention constructs a multi-feature deep fusion model MFDF, see Figure 3 , which is a deep learning model MFDF composed of a mapping layer, a fusion layer, and an output layer, demonstrates its advantages in feature extraction and malware identification. The mapping layer uses full connection and ReLU activation functions to effectively map input features to a high-dimensional space. At the same time, the introduction of the Dropout layer reduces the risk of overfitting, which helps to improve the performance of the classifier and reduce computational complexity. The fusion layer further integrates features through multi-level full connections and nonlinear transformations, which enhances the model's ability to understand the relationship between complex features. Finally, the output layer generates a compact and information-rich feature vector through feature dimensionality reduction and nonlinear changes, providing accurate input for classification tasks.
[0069] The design of the multi-feature deep fusion model MFDF deeply mines and integrates sensitive permission features, opcode features, and function call graph features, significantly improving the accuracy of detection. Through feature dimensionality reduction, the model improves computational efficiency while retaining key information. In addition, the model's adaptive learning ability and precise measurement of the loss function ensure rapid convergence and continuous performance optimization. Overall, the multi-feature deep fusion model MFDF not only improves the accuracy of malware detection, but also reduces manual intervention through automated feature processing, enhancing the generalization and robustness of the model.
[0070] Example 5: An Android malware detection method based on multi-feature fusion is the same as in Examples 1-4. The multi-feature deep fusion model MFDF is used in step 6 of the present invention to perform multi-feature deep fusion. The multi-features include sensitive permission features, operation code features, and function call graph features. Figure 3 , the specific implementation steps are as follows:
[0071] Step 6.4) Multi-feature mapping: The sensitive permission feature vectors P, operation code feature vectors o, and function call graph feature vectors F of different dimensions are mapped from the original feature space to a dense vector in a high-dimensional space through the mapping layer, which helps the model capture more complex feature relationships. After passing through the mapping layer, they are converted into 32-dimensional sensitive permission feature vectors P′, 64-dimensional operation code feature vectors o′, and 128-dimensional function call graph feature vectors F′. The three feature vectors are input into the fusion layer.
[0072] Step 6.5) Initial multi-feature fusion and dimensionality reduction: The feature vectors P′, O′ and F′ are fused into a 128-dimensional feature vector R through the fully connected layer for fusion in the first fully connected module, and the 32-dimensional sensitive permission feature vector P′, the 64-dimensional operation code feature vector o′ and the 128-dimensional function call graph feature vector F′ are respectively mapped into a 32-dimensional sensitive permission feature vector P″, a 32-dimensional operation code feature vector O″ and a 64-dimensional function call graph feature vector F″. Dimensionality reduction helps to remove redundancy, retain key features, and reduce the computational burden of the model.
[0073] Step 6.6) Secondary multi-feature fusion and dimensionality reduction: The feature fusion vector R, sensitive permission feature vector P″, operation code feature vector O″ and function call graph feature vector F″ are fused for the second time through the fully connected layer used for fusion in the second fully connected module, and a more compact 64-dimensional feature fusion vector R′ is output. At the same time, the feature vectors sensitive permission feature vector P″, operation code feature vector O″ and function call graph feature vector F″ are dimensionalized and nonlinearly changed through the fully connected layer used for nonlinear change and feature dimensionality reduction in the second fully connected module to obtain a 32-dimensional sensitive permission feature vector P″′, a 32-dimensional operation code feature vector O″′ and a 32-dimensional function call graph feature vector F″′.
[0074] Step 6.7) Three-time multi-feature fusion: The feature vector sensitive permission feature vector P″′, the operation code feature vector O″′, the function call graph feature vector F″′ and the feature fusion vector R′ are fused for the third time through the final fully connected layer for multi-feature fusion in the fusion layer to obtain a 64-dimensional feature fusion vector R″.
[0075] Step 6.8) Generate a feature vector for classification: The 64-dimensional feature fusion vector R″ is passed through the output layer of the multi-feature deep fusion model MFDF for feature dimensionality reduction and nonlinear transformation to generate a 2-dimensional feature vector for the classification task.
[0076] Through the full connection and ReLU activation function of the mapping layer, the model of the present invention effectively expands the features to high-dimensional space, significantly improving the ability to express input data. The clever application of the Dropout layer effectively prevents the overfitting problem and enhances the generalization performance of the model. The innovative design of the fusion layer, combined with multi-level full connection and nonlinear transformation, deepens the understanding of the complex relationship between features, and extracts key information about malicious behavior through feature dimensionality reduction and fusion. Finally, the compact feature vector generated by the output layer provides refined information for the classification task, which not only improves the detection efficiency, but also ensures the accuracy and reliability of malware identification, demonstrating its excellent performance in improving detection accuracy.
[0077] Example 6: An Android malware detection method based on multi-feature fusion. Similar to Examples 1-5, the present invention has good versatility and extensibility, and other features can also be integrated through this method:
[0078] The present invention constructs a multi-feature deep fusion model MFDF, which fuses sensitive permission features, operation code sequence features, and function call graph features. The present invention can not only deeply fuse these three features, but also fuse features in other existing malware detection technologies, such as network traffic features, system call features, file operation features, application behavior features, etc. At the same time, the present invention also has the ability to adapt to new features that may appear in the future, such as features based on user behavior analysis, semantic features, and device sensor data features, so as to achieve more comprehensive and efficient malware detection.
[0079] The present invention demonstrates the high versatility and extensibility of detection technology by deeply integrating sensitive permissions, opcode sequences, and function call graph features. This method can not only integrate multiple existing malware detection features, such as network traffic, system calls, file operations, and application behavior features, but also has the ability to adapt to future new features, such as user behavior analysis, semantic features, and device sensor data. This forward-looking and flexible approach enables the detection mechanism to cope with evolving malware technologies while maintaining high accuracy and robustness.
[0080] The solutions of the present invention are integrated together to provide a more detailed embodiment.
[0081] Example 7: An Android malware detection method based on multi-feature fusion is the same as Example 1-6, see Figure 2 , Figure 2 The overall framework diagram of the multi-feature fusion Android malware detection technical solution of the present invention is as follows:
[0082] Step 1) Obtain a dataset containing malware samples and benign software samples: Obtain Android malware samples and benign software samples, obtain the corresponding data usage license and API access rights from the AndroZoo official website, and write a crawler script. Through the API provided by the website and the hash value of each Android software, you can download sample data containing malware and benign software. Then, mark each sample based on whether it has malicious behavior, use VirusTotal, an online security service platform, to perform a comprehensive security test on each Android software sample, and delete invalid or damaged Android software samples based on the analysis report of VirusTotal to ensure that all samples in the dataset are valid. In addition, each Android software sample is accurately marked for malicious behavior. Android software samples with malicious behavior are marked as 1, and Android malware without malicious behavior is marked as 0. Finally, a dataset of labeled Android software samples is obtained, in which all malware samples and benign software samples are APK files.
[0083] Step 2) Decompile the APK file to obtain the decompiled resource file: Use the decompilation tool Apktool to process the annotated Android software sample data set to obtain the decompiled resource file, see Figure 1 , which includes the configuration file AndroidManifest.xml, source code files and bytecode files Dalvik executable files. AndroidManifest.xml, this configuration file records the basic information of the application and the permissions requested in detail, providing a basis for understanding the behavior of the application, which contains sensitive permission characteristics. Although the source code file does not contain direct business logic, it is crucial for analyzing the application structure and potential security issues. The Dalvik bytecode file is an intermediate representation unique to the Android platform, which provides a basis for understanding how the application interacts with the system, and contains opcode characteristics and function call graph characteristics.
[0084] Step 3) Extract and generate sensitive permission feature vectors: parse the AndroidManifest.xml file and extract the <uses-permission>The permission field corresponding to the tag is used to obtain all permissions applied by the application and construct a permission list N. The sensitive permission features in the permission list N are extracted according to the sensitive permission list of StormDroid. The sensitive permissions described include: the permission to access location information, the permission to read contacts, and the permission to access call records. The permission to access location information refers to the API in the Android system that requires permission to obtain the user's geographic location. The permission to read contacts refers to the method that may access or modify the user's contact data. The permission to access call records includes the function of obtaining the user's call history and details. In addition, sensitive permissions also cover functional permissions involving user privacy information such as sending text messages, reading text messages, using the camera, and recording. According to the above sensitive permission content, a sensitive permission list M containing a total of 59 sensitive permissions is constructed and a 59-dimensional sensitive permission feature vector with all initial values set to 0 is set. Finally, by traversing the sensitive permission list M, check whether each permission exists in the permission list N. If it exists, the dimension corresponding to the sensitive permission feature vector is set to 1. If it does not exist, no setting is made. Through this process, a 59-dimensional feature vector P is formed to characterize the characteristics of sensitive permissions requested by the application. It can accurately characterize the sensitive permissions applied for by the application and achieve fine-grained analysis of sensitive permission characteristics.
[0085] Step 4) Extract and generate opcode feature vectors: Parse the Dalvik executable file and extract all opcodes, which essentially map the lowest-level behavior patterns of the application. Give each unique opcode a unique integer code, and use a dynamic padding strategy to automatically calculate and pad to the length of the longest sequence in each batch of data based on the length difference of the opcode sequence in each batch of data, ensuring that the model can uniformly process inputs from different batches. Construct a BiLSTM network. First, use an embedding layer to map the integer-coded opcodes to a dense vector of 512 dimensions, which can effectively capture the semantic relationship between opcodes and improve the quality of feature representation. Next, pack the padded sequence so that the BiLSTM network can correctly handle indefinite-length sequences and process it through a BiLSTM layer, which contains 2 hidden layers, each with 256 hidden units, and uses a dropout rate of 0.3 to capture the forward and backward information of the sequence. After passing through the BiLSTM layer, unpack the packed sequence, restore the padded sequence form, and obtain the last non-padded element of each sequence as the feature representation extracted by the BiLSTM. The forward and backward information of the opcode sequence is captured through the BiLSTM network to fully reflect the behavioral characteristics of the application. Then, the extracted features are further processed through a fully connected layer, which maps the 512-dimensional features to 64 dimensions and uses the Tanh activation function. Next, the Tanh activation function is applied to generate a feature vector as the final output of the model. This method of further processing features through a fully connected layer and a Tanh activation function can effectively reduce dimensions and capture nonlinear relationships, thereby providing a more compact and meaningful representation for feature fusion. Finally, a 64-dimensional feature vector O is generated for feature fusion.
[0086] Step 5) Build an improved graph attention network and extract the function call graph feature vector. The specific implementation steps include the following steps:
[0087] Step 5.1) Extract function call relationships: Use Androguard to extract all functions and the call relationships between these functions from the DEX executable file. Each function can be regarded as a node in the graph, and the call relationships between functions form edges. This can be expressed as:
[0088] G=(V,E)
[0089] Where G is the function call graph, V is the node set, and E is the edge set. Each edge e∈E is an ordered pair (u,v), indicating that function u calls function v.
[0090] Step 5.2) Construct a function call graph: Use the information extracted above to construct a function call graph. The specific construction process design represents each function as a node and each call relationship as a directed edge. The creation of nodes and edges can be expressed as:
[0091] V={function1,function2……,function n-1 ,function n }
[0092] E={(f i ,f j )|function i callsfunction j }
[0093] For each element in the set V function n is a function name, and the subscript n is the index position of the function in the node set V. For the edge set E, each element is a call relationship between functions, (f i ,f j ) means that the function at the i+1th position in set V calls the function at the j+1th position in set V.
[0094] Step 5.3) Node Embedding: Preprocess the node information using the TF-IDF model. Preprocess the node information using the TF-IDF model. For each APK, extract all the contents of its source code to form the original text, followed by a series of preprocessing steps: remove irrelevant characters, convert to lowercase, segment, remove stop words, and stem or lemma to purify the data and standardize the text format. Based on these preprocessed texts, create a dictionary and corpus, where the dictionary contains all unique terms and the corpus is a frequency representation of each document. Using the corpora.Dictionary class of the Gensim library, build a dictionary and filter out terms with extreme frequency of occurrence, train the TF-IDF model, and convert the node information into a TF-IDF vector.
[0095] Build an LSI model and use it to process the TF-IDF vector of each node. The core of LSI is singular value decomposition, which is a method of decomposing matrices to extract and reduce the key features of data, retain the main structure and pattern of the data, and help reduce the complexity of subsequent processing. Perform singular value decomposition on the TF-IDF vector:
[0096] A=U∑V T
[0097] Among them, U and V are left and right singular vector matrices respectively, ∑ is a diagonal matrix, and the elements on its diagonal are singular values, arranged in descending order. The size of the singular value represents the energy or amount of information in the data. The largest singular values and their corresponding singular vectors contain the main structure and pattern of the data. Therefore, when performing data compression or feature extraction, usually only the first k largest singular values and their corresponding vectors are selected.
[0098] Calculate the minimum k value k min :Let n i Represents the number of Java files in the i-th APK file. Perform the operation on all m APK files and get a set N containing the number of all Java files:
[0099] N={n1,n2……n m }
[0100] Sort the elements in set N in ascending order to get N sorted , calculate the median Median(N):
[0101]
[0102] Given a preset maximum timestamp ts max , the minimum k value k min Calculate by the following formula and ensure that k min ≥1:
[0103]
[0104] In order to effectively reduce the data dimension and capture the most critical graph structure information, the selected k min singular values and corresponding singular vectors to construct a low-dimensional vector representation of each node. The vector representation of each node i can be obtained by the first k corresponding singular values in the matrix U. min The column vectors are given. These vectors provide the nodes in the most important k min The projection on the latent semantic dimension finally obtains the vector representation of each node feature.
[0105] Step 5.4) Edge Embedding: For edge information, use the function call relationship to generate an adjacency matrix A, which is used to represent the direct call relationship between functions. First, determine the total number of functions N and initialize an N×N matrix A. Then, traverse the function call relationship information list, and for each pair of direct call relationships (i, j), set the corresponding element A[i][j] in matrix A to 1, indicating that function i directly calls function j. The adjacency matrix reflects the direct call relationship between functions. This binary relationship helps to identify direct dependencies between functions.
[0106] Step 5.5) Get the Graph Attention Network GAT: Load the Graph Attention Network GAT from the predefined model library PyTorch Geometric.
[0107] Step 5.6) Configure the multi-head attention mechanism in the graph attention network GAT: assign independent parameters to each head, and for each head k, calculate the attention weight e between nodes ij (k) , update the feature representation of the node, the specific formula is as follows:
[0108]
[0109] Where k represents the kth head, and these weights reflect the relationship between nodes i and j. The attention weight of each head is normalized using the softmax function to obtain the normalized attention weight α ij (k) , α ij (k) The calculation process is as follows:
[0110]
[0111] According to the normalized attention weights, the features of the adjacent nodes are weighted summed to obtain the node feature representation x under the attention head i (k) , the calculation process is as follows:
[0112]
[0113] Where σ is the nonlinear activation function ReLU. The multi-head attention mechanism is used to stabilize the training effect and capture diverse feature representations. Each head k performs the above attention calculation independently, and the features x output by all heads are i (k) Perform an averaging operation to obtain the comprehensive node feature x i .
[0114] The multi-head attention mechanism allows the model to learn the relationship between nodes from different perspectives. Each head can capture different features and patterns, thereby enhancing the model's ability to understand complex data structures. Through independent parameter allocation and normalization, the model can balance the contributions of different attention heads and avoid the dominant role of certain heads, thereby improving the generalization and stability of the model.
[0115] Step 5.7) Obtain the global features of the function call graph: Introducing the maximum pooling layer in the graph attention network GAT can retain the most important information in the node features and ignore redundant or noisy data, thereby enhancing the model's sensitivity to key features. Apply the maximum pooling layer on the node feature dimension, and select the maximum value on each feature dimension through the maximum pooling operation to obtain the global feature h of the function call graph. i .
[0116] Step 5.8) Get the function call graph feature vector: Introduce the average pooling layer in the graph attention network GAT. The average pooling layer can capture the global information of the entire graph by aggregating the concatenated vectors of all nodes, which helps the model understand the global structure and pattern in the graph. i and the global feature h i The concatenation is performed to form a concatenation vector of the node. The concatenation vectors of all nodes are aggregated using an average pooling operation to obtain a function call graph feature vector F.
[0117] Step 5.9) Optimize the improved graph attention model: For the improved graph attention model, the parameters of the model are adjusted through the Adam optimization algorithm and the cross entropy loss function to minimize the difference between the predicted output and the actual label. The model can adaptively adjust the learning rate to accelerate the convergence process, while accurately measuring the difference between the predicted output and the actual label to guide the effective adjustment of the model parameters. The Adam optimization algorithm has the advantage of adaptive learning rate, which can accelerate the convergence process. The cross entropy loss function is used to measure the difference between the probability distribution predicted by the model and the actual distribution, further guiding the adjustment of the model parameters. Through the combination of these two, the model can learn more effectively and improve performance.
[0118] Step 5.10) Train the improved graph attention model: Input the features including node attributes, adjacency matrix, graph labels and node labels into the constructed improved graph attention network model for training. Node attributes provide the model with a vector representation of each node feature, the adjacency matrix is a direct expression of the graph structure, and the graph labels and node labels provide the necessary supervision information for model training, so that the model can learn how to effectively classify according to the structure of the graph and the characteristics of the nodes. The model learns this comprehensive information and weights each type of information by assigning different attention coefficients, thereby achieving the emphasis on different information. Finally, a 500-dimensional feature vector F can be generated for each graph, which combines the local and global features of the graph and provides rich information for further analysis.
[0119] Step 6) Construct a multi-feature deep fusion model MFDF and perform multi-feature deep fusion. The specific implementation steps include the following steps:
[0120] Step 6.1) Construct the mapping layer: The mapping layer consists of three fully connected layers. These layers are responsible for receiving the input sensitive permission feature vector P, the operation code feature vector O, and the function call graph feature vector F, and mapping them from the original feature space to a dense vector in a high-dimensional space, which helps the model capture more complex feature relationships. The nonlinear activation function ReLU is used in the fully connected layer so that the model can learn nonlinear combinations between features. A Dropout layer is followed by the fully connected layer to reduce the risk of overfitting. By randomly discarding some network connections, the model is prompted to learn more robust feature representations. Output sensitive permission feature vector P′, operation code feature vector O′, and function call graph feature vector F′.
[0121] Step 6.2) Construct the fusion layer: The fusion layer is composed of multiple layers of fully connected layers, each of which uses a nonlinear activation function ReLU and is followed by a Dropout layer. The fusion layer begins with two fully connected modules, which are composed of a fully connected layer for fusing the output of the mapping layer and three fully connected layers for performing nonlinear changes and feature dimensionality reduction on the sensitive permission feature vector P′, the opcode feature vector O′, and the function call graph feature vector F′. The fusion layer ends with a fully connected layer, which is used to perform the final fusion and nonlinear change on the three dense vectors in the high-dimensional space obtained by the two fully connected modules and a fused feature vector. Fusion and dimensionality reduction through multiple layers of fully connected layers enable the model to fuse features at different levels of abstraction, enhance the model's ability to learn complex relationships between features, help remove redundant information, and extract more critical and representative features. The output is a unified feature fusion vector that integrates all input feature information.
[0122] Step 6.3) Construct the output layer: The output layer consists of a fully connected layer, using the nonlinear activation function ReLU. A Dropout layer is placed immediately after the fully connected layer to reduce the risk of overfitting. This layer performs feature dimensionality reduction and nonlinear transformation on the high-dimensional feature vector output by the fusion layer to generate a compact feature vector. Finally, the feature vector suitable for classification tasks is output.
[0123] Step 6.4) Multi-feature mapping: The sensitive permission feature vectors P, operation code feature vectors O, and function call graph feature vectors F of different dimensions are mapped from the original feature space to a dense vector in a high-dimensional space through a mapping layer, which helps the model capture more complex feature relationships. After passing through the mapping layer, they are converted into 32-dimensional sensitive permission feature vectors P′, 64-dimensional operation code feature vectors O′, and 128-dimensional function call graph feature vectors F′. The three feature vectors are input into the fusion layer.
[0124] Step 6.5) Initial multi-feature fusion and dimensionality reduction: The feature vectors P′, O′ and F′ are fused into a 128-dimensional feature vector R through the fully connected layer for fusion in the first fully connected module, and the 32-dimensional sensitive permission feature vector P′, the 64-dimensional operation code feature vector O′ and the 128-dimensional function call graph feature vector F′ are respectively mapped into a 32-dimensional sensitive permission feature vector P″, a 32-dimensional operation code feature vector O″ and a 64-dimensional function call graph feature vector F″. Dimensionality reduction helps to remove redundancy, retain key features, and reduce the computational burden of the model.
[0125] Step 6.6) Secondary feature fusion and dimensionality reduction: The feature fusion vector R, sensitive permission feature vector P′′, operation code feature vector O″ and function call graph feature vector F″ are fused for the second time through the fully connected layer used for fusion in the second fully connected module, and a more compact 64-dimensional feature fusion vector R′ is output. At the same time, the feature vectors sensitive permission feature vector P″, operation code feature vector O″ and function call graph feature vector F″ are dimensionalized and nonlinearly changed through the fully connected layer used for nonlinear change and feature dimensionality reduction in the second fully connected module to obtain a 32-dimensional sensitive permission feature vector P″′, a 32-dimensional operation code feature vector O″′ and a 32-dimensional function call graph feature vector F″′.
[0126] Step 6.7) Three-time multi-feature fusion: The sensitive permission feature vector P″′, the operation code feature vector O″′, the function call graph feature vector F″′ and the feature fusion vector R′ are fused for the third time through the final fully connected layer for multi-feature fusion in the fusion layer to obtain a 64-dimensional feature fusion vector R″.
[0127] Step 6.8) Generate a feature vector for classification: The 64-dimensional feature fusion vector R″ is passed through the output layer of the multi-feature deep fusion model MFDF for feature dimensionality reduction and nonlinear transformation to generate a 2-dimensional feature vector for the classification task.
[0128] Step 7) Train the XGBoost classification model: Use the XGBoost classification model to train the feature fusion vector R. During the training process, XGBoost gradually optimizes the model by stacking multiple decision trees. Each tree further refines the prediction based on the previous round, and enhances the accuracy and generalization of the model by adjusting the following parameters: the learning rate is 0.2, which helps to avoid overfitting, improves the generalization of the model, and controls the contribution of each tree to the model; the depth of the tree is 12, and the relatively high depth enables the model to capture more complex data patterns; in order to provide a stronger model and avoid and prevent overfitting, the number of trees is 80, which is inversely proportional to the learning rate; the minimum child weight is 1, which determines the minimum sample weight and of each leaf node; the sampling ratio is 1 and 0.6. Using different sampling ratios can increase the diversity of the model, thereby improving the generalization of the model. A sampling ratio of 1 means using all data, while 0.6 means using 60% of the data, which helps reduce overfitting; setting L1 regularization to 0 helps to produce a sparse model and reduce model complexity; and L2 regularization is 0.1, so that the model focuses on reducing variance, thereby improving the stability of the model. By fine-tuning these parameters, the XGBoost classification model can better capture the characteristics of the data and improve the accuracy and robustness of detection. After training, the XGBoost classification model accurately detects Android malware based on the feature fusion vector R, that is, outputs the category to which the detection sample belongs.
[0129] Step 8) Detect Android malware: The Android software to be detected is processed through the above steps 2-5, and sensitive permission features, operation code features, and function call graph features are extracted and fused; then, these original features are converted into high-dimensional dense vectors through feature processing and mapping layers, and then input into the trained multi-feature deep fusion model MFDF for deep feature fusion and nonlinear transformation, further improving the robustness and distinguishing ability of feature expression; finally, the fused feature vector is classified using the optimized XGBoost classification model. Output the detection result, identify whether the sample is malware or benign software, and complete Android malware detection.
[0130] The present invention proposes an Android malware detection method based on multi-feature deep fusion, which solves the problems of incomplete coverage, low feature utilization, and high dimensionality and information redundancy caused by direct splicing of multiple features faced by traditional static methods that use a single feature to detect Android malware. By combining sensitive permission features, opcode features, and function call graph features, the present invention not only significantly improves the detection accuracy of known malware, but also greatly enhances the adaptability to new malware. The design of the multi-feature deep fusion model MFDF cleverly applies deep learning technology, effectively integrates different types of data features through multi-level fusion and nonlinear changes, significantly improves the accuracy and adaptability of malware identification, and improves the level of automation of detection and the efficiency of processing large-scale data.
[0131] The present invention solves the problems of incomplete coverage, low feature utilization, and high dimensionality and information redundancy caused by direct splicing of multiple features faced by traditional static methods using a single feature to detect Android malware. The main scheme includes: obtaining an Android software data set; decompiling APK files; obtaining a list of permissions applied for by the software; obtaining an opcode sequence; obtaining sensitive API calls and function call relationships, and constructing a sensitive function call graph; learning the above features through a deep learning model and converting them into feature vectors of different dimensions; inputting the feature vectors of all the above dimensions into a feature deep fusion model for fusion processing, and finally using a classification model to detect Android malware; the present invention deeply integrates sensitive permissions, function call graphs, and opcode sequences, effectively and comprehensively captures the complex behavioral characteristics of malware, significantly improves the detection accuracy while significantly improving the ability to discover unknown or deformed malware, and provides an efficient solution for Android security protection.
[0132] The following is a verification explanation of the technical effect of the present invention in combination with experiments and experimental data.
[0133] Example 8: An Android malware detection method based on multi-feature fusion is the same as Example 1-7.
[0134] Experimental content: The present invention first collects Android application samples from the AndroZoo dataset and verifies them through the VirusTotal online service to ensure the integrity and validity of the downloaded APK file, thereby forming a reliable dataset containing malware samples and benign software samples. The ratio of the training set to the test set is 8:2, with 6314 malware samples and 4133 benign software samples. The dataset is preprocessed to obtain the AndroidManifest.xml file, source code file, Dalvik executable file, and obtain sensitive permission features, opcode features, and function call graph features from them, and the final feature vectors of different dimensions are obtained through vectorization processing. Combined with the experimental environment restrictions, the preset maximum timestamp ts max Experiments were conducted with values of 400, 600, 800, 1000, 1200, and 1500 to determine the optimal maximum timestamp ts in this experimental environment. max . The present invention performs multiple rounds of training and Android malware detection on three different feature vectors: sensitive permission feature vector, operation code feature vector and function call graph feature vector through the XGBoost classification model, and saves the detection results of each round. Then, these three features are directly spliced in pairs, and multiple rounds of training and Android malware detection are performed through the XGBoost model, and the optimal results are also saved. Secondly, the present invention also performs a deeper fusion processing on these three features and directly splices the three features through the feature deep fusion model MFDF, and multiple rounds of training and Android malware detection are performed, and the detection results of each round are saved.
[0135] Experimental results and analysis: In the experiment, six different maximum timestamp values were tested to determine the most appropriate maximum timestamp setting in the current environment and evaluate the impact of different settings on the model classification accuracy. The experimental results are shown in Table 1, which shows the impact of different maximum timestamp settings on classification accuracy and F1 value.
[0136] Table 1: Effect of different maximum timestamp settings on classification accuracy and F1 value
[0137]
[0138] The experimental results show that the lowest accuracy of the present invention is ts max =400, the accuracy is 94.87%. This shows that at the maximum timestamp ts max Under the setting, the model processes less data and fails to fully capture enough features, thus affecting the classification accuracy. The highest accuracy is in ts max =1500, the accuracy rate reaches 97.13%. This shows that the higher maximum timestamp ts in the present invention max Setting ts enables the model to process more data, which significantly improves the classification accuracy. However, choosing the best maximum timestamp ts max The resource limitations and computational costs of the experimental environment also need to be considered.
[0139] Example 9: An Android malware detection method based on multi-feature fusion is the same as Example 1-7, and the experimental conditions and content are the same as Example 8.
[0140] This example experiments on sensitive permission feature vectors, opcode feature vectors, and function call graph feature vectors, pairwise splicing fusion, three types of direct splicing fusion, and fusion using the feature deep fusion model MFDF to evaluate the impact of different feature combinations and different fusion methods on classification accuracy. The experimental results are shown in the figure. Figure 4 As shown, Figure 4 It is a bar graph of the accuracy and F1 values of different feature combinations of the present invention, which shows in detail the accuracy and F1 values of Android malware detection using sensitive permission feature vectors, opcode feature vectors and function call graph feature vectors, pairwise splicing fusion, three types of direct splicing fusion, and feature deep fusion model MFDF fusion. Figure 4 Although a single feature vector can provide basic classification capabilities, its accuracy is relatively low, all below 95%. The combination of two feature vectors significantly improves the classification effect by utilizing the complementary information between features, with the highest accuracy reaching 96.61%. The direct concatenation of three feature vectors improves the performance to a certain extent, but the most significant improvement comes from the use of the feature deep fusion model MFDF of the present invention, with an accuracy of 97.63%. This not only reflects the effectiveness of this method in improving classification accuracy, but also verifies through experimental data that the present invention improves the accuracy of the classification method relative to a single feature and a combination of two features, and solves the high dimensionality and information redundancy problems caused by the direct concatenation of multiple features.
[0141] In summary, the Android malware detection method based on multi-feature fusion proposed in the present invention effectively solves the problems of incomplete coverage, low feature utilization, and high dimensionality and information redundancy caused by direct splicing of multiple features faced by traditional static methods using a single feature to detect Android malware. The implementation includes obtaining a data set containing malware samples and benign software samples; decompiling APK files to obtain decompiled resource files; extracting and generating sensitive permission feature vectors; extracting and generating opcode feature vectors; constructing an improved graph attention network and extracting function call graph feature vectors; constructing a multi-feature deep fusion model MFDF and performing multi-feature deep fusion; training an XGBoost classification model; and detecting Android malware. The present invention significantly improves the accuracy and adaptability of malware detection by comprehensively utilizing the multi-dimensional features of sensitive permissions, opcodes, and function call graphs. This processing method based on deep fusion of multiple features not only deeply mines the semantics and structural information of malware behavior, but also greatly optimizes the data processing efficiency, thereby greatly improving the comprehensiveness and response speed of the detection system. The present invention not only provides an efficient and reliable Android malware detection solution, but also provides strong technical support for modern Android security protection, and is used for malware identification and prevention in the field of mobile device security, as well as network security defense.
Claims
1. An Android malware detection method based on multi-feature deep fusion, characterized in that: The graph attention network is improved to extract function call graph features, and a multi-feature deep fusion model MFDF is constructed to fuse sensitive permission features, opcode features, and function call graph features, including the following steps: Step 1) Obtain a data set containing malware samples and benign software samples: obtain Android malware samples and benign software samples, mark each sample according to whether it has malicious behavior, and finally obtain an Android software sample data set with annotations, where all malware samples and benign software samples are APK files; Step 2) Decompile the APK file to obtain a decompiled resource file: Use the decompilation tool Apktool to process the annotated Android software sample data set to obtain a decompiled resource file, which includes a configuration file AndroidManifest.xml, a source code file, and a bytecode file Dalvik executable file; Step 3) Extract and generate sensitive permission feature vector: parse the AndroidManifest.xml file, extract the requested permissions and construct a permission list, then extract the sensitive permission features in the permission list according to StormDroid's sensitive permission list, and generate a sensitive permission feature vector P; Step 4) Extract and generate an opcode feature vector: parse the Dalvik executable file, extract the opcode features, embed the opcode features and input them into the bidirectional long short memory network BiLSTM for training to generate the opcode feature vector O; Step 5) Construct an improved graph attention network and extract the function call graph feature vector: introduce a maximum pooling operation module into the graph attention network GAT; place the module after the graph attention network GAT to form an improved graph attention network architecture; under this architecture, extract the features of the function call graph; the function call graph represents the calling relationship between functions, each node represents a function, and the edge between nodes is a directed edge, indicating that one function calls another function; embed the function call graph using node embedding and edge embedding; first extract local features from the function call graph through the graph attention network GAT; then aggregate the output of GAT through the maximum pooling operation to obtain the global features of the function call graph; concatenate the two features to generate the function call graph feature vector F; Step 6) construct a multi-feature deep fusion model MFDF and perform multi-feature deep fusion: the constructed multi-feature deep fusion model MFDF is a neural network with a multi-level fully connected architecture, which includes a mapping layer, a fusion layer and an output layer in sequence; the input of the multi-feature deep fusion model MFDF is a sensitive permission feature vector P, an operation code feature vector O and a function call graph feature vector F, and multi-feature deep fusion is performed in the fusion layer of the multi-feature deep fusion model MFDF to obtain a feature fusion vector R, which contains a description of malicious behavior of malware. After fusion, the feature fusion vector R is output through the output layer of the multi-feature deep fusion model MFDF to output a feature vector suitable for classification tasks; the multi-feature deep fusion model MFDF is used to perform multi-feature deep fusion; the multi-feature deep fusion model MFDF uses a multi-level fully connected layer architecture to perform feature dimension reduction, nonlinear transformation and multi-feature fusion of features in the fusion layer; Step 7) Training the XGBoost classification model: Use the XGBoost classification model to train the feature fusion vector R; after the training is completed, the XGBoost classification model accurately detects Android malware based on the feature fusion vector R, that is, outputs the category to which the detection sample belongs; Step 8) Detect Android malware: After the Android software to be detected is processed through the above steps 2-5, it is passed into the trained multi-feature deep fusion model MFDF for fusion and classified through the XGBoost classification model, and the category to which the sample belongs is output to complete the Android malware detection.
2. The Android malware detection method based on multi-feature deep fusion according to claim 1 is characterized in that: The improved graph attention network constructed in step 5 includes the following steps: Step 5.1) Get the graph attention network GAT: load the graph attention network GAT from the predefined model library PyTorch Geometric; Step 5.2) Configure the multi-head attention mechanism in the graph attention network GAT: assign independent parameters to each head, and for each head k, calculate the attention weight e between nodes ij (k) , where k represents the kth head, and these weights reflect the relationship between nodes i and j; the softmax function is used to normalize the attention weight of each head to obtain the normalized attention weight α ij (k) ; According to the normalized attention weights, the features of the adjacent nodes are weighted summed to obtain the node feature representation x under the attention head i (k) ; Output features x for all heads i (k) Perform an averaging operation to obtain the comprehensive node feature x i ; Step 5.3) Obtain the global features of the function call graph: Introduce the maximum pooling layer in the graph attention network GAT, apply the maximum pooling layer on the node feature dimension, select the maximum value on each feature dimension through the maximum pooling operation, and obtain the global feature h of the function call graph i ; Step 5.4) Get the function call graph feature vector: Introduce the average pooling layer in the graph attention network GAT and transform the node feature x i and the global feature h i The splicing is performed to form a splicing vector of the node; the splicing vectors of all nodes are aggregated using the average pooling operation to obtain the function call graph feature vector F.
3. The Android malware detection method based on multi-feature deep fusion according to claim 1 is characterized in that: In step 5, the function call graph is embedded using node embedding and edge embedding, which includes the following steps: Step 5.a) Node Embedding: Apply the LSI model to embed each node in the function call graph; LSI maps each node into a latent space, where each dimension represents a latent topic in the data, and similar functions will have similar representations in the latent space; Step 5.b) Edge Embedding: For the edges in the function call graph, build an adjacency matrix to represent these directed edges; combine the node embedding vector obtained by the LSI model and the edge embedding vector obtained by the adjacency matrix to form the final feature vector of each node.
4. The Android malware detection method based on multi-feature deep fusion according to claim 1 is characterized in that: Step 6 constructs and forms a multi-feature deep fusion model MFDF. The feature deep fusion network model MFDF fuses features of different dimensions through a multi-level fully connected layer through a layer-by-layer progressive fusion strategy, including the following steps: Step 6.1) Construct the mapping layer: The mapping layer is the starting stage of the model and consists of three fully connected layers; these layers are responsible for receiving the sensitive permission feature vector P, the operation code feature vector O, and the function call graph feature vector F, and mapping them from the original feature space to a dense vector in a high-dimensional space; the nonlinear activation function ReLU is used in the fully connected layer; a Dropout layer is followed by the fully connected layer to reduce the risk of overfitting; the sensitive permission feature vector P′, the operation code feature vector O′, and the function call graph feature vector F′ are output; Step 6.2) Construct the fusion layer: The fusion layer is the key part of the model. It consists of multiple layers of fully connected layers. Each fully connected layer uses a nonlinear activation function ReLU and is followed by a Dropout layer. The beginning of the fusion layer is two fully connected modules, which are composed of a fully connected layer for fusing the output of the mapping layer and three layers for sensitive permission feature vectors p. ′ , into the opcode feature vector O ′ and the function call graph feature vector F ′ The fully connected layer performs nonlinear transformation and feature dimension reduction respectively; the fusion layer ends with a fully connected layer, which performs the final fusion and nonlinear transformation on the three dense vectors in high-dimensional space and a fused feature vector obtained by the two fully connected modules; The output is a unified feature fusion vector that integrates all input feature information; Step 6.3) Construct the output layer: It consists of a fully connected layer using the nonlinear activation function ReLU; a Dropout layer is immediately followed by the fully connected layer to reduce the risk of overfitting; this layer performs feature dimensionality reduction and nonlinear transformation on the high-dimensional feature vector output by the fusion layer to generate a compact feature vector; finally, the feature vector suitable for classification tasks is output.
5. The Android malware detection method based on multi-feature deep fusion according to claim 1 is characterized in that: The multi-feature deep fusion model MFDF described in step 6 is used to perform multi-feature deep fusion. The multi-features include sensitive permission features, operation code features, and function call graph features. The specific implementation steps are as follows: Step 6.4) Multi-feature mapping: The sensitive permission feature vectors P, opcode feature vectors O, and function call graph feature vectors F of different dimensions are converted into a 32-dimensional sensitive permission feature vector p through the mapping layer. ′ , 64-dimensional opcode feature vector O ′ and the 128-dimensional function call graph feature vector F ′ , input the three feature vectors into the fusion layer; Step 6.5) Initial multi-feature fusion and dimensionality reduction: transform the feature vector P ′ , O ′ and F ′ The fully connected layer used for fusion in the first fully connected module is fused into a 128-dimensional feature vector R, and at the same time, it is dimensionally adjusted and nonlinearly changed through the fully connected layer used for nonlinear change and feature dimensionality reduction in the first fully connected module, and the 32-dimensional sensitive permission feature vector P is converted into ′ , 64-dimensional opcode feature vector O ′ and the 128-dimensional function call graph feature vector F ′ They are mapped into a 32-dimensional sensitive permission feature vector P″, a 32-dimensional operation code feature vector O″, and a 64-dimensional function call graph feature vector F″; Step 6.6) Secondary feature fusion and dimensionality reduction: The feature fusion vector R, the sensitive permission feature vector P″, the operation code feature vector O″ and the function call graph feature vector F″ are fused for the second time through the fully connected layer of the second fully connected module, and a more compact 64-dimensional feature fusion vector R is output. ′ , at the same time, the feature vector sensitive permission feature vector P″, the operation code feature vector O″ and the function call graph feature vector F″ are subjected to dimension adjustment and nonlinear change through the fully connected layer of the second fully connected module for nonlinear change and feature dimensionality reduction to obtain a 32-dimensional sensitive permission feature vector P″′, a 32-dimensional operation code feature vector O″′ and a 32-dimensional function call graph feature vector F″′; Step 6.7) Three-time multi-feature fusion: Combine the sensitive permission feature vector P″′, the operation code feature vector O″′, the function call graph feature vector F″′ and the feature fusion vector R ′ The third fusion process is performed through the last fully connected layer for multi-feature fusion in the fusion layer to obtain a 64-dimensional feature fusion vector R″; Step 6.8) Generate a feature vector for classification: The 64-dimensional feature fusion vector R″ is passed through the output layer of the multi-feature deep fusion model MFDF for feature dimensionality reduction and nonlinear transformation to generate a 2-dimensional feature vector for the classification task.
Citation Information
Cited By
Encrypted malicious traffic detection method based on multi-scale space-time interaction graph network
CN119583154A
Method for detecting maliciously obtaining computing resource software based on big data
CN120930140A
A method for detecting software that maliciously acquires computing resources based on big data
CN120930140B
Multi-view small sample Android malicious software classification method based on optimal guide matching
CN121744010A
A Multi-View Small Sample Android Malware Classification Method Based on Optimal Bootstrap Matching
CN121744010B
