Malicious process detection method, device, system and computer-readable storage medium

Through feature extraction of the registry operation log and random forest model training, the problem of difficult malicious processes in the Windows system is solved, and high-accurate malicious process detection is achieved.

CN113987490BActive Publication Date: 2024-11-19SHANGHAI GUAN AN INFORMATION TECH
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202111244039.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-26
Publication Date
2024-11-19
Estimated Expiration
2041-10-26

AI Technical Summary

Technical Problem

In Windows systems, the registry operation log volume is huge, making it difficult to identify malicious processes, and the existing technology lacks effective solutions.

Method used

Collect process names, target objects, set values ​​and malicious process identification fields in the registry operation log, convert them into a sample two-dimensional matrix, train a random forest model for malicious process detection, and improve detection accuracy through node list and text content encoding.

Benefits of technology

Simplifies malicious process detection, improves detection accuracy, and identifies whether the process is malicious by associating the registry path with text content and primary key type.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113987490B_ABST
    Figure CN113987490B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention discloses a malicious process detection method, which obtains the process name, target object, setting value and malicious process identification field in the registry operation log, and stores the process name, target object, setting value and malicious process identification field in a two-dimensional matrix as a first two-dimensional matrix, converts the registry path in the target object into a node list, and merges the setting value into the node list. In the node list, the list items are numbered according to their contents to obtain a sample two-dimensional matrix; the process name in the sample two-dimensional matrix is ​​used as a row index, the numbered node list and the malicious process identification field are used as a column index, and input into a random forest model to obtain a malicious process detection model; the process to be detected is input into the malicious process detection model to determine whether the process to be detected is a malicious process. The present invention links the registry path with malicious detection to establish a malicious process detection model, and realizes rapid and accurate identification of malicious processes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of machine learning, and in particular to a malicious process detection method, device, system and computer-readable storage medium. Background Art

[0002] The registry is a hierarchical database in the Windows system that contains data that is critical to applications and services running in the system. The database is built in a tree format, with each node called a key, and each key can contain subkeys and data entries called values. The data required by the application may be the key itself or the value associated with the key. In order to realize its functions, the process will basically operate on the registry during its operation, and these operations also reflect the behavior of the process. Therefore, the process attributes can be judged by analyzing the registry operation log.

[0003] There is a logging function in the Windows system. After installing Sysmon, an official Microsoft software, the registry operation behavior of the process can be detected, which provides us with a source of data.

[0004] The amount of registry operation logs is very large. A process can generate hundreds of logs in a short period of time, which is difficult to analyze manually and difficult to match using inherent rules, making it difficult to identify malicious processes.

[0005] There is currently no effective solution to the problem that it is difficult to identify malicious processes in existing technologies. Summary of the invention

[0006] To solve the above problems, the present invention provides a malicious process detection method, device, system and computer-readable storage medium, which collect the process name, target object, setting value and malicious process identification field in the registry operation log, convert the registry path in the target object into a node list, and merge the setting value into the node list, encode the registry path to obtain a sample two-dimensional matrix, use the sample two-dimensional matrix to train a malicious process detection model, and then use the malicious process detection model to perform malicious detection on the process to be detected, and obtain the detection result of the process to solve the problem that malicious processes are difficult to identify.

[0007] To achieve the above-mentioned purpose, the present invention provides a malicious process detection method, comprising: obtaining a registry operation log, extracting a process name, a target object, a setting value and a malicious process identification field in each registry operation log, and storing the process name, the target object, the setting value and the malicious process identification field in the form of a two-dimensional matrix to obtain a first two-dimensional matrix; in the first two-dimensional matrix, performing node segmentation on the registry path in the target object, using the content of each node after segmentation as a list item to convert the registry path into a node list, deleting the target object, and merging the setting value into the node list; in the node list, numbering a preset number of list items closest to the root node item according to the key type, and merging the registry operation logs with the same process name to obtain a second two-dimensional matrix; in the second two-dimensional matrix, numbering the unnumbered list items in the node list according to the text content of the list item to obtain a sample two-dimensional matrix; using the process name in the sample two-dimensional matrix as a row index, the numbered node list and the malicious process identification field as a column index, and inputting them into a random forest model to obtain a malicious process detection model; inputting the process to be detected into the malicious process detection model to determine whether the process to be detected is a malicious process.

[0008] Further optionally, in the node list, a preset number of list items closest to the root node item are numbered according to the key type, including: when the root node item is HKLM, the root node item is numbered as 1, the subkey item is numbered according to the subkey type, and a three-digit sequence is generated in the order of the root node item number, 0, and the subkey item number to replace the root node item and the subkey item; when the root node item is HKU, the root node item is numbered as 2, the first-level subkey item is numbered according to the first-level subkey type, and the second-level subkey item is numbered according to the second-level subkey type, and a three-digit sequence is generated in the order of the root node item number, the first-level subkey item number, and the second-level subkey item number to replace the root node item, the first-level subkey item, and the second-level subkey item; when the root node item is HKCU, the root node item is numbered as 3, the subkey item is numbered according to the subkey type, and a three-digit sequence is generated in the order of the root node item number, 0, and the subkey item number to replace the root node item and the subkey item; when the root node item is other content, the root node item is numbered as 0.

[0009] Further optionally, the unnumbered list items in the node list are numbered according to the text content of the list items, including: converting each list item in the node list into a character string with a space as a separator; dividing the second two-dimensional matrix into a training set two-dimensional matrix and a test set two-dimensional matrix by random segmentation; using the character data of the training set two-dimensional matrix as a dictionary, and using the Tf-idf vectorization algorithm to convert the character data in the training set two-dimensional matrix and the test set two-dimensional matrix into a sparse matrix to obtain a sample two-dimensional matrix.

[0010] Further optionally, the method of obtaining the registry operation log, extracting the process name, target object, setting value and malicious process identification field in each registry operation log, and storing the process name, target object, setting value and malicious process identification field in the form of a two-dimensional matrix to obtain a first two-dimensional matrix includes: obtaining the registry operation log, and respectively marking the registry operation logs generated by malicious processes and normal processes to obtain a malicious process identification field; data-connecting the process name, target object, setting value and corresponding malicious process identification field in each collected registry operation log, and storing them in the form of a two-dimensional matrix, deleting completely duplicate registry operation logs, and obtaining the first two-dimensional matrix.

[0011] On the other hand, the present invention also provides a malicious process detection device, including: a first two-dimensional matrix generation module, used to obtain a registry operation log, extract the process name, target object, setting value and malicious process identification field in each registry operation log, and store the process name, target object, setting value and malicious process identification field in the form of a two-dimensional matrix to obtain a first two-dimensional matrix; a node list generation module, used to perform node segmentation on the registry path in the target object in the first two-dimensional matrix, use the content of each node after segmentation as a list item to convert the registry path into a node list, delete the target object, and merge the setting value into the node list; a second two-dimensional matrix generation module, used to store the registry path in the node list , numbering a preset number of list items closest to the root node item according to the key type, and merging the registry operation logs of the same process name to obtain a second two-dimensional matrix; a sample two-dimensional matrix generation module, used to number the unnumbered list items in the node list according to the text content of the list items in the second two-dimensional matrix to obtain a sample two-dimensional matrix; a malicious process detection model generation module, used to input the process name in the sample two-dimensional matrix as a row index, the numbered node list and the malicious process identification field as a column index into the random forest model to obtain a malicious process detection model; a malicious process detection module, used to input the process to be detected into the malicious process detection model to determine whether the process to be detected is a malicious process.

[0012] Further optionally, the second two-dimensional matrix generation module includes: a first numbering submodule, which is used to, when the root node item is HKLM, number the root node item as 1, number the subkey item according to the subkey type, and generate a three-digit sequence in the order of the root node item number, 0, and the subkey item number to replace the root node item and the subkey item; a second numbering submodule, which is used to, when the root node item is HKU, number the root node item as 2, number the first-level subkey item according to the first-level subkey type, number the second-level subkey item according to the second-level subkey type, and generate a three-digit sequence in the order of the root node item number, 0, and the subkey item number to replace the root node item and the subkey item. A three-bit sequence is generated in the order of the node item number, the first-level sub-key item number, and the second-level sub-key item number to replace the root node item, the first-level sub-key item, and the second-level sub-key item; a third numbering sub-module is used to number the root node item as 3 when the root node item is HKCU, number the sub-key items according to the sub-key type, and generate a three-bit sequence in the order of the root node item number, 0, and the sub-key item number to replace the root node item and the sub-key item; a fourth numbering sub-module is used to number the root node item as 0 when the root node item is other content.

[0013] Further optionally, the sample two-dimensional matrix generation module includes: a string conversion submodule, used to convert each list item in the node list into a string with a space as a separator; a sample segmentation submodule, used to divide the second two-dimensional matrix into a training set two-dimensional matrix and a test set two-dimensional matrix by random segmentation; a character conversion submodule, used to use the character data of the training set two-dimensional matrix as a dictionary, and adopt the Tf-idf vectorization algorithm to convert the character data in the training set two-dimensional matrix and the test set two-dimensional matrix into a sparse matrix to obtain a sample two-dimensional matrix.

[0014] Further optionally, the first two-dimensional matrix generation module includes: a malicious process identification field annotation submodule, used to obtain the registry operation log, and respectively annotate the registry operation logs generated by the malicious process and the normal process to obtain the malicious process identification field; a feature acquisition submodule, used to perform data connection between the process name, target object, and setting value in each collected registry operation log and the corresponding malicious process identification field, and store them in the form of a two-dimensional matrix, delete completely duplicate registry operation logs, and obtain the first two-dimensional matrix.

[0015] On the other hand, the present invention further provides a malicious process detection system, comprising the malicious process detection device mentioned above.

[0016] On the other hand, the present invention further provides a computer-readable storage medium having a computer program stored thereon, wherein the program implements the above-mentioned malicious process detection method when executed by a processor.

[0017] The above technical scheme has the following beneficial effects: the present invention establishes a sample set characterized by a registry path, and uses the sample set as input to train a malicious process detection model, thereby linking the detection of malicious processes with the registry path, making the detection of malicious processes easier; since the registry path of a malicious process is different from the registry path of a normal process in content, the registry path is associated with its text content, primary key type and subkey type, and the registry path is given meaning to determine whether a process is malicious, thereby improving the accuracy of malicious process detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0019] Figure 1 is a flow chart of a malicious process detection method provided by an embodiment of the present invention;

[0020] Figure 2 is a flowchart of a method for numbering a preset number of list items in a node list provided by an embodiment of the present invention;

[0021] Figure 3 is a flow chart of a second two-dimensional matrix generation method provided by an embodiment of the present invention;

[0022] Figure 4 is a flow chart of a first two-dimensional matrix generation method provided by an embodiment of the present invention;

[0023] Figure 5 is a schematic diagram of the structure of a malicious process detection device provided by an embodiment of the present invention;

[0024] Figure 6 is a structural schematic diagram of a second two-dimensional matrix generation module provided in an embodiment of the present invention;

[0025] Figure 7 is a schematic diagram of the structure of a sample two-dimensional matrix generation module provided by an embodiment of the present invention;

[0026] Figure 8 It is a structural schematic diagram of a first two-dimensional matrix generation module provided in an embodiment of the present invention.

[0027] Figure numerals: 100 - first two-dimensional matrix generation module 1001 - malicious process identification field labeling submodule 1002 - feature acquisition submodule 200 - node list generation module 300 - second two-dimensional matrix generation module 3001 - first numbering submodule 3002 - second numbering submodule 3003 - third numbering submodule 3004 - fourth numbering submodule 400 - sample two-dimensional matrix generation module 4001 - string conversion submodule 4002 - sample segmentation submodule 4003 - character conversion submodule 500 - malicious process detection model generation module 600 - malicious process detection module DETAILED DESCRIPTION

[0028] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0029] In order to solve the problem of difficulty in detecting malicious processes in the prior art, an embodiment of the present invention provides a malicious process detection method. Figure 1 is a flow chart of a malicious process detection method provided by an embodiment of the present invention. Figure 1 As shown, including:

[0030] S101, obtaining a registry operation log, extracting a process name, a target object, a setting value, and a malicious process identification field in each registry operation log, and storing the process name, the target object, the setting value, and the malicious process identification field in a two-dimensional matrix form to obtain a first two-dimensional matrix;

[0031] The registry operation log refers to a log record of a process's operation on the registry. The operation may be the setting of a registry value or the addition and deletion of a registry item. The registry operation log can be generated by the third-party software Sysmon.

[0032] The acquired registry operation log initially contains fields such as generation time, process ID, process name, operation type, target object, setting value, etc. In this embodiment, the process name, target object (the complete path of the registry item of the specific operation), setting value, and the marked malicious process identification field are extracted from the registry operation log as feature values ​​for subsequent data processing. The above extraction and collection steps can be implemented by third-party software nxlog. After these feature values ​​are extracted, they are converted into json format and stored in a two-dimensional matrix form to facilitate subsequent data processing.

[0033] S102, in the first two-dimensional matrix, performing node segmentation on the registry path in the target object, using the content of each node after segmentation as a list item to convert the registry path into a node list, deleting the target object, and merging the setting value into the node list;

[0034] The registry target object contains the complete path of the registry, which is stored in the form of a string, with backslashes as separators between nodes. In this embodiment, in order to divide the content of each node into independent parts, the backslash segmentation method is adopted to obtain the content of each node from the root node to the value, and each node content is stored as a list item to obtain the node list converted from the registry path. The empty content of the setting value is replaced with None, and the setting value is merged into the node list and located at the end of the corresponding node list.

[0035] S103, in the node list, numbering a preset number of list items closest to the root node item according to the key type, and merging the registry operation logs with the same process name to obtain a second two-dimensional matrix;

[0036] Considering that the uncertain items in the node list generated by the target object conversion are too numerous and complex, and each item is not an equivalent object, which easily leads to the problem of high feature complexity of the construction, this embodiment first numbers the nodes close to the root node. Since the structure near the root node is basically fixed, the part with inherent rules can be numbered first to reduce the feature complexity of the data and reduce the amount of subsequent data processing.

[0037] The type of the root node primary key in the registry path is fixed, so the primary key type of the root node item can be used as a numbering standard to make the root node item get a corresponding number according to its type. In addition, the content of the preset number of node items after the root node item is the subkey corresponding to the primary key. The number of node items stored in the subkey varies with the type of the corresponding primary key. For example, the primary key HKLM has only one level of subkeys. At this time, it is only necessary to number the root node item and the node item after the root node item according to the key type. If the primary key HKU has two levels of subkeys, the root node item and the two node items after the root node item need to be numbered according to the corresponding key type. After the numbering is completed, the characters in the numbered list items are replaced with the corresponding numbers.

[0038] Since the final detection subject is a process, it is necessary to merge the registry operation logs with the same process name. To this end, after completing the numbering of the node list part, this embodiment merges the registry operation logs with the same process name. When merging, the node lists with the same process name are connected end to end and merged into a new node list. In addition, since the malicious process identification field is marked according to the process name, the malicious process operation logs and malicious process identification fields with the same process name are the same, and data merging can be performed directly.

[0039] S104, in the second two-dimensional matrix, numbering the unnumbered list items in the node list according to the text content of the list items to obtain a sample two-dimensional matrix;

[0040] After numbering the root node items storing the primary key and the node items storing the subkey, there are other unnumbered list items in the node list. The contents of these list items are still characters. In order to effectively encode these characters, this embodiment uses the text content in the list items as the numbering basis, and converts the characters in these list items into corresponding numbers to facilitate subsequent model training. In this way, the contents of other unnumbered list items are replaced with corresponding numbers, so that the original node list is completely converted into a numbered node list. At this time, the registry operation log of each process includes the process name, the numbered node list, and the malicious process identification field. The registry operation logs of multiple different process names form a sample two-dimensional matrix.

[0041] S105, using the process name in the sample two-dimensional matrix as a row index, the numbered node list and the malicious process identification field as a column index, and inputting them into a random forest model to obtain a malicious process detection model;

[0042] In the sample two-dimensional matrix, the row index is the process name, the column index is the numbered node list and the malicious process identification field. This data is the final standardized data set for machine learning model training. The random forest model in the open source machine learning library scikit-learn is called. The random forest model uses the Gini coefficient as the impurity calculation method. This is because the data generated by the data processing part has the characteristics of high dimension, sparse features, and many zero values, so the above parameters are more applicable.

[0043] The sample two-dimensional matrix is ​​divided into a training set and a test set in a ratio of 7:3. Both the training set and the test set use the numbered node list as a feature and whether it is a malicious process as a label. At the beginning, the training set is input into the random model for training, and the detection model after training is saved in sav format; the test set is used to test the recognition accuracy of the detection model trained with the training set, and the parameters of the detection model are corrected according to the accuracy of the detection results to obtain the final malicious process detection model, which can be used to detect whether the process is malicious.

[0044] S106: Input the process to be detected into a malicious process detection model to determine whether the process to be detected is a malicious process.

[0045] The malicious process detection model is used to detect whether the process to be detected is malicious. During the detection, the malicious process detection model determines whether the process to be detected is malicious by identifying the registry path in the process to be detected, so as to achieve fast and accurate judgment of the malicious process.

[0046] As an optional implementation, Figure 2 is a flowchart of a method for numbering a preset number of list items in a node list provided by an embodiment of the present invention, such as Figure 2 As shown, in the node list, a preset number of list items closest to the root node item are numbered according to the key type, including:

[0047] S1031. When the root node item is HKLM, the root node item is numbered as 1, the subkey items are numbered according to the subkey type, and a three-digit sequence is generated in the order of the root node item number, 0, and the subkey item number to replace the root node item and the subkey item;

[0048] S1032. When the root node item is HKU, the root node item is numbered as 2, the first-level subkey item is numbered according to the first-level subkey type, and the second-level subkey item is numbered according to the second-level subkey type. A three-digit sequence is generated in the order of the root node item number, the first-level subkey item number, and the second-level subkey item number to replace the root node item, the first-level subkey item, and the second-level subkey item;

[0049] S1033, when the root node item is HKCU, number the root node item as 3, number the subkey item according to the subkey type, and generate a three-digit sequence in the order of the root node item number, 0, and the subkey item number to replace the root node item and the subkey item;

[0050] S1034. When the root node item is other content, the root node item is numbered as 0.

[0051] The most common primary keys in the registry path are the root nodes HKLM, HKU and HKCU, which are numbered 1, 2 and 3 respectively, and the non-three items are numbered 0. HKLM has 6 fixed subkeys, numbered from 0 to 5; HKU's subkeys are various accounts in the system, distinguished by SID, and there is also a default item, which is numbered from 1 to 7 after classification; HKCU's subkeys are the registry items under the current account, which are consistent with the secondary subkey structure under HKU, so the subkeys of HKCU and HKU use the same numbering method, and are numbered from 0 to 8 after classification.

[0052] For HKLM and HKCU, a three-digit sequence is generated by combining the primary key number plus 0 and the subkey number. For HKU, a three-digit sequence is generated by combining the primary key number plus the SID number plus the secondary subkey number, and the sequence is added to the node list to replace the original node item content.

[0053] As an optional implementation, Figure 3 is a flow chart of a second two-dimensional matrix generation method provided by an embodiment of the present invention. Figure 3 As shown, the unnumbered list items in the node list are numbered according to the text content of the list items, including:

[0054] S1041, converting each list item in the node list into a string with a space as a separator;

[0055] After the node list is partially numbered and merged with the same process name, each process name corresponds to a node list with an indefinite number of list items. In the node list, there are not only list items in digital format but also list items in text format. Now it is necessary to convert these list items in text format into list items in digital format. Natural language processing can well extract features for classification. Before natural language processing, each list item needs to be converted into a recognizable natural language. In this embodiment, the content of each list item is regarded as a character content, and spaces are used as separators between the character contents of each list item, so that the node list can be converted into a long string similar to English text.

[0056] S1042, dividing the second two-dimensional matrix into a training set two-dimensional matrix and a test set two-dimensional matrix by random segmentation;

[0057] The data is divided into a two-dimensional matrix of the training set and a two-dimensional matrix of the test set. Here, the random segmentation method is used to allow malicious and non-malicious samples to appear evenly in the two-dimensional matrix of the training set and the two-dimensional matrix of the test set, so that both malicious and non-malicious samples can be covered in the two sample sets.

[0058] S1043. Using the character data in the two-dimensional matrix of the training set as a dictionary, the Tf-idf vectorization algorithm is used to convert the character data in the two-dimensional matrix of the training set and the two-dimensional matrix of the test set into a sparse matrix to obtain a sample two-dimensional matrix.

[0059] The character data of the two-dimensional matrix of the training set is used to generate a dictionary, and the character data in the two-dimensional matrix of the training set and the two-dimensional matrix of the test set are converted into a sparse matrix using the Tf-idf vectorization algorithm. The Tf-idf vectorization algorithm vectorizes the character data in the two-dimensional matrix of the training set and the two-dimensional matrix of the test set. This algorithm uses a combination of word frequency (tf value) and inverse text frequency index (idf value) to represent the weight of a certain term in a certain text. The tf value calculates the frequency of a certain term in a text, and the idf value calculates the sum of the ratio of the number of texts in the training set to the number of texts containing a certain term and 1. Finally, the product of the two is used as the assignment of a certain term in a certain text. The advantage of this vectorization algorithm is that it considers the role of word frequency in classification while weakening the weight of common words. It can be observed that the registry key paths of malicious samples and non-malicious samples still have a large number of identical nodes after cutting the nodes near the root node, which are not helpful for distinguishing malicious samples from non-malicious samples. Therefore, using the Tf-idf algorithm to convert the subsequent node content into visual features helps to improve the detection accuracy of the malicious detection model.

[0060] As an optional implementation, Figure 4 is a flowchart of a first two-dimensional matrix generation method provided by an embodiment of the present invention. Figure 4 As shown, the registry operation log is obtained, the process name, target object, setting value and malicious process identification field in each registry operation log are extracted, and the process name, target object, setting value and malicious process identification field are stored in the form of a two-dimensional matrix to obtain a first two-dimensional matrix, including:

[0061] S1011, obtaining a registry operation log, and marking the registry operation logs generated by a malicious process and a normal process respectively, to obtain a malicious process identification field;

[0062] S1012, data connection is performed on the process name, target object, setting value and corresponding malicious process identification field in each collected registry operation log, and the data is stored in the form of a two-dimensional matrix, and completely repeated registry operation logs are deleted to obtain a first two-dimensional matrix.

[0063] In the data acquisition phase, after obtaining the registry operation logs, each process in these logs is marked according to the process name to determine whether it is malicious, for example, 1 represents a malicious process, and 0 represents a non-malicious process. The identification of whether the process is malicious is written into the malicious process identification field to obtain the identification tag of the process for subsequent detection model generation. After extracting the process name, target object, and setting value from the log, connect them with the corresponding malicious process identification field, and store the above data in the form of a two-dimensional matrix, delete the data with completely repeated four features, that is, delete completely repeated rows in the two-dimensional matrix to obtain the first two-dimensional matrix.

[0064] Figure 5 is a schematic diagram of the structure of a malicious process detection device provided by an embodiment of the present invention. Figure 5 As shown, an embodiment of the present invention provides a malicious process detection device, the malicious process detection device comprising:

[0065] The first two-dimensional matrix generation module 100 is used to obtain the registry operation log, extract the process name, target object, setting value and malicious process identification field in each registry operation log, and store the process name, target object, setting value and malicious process identification field in the form of a two-dimensional matrix to obtain a first two-dimensional matrix;

[0066] The registry operation log refers to a log record of a process's operation on the registry. The operation may be the setting of a registry value or the addition and deletion of a registry item. The registry operation log can be generated by the third-party software Sysmon.

[0067] The acquired registry operation log initially contains fields such as generation time, process ID, process name, operation type, target object, setting value, etc. In this embodiment, the process name, target object (the complete path of the registry item of the specific operation), setting value, and the marked malicious process identification field are extracted from the registry operation log as feature values ​​for subsequent data processing. The above extraction and collection steps can be implemented by third-party software nxlog. After these feature values ​​are extracted, they are converted into json format and stored in a two-dimensional matrix form to facilitate subsequent data processing.

[0068] The node list generation module 200 is used to perform node segmentation on the registry path in the target object in the first two-dimensional matrix, use the content of each node after segmentation as a list item to convert the registry path into a node list, delete the target object, and merge the setting value into the node list;

[0069] The registry target object contains the complete path of the registry, which is stored in the form of a string, with backslashes as separators between nodes. In this embodiment, in order to divide the content of each node into independent parts, the backslash segmentation method is adopted to obtain the content of each node from the root node to the value, and each node content is stored as a list item to obtain the node list converted from the registry path. The empty content of the setting value is replaced with None, and the setting value is merged into the node list and located at the end of the corresponding node list.

[0070] The second two-dimensional matrix generating module 300 is used to number the preset number of list items closest to the root node item in the node list according to the key type, and merge the registry operation logs with the same process name to obtain the second two-dimensional matrix;

[0071] Considering that the uncertain items in the node list generated by the target object conversion are too numerous and complex, and each item is not an equivalent object, which easily leads to the problem of high feature complexity of the construction, this embodiment first numbers the nodes close to the root node. Since the structure near the root node is basically fixed, the part with inherent rules can be numbered first to reduce the feature complexity of the data and reduce the amount of subsequent data processing.

[0072] The type of the root node primary key in the registry path is fixed, so the primary key type of the root node item can be used as a numbering standard to make the root node item get a corresponding number according to its type. In addition, the content of the preset number of node items after the root node item is the subkey corresponding to the primary key. The number of node items stored in the subkey varies with the type of the corresponding primary key. For example, the primary key HKLM has only one level of subkeys. At this time, it is only necessary to number the root node item and the node item after the root node item according to the key type. If the primary key HKU has two levels of subkeys, the root node item and the two node items after the root node item need to be numbered according to the corresponding key type. After the numbering is completed, the characters in the numbered list items are replaced with the corresponding numbers.

[0073] Since the final detection subject is a process, it is necessary to merge the registry operation logs with the same process name. To this end, after completing the numbering of the node list part, this embodiment merges the registry operation logs with the same process name. When merging, the node lists with the same process name are connected end to end and merged into a new node list. In addition, since the malicious process identification field is marked according to the process name, the malicious process operation logs and malicious process identification fields with the same process name are the same, and data merging can be performed directly.

[0074] The sample two-dimensional matrix generating module 400 is used to number the unnumbered list items in the node list according to the text content of the list items in the second two-dimensional matrix to obtain a sample two-dimensional matrix;

[0075] After numbering the root node items storing the primary key and the node items storing the subkey, there are other unnumbered list items in the node list. The contents of these list items are still characters. In order to effectively encode these characters, this embodiment uses the text content in the list items as the numbering basis, and converts the characters in these list items into corresponding numbers to facilitate subsequent model training. In this way, the contents of other unnumbered list items are replaced with corresponding numbers, so that the original node list is completely converted into a numbered node list. At this time, the registry operation log of each process includes the process name, the numbered node list, and the malicious process identification field. The registry operation logs of multiple different process names form a sample two-dimensional matrix.

[0076] A malicious process detection model generation module 500 is used to input the process name in the sample two-dimensional matrix as a row index, the numbered node list and the malicious process identification field as a column index into a random forest model to obtain a malicious process detection model;

[0077] In the sample two-dimensional matrix, the row index is the process name, the column index is the numbered node list and the malicious process identification field. This data is the final standardized data set for machine learning model training. The random forest model in the open source machine learning library scikit-learn is called. The random forest model uses the Gini coefficient as the impurity calculation method. This is because the data generated by the data processing part has the characteristics of high dimension, sparse features, and many zero values, so the above parameters are more applicable.

[0078] The sample two-dimensional matrix is ​​divided into a training set and a test set in a ratio of 7:3. Both the training set and the test set use the numbered node list as a feature and whether it is a malicious process as a label. At the beginning, the training set is input into the random model for training, and the detection model after training is saved in sav format; the test set is used to test the recognition accuracy of the detection model trained with the training set, and the parameters of the detection model are corrected according to the accuracy of the detection results to obtain the final malicious process detection model, which can be used to detect whether the process is malicious.

[0079] The malicious process detection module 600 is used to input the process to be detected into the malicious process detection model to determine whether the process to be detected is a malicious process.

[0080] The malicious process detection model is used to detect whether the process to be detected is malicious. During the detection, the malicious process detection model determines whether the process to be detected is malicious by identifying the registry path in the process to be detected, so as to achieve fast and accurate judgment of the malicious process.

[0081] As an optional implementation, Figure 6is a schematic diagram of the structure of a second two-dimensional matrix generation module provided in an embodiment of the present invention. Figure 6 As shown, the second two-dimensional matrix generation module 300 includes:

[0082] The first numbering submodule 3001 is used for, when the root node item is HKLM, numbering the root node item as 1, numbering the subkey items according to the subkey type, and generating a three-digit sequence in the order of the root node item number, 0, and the subkey item number to replace the root node item and the subkey item;

[0083] The second numbering submodule 3002 is used for, when the root node item is HKU, numbering the root node item as 2, numbering the first-level subkey item according to the first-level subkey type, and numbering the second-level subkey item according to the second-level subkey type, and generating a three-digit sequence in the order of the root node item number, the first-level subkey item number, and the second-level subkey item number to replace the root node item, the first-level subkey item, and the second-level subkey item;

[0084] The third numbering submodule 3003 is used for, when the root node item is HKCU, numbering the root node item as 3, numbering the subkey items according to the subkey type, and generating a three-digit sequence in the order of the root node item number, 0, and the subkey item number to replace the root node item and the subkey item;

[0085] The fourth numbering submodule 3004 is used to number the root node item as 0 when the root node item is other content.

[0086] The most common primary keys in the registry path are the root nodes HKLM, HKU and HKCU, which are numbered 1, 2 and 3 respectively, and the non-three items are numbered 0. HKLM has 6 fixed subkeys, numbered from 0 to 5; HKU's subkeys are various accounts in the system, distinguished by SID, and there is also a default item, which is numbered from 1 to 7 after classification; HKCU's subkeys are the registry items under the current account, which are consistent with the secondary subkey structure under HKU, so the subkeys of HKCU and HKU use the same numbering method, and are numbered from 0 to 8 after classification.

[0087] For HKLM and HKCU, a three-digit sequence is generated by combining the primary key number plus 0 and the subkey number. For HKU, a three-digit sequence is generated by combining the primary key number plus the SID number plus the secondary subkey number, and the sequence is added to the node list to replace the original node item content.

[0088] As an optional implementation, Figure 7 is a schematic diagram of the structure of a sample two-dimensional matrix generation module provided by an embodiment of the present invention. Figure 7 As shown, the sample two-dimensional matrix generation module 400 includes:

[0089] The string conversion submodule 4001 is used to convert each list item in the node list into a string with a space as a separator;

[0090] After the node list is partially numbered and merged with the same process name, each process name corresponds to a node list with an indefinite number of list items. In the node list, there are not only list items in digital format but also list items in text format. Now it is necessary to convert these list items in text format into list items in digital format. Natural language processing can well extract features for classification. Before natural language processing, each list item needs to be converted into a recognizable natural language. In this embodiment, the content of each list item is regarded as a character content, and spaces are used as separators between the character contents of each list item, so that the node list can be converted into a long string similar to English text.

[0091] A sample segmentation submodule 4002 is used to divide the second two-dimensional matrix into a training set two-dimensional matrix and a test set two-dimensional matrix by random segmentation;

[0092] The data is divided into a two-dimensional matrix of the training set and a two-dimensional matrix of the test set. Here, the random segmentation method is used to allow malicious and non-malicious samples to appear evenly in the two-dimensional matrix of the training set and the two-dimensional matrix of the test set, so that both malicious and non-malicious samples can be covered in the two sample sets.

[0093] The character conversion submodule 4003 is used to use the character data of the training set two-dimensional matrix as a dictionary and adopt the Tf-idf vectorization algorithm to convert the character data in the training set two-dimensional matrix and the test set two-dimensional matrix into a sparse matrix to obtain a sample two-dimensional matrix.

[0094] The character data of the two-dimensional matrix of the training set is used to generate a dictionary, and the character data in the two-dimensional matrix of the training set and the two-dimensional matrix of the test set are converted into a sparse matrix using the Tf-idf vectorization algorithm. The Tf-idf vectorization algorithm vectorizes the character data in the two-dimensional matrix of the training set and the two-dimensional matrix of the test set. This algorithm uses a combination of word frequency (tf value) and inverse text frequency index (idf value) to represent the weight of a certain term in a certain text. The tf value calculates the frequency of a certain term in a text, and the idf value calculates the sum of the ratio of the number of texts in the training set to the number of texts containing a certain term and 1. Finally, the product of the two is used as the assignment of a certain term in a certain text. The advantage of this vectorization algorithm is that it considers the role of word frequency in classification while weakening the weight of common words. It can be observed that the registry key paths of malicious samples and non-malicious samples still have a large number of identical nodes after cutting the nodes near the root node, which are not helpful for distinguishing malicious samples from non-malicious samples. Therefore, using the Tf-idf algorithm to convert the subsequent node content into visual features helps to improve the detection accuracy of the malicious detection model.

[0095] As an optional implementation, Figure 8 is a schematic diagram of the structure of a first two-dimensional matrix generation module provided in an embodiment of the present invention. Figure 8 As shown, the first two-dimensional matrix generation module 100 includes:

[0096] Malicious process identification field marking submodule 1001 is used to obtain registry operation logs, and mark the registry operation logs generated by malicious processes and normal processes respectively to obtain malicious process identification fields;

[0097] The feature acquisition submodule 1002 is used to perform data connection on the process name, target object, setting value and corresponding malicious process identification field in each collected registry operation log, store them in the form of a two-dimensional matrix, delete completely repeated registry operation logs, and obtain the first two-dimensional matrix.

[0098] In the data acquisition phase, after obtaining the registry operation logs, each process in these logs is marked according to the process name to determine whether it is malicious, for example, 1 represents a malicious process, and 0 represents a non-malicious process. The identification of whether the process is malicious is written into the malicious process identification field to obtain the identification tag of the process for subsequent detection model generation. After extracting the process name, target object, and setting value from the log, connect them with the corresponding malicious process identification field, and store the above data in the form of a two-dimensional matrix, delete the data with completely repeated four features, that is, delete completely repeated rows in the two-dimensional matrix to obtain the first two-dimensional matrix.

[0099] An embodiment of the present invention further provides a malicious process detection system, comprising the malicious process detection device mentioned above.

[0100] An embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the above-mentioned malicious process detection method is implemented.

[0101] The above-mentioned software is stored in the above-mentioned storage medium, which includes but is not limited to: a CD, a floppy disk, a hard disk, an erasable memory, etc.

[0102] The above technical scheme has the following beneficial effects: the present invention establishes a sample set characterized by a registry path, and uses the sample set as input to train a malicious process detection model, thereby linking the detection of malicious processes with the registry path, making the detection of malicious processes easier; since the registry path of a malicious process is different from the registry path of a normal process in content, the registry path is associated with its text content, primary key type and subkey type, and the registry path is given meaning to determine whether a process is malicious, thereby improving the accuracy of malicious process detection.

[0103] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A malicious process detection method, characterized in that: include: Obtaining a registry operation log, extracting a process name, a target object, a setting value, and a malicious process identification field in each registry operation log, and storing the process name, the target object, the setting value, and the malicious process identification field in a two-dimensional matrix form to obtain a first two-dimensional matrix; In the first two-dimensional matrix, the registry path in the target object is segmented into nodes, each node content after segmentation is used as a list item to convert the registry path into a node list, the target object is deleted, and the setting value is merged into the node list; In the node list, a preset number of list items closest to the root node item are numbered according to the key type, and the registry operation logs with the same process name are merged to obtain a second two-dimensional matrix; In the second two-dimensional matrix, the unnumbered list items in the node list are numbered according to the text content of the list items to obtain a sample two-dimensional matrix; The process name in the sample two-dimensional matrix is ​​used as a row index, the numbered node list and the malicious process identification field are used as a column index, and are input into a random forest model to obtain a malicious process detection model; The process to be detected is input into the malicious process detection model to determine whether the process to be detected is a malicious process.

2. The malicious process detection method according to claim 1, characterized in that: In the node list, a preset number of list items closest to the root node item are numbered according to the key type, including: When the root node item is HKLM, the root node item is numbered as 1, the subkey item is numbered according to the subkey type, and a three-digit sequence is generated in the order of the root node item number, 0, and the subkey item number to replace the root node item and the subkey item; When the root node item is HKU, the root node item is numbered as 2, the first-level subkey item is numbered according to the first-level subkey type, and the second-level subkey item is numbered according to the second-level subkey type, and a three-digit sequence is generated in the order of the root node item number, the first-level subkey item number, and the second-level subkey item number to replace the root node item, the first-level subkey item, and the second-level subkey item; When the root node item is HKCU, the root node item is numbered as 3, the subkey item is numbered according to the subkey type, and a three-digit sequence is generated in the order of the root node item number, 0, and the subkey item number to replace the root node item and the subkey item; When the root node item is other content, the root node item is numbered as 0.

3. The malicious process detection method according to claim 1, characterized in that: The step of numbering the unnumbered list items in the node list according to the text content of the list items includes: Convert each list item in the node list into a string with spaces as separators; The second two-dimensional matrix is ​​divided into a training set two-dimensional matrix and a test set two-dimensional matrix by random segmentation; The character data in the two-dimensional matrix of the training set is used as a dictionary, and the character data in the two-dimensional matrix of the training set and the two-dimensional matrix of the test set are converted into a sparse matrix using a Tf-idf vectorization algorithm to obtain a sample two-dimensional matrix.

4. The malicious process detection method according to claim 1, characterized in that: The registry operation log is obtained, and the process name, target object, setting value and malicious process identification field in each registry operation log are extracted, and the process name, target object, setting value and malicious process identification field are stored in the form of a two-dimensional matrix to obtain a first two-dimensional matrix, including: Obtaining the registry operation log, and marking the registry operation logs generated by the malicious process and the normal process respectively, to obtain a malicious process identification field; The process name, target object, setting value and corresponding malicious process identification field in each collected registry operation log are data-connected and stored in the form of a two-dimensional matrix, and completely duplicated registry operation logs are deleted to obtain the first two-dimensional matrix.

5. A malicious process detection device, characterized in that: include: A first two-dimensional matrix generation module is used to obtain a registry operation log, extract a process name, a target object, a setting value, and a malicious process identification field in each registry operation log, and store the process name, the target object, the setting value, and the malicious process identification field in a two-dimensional matrix form to obtain a first two-dimensional matrix; a node list generating module, configured to perform node segmentation on the registry path in the target object in the first two-dimensional matrix, use the content of each node after segmentation as a list item to convert the registry path into a node list, delete the target object, and merge the setting value into the node list; A second two-dimensional matrix generating module is used to, in the node list, number a preset number of list items closest to the root node item according to the key type, and merge the registry operation logs with the same process name to obtain a second two-dimensional matrix; A sample two-dimensional matrix generating module, used for numbering the unnumbered list items in the node list according to the text content of the list items in the second two-dimensional matrix to obtain a sample two-dimensional matrix; A malicious process detection model generation module is used to input the process name in the sample two-dimensional matrix as a row index, the numbered node list and the malicious process identification field as a column index into a random forest model to obtain a malicious process detection model; The malicious process detection module is used to input the process to be detected into the malicious process detection model to determine whether the process to be detected is a malicious process.

6. The malicious process detection device according to claim 5, characterized in that: The second two-dimensional matrix generation module includes: The first numbering submodule is used for, when the root node item is HKLM, numbering the root node item as 1, numbering the subkey items according to the subkey type, and generating a three-digit sequence in the order of the root node item number, 0, and the subkey item number to replace the root node item and the subkey item; The second numbering submodule is used for, when the root node item is HKU, numbering the root node item as 2, numbering the first-level subkey item according to the first-level subkey type, and numbering the second-level subkey item according to the second-level subkey type, and generating a three-digit sequence in the order of the root node item number, the first-level subkey item number, and the second-level subkey item number to replace the root node item, the first-level subkey item, and the second-level subkey item; The third numbering submodule is used for, when the root node item is HKCU, numbering the root node item as 3, numbering the subkey item according to the subkey type, and generating a three-digit sequence in the order of the root node item number, 0, and the subkey item number to replace the root node item and the subkey item; The fourth numbering submodule is used to number the root node item as 0 when the root node item is other content.

7. The malicious process detection device according to claim 5, characterized in that: The sample two-dimensional matrix generation module includes: A string conversion submodule, used to convert each list item in the node list into a string with a space as a separator; A sample segmentation submodule, used for dividing the second two-dimensional matrix into a training set two-dimensional matrix and a test set two-dimensional matrix by random segmentation; The character conversion submodule is used to use the character data of the training set two-dimensional matrix as a dictionary and adopt the Tf-idf vectorization algorithm to convert the character data in the training set two-dimensional matrix and the test set two-dimensional matrix into a sparse matrix to obtain a sample two-dimensional matrix.

8. The malicious process detection device according to claim 5, characterized in that: The first two-dimensional matrix generation module includes: A malicious process identification field marking submodule is used to obtain the registry operation log, and mark the registry operation logs generated by the malicious process and the normal process respectively to obtain the malicious process identification field; The feature acquisition submodule is used to perform data connection between the process name, target object, setting value and corresponding malicious process identification field in each collected registry operation log, store them in the form of a two-dimensional matrix, delete completely repeated registry operation logs, and obtain the first two-dimensional matrix.

9. A malicious process detection system, comprising the malicious process detection device as described in any one of claims 5-8.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the malicious process detection method according to any one of claims 1 to 4 is implemented.

Citation Information

Patent Citations

  • Intelligent terminal malicious software dynamic detection method based on system call

    CN109753801A

  • Malicious software API call sequence detection method based on graph convolution

    CN111259388A

  • Vulnerability identification method and device, equipment and storage medium

    CN112632529A

  • Method for normalizing dynamic behavior of process and detecting malicious code

    KR1020150085741A

  • Methods and apparatus for detection of malicious documents using machine learning

    US20190236273A1