An Android malware detection method and system based on EPM-MCNET neural network
Through the multi-scale convolution module and enhanced perception module of EPM-MCNET neural network, combined with H-Swish activation function and batch normalization operation, the problem of unsatisfactory detection accuracy of lightweight neural networks and neglected feature extraction diversity is solved. Fast and accurate Android malware detection is achieved.
Patent Information
- Application Number
- CN202410380048.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-29
- Publication Date
- 2024-11-01
- Estimated Expiration
- 2044-03-29
AI Technical Summary
In the prior art, in Android malware detection, the detection accuracy of lightweight neural networks is not ideal, and the single-size convolution kernel ignores the diversity of feature extraction, making it difficult to meet the actual detection requirements.
Using the detection method based on EPM-MCNET neural network, the multi-scale convolution module and the enhanced perception module are enhanced feature extraction, combined with the H-Swish activation function and batch normalization operation, an Android malware detection model that can be quickly and accurately classified is built.
With short detection time and small number of parameters, good feature extraction capabilities are achieved, improving the classification accuracy and detection performance of Android software.
Smart Images

Figure CN118246012B_ABST
Abstract
Description
Technical Field
[0001] The present invention is applied to the field of Android malware detection, and specifically relates to an Android malware detection method and system based on an EPM-MCNET neural network. Background Art
[0002] The openness of the Android system makes it relatively easy to develop Android malware, which poses a serious security threat to users. Based on the current network security situation, how to quickly and effectively detect Android malware has important application value.
[0003] In recent years, many scholars have identified Android malware by building convolutional neural network models. However, the convolutional neural networks built all use a single-size convolution kernel to extract features from Android software feature images, ignoring the diversity of extracted features. In addition, lightweight neural networks are widely used in Android malware detection due to their short training time and fast recognition speed. However, directly using these lightweight neural networks for Android malware detection cannot guarantee high detection accuracy and is difficult to meet actual detection requirements, which increases the difficulty of Android malware detection to a certain extent.
[0004] The Chinese patent document with publication number CN113468531A discloses a malicious code classification method based on a deep residual network and a hybrid attention mechanism. The invention visualizes the .bytes and .asm files of the malicious code as RGBA images, and combines the deep residual network ResNet50 with the hybrid attention CBAM to construct a malicious code classification model to achieve automatic detection of malicious code.
[0005] The Chinese patent document with publication number CN114579970A discloses a method and system for detecting Android malware based on a convolutional neural network. The invention visualizes the classes.dex file extracted from the Android software as an RGB image, and then obtains the frequency domain feature image corresponding to the RGB image through frequency domain transform mapping. The frequency domain feature image is used as input, and the malware recognition model is used to detect maliciousness of the target Android software. Summary of the invention
[0006] Currently, in the field of Android malware detection, the direct application of lightweight neural networks to Android malware detection has the problem of unsatisfactory detection accuracy. In addition, some scholars use a single-size convolution kernel to extract features from Android software feature images in the neural network, ignoring the diversity of extracted features. In view of the shortcomings of the prior art, the present invention provides an Android malware detection method based on an EPM-MCNET neural network, which has good feature extraction capabilities under the conditions of short detection time and a small number of parameters, and can quickly and accurately classify Android software.
[0007] The present invention also provides an Android malware detection system based on the EPM-MCNET neural network. After the Android software to be detected is input into the system, the system can detect it with the help of the detection model and output the Android malware detection result.
[0008] Terminology explanation:
[0009] Android Application Package (APK): is an application package file format used by the Android operating system to publish and install Android applications. It contains the code, resources, certificates, etc. of the Android software.
[0010] Android software dataset: In the present invention, the Android software dataset refers to a collection of Android benign software application installation packages and Android malware installation packages.
[0011] H-Swish activation function: It is an activation function constructed by introducing the ReLu6 activation function based on the Swish activation function. The H-Swish activation function is widely used in deep learning models to improve the training speed of the model and avoid the problem of neuron necrosis in the model. The calculation formula is as follows:
[0012]
[0013] Batch Normalization (BN) operation: It is an operation that performs normalization on the input or intermediate layer activation values of a neural network. The BN operation can increase the training speed of the neural network and accelerate the convergence of the neural network.
[0014] The technical solution of the present invention is:
[0015] An Android malware detection method based on EPM-MCNET neural network, the specific steps are as follows Figure 1 shown.
[0016] S1: Construct an Android software RGB image dataset D, which consists of several Android software RGB images FI constitute;
[0017] S2: Build and train an Android malware detection model based on the EPM-MCNET neural network. The model includes a part that visualizes Android software as an RGB image and an EPM-MCNET neural network.
[0018] S3: Use the Android malware detection model based on the EPM-MCNET neural network to detect Android software and determine whether the Android software is Android malware.
[0019] Further, step S1 is specifically as follows:
[0020] S11. Change the suffixes of multiple APK installation packages from .apk to .zip, read the APK installation packages, and obtain the classes.dex, AndroidManifest.xml, and resources.arsc binary files.
[0021] S12. Visualize the classes.dex, AndroidManifest.xml, and resources.arsc binary files obtained in step S11 as RGB images. Specifically, for each of the above files, read 8 bits in the file as a group, and convert each group into an unsigned decimal integer, which is called a pixel, ranging from 0 to 255. Then, fill the array of unsigned decimal integers into a two-dimensional matrix of size 224×224 in sequence. Then fill the two-dimensional matrices generated by the classes.dex, AndroidManifest.xml, and resources.arsc binary files into the three color channels of R, G, and B, respectively, and finally generate an RGB image with a height of 224, a width of 224, and 3 channels.
[0022] S13. All RGB images obtained through the processing in step S12 are used to form an Android software RGB image dataset D.
[0023] S2: Build and train an Android malware detection model based on the EPM-MCNET neural network. The model includes a part that visualizes Android software as an RGB image and an EPM-MCNET neural network. The overall network structure diagram of EPM-MCNET is shown in the figure. Figure 2 shown.
[0024] The EPM-MCNET neural network includes an input layer, an intermediate layer and an output layer; the intermediate layer includes a first convolution normalization activation module CBR1, a second convolution normalization activation module CBR2, a first hard convolution normalization activation module CBH1, a second hard convolution normalization activation module CBH2, a maximum pooling layer, an enhanced perception module EPM, and a multi-scale convolution module MC. The specific model training steps include:
[0025] S21, the input layer receives any Android software RGB image F in D I , and F I Passed to the middle layer of the EPM-MCNET neural network.
[0026] S22, the CBR1 module in the middle layer receives F I Afterwards, a 3×3 convolution kernel is used to I The convolution operation is performed, and then the convolution result is normalized and activated by the ReLU activation function to output the feature image T1. T1 is then input into the maximum pooling layer for dimensionality reduction, and the feature image F is output. m1 , and pass it to the CBH1 module.
[0027] S23, CBH1 module receives F m1 Afterwards, a 3×3 convolution kernel is used to m1 The convolution operation is performed, and then the convolution result is normalized and activated by the H-Swish activation function to output the feature image T2. T2 is then input to the maximum pooling layer for dimensionality reduction, and the feature image T3 is output. T3 is then input to the EPM module to enhance the feature information of a specific area or a specific channel of the feature image T3, and the feature image F is output. m2 Finally, the feature image F m2 Input into the CBH2 module.
[0028] The input of T3 to the EPM module is to enhance the characteristic information of a specific region or a specific channel of the characteristic image T3, and output the characteristic image F m2 , the specific steps include:
[0029] When the three-dimensional feature image T3 with a height of H, a width of W, and a number of channels of C is input into the EPM attention module, it is simultaneously received by the path A and the path B of the module;
[0030] For path A, global maximum pooling and global average pooling are used to extract the feature information of feature image T3, and two 1×1×C feature vectors are obtained. Then, path A sums these two feature vectors element by element to obtain a 1×1×C feature vector F A1 ; Then path A uses multi-layer perceptron MLP1 to transform the feature vector FA1 We assign weights to each channel of the function to obtain a feature vector F with a size of 1×1×C. A2 ;
[0031] For path B, global maximum pooling and global average pooling are used to extract the feature information of feature image T3, respectively, to obtain two H×W×1 feature matrices; then, path B sums these two feature matrices element by element to obtain a H×W×1 feature matrix F B1 ; Then path B uses the multi-layer perceptron MLP2 to process the feature matrix F B1 We assign weights to different regions and obtain a H×W×1 feature matrix F B2 ;
[0032] Next, the EPM module will F B2 Reshape to 1×1×HW, so that the eigenvector F A2 With the feature matrix F B2 The channels are superimposed and input into MLP3 for weight assignment, and the output feature vector F1 is 1×1×(HW+C). Then, the feature vector F1 is split into feature vector F2 and feature vector F3, where F2 is 1×1×C and F3 is 1×1×HW. F2 is input into the Sigmoid activation function to obtain the weight vector M. C , that is, the importance of each channel in the feature image T3; reshape the size of the feature vector F3 to H×W×1, and then input F3 into the Sigmoid activation function to obtain the weight matrix M S , that is, the importance of different regions of the feature image T3; finally, the feature image T3 and M C 、M S Multiply them together to get the feature enhanced feature image F m2 The specific formula is:
[0033]
[0034] Among them, δ represents the Sigmoid activation function, ⊙ represents the element-wise product operation, S represents the segmentation of the feature vector along the channel dimension, and R represents the reshaping of the feature vector;
[0035] In formula (1), the calculation formula of the feature vector F1 is shown in formula (2):
[0036]
[0037] Among them, M represents MLP, [,,] represents tensor concatenation operation, Max represents global maximum pooling, Avg represents global average pooling, represents element-wise summation, and R represents reshaping the feature vector.
[0038] The structural diagram of the channel space fusion attention module EPM is as follows Figure 3 shown.
[0039] S24, CBH2 module receives F m2 Afterwards, a 3×3 convolution kernel is used to m2 The convolution operation is performed, and then the convolution result is normalized, and then activated by the H-Swish activation function to output the feature image T4. Then T4 is input into the EPM module to output the feature image F m3 , and finally the feature image F m3 Input to the CBR2 module.
[0040] S25, CBR2 module receives feature image F m3 , use a 3×3 convolution kernel to m3 The convolution operation is performed, and then the convolution result is normalized and activated by the ReLU activation function to output the feature image T5; T5 is then input to the maximum pooling layer for dimensionality reduction, and the feature image T6 is output. Then T6 is input to the MC module, and the MC module uses convolution kernels of different sizes to perform convolution operations on the input feature image T6, and finally outputs the feature image F m4 , and pass it to the output layer.
[0041] The MC module uses convolution kernels of different sizes to perform convolution operations on the input feature image T6, and finally outputs the feature image F m4 , the specific steps include:
[0042] When the three-dimensional feature image T6 with a height of H0, a width of W0, and a number of channels of C0 is input into the MC module, it is simultaneously received by the path I, path II, and path III of the module;
[0043] For path I, the feature image T6 is first convolved with a convolution kernel of size 1×1, then normalized, activated by the ReLU activation function, and reduced in dimension by the maximum pooling layer, and finally the feature image F4 of size H'×W'×C1 is output.
[0044] For path II, the feature image T6 is first convolved with a convolution kernel of size 3×3, then normalized and activated with the ReLU activation function, and finally a feature image F5 of size H'×W'×C2 is output.
[0045] For path III, the feature image T6 is first convolved with a convolution kernel of size 5×5, then normalized and activated with the ReLU activation function, and finally a feature image F6 of size H'×W'×C3 is output.
[0046] The output feature images F4, F5, and F6 are superimposed along the channel dimension to obtain a feature image F7 of size H'×W'×C4, where C4=C1+C2+C3. Finally, the feature image F7 is input into a convolution layer with a convolution kernel size of 1×1 for convolution, and the output feature image F7 of size H'×W'×C' is obtained. m4 .
[0047] The structural diagram of the MC module is as follows: Figure 4 shown.
[0048] S26, the output layer receives the feature image F m4 , determine the feature image F m4 Whether the corresponding Android software is Android malware, and output the judgment result.
[0049] S27, continuously repeat the above steps S21-S26 until the model training is completed. After the training is completed, a trained Android malware detection model based on the EPM-MCNET neural network is obtained.
[0050] S3. Use the Android malware detection model based on the EPM-MCNET neural network to detect Android software and determine whether the Android software is Android malware. The structure diagram of the Android malware detection model based on the EPM-MCNET neural network is as follows: Figure 5 shown.
[0051] The present invention also provides an Android malware detection system based on the EPM-MCNET neural network, comprising:
[0052] Data preprocessing module: Construct an Android software RGB image dataset D, which consists of several Android software RGB images F I constitute.
[0053] Android malware detection model training module: Build an Android malware detection model based on the EPM-MCNET neural network. Input the preprocessed Android software RGB image dataset into the EPM-MCNET neural network for training and testing. Finally, a trained Android malware detection model based on the EPM-MCNET neural network is obtained.
[0054] Android software detection module: The Android software to be detected is input into the trained Android malware detection model to obtain the classification result of the Android software.
[0055] The data preprocessing module includes: first, reading the APK installation packages of multiple Android software and visualizing the binary files in the APK installation packages as RGB images. Finally, constructing and dividing the Android software RGB image dataset D.
[0056] The Android malware detection model training module includes: building an Android malware detection model based on the EPM-MCNET neural network. The model includes a part that visualizes Android software as an RGB image and an EPM-MCNET neural network.
[0057] The EPM-MCNET neural network includes an input layer, an intermediate layer and an output layer; the intermediate layer includes a first convolution normalization activation module CBR1, a second convolution normalization activation module CBR2, a first hard convolution normalization activation module CBH1, a second hard convolution normalization activation module CBH2, a maximum pooling layer, an enhanced perception module EPM, and a multi-scale convolution module MC. The specific model training steps include:
[0058] The first step is to receive any Android software RGB image F in D as input layer I , and F I Passed to the middle layer of the EPM-MCNET neural network.
[0059] Step 2: The CBR1 module in the middle layer receives F I Afterwards, a 3×3 convolution kernel is used to I The convolution operation is performed, and then the convolution result is normalized and activated by the ReLU activation function to output the feature image T1. T1 is then input into the maximum pooling layer for dimensionality reduction, and the feature image F is output. m1 , and pass it to the CBH1 module.
[0060] Step 3: CBH1 module receives F m1 Afterwards, a 3×3 convolution kernel is used to m1 The convolution operation is performed, and then the convolution result is normalized and activated by the H-Swish activation function to output the feature image T2. T2 is then input to the maximum pooling layer for dimensionality reduction, and the feature image T3 is output. T3 is then input to the EPM module to enhance the feature information of a specific area or a specific channel of the feature image T3, and the feature image F is output. m2 Finally, the feature image F m2 Input into the CBH2 module.
[0061] The input of T3 to the EPM module is to enhance the characteristic information of a specific region or a specific channel of the characteristic image T3, and output the characteristic image F m2 The specific steps include:
[0062] When the three-dimensional feature image T3 with a height of H, a width of W, and a number of channels of C is input into the EPM attention module, it is simultaneously received by the path A and the path B of the module;
[0063] For path A, global maximum pooling and global average pooling are used to extract the feature information of feature image T3, and two 1×1×C feature vectors are obtained. Then, path A sums these two feature vectors element by element to obtain a 1×1×C feature vector F A1 ; Then path A uses multi-layer perceptron MLP1 to transform the feature vector F A1 We assign weights to each channel of the function to obtain a feature vector F with a size of 1×1×C. A2 ;
[0064] For path B, global maximum pooling and global average pooling are used to extract the feature information of feature image T3, respectively, to obtain two H×W×1 feature matrices; then, path B sums these two feature matrices element by element to obtain a H×W×1 feature matrix F B1 ; Then path B uses the multi-layer perceptron MLP2 to process the feature matrix F B1 We assign weights to different regions and obtain a H×W×1 feature matrix F B2 ;
[0065] Next, the EPM module will F B2 Reshape to 1×1×HW, so that the eigenvector F A2 With the feature matrix F B2 The channels are superimposed and input into MLP3 for weight assignment, and the output feature vector F1 is 1×1×(HW+C). Then, the feature vector F1 is split into feature vector F2 and feature vector F3, where F2 is 1×1×C and F3 is 1×1×HW. F2 is input into the Sigmoid activation function to obtain the weight vector M. C , that is, the importance of each channel in the feature image T3; reshape the size of the feature vector F3 to H×W×1, and then input F3 into the Sigmoid activation function to obtain the weight matrix M S , that is, the importance of different regions of the feature image T3; finally, the feature image T3 and M C 、M S Multiply them together to get the feature enhanced feature image F m2 The specific formula is:
[0066]
[0067] Among them, δ represents the Sigmoid activation function, ⊙ represents the element-wise product operation, S represents the segmentation of the feature vector along the channel dimension, and R represents the reshaping of the feature vector;
[0068] In formula (1), the calculation formula of the feature vector F1 is shown in formula (2):
[0069]
[0070] Among them, M represents MLP, [,,] represents tensor concatenation operation, Max represents global maximum pooling, Avg represents global average pooling, represents element-wise summation, and R represents reshaping the feature vector.
[0071] Step 4: CBH2 module receives F m2 Afterwards, a 3×3 convolution kernel is used to m2 The convolution operation is performed, and then the convolution result is normalized, and then activated by the H-Swish activation function to output the feature image T4. Then T4 is input into the EPM module to output the feature image F m3 , and finally the feature image F m3 Input to the CBR2 module.
[0072] Step 5: The CBR2 module receives the feature image F m3 , use a 3×3 convolution kernel to m3 The convolution operation is performed, and then the convolution result is normalized and activated by the ReLU activation function to output the feature image T5; T5 is then input to the maximum pooling layer for dimensionality reduction, and the feature image T6 is output. Then T6 is input to the MC module, and the MC module uses convolution kernels of different sizes to perform convolution operations on the input feature image T6, and finally outputs the feature image F m4 , and pass it to the output layer.
[0073] Step 6: The output layer receives the feature image F m4 , determine the feature image F m4 Whether the corresponding Android software is Android malware, and output the judgment result.
[0074] Step 7: Repeat the above steps 1 to 6 until the model training is completed. After the training is completed, the trained Android malware detection model based on the EPM-MCNET neural network is obtained.
[0075] Android software detection module: Use the Android malware detection model based on the EPM-MCNET neural network to detect Android software and determine whether the Android software is Android malware.
[0076] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of an Android malware detection model based on an EPM-MCNET neural network when executing the computer program.
[0077] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of an Android malware detection model based on an EPM-MCNET neural network.
[0078] The beneficial effects of the present invention are:
[0079] (1) The present invention proposes a lightweight neural network EPM-MCNET, which has good feature extraction capabilities with short detection time and a small number of parameters. It can quickly and accurately classify Android software.
[0080] (2) The present invention proposes a multi-scale convolution module MC, which uses convolution kernels of different sizes to perform convolution operations on the input feature image to obtain feature information extracted from the convolution kernels of different sizes. The MC module then fuses and outputs the feature information, increasing the diversity of feature information and further enhancing the feature extraction capability of the neural network, thereby helping to improve the performance and effect of the neural network in detecting Android malware.
[0081] (3) The EPM module proposed in the present invention can comprehensively utilize the channel feature information and spatial feature information of the feature image to enhance the importance of different regions or different channels of the feature image and improve the effect of neural network in extracting key features of Android software. BRIEF DESCRIPTION OF THE DRAWINGS
[0082] Figure 1 This is a flowchart of the steps of the Android malware detection method based on the EPM-MCNET neural network;
[0083] Figure 2 This is a schematic diagram of the network architecture of the EPM-MCNET neural network;
[0084] Figure 3 It is a schematic diagram of the structure of the EPM module;
[0085] Figure 4 This is the structural diagram of the MC module.
[0086] Figure 5 This is a schematic diagram of the structure of the Android malware detection model based on the EPM-MCNET neural network. DETAILED DESCRIPTION
[0087] The present invention will be further defined below in conjunction with the accompanying drawings and embodiments, but is not limited thereto.
[0088] Example 1
[0089] Those skilled in the art will appreciate that the following examples are only used to illustrate the present invention and should not be considered to limit the scope of the present invention. If no specific techniques or conditions are specified in the examples, the techniques or conditions described in the literature in the art or the product specifications are used. If the manufacturer of the materials or equipment used is not specified, they are all conventional products that can be purchased.
[0090] An Android malware detection method based on EPM-MCNET neural network, such as Figure 1 As shown, the following steps are included:
[0091] S1: Construct an Android software RGB image dataset D, which consists of several Android software RGB images F I constitute;
[0092] S2: Build and train an Android malware detection model based on the EPM-MCNET neural network. The model includes a part that visualizes Android software as an RGB image and an EPM-MCNET neural network.
[0093] S3: Use the Android malware detection model based on the EPM-MCNET neural network to detect Android software and determine whether the Android software is Android malware.
[0094] Preferably, step S1 specifically includes:
[0095] Step S11, read the APK installation packages of multiple Android software and obtain the classes.dex, AndroidManifest.xml, and resources.arsc binary files.
[0096] Step S12: Visualize the classes.dex, AndroidManifest.xml, and resources.arsc binary files as RGB images.
[0097] Step S13: Obtain an Android software RGB image dataset D, where D consists of a number of Android software RGB images F I constitute.
[0098] Preferably, step S11 reads the APK installation package of the Android software to obtain the classes.dex, AndroidManifest.xml, and resources.arsc binary files as follows:
[0099] Change the suffix of the APK installation package from .apk to .zip, read the APK installation package, and obtain the classes.dex, AndroidManifest.xml, and resources.arsc binary files.
[0100] Preferably, step S12 visualizes the two files classes.dex, AndroidManifest.xml, and resources.arsc as RGB images as follows:
[0101] Visualize the classes.dex, AndroidManifest.xml, and resources.arsc binary files obtained in step S11 as RGB images. Specifically, for each of the above files, read 8 bits in the file as a group, and convert each group into an unsigned decimal integer, which is called a pixel, ranging from 0 to 255. Then, fill the array of unsigned decimal integers into a two-dimensional matrix of size 224×224 in sequence. Then fill the two-dimensional matrices generated by the classes.dex, AndroidManifest.xml, and resources.arsc binary files into the three color channels of R, G, and B respectively, and finally generate an RGB image with a height of 224, a width of 224, and 3 channels.
[0102] S2: Build and train an Android malware detection model based on the EPM-MCNET neural network. The model includes a part that visualizes Android software as an RGB image and an EPM-MCNET neural network. The overall network structure diagram of EPM-MCNET is shown in the figure. Figure 2 shown.
[0103] The EPM-MCNET neural network includes an input layer, an intermediate layer and an output layer. The intermediate layer includes a first convolution normalization activation module CBR1, a second convolution normalization activation module CBR2, a first hard convolution normalization activation module CBH1, a second hard convolution normalization activation module CBH2, a maximum pooling layer, an enhanced perception module EPM, and an MC module. The specific model training steps include: S21, the input layer receives any Android software RGB image F in D I , and F I Passed to the middle layer of the EPM-MCNET neural network.
[0104] S22, the CBR1 module in the middle layer receives F I Afterwards, a 3×3 convolution kernel is used to I The convolution operation is performed, and then the convolution result is normalized and activated by the ReLU activation function to output the feature image T1. T1 is then input into the maximum pooling layer for dimensionality reduction, and the feature image F is output. m1 , and pass it to the CBH1 module.
[0105] S23, CBH1 module receives F m1Afterwards, a 3×3 convolution kernel is used to m1 The convolution operation is performed, and then the convolution result is normalized, and then activated by the H-Swish activation function to output the feature image T2. T2 is then input into the maximum pooling layer for dimensionality reduction, and the feature image T is output. 3。 Then, T3 is input to the EPM module to enhance the feature information of a specific region or a specific channel of the feature image T3 and output the feature image F m2 Finally, the feature image F m2 Input into the CBH2 module.
[0106] Preferably, the input of T3 to the EPM module is to enhance the characteristic information of a specific region or a specific channel of the characteristic image T3, and output the characteristic image F m2 The specific steps include:
[0107] When the three-dimensional feature image T3 with a height of H, a width of W, and a number of channels of C is input into the EPM attention module, it is simultaneously received by the path A and the path B of the module;
[0108] For path A, global maximum pooling and global average pooling are used to extract the feature information of feature image T3, and two 1×1×C feature vectors are obtained. Then, path A sums these two feature vectors element by element to obtain a 1×1×C feature vector F A1 ; Then path A uses multi-layer perceptron MLP1 to transform the feature vector F A1 We assign weights to each channel of the function to obtain a feature vector F with a size of 1×1×C. A2 ;
[0109] For path B, global maximum pooling and global average pooling are used to extract the feature information of feature image T3, respectively, to obtain two H×W×1 feature matrices; then, path B sums these two feature matrices element by element to obtain a H×W×1 feature matrix F B1 ; Then path B uses the multi-layer perceptron MLP2 to process the feature matrix F B1 We assign weights to different regions and obtain a H×W×1 feature matrix F B2 ;
[0110] Next, the EPM module will F B2 Reshape to 1×1×HW, so that the eigenvector F A2 With the feature matrix F B2The channels are superimposed and input into MLP3 for weight assignment, and the output feature vector F1 is 1×1×(HW+C). Then, the feature vector F1 is split into feature vector F2 and feature vector F3, where F2 is 1×1×C and F3 is 1×1×HW. F2 is input into the Sigmoid activation function to obtain the weight vector M. C , that is, the importance of each channel in the feature image T3; reshape the size of the feature vector F3 to H×W×1, and then input F3 into the Sigmoid activation function to obtain the weight matrix M S , that is, the importance of different regions of the feature image T3; finally, the feature image T3 and M C 、M S Multiply them together to get the feature enhanced feature image F m2 The specific formula is:
[0111]
[0112] Among them, δ represents the Sigmoid activation function, ⊙ represents the element-wise product operation, S represents the segmentation of the feature vector along the channel dimension, and R represents the reshaping of the feature vector;
[0113] In formula (1), the calculation formula of the feature vector F1 is shown in formula (2):
[0114]
[0115] Among them, M represents MLP, [,,] represents tensor concatenation operation, Max represents global maximum pooling, Avg represents global average pooling, represents element-wise summation, and R represents reshaping the feature vector.
[0116] The structural diagram of the channel space fusion module EPM is as follows: Figure 3 shown.
[0117] In a specific implementation operation, a three-dimensional feature image T3 (27×27×128) is input into the EPM module and is received by path A and path B of the module at the same time.
[0118] For path A, global maximum pooling and global average pooling are used to extract the feature information of feature image T3, and two 1×1×128 feature vectors are obtained. Then, path A sums these two feature vectors element by element to obtain a 1×1×128 feature vector F A1 ; Then path A uses multi-layer perceptron MLP1 to transform the feature vector F A1 We assign weights to each channel and obtain a feature vector F with a size of 1×1×128 A2 .
[0119] For path B, global maximum pooling and global average pooling are used to extract the feature information of feature image T3, respectively, to obtain two 27×27×1 feature matrices; then, path B sums these two feature matrices element by element to obtain a 27×27×1 feature matrix F B1 ; Then path B uses the multi-layer perceptron MLP2 to process the feature matrix F B1 We assign weights to different regions and obtain a 27×27×1 feature matrix F B2 ;
[0120] Next, the EPM module uses the reshape function in Python to transform F B2 The size of F is changed to 1×1×729, so that the eigenvector F A2 With the feature matrix F B2 The channels are stacked and input into MLP3 for weight assignment, and the output feature vector F1 is 1×1×857. Then, the spilt function in Python is used to split the feature vector F1 into feature vector F2 and feature vector F3, where F2 is 1×1×128 and F3 is 1×1×729. F2 is input into the Sigmoid activation function to obtain the weight vector M. C , that is, the importance of each channel in the feature image T3; then call the reshape function to reshape the size of the feature vector F3 to 27×27×1, and then input F3 into the Sigmoid activation function to obtain the weight matrix M S , that is, the importance of different regions of the feature image T3; finally, the feature image T3 and M C 、M S Multiply them together to get the feature enhanced feature image F m2 .
[0121] S24, CBH2 module receives F m2 Afterwards, a 3×3 convolution kernel is used to m2 The convolution operation is performed, and then the convolution result is normalized and activated by the H-Swish activation function to output the feature image T4. Then T4 is input into the EPM attention module to output the feature image F m3 , and finally the feature image F m3 Input to the CBR2 module.
[0122] S25, CBR2 module receives feature image F m3 , use a 3×3 convolution kernel to m3The convolution operation is performed, and then the convolution result is normalized and activated by the ReLU activation function to output the feature image T5. Then T5 is input to the maximum pooling layer for dimensionality reduction, and the feature image T6 is output. Then T6 is input to the MC module, and the MC module uses convolution kernels of different sizes to perform convolution operations on the input feature image T6, and finally outputs the feature image F m4 , and pass it to the output layer.
[0123] Preferably, the MC module uses convolution kernels of different sizes to perform convolution operations on the input feature image T6, and finally outputs the feature image F m4 , the specific steps include:
[0124] When the three-dimensional feature image T6 with a height of H0, a width of W0, and a number of channels of C0 is input into the MC module, it is simultaneously received by the path I, path II, and path III of the module;
[0125] For path I, the feature image T6 is first convolved with a convolution kernel of size 1×1, then normalized, activated by the ReLU activation function, and reduced in dimension by the maximum pooling layer, and finally a feature image F4 of size H'×W'×C1 is output.
[0126] For path II, the feature image T6 is first convolved with a convolution kernel of size 3×3, then normalized and activated with the ReLU activation function, and finally a feature image F5 of size H'×W'×C2 is output.
[0127] For path III, the feature image T6 is first convolved with a convolution kernel of size 5×5, then normalized and activated with the ReLU activation function, and finally a feature image F6 of size H'×W'×C3 is output.
[0128] The output feature images F4, F5, and F6 are superimposed along the channel dimension to obtain a feature image F7 of size H'×W'×C4, where C4=C1+C2+C3. Finally, the feature image F7 is input into a convolution layer with a convolution kernel size of 1×1 for convolution, and the output feature image F7 of size H'×W'×C' is obtained. m4 .
[0129] The structural diagram of the MC module is as follows: Figure 4 shown.
[0130] S26, the output layer receives the feature image F m4 , determine the feature image F m4 Whether the corresponding Android software is Android malware, and output the judgment result;
[0131] S27, keep repeating the above steps S21-S26 until the model training is completed. Finally, a trained Android malware detection model based on the EPM-MCNET neural network is obtained.
[0132] In the specific implementation, the data set D is divided into a training set and a test set in a ratio of 7:3, and the number of training rounds of the model is set to 50 rounds.
[0133] S3. Use the Android malware detection model based on the EPM-MCNET neural network to detect Android software and determine whether the Android software is Android malware. The structure diagram of the Android malware detection model based on the EPM-MCNET neural network is as follows: Figure 5 shown.
[0134] Example 2
[0135] The present invention also provides an embodiment of an Android malware detection system based on an EPM-MCNET neural network, comprising:
[0136] Data preprocessing module: preprocess the Android software dataset to be trained.
[0137] Android malware detection model training module: Build an Android malware detection model based on the EPM-MCNET neural network. Input the preprocessed Android software RGB image dataset into the EPM-MCNET neural network for neural network training and testing. Finally, a trained Android malware detection model based on the EPM-MCNET neural network is obtained.
[0138] Android software detection module: inputs the Android software to be detected into the trained Android malware detection model to determine whether the Android software is Android malware.
[0139] The data preprocessing module includes: constructing an Android software RGB image dataset D, which consists of several Android software RGB images F I constitute.
[0140] The Android malware detection model training module includes: building an Android malware detection model based on the EPM-MCNET neural network. Inputting the Android software RGB image obtained after preprocessing into the EPM-MCNET neural network for training and testing. Finally, a trained Android malware detection model based on the EPM-MCNET neural network is obtained.
[0141] Android software detection module: The Android software to be detected is input into the trained Android malware detection model to obtain the Android software classification result.
[0142] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0143] In the embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the system embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0144] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0145] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0146] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0147] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. An Android malware detection method based on EPM-MCNET neural network, characterized in that: include: S1. Build an Android software RGB image dataset D, which consists of several Android software RGB images F I constitute; S2. Construct and train an Android malware detection model based on the EPM-MCNET neural network; the model includes a part that visualizes Android software as an RGB image and an EPM-MCNET neural network part; the EPM-MCNET neural network includes an input layer, an intermediate layer, and an output layer; the intermediate layer includes a first convolution normalization activation module CBR1, a second convolution normalization activation module CBR2, a first hard convolution normalization activation module CBH1, a second hard convolution normalization activation module CBH2, a maximum pooling layer, an enhanced perception module EPM, and a multi-scale convolution module MC. The specific model training steps include: S21, the input layer receives any Android software RGB image F in D I , and F I Passed to the middle layer of the EPM-MCNET neural network; S22, the CBR1 module in the middle layer receives F I Afterwards, I Perform convolution, normalization and ReLU activation function to activate; output feature image T1; then input T1 into the maximum pooling layer for dimensionality reduction, and output feature image F m1 , and pass it to the CBH1 module; S23, CBH1 module receives F m1 Afterwards, m1 Convolution, normalization and H-Swish activation function are performed to activate and output the feature image T2; T2 is then input into the maximum pooling layer for dimensionality reduction and outputs the feature image T3; T3 is then input into the EPM module to enhance the feature information of a specific region or a specific channel of the feature image T3 and output the feature image F m2 ; Finally, the feature image F m2 Input into CBH2 module; The input of T3 to the EPM module is to enhance the characteristic information of a specific region or a specific channel of the characteristic image T3, and output the characteristic image F m2 , the specific steps include: When the three-dimensional feature image T3 with a height of H, a width of W, and a number of channels of C is input into the EPM module, it is simultaneously received by the path A and the path B of the module; For path A, global maximum pooling and global average pooling are used to extract the feature information of feature image T3, and two 1×1×C feature vectors are obtained. Then, path A sums these two feature vectors element by element to obtain a 1×1×C feature vector F A1 ; Then path A uses multi-layer perceptron MLP1 to transform the feature vector F A1 We assign weights to each channel of the function to obtain a feature vector F with a size of 1×1×C. A2 ; For path B, global maximum pooling and global average pooling are used to extract the feature information of feature image T3, respectively, to obtain two H×W×1 feature matrices; then, path B sums these two feature matrices element by element to obtain a H×W×1 feature matrix F B1 ; Then path B uses the multi-layer perceptron MLP2 to process the feature matrix F B1 We assign weights to different regions and obtain a H×W×1 feature matrix F B2 ; Next, the EPM module will F B2 Reshape to 1×1×HW, so that the eigenvector F A2 With the feature matrix F B2 The channels are superimposed and input into MLP3 for weight assignment, and the feature vector F1 with a size of 1×1×(HW+C) is output. Then, the feature vector F1 is split into feature vector F2 and feature vector F3, where F2 is 1×1×C and F3 is 1×1×HW. F2 is input into the Sigmoid activation function to obtain the weight vector M. C , that is, the importance of each channel in the feature image T3; reshape the size of the feature vector F3 to H×W×1, and then input F3 into the Sigmoid activation function to obtain the weight matrix M S , that is, the importance of different regions of the feature image T3; finally, the feature image T3 and M C 、M S Multiply them together to get the feature enhanced feature image F m2 ; The specific formula is: Among them, δ represents the Sigmoid activation function, ⊙ represents the element-wise product operation, S represents the segmentation of the feature vector along the channel dimension, and R represents the reshaping of the feature vector; In formula (1), the calculation formula of the feature vector F1 is shown in formula (2): Among them, M represents MLP, [,,] represents tensor concatenation operation, Max represents global maximum pooling, Avg represents global average pooling, represents the element-by-element summation, and R represents the reshaped feature vector; S24, CBH2 module receives F m2 After that, for F m2 Convolution, normalization and H-Swish activation function are performed to output the feature image T4; then T4 is input into the EPM module to output the feature image F m3 , and finally the feature image F m3 Input into CBR2 module; S25, CBR2 module receives feature image F m3 , for F m3 Convolution, normalization and ReLU activation function are performed to activate and output feature image T5; T5 is then input to the maximum pooling layer for dimensionality reduction and output feature image T6; T6 is then input to the MC module, which uses convolution kernels of different sizes to perform convolution operations on the input feature image T6 and finally outputs the feature image F m4 , and pass it to the output layer; S26, the output layer receives the feature image F m4 , determine the feature image F m4 Whether the corresponding Android software is Android malware, and output the judgment result; S27, repeating steps S21-S26 until the model training is completed; after the training is completed, an Android malware detection model based on the EPM-MCNET neural network is obtained; S3. Use the Android malware detection model based on the EPM-MCNET neural network to detect Android software and determine whether the Android software is Android malware.
2. The Android malware detection method based on EPM-MCNET neural network according to claim 1, characterized in that: In step S25, the MC module uses convolution kernels of different sizes to perform convolution operations on the input feature image T6, and finally outputs the feature image F m4 , the specific contents include: When the three-dimensional feature image T6 with a height of H0, a width of W0, and a number of channels of C0 is input into the MC module, it is simultaneously received by the path I, path II, and path III of the module; For path I, the feature image T6 is first convolved with a convolution kernel of size 1×1, then normalized, activated by the ReLU activation function, and reduced in dimension by the maximum pooling layer, and finally the feature image F4 of size H'×W'×C1 is output; For path II, the feature image T6 is first convolved with a convolution kernel of size 3×3, then normalized and activated with the ReLU activation function, and finally the feature image F5 of size H'×W'×C2 is output; For path III, the feature image T6 is first convolved with a convolution kernel of size 5×5, then normalized and activated with the ReLU activation function, and finally the feature image F6 of size H'×W'×C3 is output; The feature images F4, F5, and F6 are superimposed along the channel dimension to obtain a feature image F7 of size H'×W'×C4, where C4=C1+C2+C3; finally, the feature image F7 is input into a convolutional layer with a convolution kernel size of 1×1 for convolution, and a feature image F with a size of H'×W'×C' is output. m4 .
3. An Android malware detection system based on EPM-MCNET neural network, which is implemented by an Android malware detection method based on EPM-MCNET neural network according to claim 1, characterized in that: It includes a data preprocessing module, an Android malware detection model training module, and an Android software detection module: the data preprocessing module: constructs an Android software RGB image dataset D, where D consists of a number of Android software RGB images FI; The Android malware detection model training module: constructs an Android malware detection model based on the EPM-MCNET neural network; the model includes a part that visualizes Android software as an RGB image and an EPM-MCNET neural network part; the EPM-MCNET neural network includes an input layer, an intermediate layer and an output layer; the intermediate layer includes a first convolution normalization activation module CBR1, a second convolution normalization activation module CBR2, a first hard convolution normalization activation module CBH1, a second hard convolution normalization activation module CBH2, a maximum pooling layer, an enhanced perception module EPM, and a multi-scale convolution module MC. The specific model training steps include: The first step is to receive any Android software RGB image F in D as input layer I , and F I Passed to the middle layer of the EPM-MCNET neural network; Step 2: The CBR1 module in the middle layer receives F I Afterwards, I Perform convolution, normalization and ReLU activation function to activate; output feature image T1; then input T1 into the maximum pooling layer for dimensionality reduction, and output feature image F m1 , and pass it to the CBH1 module; Step 3: CBH1 module receives F m1 Afterwards, m1 Convolution, normalization and H-Swish activation function are performed to activate and output the feature image T2; T2 is then input into the maximum pooling layer for dimensionality reduction and outputs the feature image T3; T3 is then input into the EPM module to enhance the feature information of a specific region or a specific channel of the feature image T3 and output the feature image F m2 ; Finally, the feature image F m2 Input into CBH2 module; The input of T3 to the EPM module is to enhance the characteristic information of a specific region or a specific channel of the characteristic image T3, and output the characteristic image F m2 , the specific steps include: When the three-dimensional feature image T3 with a height of H, a width of W, and a number of channels of C is input into the EPM module, it is simultaneously received by the path A and the path B of the module; For path A, global maximum pooling and global average pooling are used to extract the feature information of feature image T3, and two 1×1×C feature vectors are obtained. Then, path A sums these two feature vectors element by element to obtain a 1×1×C feature vector F A1 ; Then path A uses multi-layer perceptron MLP1 to transform the feature vector F A1 We assign weights to each channel of the function to obtain a feature vector F with a size of 1×1×C. A2 ; For path B, global maximum pooling and global average pooling are used to extract the feature information of feature image T3, respectively, to obtain two H×W×1 feature matrices; then, path B sums these two feature matrices element by element to obtain a H×W×1 feature matrix F B1 ; Then path B uses the multi-layer perceptron MLP2 to process the feature matrix F B1 We assign weights to different regions and obtain a H×W×1 feature matrix F B2 ; Next, the EPM module will F B2 Reshape to 1×1×HW, so that the eigenvector F A2 With the feature matrix F B2 The channels are superimposed and input into MLP3 for weight assignment, and the feature vector F1 with a size of 1×1×(HW+C) is output. Then, the feature vector F1 is split into feature vector F2 and feature vector F3, where F2 is 1×1×C and F3 is 1×1×HW. F2 is input into the Sigmoid activation function to obtain the weight vector M. C , that is, the importance of each channel in the feature image T3; reshape the size of the feature vector F3 to H×W×1, and then input F3 into the Sigmoid activation function to obtain the weight matrix M S , that is, the importance of different regions of the feature image T3; finally, the feature image T3 and M C 、M S Multiply them together to get the feature enhanced feature image F m2; The specific formula is: Among them, δ represents the Sigmoid activation function, ⊙ represents the element-wise product operation, S represents the segmentation of the feature vector along the channel dimension, and R represents the reshaping of the feature vector; In formula (1), the calculation formula of the feature vector F1 is shown in formula (2): Among them, M represents MLP, [,,] represents tensor concatenation operation, Max represents global maximum pooling, Avg represents global average pooling, represents the element-by-element summation, and R represents the reshaped feature vector; Step 4: CBH2 module receives F m2 After that, for F m2 Convolution, normalization and H-Swish activation function are performed to output the feature image T4; then T4 is input into the EPM module to output the feature image F m3 , and finally the feature image F m3 Input into CBR2 module; Step 5: The CBR2 module receives the feature image F m3 , for F m3 Convolution, normalization and ReLU activation function are performed to activate and output feature image T5; T5 is then input to the maximum pooling layer for dimensionality reduction and output feature image T6; T6 is then input to the MC module, which uses convolution kernels of different sizes to perform convolution operations on the input feature image T6 and finally outputs the feature image F m4 , and pass it to the output layer; Step 6: The output layer receives the feature image F m4 , determine the feature image F m4 Whether the corresponding Android software is Android malware, and output the judgment result; Step 7: Repeat the above steps 1 to 6 until the model training is completed; after the training is completed, an Android malware detection model based on the EPM-MCNET neural network is obtained; The Android software detection module uses an Android malware detection model based on the EPM-MCNET neural network to detect Android software and determine whether the Android software is Android malware.
4. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the Android malware detection method based on the EPM-MCNET neural network described in any one of claims 1-2 are implemented.
5. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by the processor, the steps of the Android malware detection method based on the EPM-MCNET neural network described in any one of claims 1-2 are implemented.
