A malware classification and detection method based on soft dependency

By dividing malware samples into multiple feature subsets and training multiple models, and calculating the s-value as the weight of the classification results, the problem of low malware variant identification accuracy and balance between training time and prediction time is solved, achieving efficient Malware classification and detection.

CN111783093BInactive Publication Date: 2024-10-22NANJING UNIV OF AERONAUTICS & ASTRONAUTICS
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010595193.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-06-28
Publication Date
2024-10-22
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing technologies have problems such as low accuracy in identifying malware variants and difficulty in balancing identification accuracy, training time, and prediction time. It is difficult for traditional antivirus software to detect emerging malware, and machine learning/deep learning-based methods suffer from overfitting, Challenges such as underfitting and feature extraction difficulty.

Method used

Using a malware classification and detection method based on soft dependencies, the malware samples are characterized by extraction and divided into multiple feature subsets, multiple models are trained, and the hybrid machine distance standard value s-value of each feature subset is calculated as The weight of the classification results is used to generate the final malware classification results, reducing training and prediction time.

Benefits of technology

Effectively identify malware variants, balance recognition accuracy, training time and prediction time, improve the efficiency and accuracy of malware classification, quickly identify new malware variants, and alleviate the impact of the explosion in the number of malware on computer security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111783093B_ABST
    Figure CN111783093B_ABST
Patent Text Reader

Abstract

The present invention discloses a malware classification and detection method based on soft dependency, so as to alleviate the misclassification problem of malware during classification. The present invention divides the extracted malware features into multiple feature subsets, and trains models for these feature subsets respectively; then uses these models to classify new malware and generate respective classification results; finally, uses s-value (soft dependency value proposed based on hybrid distance standard in pattern recognition) to obtain the final classification result. The present invention mainly combines the classification results of multiple models through the hybrid distance standard in pattern recognition, and the result is regarded as the final classification result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a malware classification and detection method based on soft dependency, and belongs to the field of security. Background Art

[0002] With the popularization and development of computers, malware has also emerged. However, due to the large number of malware, it is difficult for traditional antivirus software to identify emerging malware. For example, Worm.WhBoy.cw and Ransomware appeared in late 2006 and 2017, respectively. The former is a variant of a worm, and the latter is a new virus that combines with a worm to increase its infection range. It is difficult to detect these viruses using traditional antivirus software. According to statistical analysis, malware will grow explosively in this situation, and users will inevitably be attacked by malware that traditional antivirus software cannot defend effectively. Therefore, it is necessary to propose more effective methods to solve this problem. However, traditional antivirus software identifies malware through a signature-based method, which requires a large local database to store malicious signatures. However, this method can be easily avoided by using encryption, obfuscation, and packaging to achieve polymorphism of malware. And traditional antivirus software does not work well against new malware variants.

[0003] Based on the above problems, machine learning / deep learning-based methods have attracted the attention of academia and industry. Machine learning / deep learning-based methods can make up for the shortcomings of traditional malware classification and identification, and can also achieve good identification accuracy for malware variants. It is only necessary to extract features from malware, then use machine learning / deep learning methods to train, then generate a training model, and finally use the training model to predict new malware. Some methods do not even require feature extraction, but only need to convert the malware into a certain format, such as converting binary malware into grayscale images, and then use CNN training models, which is undoubtedly more convenient.

[0004] However, while machine learning / deep learning methods bring many advantages and opportunities, they also bring challenges. Since machine learning / deep learning methods train models based on samples, the primary problem is overfitting and underfitting. Both overfitting and underfitting will lead to reduced model performance and low generalization ability, making them unsuitable for large-scale use. In addition, malware feature extraction is also a relatively large problem that needs to be faced. Because feature extraction requires relatively professional feature engineering knowledge, it is more difficult for people who do not understand feature engineering. Moreover, we do not know whether the extracted feature dimension is too high, whether the extracted features are useful for training models, and whether there are relatively powerful features that have not been discovered. Although some malware can be converted into other forms and classified and identified using special deep learning methods, these malware are in the minority and we cannot avoid malware feature extraction. In addition, the selection of machine learning / deep learning methods is also an issue that needs to be considered. For example, some deep learning methods are not suitable for malware classification and detection tasks. In addition, although the models trained by some methods can achieve good accuracy, the training time and prediction time are often long. In general, time is exchanged for recognition accuracy. For the sample feature part, principal component analysis (PCA) can be used to process the features. Although many methods for classifying or detecting malware have been proposed in academia, each of them has more or less defects. For example, feature-based methods are also too dependent on the features of training samples, which may lead to overfitting of the model. In addition, if the model classifies new malware that does not belong to any training series, misclassification is very likely to occur. The emergence of these problems is likely to lead to a decline in model performance. At the same time, there is no good balance between the accuracy of the model, training time, and prediction time, and time is often exchanged for accuracy. Current research generally pays less attention to these issues. Summary of the invention

[0005] Aiming at the low recognition accuracy of some malware variants by existing methods and the balance problem between recognition accuracy, training time and prediction time, a malware classification and detection method based on soft dependency is proposed. Through the present invention, some malware variants can be effectively detected, and a good balance is found between recognition accuracy, training time and prediction time, which reduces the training time and prediction time while ensuring the recognition accuracy.

[0006] The present invention adopts the following technical solutions to solve the above technical problems:

[0007] A malware classification and detection method based on soft dependency includes the following steps:

[0008] Step 1: Extract features from all malware samples in the malware sample training set and divide the extracted features into n feature subsets F0, F1, …, F n-1 ; The malware sample training set is trainset = {D0, D1, ..., D k-1}, where D i represents the i-th malware family in the malware sample training set, 0≤i≤k-1, k represents the number of malware families in the malware sample training set; the j-th feature subset F j ={Df0, Df1, ..., Df k-1}, Df i represents the features of all malware samples in the i-th malware family in the feature subset, 0≤j≤n-1;

[0009] Step 2: Take the n feature subsets F0, F1, ..., F in step 1 respectively n-1 Perform machine learning for training samples and generate n models M0, M1, ..., M n-1 ;

[0010] Step 3: Use the n models M0, M1, ..., M in step 2 n-1 , classify the malware to be detected, and obtain n classification results P0, P1, ..., P n-1 ;

[0011] Step 4: Calculate the standard value s-value of the mixture deviation of each feature subset;

[0012] Step 5: According to the results predicted by each model obtained in step 3, the s-value of each feature subset in step 4 is s-value0, s-value1, ..., s-value n-1 As the weights of the classification results obtained in step 3, the classification result of the malware to be detected is obtained as P = ||s-value0||·P0+||s-value1||·P1+…+||s-value n-1 ||·P n-1 .

[0013] Furthermore, the jth feature subset F in step 4 j Mixer from standard value s-value j for:

[0014] s-value j =EC j α+EN j β–EI j γ

[0015] Among them, Fj The standard value of the distance between the centroids of malware families in EC j =(ec pq ) k*k ,ec pq F j The distance between the centroids of the pth and qth malware families in F j The minimum distance standard value between malware families in EN j =(en ab ) k*k , ab F j The shortest distance between the ath and bth malware families in F j The standard value of the inter-class distance EI within the malware family j =(ei ab ) k*2 ,ei a1 F j The maximum distance between the features of malware samples in the ath malware family, ei a2 F j The sum of the distances between the features of malware samples in the ath malware family; α, β, and γ are the sum of the distances between the features of malware samples in the ath malware family; j ,EN j and EI j The weight of .

[0016] Furthermore, the centroid of the malware family is α u is the characteristic of the uth malware sample in the malware family.

[0017] Furthermore, α, β and γ are obtained by minimizing the loss function in the machine learning process in step 2. The loss function is y v is the label of the vth malware sample, and N is the number of malware samples in the malware sample training set.

[0018] Compared with the prior art, the present invention adopts the above technical solution and has the following technical effects:

[0019] The present invention alleviates the problem of low malware variant identification accuracy and the problem of exchanging time for identification accuracy by proposing a method for identifying malware variants and seeking a balance between identification accuracy, training time and prediction time. In addition, the number of malware is exponentially growing, and most malware is derived from known malware. Our method can identify certain malware variants, and for malware variants that cannot be identified, a new malware identification model can be quickly trained while ensuring accuracy. The present invention can alleviate the impact of the surge in the number of malware on computer security. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 It is a flow chart of the present invention. DETAILED DESCRIPTION

[0021] The technical solution of the present invention is further described in detail below in conjunction with the accompanying drawings:

[0022] The present invention is proposed to solve the problem of low accuracy in identifying malware variants and the balance between identification accuracy, training time and prediction time. The present invention proposes a malware classification and detection method based on soft dependency, which adopts training of multiple models to obtain multiple classification results, and finally obtains the final malware classification result through the s-value of each feature subset. The goal of the present invention is to reduce the training time and prediction time while ensuring the identification accuracy, find a balance between identification accuracy, training time and prediction time, and also be able to identify some malware variants, etc.

[0023] In the present invention, malware classification and detection are divided into two stages: a model training stage and an s-value generation final result stage.

[0024] Before introducing these two stages, let us first introduce the parameter expressions used in the present invention. First, the malware sample training set is denoted as trainset = {D0, D1, ..., D k-1}, where D i represents the i-th malware family in the malware sample training set (we call the same type of malware a malware family), 0≤i≤k-1, k represents the number of malware families in the malware sample training set, and y represents the label of all malware samples in the malware sample training set. During feature extraction, feature extraction is performed on all malware samples in the malware sample training set, and then their IDs (generally represented by the hash value of the malware name), the malware family to which they belong, and the features of the malware samples are stored in a file. The features of all malware samples are divided into n feature subsets F0, F1, …, F n-1When dividing feature subsets, some features of malware samples with high correlation are divided into the same feature subset, such as the size of malware samples, the size after compression, and the compression ratio. Such features can be divided into the same feature subset; generally, we use the chi-square test to calculate the chi-square value between the feature value of a column of all samples and j (the index of the feature subset, 0 <= j <= n-1) to measure the similarity between features, and consider the first k features after ascending sorting to be the features with high correlation. Therefore, the jth feature subset can be expressed as F j ={Df0, Df1, ..., Df k-1}, where Df i represents the features of all malware samples in the i-th malware family in the feature subset. The vector of features of a malware sample s of a malware family in a feature subset is represented as sample i ={f1,f2,......f m-1}, where f x represents a certain eigenvalue of sample s, m represents the number of eigenvalues, 0<=x<=m-1.

[0025] The following introduces the model training phase and the s-value generation final result phase.

[0026] 1) Model training phase

[0027] In this stage, each feature subset is first extracted based on the malware sample, and then the corresponding sub-models are trained using some machine learning / deep learning algorithms (XGBoost) for these feature subsets. Finally, these sub-models are used to generate prediction results, which are recorded as P0, P1, ..., P n-1 .

[0028] 2) s-value generates the final result stage

[0029] This stage uses s-value to generate the final malware classification result for the prediction result generated in 1). The s-value is based on the hybrid distance standard in pattern recognition and is formulated as follows:

[0030] s-value=ECα+ENβ–EIγ

[0031] Among them, s-value is the standard value of the mixed distance, EC is the standard value of the centroid distance, EN is the standard value of the minimum distance between malware families, EI is the standard value of the inter-class distance within a malware family, and α, β, and γ are the weights of these three standard values, which are used to adjust the importance of each standard.

[0032] Step 1: Solve for EC.

[0033] EC j Represents the feature subset F j The standard value of the distance between the centroids of malware families in the feature subset F j The distance between the centroids of any two malware families in , the larger the value of this criterion, the higher the discrimination between different families. In this part, in order to obtain the EC criterion value, we should first j In the above example, according to the feature vector Df of all malware samples in each malware family, i , calculate the centroid of each malware family with the following formula:

[0034]

[0035] Where U is the number of malware in a malware family, α u is the feature vector of the uth malware sample in the malware family.

[0036] Finally, the feature subset F is obtained according to the formula for calculating the centroid above j The centroid of each malware family in the , and then find the distance between the centroids of any two malware families, and finally get a k*k matrix, which is denoted as EC, and the element ec pq Indicates F j The distance between the centroids of the pth and qth malware families in , where the main diagonal elements of the matrix are all 0.

[0037] Step 2: Solve EN.

[0038] EN j Indicates that in the feature subset F j The shortest distance between two malware families in F j The distance between any feature vector in the ath malware family and any feature vector in the bth malware family is calculated, and the minimum value of the distance is found as the shortest distance between the ath and bth malware families. Finally, a k*k matrix is ​​obtained, which is recorded as EN. The elements en in EN ab F j The shortest distance between the ath and bth malware families in the matrix, and the diagonal elements in this matrix are 0.

[0039] Step 3: Solve for EI.

[0040] EI j Represents the feature subset F j The standard value of the inter-class distance within the malware family in , has two values, namely, jThe maximum distance between the feature vectors of malware samples in a certain malware family and the sum of the distances between the feature vectors of all malware samples in the malware family.

[0041] Finally, we can get a k*2 matrix, which is recorded as EI j =(ei ab ) k*2 , EI a1 F j The maximum distance between the features of malware samples in the ath malware family, ei a2 F j The sum of the distances between the features of malware samples in the ath malware family.

[0042] Step 4: Solve for the s-value.

[0043] Through the above three steps, the values ​​of EC, EN and EI have been obtained. In order to solve the s-value of each feature subset, we also need to know the values ​​of α, β and γ. These three values ​​are obtained by optimizing the loss function loss in the process of training the corresponding sub-model using machine learning / deep learning. After obtaining, the s-value of each feature subset can be obtained, and then the final malware classification result can be obtained based on the prediction results generated in 1).

[0044] Below we will specifically introduce the solution methods of α, β and γ and the final calculation method of malware classification results.

[0045] To obtain the values ​​of α, β and γ, the formula s-value = ECα + ENβ – EIγ can be written as follows:

[0046]

[0047] When using each feature subset as input to train each corresponding sub-model, the corresponding sub-model's corresponding test set will output the prediction result of each malware sample. The prediction result of a malware sample is recorded as p0, p1, ..., p n-1 (All are 1*n vectors). The EC, EN and EI obtained for each feature subset are denoted as [EC0,EN0,EI0], [EC1,EN1,EI1], ..., [EC n-1 ,EN n-1 ,EI n-1 ]; then we get a set of s-values, recorded as s-value0, s-value1, ..., s-value n-1 In order to find the values ​​of α, β and γ, the following formula is used as the loss function:

[0048]

[0049] where y v is the label of the vth malware sample, represented by a 1*n vector, where N represents the number of all training samples in the training set.

[0050] In order to make the model converge, we only need to minimize the loss function. Finally, by minimizing the loss function, we can find the values ​​of α, β and γ.

[0051] In summary, the EC, EN and EI of each feature subset have been obtained, and the values ​​of α, β and γ have also been obtained by minimizing the loss function. In addition, the sub-models trained for each feature subset have also been obtained. By predicting the test set, each sub-model obtains its own prediction results, which are recorded as P0, P1, ..., P n-1 After that, the s-value of each feature subset can be obtained by calculation, which is recorded as s0, s1, ...s n-1 Finally, the final classification result is calculated by the following formula:

[0052] P=||s-value0||·P0+||s-value1||·P1+…+||s-value n-1 ||·P n-1 .

[0053] like Figure 1 As shown, the specific implementation process of the present invention is as follows:

[0054] Step 1: Extract features from all malware samples in the malware sample training set and divide the extracted features into n feature subsets F0, F1, …, F n-1 .

[0055] Step 2: Based on the feature subset F0, F1, ..., F n-1 , respectively train the corresponding models, denoted as M0, M1, ..., M n-1 Here we use machine learning / deep learning algorithms to train the model, such as XGBoost algorithm.

[0056] Step 3: Use models M0, M1, …, M n-1 , classify the malware to be detected, and obtain the corresponding classification results P0, P1, ..., P n-1 .

[0057] Step 4: Calculate the mixture standard value s-value for each feature subset.

[0058] Step 5: According to the results predicted by each model obtained in step 3, the s-value values ​​s-value0, s-value1, ..., s-value of each feature subset in step 4 are n-1 The weights of the classification results obtained in step 3 are used respectively to obtain the classification results of the malware to be detected.

[0059] The present invention reduces the time of model training by converting the feature space into multiple feature spaces and reducing the dimension of the feature space, and finally integrates the classification results of multiple sub-models into the final malware classification result through s-value. Model training for multiple feature subsets can be performed in parallel, and prediction of new malware can be performed in parallel, so both training time and prediction time can be reduced. Through parallelization, the training time and prediction time can be reduced under the condition of ensuring accuracy, which is reasonable. Tests show that the training time can be reduced several times under the condition of ensuring accuracy.

[0060] In summary, the present invention mainly aims at the low accuracy of deep learning methods in identifying malware variants and the balance between model accuracy, training time and prediction time, and proposes an improved method. Soft dependency (s-value) is based on the hybrid distance standard in pattern recognition. Using s-value, an evaluation value can be obtained for each feature subset respectively, and finally the evaluation value is used as the weight of the corresponding prediction value to finally obtain the final malware prediction result. Through this method, the accuracy of malware classification is improved, and a balance is found between classification accuracy, model training time and prediction time. While ensuring classification accuracy, the model training time and prediction time are shortened.

[0061] The above description is only a specific implementation of the present invention, but the protection scope of the present invention is not limited thereto. Any person familiar with the technology can understand and think of any changes or substitutions within the technical scope disclosed by the present invention, which should be included in the scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. A malware classification and detection method based on soft dependency, It is characterized in that The following steps are involved: Step 1: Extract features from all malware samples in the malware sample training set and divide the extracted features into n feature subsets F 0 ,F 1 ,…,F n-1 ; The malware sample training set is trainset = {D 0 , D 1 ,......,D k-1 }, where D i represents the i-th malware family in the malware sample training set, 0≤i≤k-1, k represents the number of malware families in the malware sample training set; the j-th feature subset F j ={Df 0 , Df 1 , ..., Df k-1 }, Df i represents the features of all malware samples in the i-th malware family in the feature subset, 0≤j≤n-1; Step 2: Take the n feature subsets F in step 1 respectively 0 ,F 1 ,…,F n-1 Perform machine learning for training samples and generate n models M 0 ,M 1 ,…,M n-1 ; Step 3: Use the n models M from step 2 0 ,M 1 ,…,M n-1 , classify the malware to be detected respectively, and obtain n classification results P 0 ,P 1 ,…,P n-1 ; Step 4: Calculate the standard value s-value of the mixture deviation of each feature subset; Step 5: Based on the results predicted by each model obtained in step 3, the s-value of each feature subset in step 4 is 0 ,s-value 1 ,...,s-value n-1 As the weights of the classification results obtained in step 3, the classification result P of the malware to be detected is obtained. 0 ||·P 0 +||s-value 1 ‖·P 1 +…+||s-value n-1 ||·P n-1 ; The jth feature subset F in step 4 j The mixer is off the standard value s-value j for: s-value j =EC j α+EN j β–EI j γ Among them, F j The standard value of the distance between the centroids of malware families in EC j =(ec pq ) k*k ,ec pq F j The distance between the centroids of the pth and qth malware families in F j The minimum distance standard value between malware families in EN j =(en ab ) k*k , ab F j The shortest distance between the ath and bth malware families in F j The standard value of the inter-class distance EI within the malware family j =(ei ab ) k*2 ,ei a1 F j The maximum distance between the features of malware samples in the ath malware family, ei a2 F j The sum of the distances between the features of malware samples in the ath malware family; α, β, and γ are the sum of the distances between the features of malware samples in the ath malware family; j ,EN j and EI j The weight of .

2. A method for classifying and detecting malware based on soft dependency as claimed in claim 1, It is characterized in that The centroid of the malware family is α u is the characteristic of the u-th malware sample in the malware family, and U is the number of malware samples.

3. A method for classifying and detecting malware based on soft dependency as claimed in claim 1, It is characterized in that α, β and γ are obtained by minimizing the loss function in the machine learning process in step 2. The loss function is y v is the label of the vth malware sample, and N is the number of malware samples in the malware sample training set.