Malware family main feature extraction and visualization method based on machine learning
Through feature selection, machine learning classification and color coding methods, the main features of malware families are extracted and visualized, which solves the problem that existing technology cannot effectively extract and display malware family features, and achieves accurate extraction and differentiation of malware family features. analyze.
Patent Information
- Application Number
- CN202411000178.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-24
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2044-07-24
AI Technical Summary
Existing technology cannot effectively extract the main features of malware families, and cannot specifically display the similarities and differences of features between different families, making it impossible to confirm whether high-contribution features are the main features of malware.
Through feature selection, machine learning classification, feature contribution extraction, normalization processing and color coding methods, the main features of malware families are extracted and visualized. The RGBA color overlap principle is used to display the feature similarities and differences between different families and generate a feature contribution matrix. And perform normalization processing and use Matplotlib for visualization.
It achieves accurate extraction and intuitive display of malware family features, provides clear classification basis and detailed feature difference analysis, and can effectively display feature differences between different families.
Smart Images

Figure CN118862073A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of computer technology, machine learning and information security, and in particular to a method for extracting and visualizing main features of malware families based on machine learning. Background Art
[0002] In the field of malware classification based on machine learning, although there are a variety of high-precision and high-efficiency classification algorithms, there are still several key issues that have not been resolved due to the "black box" effect of machine learning algorithms: Whether the machine learning classification algorithm has truly learned the representative features of the malware family; Machine learning classification algorithms learn which features differ to correctly classify malware families.
[0003] Although researchers have proposed a variety of explainable machine learning frameworks to explain the decision-making basis and process of machine learning algorithms, in the field of information security, especially in the classification of malware families, existing methods cannot confirm whether high-contribution features are the main features of malware, nor can they specifically show the similarities and differences in features between different families.
[0004] Therefore, there is an urgent need for a method that can effectively extract the main features of malware, specifically display the content of these features, and visualize the similarities and differences between features of different families. Summary of the invention
[0005] In view of the many problems existing in the above-mentioned prior art, the present invention provides a method for extracting and visualizing the main features of malware families based on machine learning. The present invention extracts and visualizes the main features of malware families through feature selection, machine learning classification, feature contribution extraction, normalization processing and color coding method steps, and uses the RGBA color overlap principle to display the feature similarities and differences between different families. Finally, it realizes the accurate extraction and intuitive display of malware family features, and provides a clear classification basis and detailed feature difference analysis.
[0006] The main feature extraction and visualization method of malware families based on machine learning includes the following steps: Analyze the collected malware samples, select the features that can be used for family classification, and convert them into a matrix form that can be used for machine learning algorithms; Classify malware families based on machine learning algorithms; Analyze the characteristics of the machine learning classification algorithm, and extract the classification contribution of each feature to each family based on the classification results to generate a feature contribution matrix; The extracted feature contribution values are normalized to obtain a normalized feature contribution matrix; According to the feature contribution matrix, different features are visualized by color coding method; Through visualization of the results, the similarities and differences in characteristics between different families are displayed, reflecting the main characteristics of each family and their differences.
[0007] Preferably, behavioral data of malware samples are collected through static analysis or dynamic analysis, and features are selected, including API call sequences, network communication data, and byte order.
[0008] Preferably, selecting the feature includes: selecting the first 512 bytes of content starting from the Entry Point of the malware sample as the feature.
[0009] Preferably, a machine learning algorithm is selected, and the model is trained and the optimal parameters are found based on cross-validation.
[0010] Preferably, the machine learning algorithm is a Linear SVM algorithm, and the Linear SVM decision function calculation expression is:
[0011] in, is the input feature vector, is the weight vector assigned to all features, is the bias parameter.
[0012] Preferably, it also includes: extracting the weight vector Elements in As feature contribution, and generate feature contribution matrix ,in, Indicates The weight of a feature.
[0013] Preferably, when the total number of families When using the One-VS-Rest strategy The classification task is split into Two-classification subtasks, get the classification contribution matrix of each feature to all families ,in, represents the number of features, Indicates the number of families, Indicates The feature pair The contribution of a family.
[0014] Preferably, a scaling function is used to normalize the feature contribution to obtain a normalized feature contribution matrix: , where the scaling function calculation expression is:
[0015] in, is the scaling factor, is the offset.
[0016] Preferably, different features are visualized by a color coding method according to the feature contribution matrix, including: The RGBA color model is used to represent the feature contribution, where the Alpha channel value represents the feature contribution calculation expression:
[0017] in, Features transparency, For the characteristics Number of contributing families.
[0018] Preferably, the visualization includes: Use Matplotlib's matshow function to visualize the feature contribution matrix, showing the similarities and differences between features in different families; The specific feature content in the feature contribution matrix is visualized at the micro level to show the main features of each family and their differences.
[0019] Compared with the prior art, the advantages and beneficial effects of the present invention are: The present invention achieves accurate extraction and specific visualization of the main features of malware families through feature selection, classification and contribution analysis techniques; The present invention achieves a clear display effect of the feature differences of different malware families through feature contribution normalization processing and coloring technology. The present invention realizes the all-round comparison and specific analysis effect of the main features between malware families by means of macro and micro visualization technology. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 It is a schematic diagram of the process of the present invention. DETAILED DESCRIPTION
[0021] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present disclosure. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present disclosure. However, it is obvious that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present disclosure.
[0022] The terms used herein are only for describing specific embodiments and are not intended to limit the present disclosure. The terms "comprise", "include", etc. used herein indicate the existence of the features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.
[0023] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.
[0024] In the case of using expressions such as "at least one of A, B, and C, etc.", it should generally be interpreted in accordance with the meaning of the expression generally understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.). In the case of using expressions such as "at least one of A, B, or C, etc.", it should generally be interpreted in accordance with the meaning of the expression generally understood by those skilled in the art (for example, "a system having at least one of A, B, or C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).
[0025] Some block diagrams and / or flow charts are shown in the accompanying drawings. It should be understood that some boxes or combinations thereof in the block diagrams and / or flow charts can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that these instructions can create a device for implementing the functions / operations described in these block diagrams and / or flow charts when executed by the processor. The technology of the present disclosure can be implemented in the form of hardware and / or software (including firmware, microcode, etc.). In addition, the technology of the present disclosure can take the form of a computer program product on a computer-readable storage medium storing instructions, which can be used by an instruction execution system or in combination with an instruction execution system.
[0026] like Figure 1 As shown in the figure, the main feature extraction and visualization method of malware families based on machine learning includes the following steps: Analyze the collected malware samples, select the features that can be used for family classification, and convert them into a matrix form that can be used for machine learning algorithms; The present invention collects malware samples from public resources, such as VirusShare and VirusTotal; Preferably, behavioral data of malware samples are collected through static analysis or dynamic analysis, and features are selected, including API call sequences, network communication data, and byte order.
[0027] Collect behavioral data of malware samples through static analysis or dynamic analysis, and select features from them, such as API call sequences, network communication data, byte order, etc. Preferably, selecting the feature includes: selecting the first 512 bytes of content starting from the Entry Point of the malware sample as the feature.
[0028] Use programming languages such as Python and C to convert the extracted malware features and corresponding family labels into a matrix , where the number of families is , the number of features is ; Classify malware families based on machine learning algorithms; Preferably, a machine learning algorithm is selected, and the model is trained and the optimal parameters are found based on cross-validation.
[0029] Select machine learning algorithms such as SVM, Random Forest, KNN, KMeans, etc., and train the model and find the optimal parameters based on cross-validation.
[0030] Preferably, the machine learning algorithm is a Linear SVM algorithm, and the Linear SVM decision function calculation expression is:
[0031] in, is the input feature vector, is the weight vector assigned to all features, is the bias parameter.
[0032] In the implementation form of the present invention, Linear SVM (LSVM) is selected as the classification algorithm; family classification is performed with optimal parameters, and family classification results are obtained.
[0033] Analyze the characteristics of the machine learning classification algorithm, and extract the classification contribution of each feature to each family based on the classification results to generate a feature contribution matrix; Preferably, it also includes: extracting the weight vector Elements in As feature contribution, and generate feature contribution matrix ,in, Indicates The weight of a feature.
[0034] Preferably, when the total number of families When using the One-VS-Rest strategy The classification task is split into Two-classification subtasks, get the classification contribution matrix of each feature to all families ,in, represents the number of features, Indicates the number of families, Indicates The feature pair The contribution of a family.
[0035] When the total number of families When it is a binary classification, each row in the feature contribution matrix contains The contribution of each feature to the classification of the two families; When the total number of families When it is a multi-classification task, the One-VS-Rest-based strategy can be used to split the class classification task into A binary classification subtask, The extracted feature contribution values are normalized to obtain a normalized feature contribution matrix; Preferably, a scaling function is used to normalize the feature contribution to obtain a normalized feature contribution matrix: , where the scaling function calculation expression is:
[0036] in, is the scaling factor, is the offset.
[0037] Use programming languages and visualization tools (such as Matplotlib, Seaborn, etc.) to visualize the distribution of feature contributions and determine the normalization function Fixed point in The value of Use the normalization function Feature contribution matrix Normalization is performed to normalize the feature contributions in different value ranges to the same range, and the matrix ; According to the feature contribution matrix, different features are visualized by color coding method; Preferably, different features are visualized by color coding according to the feature contribution matrix. Including: Using the RGBA color model to represent the feature contribution, where the Alpha channel value represents the feature contribution calculation expression:
[0038] in, Features transparency, For the characteristics Number of contributing families.
[0039] In an implementation form of the present invention, the color coding method comprises: Different families are given different colors, such as red, green, and blue based on three families, while other families can be assigned gray. To facilitate the calculation of these colors, use The values are processed, including: red:
[0040] green:
[0041] blue:
[0042] grey:
[0043] The Alpha channel value in the value represents the transparency of the color. In the present invention, it is used to indicate the magnitude of the feature contribution. The higher the contribution, the more opaque the color, and vice versa. When a feature contributes to the classification of all families, that is, the feature is common to all families, that is, an invalid feature, so this method is limited to calculating the contribution. Need to be less than the total number of families ; Through visualization of the results, the similarities and differences in characteristics between different families are displayed, reflecting the main characteristics of each family and their differences.
[0044] Preferably, the visualization includes: Use the matshow function in the Matplotlib library for macro visualization to show the similarities and differences between the features of different families in the feature contribution matrix; Microscopic visualization is performed to display the specific feature content in the feature contribution matrix and to show the main features of each family and their differences.
[0045] Macro visualization: It can reflect the similarities and differences between the characteristics of different families, that is, it can reflect the similarities and differences between the characteristics of different families as a whole, but not the specific characteristics. Use Python's visualization tool Matplotlib's matshow function to visualize the matrix , where the Y-axis is the name of each family and the X-axis is the first 512-byte sequence starting from the Enyry Point of the malware sample; Microscopic visualization: It can reflect the specific content of different family characteristics, that is, present the specific content of family characteristics in the visualization results, so as to extract the main characteristics of each family and analyze the specific characteristic differences between different families or different subspecies in the same family; Based on the macro visualization results, the contents of the 512-byte sequence are displayed.
[0046] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0047] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0048] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0049] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0050] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0051] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0052] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0053] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0054] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims
1. A method for extracting and visualizing the main features of malware families based on machine learning, characterized in that: The following steps are involved: Analyze the collected malware samples, select the features that can be used for family classification, and convert them into a matrix form that can be used for machine learning algorithms; Classify malware families based on machine learning algorithms; Analyze the characteristics of the machine learning classification algorithm, and extract the classification contribution of each feature to each family based on the classification results to generate a feature contribution matrix; The extracted feature contribution values are normalized to obtain a normalized feature contribution matrix; According to the feature contribution matrix, different features are visualized by color coding method; Through visualization of the results, the similarities and differences in characteristics between different families are displayed, reflecting the main characteristics of each family and their differences.
2. The method according to claim 1, characterized in that Collect behavioral data of malware samples through static analysis or dynamic analysis, and select features, including API call sequences, network communication data, and byte order.
3. The method according to claim 2, characterized in that Selecting the feature includes: selecting the first 512 bytes of content starting from the Entry Point of the malware sample as the feature.
4. The method according to claim 1, characterized in that: Select a machine learning algorithm, train the model based on cross-validation, and find the optimal parameters.
5. The method according to claim 4, characterized in that The machine learning algorithm is the Linear SVM algorithm, and the LinearSVM decision function calculation expression is: in, is the input feature vector, is the weight vector assigned to all features, is the bias parameter.
6. The method according to claim 1, characterized in that Also includes: Extract weight vector Elements in As feature contribution, and generate feature contribution matrix ,in, Indicates The weight of a feature.
7. The method according to claim 6, characterized in that When the total number of families When using the One-VS-Rest strategy The classification task is split into Two-classification subtasks, get the classification contribution matrix of each feature to all families ,in, represents the number of features, Indicates the number of families, Indicates The feature pair The contribution of a family.
8. The method according to claim 1, characterized in that Use the scaling function to normalize the feature contribution and get the normalized feature contribution matrix , where the scaling function calculation expression is: in, is the scaling factor, is the offset.
9. The method according to claim 1, characterized in that: Based on the feature contribution matrix, different features are visualized through color coding, including: The RGBA color model is used to represent the feature contribution, where the Alpha channel value represents the feature contribution, and the calculation expression is: in, Features transparency, For the characteristics Number of contributing families.
10. The method according to claim 1, characterized in that the visualization include: Use the matshow function in the Matplotlib library for macro visualization to show the similarities and differences between the features of different families in the feature contribution matrix; Microscopic visualization is performed to display the specific feature content in the feature contribution matrix and to show the main features of each family and their differences.
Citation Information
Patent Citations
Malicious software homology analysis method based on behavior tree
CN111737694A
Malicious software family classification model generation method and device
CN115859170A
Malicious code classification method and device, electronic equipment and storage medium
CN118070276A
API interface data risk monitoring system based on machine learning
CN118350008A
Device and method for classifying program behaviour
WO2019197022A1
