Malicious software detection method and device and storage medium
The detection model is used to preprocess and feature the malware's interface instruction function sequence, combined with the MOE-Transformer-Encoder layer, to solve the time-consuming, labor-intensive and manual deviation problems of traditional malware detection methods, achieving a more efficient and accurate Malware identification.
Patent Information
- Application Number
- CN202410641314.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-22
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2044-05-22
AI Technical Summary
Traditional malware detection methods rely on pattern matching or fingerprint matching, which is time-consuming and labor-intensive and requires continuous construction and maintenance of fingerprint libraries. There is a high degree of manual bias and insufficient detection accuracy.
The interface instruction function sequence of the target software is preprocessed through the detection model, the initial sequence features are extracted, and multiple feature processors are used to perform feature processing from different dimensions, combined with the MOE-Transformer-Encoder layer for linear mapping, and the detection results are output to reduce Manual intervention improves recognition accuracy.
It improves the efficiency and accuracy of malware detection and reduces manual bias. Compared with traditional methods, it can extract features at a deeper level and improve identification capabilities.
Smart Images

Figure CN118797635A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure generally relates to the field of machine control, and more particularly to a method, device, and computer-readable storage medium for detecting malware. Background Art
[0002] Malware Malware is any program designed to harm a computer system or its users. This type of malware can cause system crashes, data loss, personal information leakage, and other security and privacy issues. The purpose of malware detection is to identify and remove malware from a computer system to protect the system and users from potential threats.
[0003] Traditional malware detection methods are usually based on pattern matching or fingerprint matching. These methods require continuous construction and maintenance of fingerprint libraries and rely on expert knowledge, which is very time-consuming and labor-intensive in practical applications. Summary of the invention
[0004] In view of the above-mentioned defects or deficiencies in the prior art, it is desirable to provide a malware detection method, device, and computer-readable storage medium that can reduce human bias and improve detection accuracy.
[0005] A first aspect provides a method for detecting malware, the method comprising: Acquire a detection data set corresponding to the target software, and input the detection data set into a detection model, wherein the detection data set includes a plurality of interface instruction function sequences; Preprocessing each of the interface instruction function sequences by using the detection model to obtain initial sequence features corresponding to the target software; Performing feature screening processing on the initial sequence features by the detection model to obtain feature screening results of the initial sequence features; Selecting a target encoder from the detection model based on the feature screening result, and performing feature processing on the initial sequence features by the target encoder to obtain target sequence features, wherein the target encoder includes a plurality of feature processors, and the plurality of feature processors perform feature processing from different dimensions; The target sequence features are linearly mapped through the detection model, and the detection result of the target software is output.
[0006] The malware detection method provided in the present application detects malware on the target software based on the detection data set of the target software through a detection model, wherein the detection model can pre-process the interface instruction function sequences corresponding to multiple target software to obtain the initial sequence features corresponding to the target software, which can not only reduce the amount of data processing and improve the efficiency of detection, but also perform deeper extraction of the features of the target software from different dimensions through different encoders and feature processors. Compared with traditional manual feature extraction and machine learning methods, it can reduce human bias and improve recognition accuracy.
[0007] A second aspect provides a detection device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the detection method of the first aspect when executing the computer program.
[0008] A third aspect provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the detection method of the first aspect when executed by a processor. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] Other features, objects and advantages of the present application will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings: Figure 1 A flowchart of the steps of a malware detection method provided by the present application; Figure 2 A flowchart of another method for detecting malware provided by the present application; Figure 3 A schematic diagram of the structure of a MOE-Transformer-Encoder layer provided in this application; Figure 4 A flowchart of another method for detecting malware provided by the present application; Figure 5 A flowchart of another method for detecting malware provided by the present application; Figure 6 A schematic diagram of the structure of a detection device provided in this application. DETAILED DESCRIPTION
[0010] The present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the relevant invention, rather than to limit the invention. It is also necessary to explain that, for ease of description, only the parts related to the invention are shown in the accompanying drawings.
[0011] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0012] Please refer to Figure 1 , Figure 1 A flowchart of a method for detecting malware provided by an exemplary embodiment of the present application includes the following steps: Step S20, obtaining a detection data set corresponding to the target software, and inputting the detection data set into a detection model, wherein the detection data set includes a plurality of interface instruction function sequences; The target software is any software that needs to be tested for malware, and the detection data set includes data that can represent the characteristics of the target software, such as the software code of the target software, the running information of the target software, the interface information of the target software, etc. Exemplarily, the present application may select the interface instruction function sequence of the target software as the detection data set.
[0013] The detection model may be a model that has been trained in advance by a service device, a terminal device, etc., and stored in a memory corresponding to the device. The detection model is used to detect whether the target software is malware.
[0014] In one embodiment, the detection data set of the target software can be obtained according to the interface instruction function sequence generated during the operation of the target software. Then the service device or the terminal device can send an acquisition instruction to the device equipped with the target software to obtain the detection data sent by the device equipped with the target software, and obtain the detection data set after aggregating the data.
[0015] In another embodiment, Figure 2 As shown, Figure 2 An optional method embodiment of obtaining a detection data set provided by an exemplary embodiment of the present application includes the following steps: Step S201, simulate the operation of the target software through the sandbox program to obtain multiple interface instruction function sequences corresponding to the target software; Among them, the sandbox program can be a program in the service device for simulating software operation. Then, when the service device determines that malware detection needs to be performed on the target software, the target software can be run through the sandbox program running thereon to obtain multiple interface instruction function sequences obtained by the target software during the operation process.
[0016] Step S202: taking a set consisting of a plurality of interface instruction function sequences as a detection data set.
[0017] Then, the service device may aggregate multiple interface instruction function sequences obtained during the operation of the target software to obtain a set of multiple interface instruction function sequences and use it as a detection data set, so the detection data set includes multiple interface instruction function sequences generated by the target software during operation.
[0018] The present application runs the software that needs to be tested through a pre-set running program to obtain the test data corresponding to the software that needs to be tested, so that the application of the present application is not limited to the test of software that carries the test data itself, but can also be used for the test of software that has not yet been run and has no running data, thereby expanding the application scope of the present application.
[0019] Next, the method of training the detection model in this application is explained: Acquire positive sample data and negative sample data, wherein the positive sample data includes a plurality of interface instruction function sequences corresponding to malware, and the negative sample data includes a plurality of interface instruction function sequences corresponding to benign software; The positive sample data may be obtained after obtaining a certain number of malwares according to the interface instruction function sequence corresponding to each malware. It is understandable that the interface instruction function sequence corresponding to each malware may be collected and obtained during the operation of each malware, or may be obtained by simulating the operation of a sandbox program, which is not limited here.
[0020] Based on the same acquisition method, negative sample data is obtained after obtaining a certain number of benign software and according to the interface instruction function sequence corresponding to each benign software. It should be noted that the certain number can be determined according to the model training requirements, and the number of positive sample data and negative sample data can be the same or different, which is not limited here.
[0021] After obtaining the positive sample data and the negative sample data according to the above method, the present application can combine the positive sample data and the negative sample data into a package to obtain a training sample, and perform package-level annotation on the training sample, that is, only annotate the software package, and no longer annotate each API sequence separately. This can simplify the annotation task, reduce the difficulty of annotation, and make full use of the multi-instance learning method to better extract the main malicious features and reduce noise interference, thereby improving the accuracy of the classification results.
[0022] Initialize the initial model to set the number of iterations of the model; Initializing the initial model means clearing all previous training traces and defining the starting point of the training and the number of iterations so that the initial model can be trained in an orderly manner according to the preset training rules. For example, the number of iterations is 10.
[0023] Inputting the positive sample data and the negative sample data into the initial model in sequence for model training; According to the above description, the positive sample data and the negative sample data together constitute the training samples. However, when performing model training, the training samples corresponding to each software are divided and input into the initial model in sequence for model training.
[0024] For example, if the training sample includes multiple interface instruction function sequences corresponding to the first software, multiple interface instruction function sequences corresponding to the second software, multiple interface instruction function sequences corresponding to the third software, multiple interface instruction function sequences corresponding to the fourth software, multiple interface instruction function sequences corresponding to the fifth software, and multiple interface instruction function sequences corresponding to the sixth software, and it is known that the first software, the second software, and the third software are malware; and the fourth software, the fifth software, and the sixth software are benign software.
[0025] Then, multiple interface instruction function sequences corresponding to the first software may be input into the initial model to complete a complete model training; after the first software is model trained once, multiple interface instruction function sequences corresponding to the second software may be input into the initial model to complete a complete model training; after the second software is model trained once, multiple interface instruction function sequences corresponding to the third software may be input into the initial model to complete a complete model training; after the third software is model trained once, multiple interface instruction function sequences corresponding to the fourth software may be input into the initial model to complete a complete model training; after the fourth software is model trained once, multiple interface instruction function sequences corresponding to the fifth software may be input into the initial model to complete a complete model training; after the fifth software is model trained once, multiple interface instruction function sequences corresponding to the sixth software may be input into the initial model to complete a complete model training; repeat the above steps until the training process is completed for the number of iterations.
[0026] Since the training process for multiple interface instruction function sequences corresponding to each software is the same, the subsequent model training process is exemplified below by taking the process of model training for multiple interface instruction function sequences corresponding to the first software as an example.
[0027] First, after the multiple interface instruction function sequences corresponding to the first software are input into the initial model, the initial model will perform word segmentation processing on the multiple interface instruction function sequences corresponding to the first software to obtain word segmentation sets corresponding to the multiple interface instruction function sequences.
[0028] In order to convert the function sequence into a mathematical problem, a vector representation is performed. However, if each interface instruction function sequence is represented by a vector, the amount of information is too large, and if it is represented by a word, the meaning cannot be accurately expressed. Therefore, this application chooses to represent each interface instruction function sequence by a word, so that the interface instruction function sequence can be represented by the smallest unit that can express the complete meaning. Not only can the interface instruction function sequence be uniquely represented, but it is also convenient for the subsequent conversion of the vector into a eigenvalue.
[0029] It is understandable that after obtaining the word segmentation set, each word segmentation may be converted into a vector with a fixed size to represent the word segmentation set with a word vector to obtain a corresponding word vector set.
[0030] For each software, all the interface instruction function sequences it possesses constitute a multi-example package. The present application may continue to select the interface instruction function sequence that best represents the characteristics of the software from each interface instruction function sequence by means of maximum pooling as the feature for subsequent feature processing. Exemplarily, the feature value of each word vector in the word vector set may be calculated by means of maximum pooling, and the word vector with the largest feature value may be used as the feature of the first software. Exemplarily, the maximum vector of the word vector matrix in the first and second dimensions may be calculated using the maximum pooling method, and a vector of size 1024 may be obtained.
[0031] In addition, the initial model of the present application also includes a classification sub-model consisting of an expert gated binary classification linear layer, two MOE-Transformer-Encoder layers and a linear layer, so as to process and identify the features of the first software through the classification sub-model to obtain a classification result of whether the first software is malware.
[0032] Specifically, after obtaining the features of the first software according to the above method, the initial model calculates the probability that the features belong to malware features and the probability that the features belong to benign software according to the features of the first software through the expert gated binary classification linear layer. It should be noted here that at the beginning of model training, these probability data are randomly assigned by the initial model. After subsequent iterative training and continuous correction of the assignments, more accurate training results will be obtained.
[0033] Then, the initial model calculates the probability that the feature belongs to malware and the probability that the feature belongs to benign software respectively according to the feature of the first software, and selects one of the two MOE-Transformer-Encoder layers for further processing the feature of the first software. It should be noted here that one of the two MOE-Transformer-Encoder layers is used to process the features of malware, and the other is used to process the features of benign software.
[0034] Therefore, if the expert gated binary classification linear layer determines that the probability that the first software is malware is greater than the probability that it is benign software, the MOE-Transformer-Encoder layer for processing the features of the malware will be selected for the first software to process the features of the first software. The processing includes, for example, feature extraction, feature conversion, etc.
[0035] like Figure 3 As shown, each MOE-Transformer-Encoder layer includes multiple feature processors, and the multiple feature processors process features from different dimensions. For example, the first feature processor processes features from the semantic dimension of the feature, the second feature processor processes features from the part of speech of the feature, the third feature processor processes features from the length dimension of the feature, and the fourth feature processor processes features from the vector dimension of the feature. That is to say, each feature processor has different focus points on the features when performing feature processing, so the results obtained by different feature processors for feature processing of the same feature are bound to be different. In this way, deeper features can be extracted and the accuracy of software recognition can be improved. In addition, the linear layer in the MOE-Transformer-Encoder layer chooses to use the SwiGLU activation function to process the features of the software. Compared with the traditional ReLU activation function, this activation function is smoother, easier to converge, and better captures the relationship between input and output.
[0036] However, in order to save time in feature processing, the present application may select two feature processors from multiple feature processors to perform deeper feature processing on the features of the first software. This can not only avoid the inaccurate feature processing results obtained by performing feature processing by only one feature processor, but also improve the efficiency of feature processing.
[0037] Depend on Figure 3It can be seen that the present application also sets an expert gated linear layer before multiple feature processors, and calculates the probability of each feature processor selected by the feature of the first software by setting the expert gated linear layer. Similarly, these probability data are all randomly assigned by the initial model. After subsequent iterative training, the assignment is continuously corrected to obtain more accurate training results.
[0038] Then the initial model can select the feature processor corresponding to the maximum probability and the probability just less than the maximum probability as the target feature processor, and input the probability of the first software into the target feature processor to perform feature extraction and feature transformation processing on the features of the first software.
[0039] Exemplarily, the MOE-Transformer-Encoder layer may perform feature processing operations on the features of the first software by the following method: Step 1: X pi Do linear mapping to form three matrices, Q, K, V, where X pi is the target feature of the software; Q is the query matrix; K is the key matrix; V is the value matrix.
[0040] Q = Linear (X pi )=X pi W Q K=Linear(X pi )=X pi W K V=Linear(X pi )=X pi W V Among them, W Q is the weight corresponding to Q; W K is the weight corresponding to K; W V is the weight corresponding to V; Step 2: Self-attention mechanism: X attention =Softmax( )V Among them, d k Characterize the dimensionality of the software feature vector.
[0041] Step 3: Residual Connection and Layer Normalization: X=X pi +X attention X_L=LayerNorm(X) Step 4: Expert hybrid gating: Calculate the Gate Weight = Linear(X_L) Select the two largest FFN layer indexes in Weight: i, j = Top2[Weight] Compute the mixed result:
[0042] Step 5: Residual connection and Layer Normalization: X=X_L+X_MOE X pi =LayerNorm(X) Step 6: Repeat step 1 to step 5 8 times: Step 7: Get the Transformer extracted .
[0043] Since the features of the first software are subjected to feature extraction and feature transformation processing by two feature processors, two processing results are obtained, which are referred to herein as the first feature result and the second feature result.
[0044] Since there can only be one recognition result for the first software, this application will merge the first feature result and the second feature result to obtain the target feature of the first software. So that the last binary classification linear layer can linearly map the target feature and output a binary classification result. This result can be expressed in the form of probability. For example, the output of the linear layer is 0.3, indicating that the probability of the first software being malware is 0.3. If we define software with a probability of 1 as malware and software with a probability of 0 as benign software, since the first software is known to be malware, the result we want to get is 1 or a result infinitely close to 1. Therefore, when the next round of training is performed on the multiple interface instruction function sequences corresponding to the first software, the data that can be adjusted in the above training process can be adjusted based on the known results, so as to obtain the training results we want.
[0045] The data that can be adjusted include, for example, the numerical value of the feature value, the probability that the software is malware calculated based on the software feature, the probability that the software is benign software calculated based on the software feature, the selected feature processor, etc.
[0046] When the positive sample data corresponding to each software and the negative sample data have completed training for the number of iterations, the above detection model is obtained.
[0047] Exemplarily, after training multiple interface instruction function sequences of the first software, multiple interface instruction function sequences of the second software, multiple interface instruction function sequences of the third software, multiple interface instruction function sequences of the fourth software, multiple interface instruction function sequences of the fifth software and multiple interface instruction function sequences of the sixth software in sequence as one iteration, the required detection model can be trained after the above-mentioned 10 iterations.
[0048] In order to verify the robustness of the detection model, after obtaining the detection model, the present application can also verify the detection model by verifying sample data, and output the detection model when the verification result reaches the predetermined result.
[0049] For example, the data set is divided into training and validation sets in a ratio of 7:3, and finally a 96% accuracy, 95% recall, and 0.96 F1 score are achieved on the validation set, indicating that the detection model can be output. Recall is the recall rate; Precision is the accuracy rate.
[0050] Recall=
[0051] Precision=
[0052] F1=
[0053] Step S30, preprocessing each interface instruction function sequence through the detection model to obtain the initial sequence features corresponding to the target software; The purpose of preprocessing each interface instruction function sequence is to obtain the initial sequence features corresponding to the target software, so as to facilitate subsequent more refined feature processing and obtain more accurate judgment results for the target software.
[0054] In an optional embodiment, if Figure 4 As shown, Figure 4 A method embodiment of preprocessing provided by an exemplary embodiment of the present application includes the following steps: Step S401, performing word segmentation processing on each interface instruction function sequence through a detection model to obtain the word segmentation corresponding to each interface instruction function sequence, and obtaining a word segmentation sequence set according to the word segmentation corresponding to each interface instruction function sequence; Based on the above description of model training, it can be known that the word segmentation processing of each interface instruction function sequence facilitates the subsequent acquisition of vectors to determine the eigenvalues of each vector. The word segmentation processing can be an operation performed by a word segmenter in the detection model, and the type of the word segmenter is not limited here.
[0055] After the word segmentation process is performed on each interface instruction function sequence by the word segmenter, the word segmentation corresponding to each interface instruction function sequence can be obtained, and the word segmentation sequence set can be obtained by aggregating the word segmentation corresponding to each interface instruction function sequence.
[0056] Step S402, vectorizing each word in the word segmentation sequence set using a detection model to obtain a word vector set; Among them, vector representation of word segmentation is conducive to the calculation of feature values of each word segmentation, and the vectors all have a fixed size to avoid disagreement.
[0057] After each word in the word sequence set is represented by a vector of a fixed size, a word vector set can be obtained.
[0058] Step S403, calculating the feature value of each word vector in the word vector set through the detection model, and selecting a target word vector from each word vector as an initial sequence feature based on the feature value of each word vector.
[0059] Among them, for each software, all the interface instruction function sequences it has constitute a multi-example package, and the present application can continue to select the interface instruction function sequence that best represents the characteristics of the target software from each interface instruction function sequence by means of maximum pooling as the initial sequence feature for subsequent feature processing. Exemplarily, the feature value of each word vector in the word vector set can be calculated by means of maximum pooling, and the word vector with the largest feature value is used as the initial sequence feature of the target software.
[0060] Step S40, performing feature screening processing on the initial sequence features through the detection model to obtain feature screening results of the initial sequence features; After obtaining the initial sequence features of the target software according to the above method, it is necessary to perform feature screening processing through the first expert gated linear layer to obtain the feature screening results of the initial sequence features. Specifically: the first probability that the initial sequence features are malware features is calculated through the first expert gated linear layer in the detection model, and the second probability that the initial sequence features are benign software features is calculated; the first probability and the second probability are used as the feature screening results.
[0061] Step S50, selecting a target encoder from the detection model based on the feature screening result, and performing feature processing on the initial sequence features through the target encoder to obtain target sequence features, wherein the target encoder includes multiple feature processors, and the multiple feature processors perform feature processing from different dimensions; Based on the above description, the detection model of the present application includes two MOE-Transformer-Encoder layers, one of which is used to process the characteristics of malware, and the other is used to process the characteristics of benign software.
[0062] Therefore, according to the above-mentioned first probability and second probability, it is possible to initially screen out whether the target software is malware or benign software. Exemplarily, the target encoder may be determined from the two encoders in the detection model according to the first probability, the second probability and the probability threshold. Specifically, when the first probability is greater than the probability threshold, the MOE-Transformer-Encoder layer used to process the features of malware may be selected to perform further feature processing on the initial sequence features of the target software. Conversely, if the second probability is greater than the probability threshold, the MOE-Transformer-Encoder layer used to process the features of benign software may be selected to perform further feature processing on the initial sequence features of the target software.
[0063] In another embodiment, Figure 5 As shown, it can be through Figure 5 The method shown performs feature processing on the initial sequence features through the target encoder to obtain target sequence features: Step S501, calculating the third probability of each feature processor for selecting the initial sequence feature through the second expert gated linear layer in the detection model; Step S502, selecting a feature processor corresponding to a first target probability with a maximum probability value and a second target probability with a probability value only smaller than the first target probability from the third probabilities as a target feature processor; Step S503, inputting the initial sequence features into the target feature processor for feature extraction and feature transformation processing to obtain the first feature and the second feature; Step S504: merge the first feature and the second feature to obtain a target sequence feature.
[0064] The method of processing the initial sequence features to obtain the target sequence features is described in the above description of the detection model training process, which will not be repeated here.
[0065] Step S60, linearly mapping the target sequence features through the detection model, and outputting the detection result of the target software.
[0066] Among them, since the detection model is also provided with a linear layer, the linear layer can perform linear mapping processing on the target sequence features. The detection result can be expressed in the form of probability. For example, if the detection result is 0.95, the target software can be determined as malware.
[0067] The malware detection method provided in the present application detects malware on the target software based on the detection data set of the target software through a detection model, wherein the detection model can pre-process the interface instruction function sequences corresponding to multiple target software to obtain the initial sequence features corresponding to the target software, which can not only reduce the amount of data processing and improve the detection efficiency, but also perform deeper extraction of the features of the target software from different dimensions through different encoders and feature processors. Compared with the traditional manual feature extraction + machine learning method, it can reduce human bias and improve recognition accuracy.
[0068] It should be noted that although the operations of the method of the present invention are described in a specific order in the accompanying drawings, this does not require or imply that these operations must be performed in this specific order, or that all the operations shown must be performed to achieve the desired results. On the contrary, the steps depicted in the flow chart can change the execution order.
[0069] Further references Figure 6 , which shows an exemplary structural block diagram of a detection device for detecting malware according to an embodiment of the present application, the device includes a memory and a processor, and when the processor executes the computer program, the following is achieved: Acquire a detection data set corresponding to the target software, and input the detection data set into a detection model, wherein the detection data set includes a plurality of interface instruction function sequences; Preprocessing each of the interface instruction function sequences by using the detection model to obtain initial sequence features corresponding to the target software; Performing feature screening processing on the initial sequence features by the detection model to obtain feature screening results of the initial sequence features; Selecting a target encoder from the detection model based on the feature screening result, and performing feature processing on the initial sequence features by the target encoder to obtain target sequence features, wherein the target encoder includes a plurality of feature processors, and the plurality of feature processors perform feature processing from different dimensions; The target sequence features are linearly mapped through the detection model, and the detection result of the target software is output.
[0070] In one embodiment, when the processor executes the computer program, it also implements: Calculating a first probability that the initial sequence feature is a malware feature and a second probability that the initial sequence feature is a benign software feature by a first expert gated linear layer in the detection model; The first probability and the second probability are used as the feature screening result.
[0071] In one embodiment, when the processor executes the computer program, the processor further implements: determining the target encoder from two encoders in the detection model according to the first probability, the second probability and a probability threshold.
[0072] In one embodiment, when the processor executes the computer program, it further implements: calculating the third probability of selecting each of the feature processors of the initial sequence feature through the second expert gated linear layer in the detection model; Selecting, from the third probabilities, a feature processor corresponding to a first target probability with a maximum probability value and a second target probability with a probability value only less than the first target probability as a target feature processor; Inputting the initial sequence features into the target feature processor for feature extraction and feature transformation processing to obtain a first feature and a second feature; The first feature and the second feature are combined to obtain the target sequence feature.
[0073] In one embodiment, when the processor executes the computer program, it further implements: performing word segmentation processing on each of the interface instruction function sequences through the detection model to obtain the word segmentation corresponding to each of the interface instruction function sequences, and obtaining a word segmentation sequence set according to the word segmentation corresponding to each of the interface instruction function sequences; Using the detection model, each word in the word segmentation sequence set is represented by a vector to obtain a word vector set; The detection model is used to calculate the characteristic value of each word vector in the word vector set, and a target word vector is selected from each word vector as the initial sequence feature based on the characteristic value of each word vector.
[0074] In one embodiment, when the processor executes the computer program, it also implements: determining, through the detection model, the word vector with the largest feature value as the target word vector.
[0075] In one embodiment, when the processor executes the computer program, the processor further implements: simulating the operation of the target software through a sandbox program to obtain a plurality of interface instruction function sequences corresponding to the target software; A set consisting of the multiple interface instruction function sequences is used as the detection data set.
[0076] In one embodiment, when the processor executes the computer program, it further implements: obtaining positive sample data and negative sample data, wherein the positive sample data includes a plurality of interface instruction function sequences corresponding to malware, and the negative sample data includes a plurality of interface instruction function sequences corresponding to benign software; Initialize the initial model to set the number of iterations of the model; Inputting the positive sample data and the negative sample data into the initial model in sequence for model training; When each of the positive sample data and each of the negative sample data completes training for the number of iterations, the detection model is obtained.
[0077] In particular, according to the embodiments of the present disclosure, the above reference Figure 1 The described processes may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program tangibly embodied on a machine-readable medium, the computer program comprising a computer program for executing Figure 1 In such an embodiment, the computer program can be downloaded and installed from the Internet.
[0078] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, program segment or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a different order from the order marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0079] The units or modules involved in the embodiments described in the present application may be implemented by software or hardware. The units or modules described may also be arranged in a processor, for example, may be described as: a processor includes an XX unit, a YY unit, and a ZZ unit. The names of these units or modules do not, in some cases, constitute a limitation on the unit or module itself, for example, the XX unit may also be described as a "unit for XX".
[0080] As another aspect, the present application further provides a computer-readable storage medium, which may be a computer-readable storage medium included in the device described in the above embodiment; or a computer-readable storage medium that exists independently and is not assembled into the device. The computer-readable storage medium stores one or more programs, and the programs are used by one or more processors to execute the formula input method described in the present application.
[0081] The above description is only a preferred embodiment of the present application and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the present application is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the inventive concept. For example, the above features are replaced with (but not limited to) technical features with similar functions disclosed in the present application.
Claims
1. A method for detecting malware, characterized in that: The method comprises: Acquire a detection data set corresponding to the target software, and input the detection data set into a detection model, wherein the detection data set includes a plurality of interface instruction function sequences; Preprocessing each of the interface instruction function sequences by using the detection model to obtain initial sequence features corresponding to the target software; Performing feature screening processing on the initial sequence features by the detection model to obtain feature screening results of the initial sequence features; Selecting a target encoder from the detection model based on the feature screening result, and performing feature processing on the initial sequence features by the target encoder to obtain target sequence features, wherein the target encoder includes a plurality of feature processors, and the plurality of feature processors perform feature processing from different dimensions; The target sequence features are linearly mapped through the detection model, and the detection result of the target software is output.
2. The detection method according to claim 1, characterized in that: The step of performing feature screening processing on the initial sequence features by using the detection model to obtain feature screening results of the initial sequence features includes: Calculating a first probability that the initial sequence feature is a malware feature and a second probability that the initial sequence feature is a benign software feature by a first expert gated linear layer in the detection model; The first probability and the second probability are used as the feature screening result.
3. The detection method according to claim 2, characterized in that: The selecting a target encoder from the detection model based on the feature screening result includes: The target encoder is determined from two encoders in the detection model according to the first probability, the second probability and a probability threshold.
4. The detection method according to claim 1, characterized in that: The step of performing feature processing on the initial sequence features by the target encoder to obtain target sequence features includes: Calculating the third probability of selecting each of the feature processors of the initial sequence feature through the second expert gated linear layer in the detection model; Selecting, from the third probabilities, a feature processor corresponding to a first target probability with a maximum probability value and a second target probability with a probability value only less than the first target probability as a target feature processor; Inputting the initial sequence features into the target feature processor for feature extraction and feature transformation processing to obtain a first feature and a second feature; The first feature and the second feature are combined to obtain the target sequence feature.
5. The detection method according to claim 1, characterized in that: The preprocessing of each of the interface instruction function sequences by the detection model includes: Performing word segmentation processing on each of the interface instruction function sequences through the detection model to obtain the word segments corresponding to each of the interface instruction function sequences, and obtaining a word segmentation sequence set according to the word segments corresponding to each of the interface instruction function sequences; Using the detection model, each word in the word segmentation sequence set is represented by a vector to obtain a word vector set; The detection model is used to calculate the characteristic value of each word vector in the word vector set, and a target word vector is selected from each word vector as the initial sequence feature based on the characteristic value of each word vector.
6. The detection method according to claim 5, characterized in that: The selecting a target word vector from each of the word vectors as the initial sequence feature based on the feature value of each of the word vectors includes: The word vector with the largest eigenvalue determined by the detection model is the target word vector.
7. The detection method according to claim 1, characterized in that: The step of obtaining a detection data set corresponding to the target software includes: The target software is simulated and run through a sandbox program to obtain a plurality of interface instruction function sequences corresponding to the target software; A set consisting of the multiple interface instruction function sequences is used as the detection data set.
8. The detection method according to claim 1, characterized in that: The method further comprises: a training process of the detection model: Acquire positive sample data and negative sample data, wherein the positive sample data includes a plurality of interface instruction function sequences corresponding to malware, and the negative sample data includes a plurality of interface instruction function sequences corresponding to benign software; Initialize the initial model to set the number of iterations of the model; Inputting the positive sample data and the negative sample data into the initial model in sequence for model training; When each of the positive sample data and each of the negative sample data completes training for the number of iterations, the detection model is obtained.
9. A detection device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and wherein the processor implements the steps performed by the control device in the method according to any one of claims 1 to 8 when executing the computer program.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Malicious software detection method and device
CN112163222A
Malicious encrypted traffic detection method based on graph convolutional network
CN115174169A
Web attack detection model construction method and device and electronic equipment
CN116599724A
Malicious software analysis method and device, storage medium and equipment
CN117171738A
Malicious software detection method and device, electronic equipment and storage medium
CN117636009A
Cited By
Code detection method, device and equipment, medium and product
CN119939541A
A code detection method, apparatus, device, medium and product
CN119939541B
