Detection rule determination and malicious binary file detection method, device and medium

By training decision trees to generate malicious binary file detection rules and combining the detection results of multiple antivirus engines, the problem of insufficient detection capabilities of existing antivirus engines is solved, and more efficient and accurate malicious binary file detection is achieved.

CN116821903BActive Publication Date: 2026-11-24ALIBABA CLOUD COMPUTING CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310597956.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-24
Publication Date
2026-11-24
Estimated Expiration
2043-05-24

AI Technical Summary

Technical Problem

Existing antivirus engines struggle to cover various virus types in binary files, leading to false positives or false negatives and making it difficult to effectively detect malicious binary files.

Method used

By training a first decision tree and second decision trees corresponding to multiple virus types, malicious binary file detection rules and virus type detection rules are generated. These rules are then combined with the virus detection results from multiple antivirus engines for correlation analysis to automatically generate detection rules and improve detection capabilities.

Benefits of technology

It improves the detection coverage of binary files of various virus types, reduces false positives and false negatives, improves detection efficiency and reduces the cost of manually writing rules, and has the ability to respond and interpret quickly.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116821903B_ABST
    Figure CN116821903B_ABST
Patent Text Reader

Abstract

This application provides a method, device, and medium for determining detection rules and detecting malicious binary files. In this application, a first decision tree with malicious binary file detection functionality and a second decision tree with malicious binary file virus type detection functionality are trained. Multiple decision rules, including malicious binary file detection rules and virus type detection rules, are automatically generated based on tree traversal. Because the sample binary files used in the decision tree training incorporate virus detection results from multiple antivirus engines, the generated detection rules can perform correlation analysis on the virus name strings output by multiple antivirus engines to determine whether the binary file to be detected is malicious and to identify the virus type. Compared to a single antivirus engine, incorporating the detection capabilities of multiple antivirus engines improves the overall virus detection capability and overcomes the shortcomings of single antivirus engines, such as false positives or false negatives.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a method, device and medium for determining detection rules and detecting malicious binary files. Background Technology

[0002] Currently, several antivirus engines on the market offer malicious binary file detection capabilities. However, binary files contain a wide variety of viruses, including but not limited to: backdoor programs, high-risk programs, Trojans, hacking tools, infectious viruses, ransomware, cryptocurrency mining programs, and proxy tools. Due to the diverse types of binary file viruses, it is difficult for a single antivirus engine to cover the detection of most of these virus types. Summary of the Invention

[0003] This application provides a method, device, and medium for determining detection rules and detecting malicious binary files, thereby improving the virus detection capability against malicious binary files.

[0004] This application provides a method for determining detection rules, including: training a model using a first sample file set to obtain a first decision tree; training a model using a second sample file set corresponding to multiple virus types to obtain a second decision tree corresponding to each of the multiple virus types; determining malicious binary file detection rules based on the first decision tree; and determining virus type detection rules corresponding to each of the multiple virus types based on the second decision trees corresponding to each of the multiple virus types. The sample data of the sample binary files in the first sample file set includes: a concatenated virus name string and a malicious result label indicating whether it is a malicious binary file. The concatenated virus name string is obtained by concatenating multiple virus name strings, which are obtained by performing virus detection on the corresponding sample binary files using multiple antivirus engines. The sample data of the sample binary files in the second sample file set includes: a concatenated virus name string and a virus type label indicating the virus type.

[0005] This application also provides a method for detecting malicious binary files, including: acquiring a binary file to be detected; performing virus detection on the binary file to be detected using multiple antivirus engines to obtain multiple virus name strings; concatenating the multiple virus name strings to obtain a target virus name string; detecting the target virus name string using malicious binary file detection rules to determine whether the binary file to be detected is a malicious binary file; and if the binary file to be detected is a malicious binary file, performing virus type detection on the target virus name string using virus type detection rules corresponding to multiple virus types to determine the virus type of the binary file to be detected.

[0006] This application also provides an electronic device, including: a memory and a processor; the memory for storing a computer program; the processor coupled to the memory for executing the computer program to perform steps in a detection rule determination method or a malicious binary file detection method.

[0007] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, enables the processor to implement the steps in the detection rule determination method or the malicious binary file detection method. Attached Figure Description

[0008] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0009] Figure 1 An application scenario diagram provided for an embodiment of this application;

[0010] Figure 2 A flowchart illustrating a detection rule determination method provided in this application embodiment;

[0011] Figure 3 A process diagram illustrating an exemplary detection rule generation stage provided for embodiments of this application;

[0012] Figure 4 A flowchart illustrating a malicious binary file detection method provided in this application embodiment;

[0013] Figure 5 This is another application scenario diagram provided by an embodiment of this application;

[0014] Figure 6 This is a schematic diagram of the structure of a detection rule determination device provided in an embodiment of this application;

[0015] Figure 7 A schematic diagram of a malicious binary file detection device provided in this application embodiment;

[0016] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0017] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0018] In the embodiments of this application, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the access relationship between associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, and B alone, where A and B can be singular or plural. In the textual description of this application, the character " / " generally indicates that the preceding and following associated objects have an "or" relationship. Furthermore, in the embodiments of this application, "first," "second," "third," etc., are only used to distinguish the content of different objects and have no other special meaning.

[0019] First, some terms used in the embodiments of this application will be explained:

[0020] Anti-virus engine: This refers to an engine with malicious binary file detection capabilities. For example, it can detect whether a binary file is malicious and identify the type of virus within it. Virus types include, but are not limited to: backdoor programs, high-risk programs, Trojan horses, hacking tools, infectious viruses, ransomware, mining programs, and proxy tools, etc.

[0021] Multi-engine platform: refers to a platform composed of multiple antivirus engines.

[0022] Binary files: A computer file format in which data is stored in binary form. On Windows systems, binary files refer to Portable Executable (PE) format files, while on Linux and Unix systems, they refer to Executable and Linkable Format (ELF) format files. Windows is an operating system developed based on a graphical user interface. Linux is a free and open-source Unix-like operating system, a multi-user, multi-tasking operating system that supports multi-threading and multiple CPUs (Central Processing Units). Unix is ​​a powerful multi-user, multi-tasking operating system that supports various processor architectures. Malicious result labels: Labels that indicate whether a binary file being detected is malicious.

[0023] Virus type label: This refers to a label that indicates the type of virus to which the binary file being detected belongs.

[0024] Virus name string: refers to a string that represents the name of a virus, consisting of a series of characters such as numbers, letters, and underscores.

[0025] Concatenating virus name strings: This is obtained by concatenating multiple virus name strings.

[0026] Knowledge graph: A knowledge graph includes at least two entities (also called nodes), and whether there are relationships between different entities.

[0027] Classification accuracy: The number of correctly classified samples divided by the total number of samples. Generally speaking, the higher the accuracy, the better the classifier.

[0028] A decision tree is a decision analysis method that, based on the known probabilities of various scenarios, constructs a decision tree to calculate the probability that the expected net present value is greater than or equal to zero, evaluating project risk and determining its feasibility. A decision tree is a tree-like structure; its decision branches resemble the branches of a tree, hence the name. A decision tree consists of a root node, internal nodes, and leaf nodes. Each decision tree has only one root node, each internal node represents a test on an attribute, each branch represents a test output, and each leaf node represents a category. Decision tree generation typically starts from the root node, selecting the corresponding attribute, then choosing the split point for that attribute, and then splitting the node based on the split point. A decision tree generates multiple child nodes by selecting features and corresponding split points. When a node's value belongs only to a certain category (or has a small variance), then no further splitting of child nodes occurs.

[0029] In practical applications, different antivirus engines excel at detecting different types of viruses, resulting in varying detection capabilities. Furthermore, binary files contain a wide variety of viruses, making it difficult for a single antivirus engine to cover the detection of most types of binary files. Currently, several antivirus engines on the market offer malicious binary file detection capabilities. However, binary files contain numerous types of viruses, including but not limited to: backdoor programs, high-risk programs, Trojans, hacking tools, infectious viruses, ransomware, cryptocurrency mining programs, and proxy tools. Due to the diverse types of viruses in binary files, it is difficult for a single antivirus engine to cover the detection of most types of binary files.

[0030] Therefore, this application provides a method, device, and medium for determining detection rules and detecting malicious binary files. In this application, a first decision tree with malicious binary file detection function and a second decision tree with malicious binary file virus type detection function are trained. Multiple decision rules, such as malicious binary file detection rules and virus type detection rules, are automatically generated based on tree traversal. Since the sample data of the sample binary files participating in the decision tree training incorporates virus detection results from multiple antivirus engines, the generated detection rules can perform correlation analysis on the virus name strings output by multiple antivirus engines to determine whether the binary file to be detected is malicious and to identify the virus type. Compared to a single antivirus engine, incorporating the detection capabilities of multiple antivirus engines can cover the detection of more types of binary files with viruses. By using multiple antivirus engines for joint decision-making, the detection advantages of a single antivirus engine can be used to improve the overall virus detection capability, and the strengths and weaknesses can be complemented to achieve an enhanced effect, overcoming the shortcomings of a single antivirus engine such as false positives or false negatives.

[0031] Figure 1 This is an application scenario diagram provided for an embodiment of this application. See also... Figure 1 Users can input a binary file to be detected into a multi-engine platform. The platform utilizes multiple anti-virus engines of different types to perform virus detection on the binary file and outputs the results. The multi-engine platform may include, for example, anti-virus engine 1, anti-virus engine 2, anti-virus engine 3, anti-virus engine 4... anti-virus engine n, where n is an integer greater than 1. If the binary file is malicious, the anti-virus engine outputs a virus name string and a virus type. For example, virus name strings might be Win32 / Rozena.AUW, trojan:Win32 / Swrort.A, or deepscan:Generic.Exploit.Shellcode.1.319DAA74. Conversely, if the binary file is not malicious, the anti-virus engine outputs a result indicating that the binary file is legitimate.

[0032] In practical applications, the multi-engine platform can also pre-learn virus detection results obtained from detecting massive amounts of malicious binary files, and automatically generate various detection rules such as malicious binary file detection rules and virus type detection rules. See the following text for an introduction to detection rules.

[0033] See Figure 1As shown in ①, the cloud server pre-loads various detection rules, such as malicious binary file detection rules and virus type detection rules. If a multi-engine platform requests the cloud server to detect the binary file to be detected based on virus name strings output by multiple antivirus engines, the cloud server first concatenates the multiple virus name strings to obtain a concatenated virus name string. Then, see [link to relevant documentation]. Figure 1 As shown in ②, the cloud server uses pre-loaded detection rules to detect the concatenated virus name string. Specifically, the cloud server first uses malicious binary file detection rules to detect the concatenated virus name string to determine whether the binary file to be detected is malicious. Next, if the binary file to be detected is malicious, it uses virus type detection rules to detect the concatenated virus name string to determine the virus type of the binary file. Thus, through the interaction between the multi-engine platform and the cloud server, the task of detecting viruses in binary files is completed.

[0034] Compared to a single antivirus engine, integrating the detection capabilities of multiple antivirus engines can cover the detection of more types of binary files containing viruses. By leveraging the combined decision-making of multiple antivirus engines, the overall virus detection capability can be improved by utilizing the strengths of individual engines, and their weaknesses can be complemented to achieve a synergistic effect, overcoming the shortcomings of single antivirus engines such as false positives or false negatives. Furthermore, using automatically constructed detection rules can improve detection efficiency, reduce resource consumption, and decrease the cost of manually writing rules. Automated detection rules can address the inability of traditional model-based detection methods to correct false positives; they can also quickly modify detection rules for false positives or false negatives, enabling rapid deployment. Moreover, automated detection rules have excellent interpretability, overcoming the slow iteration and lack of interpretability inherent in traditional model-based detection methods.

[0035] It should be noted that, Figure 1 The application scenario shown is merely an exemplary scenario, and the embodiments of this application do not limit the application scenarios. The embodiments of this application do not... Figure 1 The included equipment is not limited, nor is it restricted. Figure 1 The positional relationships between the devices are defined.

[0036] Furthermore, the antivirus engine can be either hardware or software. When the antivirus engine is hardware, it can be, for example, a mobile phone, tablet computer, desktop computer, wearable smart device, or smart home device. When the antivirus engine is software, it can be installed on the aforementioned hardware devices. In this case, the antivirus engine can be, for example, multiple software modules or a single software module; this application embodiment is not limited in this regard. The cloud server can also be hardware or software. When the cloud server is hardware, it can be a single server or a distributed server cluster composed of multiple servers. When the cloud server is software, it can be multiple software modules or a single software module; this application embodiment is not limited in this regard.

[0037] The technical solutions provided by the various embodiments of this application are described in detail below with reference to the accompanying drawings.

[0038] Figure 2 This is a flowchart illustrating a detection rule determination method provided in an embodiment of this application. The method can be executed by a detection rule determination device, which can consist of software and / or hardware, and is generally configured in various electronic devices such as cloud servers.

[0039] See Figure 2 The method may include the following steps:

[0040] 201. Use the first sample file set to train the model and obtain the first decision tree.

[0041] 202. The model is trained using the second sample file sets corresponding to each of the multiple virus types to obtain the second decision trees corresponding to each of the multiple virus types.

[0042] 203. Determine the malicious binary file detection rules based on the first decision tree.

[0043] 204. Based on the second decision tree corresponding to each of the multiple virus types, determine the virus type detection rules corresponding to each of the multiple virus types.

[0044] In this embodiment, both a decision tree capable of detecting malicious binary files and a decision tree capable of detecting the virus type of malicious binary files need to be trained. For ease of understanding and distinction, the decision tree capable of detecting malicious binary files is referred to as the first decision tree, and the decision tree capable of detecting the virus type of malicious binary files is referred to as the second decision tree. There may be multiple second decision trees, with different virus types corresponding to different second decision trees. Each second decision tree is used to determine whether the virus type of the binary file to be detected is a virus type that the second decision tree can recognize.

[0045] In this embodiment, the binary file used during the model training phase is referred to as the sample binary file. See also Figure 2 During the rule generation phase, it is necessary to collect a massive amount of sample binary files. These sample binary files have already undergone virus detection using multiple antivirus engines. First, the virus detection results from these multiple antivirus engines are collected. The virus detection results output by any antivirus engine include, but are not limited to, virus name strings and virus types. For any given sample binary file, let's assume the virus name strings output by n antivirus engines are denoted as s1, s2, s3…sn, etc.

[0046] Next, the sample binary files are manually or automatically labeled, for example, by labeling the virus type and maliciousness score corresponding to the sample binary files. The maliciousness score reflects the degree of security risk posed by the sample binary files. The higher the maliciousness score, the higher the degree of security risk. The value range of the maliciousness score is, for example, [0, 100].

[0047] When labeling the virus type of a sample binary file, the labeling can be based on a combination of virus types output by various antivirus engines. For example, among the virus types output by various antivirus engines, the most frequently occurring virus type can be selected as the final virus type for the sample binary file. Alternatively, the virus type with the highest malicious score can be selected as the final virus type. Another example is that, as needed, any virus type from the most frequently occurring virus types output by various antivirus engines can be randomly selected as the final virus type. Yet another example is that, among the virus types output by various antivirus engines, the virus type output by the antivirus engine with the best detection performance can be selected as the final virus type. Finally, combining expert experience, any virus type from the virus types output by various antivirus engines can be randomly selected as the final virus type for the sample binary file; there are no restrictions on this.

[0048] Next, after labeling the virus type and malware score of the sample binary files, the sample binary files are processed. The processed sample data includes, but is not limited to: file identifiers, virus name strings output by multiple antivirus engines, labeled virus types, and labeled malware scores. Among them, file identifiers are used to identify the uniqueness of sample binary files, and include, but are not limited to: filename, random number, timestamp, or file MD5 (Message Digest Algorithm 5), etc.

[0049] In practical applications, sample data from sample binary files can also be encapsulated using on-demand defined data formats. For example, the data format of sample binary file data is: [file MD5:s1, s2, s3...sn|virus type|malicious score]. Here, | is the separator. Based on the above data format, the compiled sample data of the sample binary file can include the following information: file MD5, the virus name strings of the sample binary file output by n antivirus engines, the labeled virus type, and the malicious score, etc.

[0050] In this embodiment, sample data from a massive number of sample binary files is collected to construct an initial sample file set. The sample data from the sample binary files in the initial sample file set includes one or more of the following: file identifier, concatenated virus name string, virus type, and malware score. The concatenated virus name string is obtained by concatenating multiple virus name strings from the sample binary files. Let S be the concatenated virus name string, where S is {S:s1+s2+s3……+sn}. In practical applications, the order in which virus name strings output by multiple antivirus engines participate in the concatenation can be set, and the multiple virus name strings are concatenated sequentially according to this order.

[0051] In this embodiment, a sample file set for training the first decision tree can be obtained from the initial sample file set. For ease of distinction and understanding, the sample file set used to train the first decision tree is referred to as the first sample file set. The sample data of the sample binary files in the first sample file set includes at least: a concatenated virus name string and a malicious result label indicating whether it is a malicious binary file, but is not limited to this. It is worth noting that when training the first decision tree with the goal of determining whether the binary file to be detected is a malicious binary file, the sample binary files in the first sample file set with malicious result labels indicating malicious binary files are considered positive samples (also known as black samples), and the sample binary files in the first sample file set with malicious result labels indicating that they are not malicious binary files are considered negative samples (also known as white samples).

[0052] Further, optionally, to improve the accuracy of identifying malicious binary files in the first decision tree, a score threshold can be flexibly set as needed, for example, 80 points. Binary files in the initial sample file set with a malicious score greater than or equal to the score threshold are classified as binary files with malicious result labels indicating they are malicious; binary files in the initial sample file set with a malicious score less than the score threshold are classified as binary files with malicious result labels indicating they are not malicious.

[0053] In this embodiment, a sample file set for training the second decision tree can be obtained from the initial sample file set. For ease of understanding and distinction, the sample file set used to train the second decision tree is referred to as the second sample file set. The sample data of the sample binary files in the second sample file set includes at least: a concatenated virus name string and a virus type label indicating the virus type, but is not limited to this.

[0054] It is worth noting that different virus types require accurately corresponding second sample file sets. That is, multiple second sample file sets need to be prepared for multiple virus types. For example, taking multiple virus types such as backdoor programs, high-risk programs, and Trojan programs as examples, the sample binary files in the second sample file set for backdoor programs will have a backdoor program tag; the sample binary files in the second sample file set for high-risk programs will have a high-risk program tag; and the sample binary files in the second sample file set for Trojan programs will have a Trojan program tag.

[0055] It is worth noting that, with the goal of identifying the virus type of the binary file to be detected, a second decision tree is trained for any target virus type among multiple virus types. Sample binary files from the second sample file set corresponding to the target virus type are used as positive samples, and sample binary files from the second sample file set corresponding to other virus types are used as negative samples. Other virus types refer to virus types other than the target virus type among the multiple virus types. For example, when training the second decision tree for a backdoor program, the sample binary file for the backdoor program is a positive sample, and the sample binary files for other virus types are negative samples. Other virus types include, but are not limited to, high-risk programs, Trojan programs, hacking tools, infectious viruses, ransomware, mining programs, and proxy tools.

[0056] Further, optionally, to improve the efficiency of sample construction, sample binary files with malicious result tags indicating malicious binary files in the first sample file set can be classified to obtain second sample file sets for multiple virus types.

[0057] In practical applications, different malicious binary files may have the same concatenated virus name string S. If the malicious scores corresponding to the concatenated virus name string S are different, it can lead to ambiguity. For example, when the same concatenated virus name string S corresponds to two malicious scores G1 and G2, where G1 = 90 and G2 = 60, the sample binary files corresponding to the same concatenated virus name string S will be assigned to the first sample file set and the second sample file set. For instance, a sample binary file with G1 = 60 corresponding to the same concatenated virus name string S will be assigned to the first sample file set, while a sample binary file with G1 = 90 corresponding to the same concatenated virus name string S will be assigned to the second sample file set. This is unreasonable and needs to be corrected.

[0058] Based on this, further optional information can be found here. Figure 3 Before obtaining the first sample file set from the initial sample file set, ambiguous data correction can be performed. As an example, it can be determined whether the same concatenated virus name string in the initial sample file set has multiple malicious scores. If the same concatenated virus name string in the initial sample file set has multiple malicious scores, the sample count corresponding to each malicious score is obtained. Based on the sample count corresponding to each malicious score, the malicious scores of the sample binary files with the same concatenated virus name string in the initial sample file set are corrected. For example, the malicious score with the largest number of samples is determined as the final malicious score of the sample binary files with the same concatenated virus name string. Alternatively, any malicious score from the malicious score with the largest number of samples can be randomly selected as the final malicious score of the sample binary files with the same concatenated virus name string; there are no restrictions on this.

[0059] For example, the same concatenated virus name string S corresponds to two malicious scores G1 and G2, where G1 = 90 and G2 = 60. In the initial sample file set, there are 10 sample binary files with G1 = 90 and 30 sample binary files with G2 = 60. Therefore, the malicious score of the same concatenated virus name string S is corrected to G2 = 60.

[0060] In practical applications, different malicious binary files may correspond to the same concatenated virus name string S. If the concatenated virus name string S corresponds to different virus types, it can lead to ambiguity. For example, when the same concatenated virus name string S corresponds to two virus types—a mining program and a ransomware program—the sample binary files corresponding to the same concatenated virus name string S will be assigned to a third set of sample files for different virus types. For instance, a sample binary file of a mining program with the same concatenated virus name string S will be assigned to the mining program sample file set, and a sample binary file of a ransomware program with the same concatenated virus name string S will be assigned to the ransomware sample file set. This situation is unreasonable and needs to be corrected.

[0061] Based on this, before obtaining the second set of sample files, it can be determined whether the same concatenated virus name string in the initial set of sample files has multiple virus types. If the same concatenated virus name string in the initial set of sample files has multiple virus types, the number of samples corresponding to each virus type is obtained. Based on the number of samples corresponding to each virus type, the virus type of the sample binary files with the same concatenated virus name string in the initial set of sample files is corrected. For example, the virus type with the most samples is determined as the final virus type of the sample binary files with the same concatenated virus name string. Alternatively, any virus type can be randomly selected from the virus type with the most samples to determine the final virus type of the sample binary files with the same concatenated virus name string; there are no restrictions on this.

[0062] See Figure 3 As shown, the model is trained using the first set of mined sample files to obtain the first decision tree. As an optional implementation, when training the first decision tree, a first word segmentation lexicon is constructed based on multiple concatenated virus name strings obtained from the first sample file set; for any sample binary file in the first sample file set, the concatenated virus name strings of the sample binary files are segmented; the word segmentation results of the sample binary files are vectorized using the first word segmentation lexicon to obtain the word vector sequences of the sample binary files; and the model is trained using the word vector sequences of multiple sample binary files and their malicious result labels to obtain the first decision tree.

[0063] Specifically, a large number of concatenated virus name strings are extracted from the first sample file set. Each virus name string sequence in the multiple virus name string sequences is then segmented to obtain multiple word segments (also known as virus name terms). A dictionary is constructed based on these multiple word segments to obtain the first segmented word dictionary. Optionally, to improve the segmentation effect, segmentation based on the N-Gram algorithm (also known as the N-gram model) can be performed during the segmentation process. The N-Gram algorithm is a word-level window word extraction algorithm.

[0064] The first word segmentation dictionary is used to vectorize the concatenated virus name string from the sample binary file. The length of the vector is the length of the first word segmentation dictionary. During vectorization, if the concatenated virus name string contains a word from the first word segmentation dictionary, the word vector at the corresponding character position in the concatenated virus name string is 1; otherwise, it is 0. For example, if the concatenated virus name string S is Win32 / Rozena.AUW, and its word segments are Win32, Rozena, and AUW, and the first word segmentation dictionary is (Win32, Rozena, AUW, TTT, TTT1, TTT2), the word vector sequence corresponding to S is [1,1,1,0,0,0]. For more information on using the dictionary to vectorize strings, please refer to the One-Hot encoding method, which will not be elaborated here.

[0065] During model training, word vector sequences from multiple sample binary files and their malicious result labels are used to train the model, resulting in the first decision tree. Each sample binary file has a word vector sequence, which can also be understood as a feature sequence. A value of 1 in the word vector sequence indicates that the corresponding word exists in the word segmentation dictionary, i.e., the feature (word) exists. A value of 0 in the word vector sequence indicates that the corresponding word does not exist in the word segmentation dictionary, i.e., the feature does not exist. The word vector sequences from all sample binary files are fed into the decision tree model for training. The decision tree is trained according to the decision tree decision logic, which is described above. For more details, please refer to existing technologies. For example, by analyzing the word vector sequence of each sample binary file, the splitting index (such as information entropy, Gini index, etc.) of each feature relative to the entire sample binary file is calculated. The best feature is selected as the splitting node of the tree branch, and this process is repeated until the entire decision tree is constructed.

[0066] In this embodiment, the first decision tree can be considered a binary classification model, that is, distinguishing whether the binary file to be detected is a malicious binary file. See also Figure 3 The root node and internal nodes of the first decision tree correspond to a virus name, and the leaf nodes correspond to malicious labels indicating malicious binary files or non-malicious labels indicating non-malicious binary files, that is, binary classification of binary files.

[0067] See Figure 3 As shown, the model is also trained using the second sample file set corresponding to each virus type mined out, and the second decision tree corresponding to each virus type is obtained.

[0068] In practical applications, a second word segmentation lexicon can be constructed by obtaining multiple concatenated virus name strings from a second sample file set containing all or some virus types. Each virus name string sequence within these sequences is then segmented to obtain multiple words. A lexicon is then built based on these segmented words to obtain the second word segmentation lexicon. The method for constructing the second word segmentation lexicon is similar to that of the first word segmentation lexicon, and there are no restrictions on its construction.

[0069] In training a second decision tree for any target virus type among multiple virus types, sample binary files from the second sample file set corresponding to the target virus type are used as positive samples, and sample binary files from the second sample file set corresponding to other virus types are used as negative samples. For any sample binary file in the positive or negative samples, the concatenated virus name string of the sample binary file is segmented; the segmentation results from the second segmentation dictionary are vectorized to obtain the word vector sequence of the sample binary file; the word vector sequences of multiple sample binary files and their malicious type labels are used to train the model to obtain the second decision tree. It is worth noting that the trained second decision tree for the target virus type is a binary classification model, which can determine whether the virus type of the malicious binary file is the target virus type or another virus type. Other virus types are not the target virus type. Since multiple virus types construct corresponding second decision trees, multiple second decision trees form a multi-classification model. See also Figure 3 For example, the second decision tree for a backdoor program classifies whether the virus type of a malicious binary file is a backdoor program. If the virus type of the malicious binary file is not a backdoor program, the second decision tree for the backdoor program outputs the identification result of other programs. If the virus type of the malicious binary file is a backdoor program, the second decision tree for the backdoor program outputs the identification result of a backdoor program. Similarly, the second decision tree for a Trojan program classifies whether the virus type of a malicious binary file is a Trojan program. If the virus type of the malicious binary file is not a Trojan program, the second decision tree for the Trojan program outputs the identification result of other programs. If the virus type of the malicious binary file is a Trojan program, the second decision tree for the Trojan program outputs the identification result of a Trojan program.

[0070] In this embodiment, after obtaining a first decision tree capable of determining whether a binary file to be detected is a malicious binary file and multiple second decision trees for determining the virus type to which the binary file to be detected belongs, see [link to documentation]. Figure 3 Then, it can enter the automated rule generation stage.

[0071] Specifically, a decision tree is a collection of decision rules. Each leaf node in a decision tree corresponds to a decision rule, and the number of decision rules is the same as the number of leaf nodes. Each decision rule is a detection rule for whether a decision has the corresponding decision result of a leaf node.

[0072] In this embodiment, the paths from the root node to each leaf node in the first decision tree are traversed to obtain the decision rules corresponding to each path. The decision rules corresponding to each path are combined to obtain the malicious binary file detection rules used to determine whether the binary file to be detected is a malicious binary file.

[0073] Optionally, to obtain a more superior malicious binary file detection rule, when determining the malicious binary file detection rule based on the first decision tree, the classification accuracy of the leaf nodes in the first decision tree can be judged to meet the specified conditions; the first decision tree also includes the root node; if the specified conditions are met, the regular expression corresponding to the leaf node is determined based on the sub-regular expressions of multiple branches on the path from the root node to the leaf node; the malicious binary file detection rule is obtained by combining the regular expressions corresponding to at least one leaf node in the first decision tree.

[0074] Specifically, the classification accuracy of a leaf node reflects the correct classification of all samples (including positive and negative samples) used in training the first decision tree under the malicious result label corresponding to that leaf node. The specified conditions can be flexibly set according to actual application needs; for example, a specified condition could be a classification accuracy of 100%. If all positive and all negative samples are correctly classified under the malicious result label corresponding to that leaf node (i.e., correctly classified), the classification accuracy of the leaf node is 100%, and the classification accuracy of the leaf node meets the specified condition. If some positive or negative samples are misclassified under the malicious result label corresponding to that leaf node, the classification accuracy of the leaf node is below 100%, and the classification accuracy of the leaf node does not meet the specified condition.

[0075] In this embodiment, if the classification accuracy of a leaf node does not meet the specified conditions, the decision rule corresponding to that leaf node is discarded. If the classification accuracy of a leaf node meets the specified conditions, the decision rule corresponding to that leaf node can be selected as part of the malicious binary file detection rule.

[0076] In this embodiment, if the classification accuracy of a leaf node meets a specified condition, the regular expression corresponding to the leaf node is determined based on the sub-regular expressions of multiple branches on the path from the root node to the leaf node; the regular expressions corresponding to at least one leaf node in the first decision tree are combined to obtain the malicious binary file detection rule.

[0077] In this embodiment, a sub-regular expression can be understood as an expression included in a regular expression. The sub-regular expression indicates whether the virus name term corresponding to the target node connected to the branch is matched. The target node is the higher-level node among the two nodes connected by the branch. Assuming the virus name term is denoted as "feature," the sub-regular expression `(?=feature)` indicates a match with the virus name term; `(?!feature)` indicates a mismatch. Starting from the root node, the sub-regular expressions of multiple branches on the path from the root node to the leaf node are combined sequentially to obtain the regular expression corresponding to the leaf node. For example, the regular expression corresponding to a leaf node is `(?=(?!.*?SSHDoor))(?=(?!.*?RedXor))(?=(?!.*?Ladvix))`. Here, `(?=(?!.*?SSHDoor))`, `(?=(?!.*?RedXor))`, and `(?=(?!.*?Ladvix))` are respectively the sub-regular expressions corresponding to a branch. The meaning of (?=(?!.*?SSHDoor))(?=(?!.*?RedXor))(?=(?!.*?Ladvix)) is: match a string of concatenated virus names. This string must not contain the three strings "SSHDoor", "RedXor" and "Ladvix" at the same time, otherwise it will not match successfully.

[0078] In practical applications, one or more leaf nodes in the first decision tree may have classification accuracy that meets a specified condition. Therefore, the regular expressions of one or more leaf nodes can be combined to obtain malicious binary file detection rules, thereby expanding the application scope of these rules and enabling virus detection of more types of binary files. It is understandable that each regular expression in the combined malicious binary file detection rules is an independent decision rule.

[0079] When combining multiple leaf nodes in a regular expression, the delimiter | can be used for combination. For example, the malicious binary file detection rule is (?=(?=.*?Mimikatz)(?=(?!.*?eset)|(?=(?=.*?eset)(?=.*?cpqbz)))).

[0080] In this embodiment, for any target virus type among multiple virus types, a second decision tree is used to determine the corresponding virus type detection rule for the target virus type.

[0081] In this embodiment, the paths from the root node to each leaf node in the second decision tree are traversed to obtain the decision rules corresponding to each path. The decision rules corresponding to each path are combined to obtain the virus type detection rules used to determine whether a malicious binary file has the target virus type.

[0082] Optionally, to obtain more effective virus type detection rules, when determining the virus type detection rules based on the second decision tree, the classification accuracy of the leaf nodes in the second decision tree can be checked to see if it meets specified conditions. The second decision tree also includes a root node. If the specified conditions are met, the regular expression corresponding to the leaf node is determined based on the sub-regular expressions of multiple branches on the path from the root node to the leaf node. By combining the regular expressions corresponding to at least one leaf node in the second decision tree, the virus type detection rule for the target virus type is obtained. The working principle of traversing the second decision tree to obtain the virus type detection rule is the same as that of traversing the first decision tree to obtain the malicious binary file detection rule, and will not be elaborated here.

[0083] Optionally, it also supports modifying malicious binary file detection rules or virus type detection rules. For example, after malicious binary file detection rules or virus type detection rules are deployed, the deployment results can be analyzed to determine if there are any false positives or false negatives in the virus detection results. If there are false positives or false negatives, the detection rules can be quickly modified and re-deployed.

[0084] The detection rule determination method provided in this application trains a first decision tree with malicious binary file detection capabilities and a second decision tree with malicious binary file virus type detection capabilities. It then automatically generates various decision rules, including malicious binary file detection rules and virus type detection rules, based on tree traversal. Since the sample binary files used in the decision tree training incorporate virus detection results from multiple antivirus engines, the generated detection rules can perform correlation analysis on the virus name strings output by multiple antivirus engines to determine whether the binary file to be detected is malicious and to identify the virus type. Compared to a single antivirus engine, integrating the detection capabilities of multiple antivirus engines can cover the detection of more types of binary files with viruses. By using multiple antivirus engines in a joint decision-making process, the detection advantages of a single antivirus engine can be leveraged to improve the overall virus detection capability, and their strengths and weaknesses can be complemented to achieve an enhanced effect, thus solving the shortcomings of a single antivirus engine, such as false positives or false negatives.

[0085] Furthermore, utilizing automatically constructed detection rules can improve detection efficiency, reduce resource consumption, and decrease the cost of manually writing rules. Automated detection rules can address the inability of traditional model-based detection methods to correct false positives; they also allow for rapid modification of detection rules to address false positives or missed positives, enabling quick deployment. Moreover, automatically constructed detection rules possess excellent interpretability, overcoming the shortcomings of traditional model-based detection methods such as slow iteration and lack of interpretability.

[0086] In practical applications, after obtaining various decision rules such as malicious binary file detection rules and virus type detection rules, these decision rules can be used to detect malicious binary files. Therefore, this application also provides a method for detecting malicious binary files based on detection rules.

[0087] Figure 4 This is a flowchart illustrating a method for detecting malicious binary files provided in an embodiment of this application. This method can be executed by a malicious binary file detection device, which can consist of software and / or hardware, and is generally configured in various electronic devices such as cloud servers. See also... Figure 4 The method may include the following steps:

[0088] 401. Obtain the binary file to be tested.

[0089] 402. Use multiple antivirus engines to perform virus detection on the binary file to be detected, and obtain multiple virus name strings.

[0090] 403. Concatenate multiple virus name strings to obtain the target virus name string.

[0091] 404. Use malicious binary file detection rules to detect the target virus name string to determine whether the binary file to be detected is a malicious binary file.

[0092] 405. When the binary file to be detected is a malicious binary file, use the virus type detection rules corresponding to multiple virus types to perform virus type detection on the target virus name string in order to determine the virus type of the binary file to be detected.

[0093] For details on the rules for detecting malicious binary files and the methods for determining the virus type detection rules corresponding to each of the multiple virus types, please refer to the relevant descriptions in the foregoing embodiments, which will not be repeated here.

[0094] In this embodiment, the binary file to be detected refers to the binary file that needs to be detected for virus testing. First, multiple antivirus engines are used to perform virus detection on the binary file to be detected, and the virus detection results output by these engines are collected. Multiple virus name strings are extracted from these results. Next, the extracted virus name strings are concatenated to obtain the concatenated virus name string corresponding to the binary file to be detected; this concatenated virus name string is referred to as the target virus name string. Then, since the malicious binary file detection rule is a regular expression, the target virus name string is matched against the malicious binary file detection rule to determine whether the binary file to be detected is malicious. Next, if it is determined that the binary file to be detected is not malicious, a message indicating that the file is not malicious is output. If it is determined that the binary file to be detected is malicious, the target virus name string is matched against the virus type detection rules for each virus type, and the final virus type of the binary file is determined based on the regular expression matching results. Taking the examples of backdoor programs and Trojan programs as different virus types, the regular expression matching result for a backdoor program is "not matched," indicating that the virus type of the file to be detected is another program (i.e., not a backdoor program). The regular expression matching result for a Trojan program is "matched," indicating that the virus type of the file to be detected is a Trojan program. Of course, if the malicious binary file detection rules cannot be matched, that is, if all regular expression matching results indicate another program, the default output can be "suspicious program" as the virus type.

[0095] The malicious binary file detection method provided in this application, compared to a single antivirus engine, integrates the detection capabilities of multiple antivirus engines, enabling it to cover the detection of more types of virus-laden binary files. By leveraging the combined decision-making of multiple antivirus engines, the overall virus detection capability can be enhanced by utilizing the strengths of individual engines, and their complementary advantages and disadvantages can achieve a synergistic effect, overcoming the shortcomings of single antivirus engines such as false positives or false negatives. Furthermore, utilizing automatically constructed detection rules improves detection efficiency, reduces resource consumption, and minimizes the cost of manually writing rules. Automatedly constructed detection rules can address the inability of traditional model-based detection methods to correct false positives; they also allow for rapid modification and deployment of rules to address false positives or false negatives. Moreover, automatically constructed detection rules possess excellent interpretability, overcoming the shortcomings of traditional model-based detection methods such as slow iteration and lack of interpretability.

[0096] Globally, an average of four new malware programs are created every second, and these rapidly mutating programs have a significant impact on daily life. To enhance the ability to detect malware mutations, a thorough understanding of these malware programs is essential. Therefore, accurately identifying suspicious malware in advance will help security companies archive different families of malware and assist security analysts in further analyzing malicious behavior and patching vulnerabilities.

[0097] In practical applications, the detection results of various antivirus engines are in different formats, and each antivirus engine defines virus names and types differently, which makes it impossible to accurately identify the malicious family information of malware.

[0098] Therefore, in some optional embodiments, a virus name knowledge graph can be constructed based on the virus detection results of multiple antivirus engines on malicious binary files corresponding to massive amounts of malware. This allows for the accurate identification of malicious family information of malware using the virus name knowledge graph.

[0099] Based on the above, optionally, the file identifiers and virus name strings of multiple malicious binary files are analyzed to obtain analysis results. The analysis results include multiple file identifier entities, multiple virus name word entities, the relationship between file identifier entities and virus name word entities, and the relationship between virus name word entities; a virus name knowledge graph is constructed based on the analysis results.

[0100] In practical applications, it is possible to collect massive amounts of virus detection results output by multiple antivirus engines, analyze these massive amounts of virus detection results, and obtain file identifiers and virus name strings for multiple malicious binary files.

[0101] In this embodiment, the entities in the virus name knowledge graph include: virus name term entities and file identifier entities. In practical applications, virus name term entities and file identifier entities can be extracted from massive virus detection results based on NLP (Natural Language Processing) technology.

[0102] When performing entity extraction, the core logic is to extract useful information. The number of entities extracted should be appropriate; too many will negatively impact knowledge graph construction and search. One or more of the following strategies can be used for entity extraction:

[0103] (1) Segmenting words (i.e., tokens) based on punctuation marks.

[0104] (2) All tokens should be lowercase.

[0105] (3) Filter out meaningless tokens based on length or algorithm.

[0106] (4) Filter tokens that represent specific information, such as numbers or hash values.

[0107] (5) Tokens ending with three or more digits are considered to contain sample information and such tokens are removed.

[0108] In this embodiment, the relationship type between two virus name term entities can be determined based on the conditional probability between them. Assuming any two virus name term entities are denoted as A and B, the relationship between them can be defined in the following five categories:

[0109] (1) A = B, that is, entity A and instance B are equal. When the conditional probability P(B|A)>0.9 and the conditional probability P(A|B)>0.9 occur, the relationship between entity A and instance B is: A = B.

[0110] (2) A≠B, that is, entity A and instance B are not equal. When the conditional probability P(B|A<0.1) and the conditional probability P(A|B)<0.1 occur, the relationship between entity A and instance B is: A≠B.

[0111] (3) That is, B is a subset of A. When the conditional probability P(B|A) < 0.9 and the conditional probability P(A|B) > 0.9 occurs, the association between entity A and instance B is as follows:

[0112] (4) That is, A is a subset of B. When the conditional probability P(B|A) > 0.9 and the conditional probability P(A|B) < 0.9 occurs, the association between entity A and instance B is as follows:

[0113] (5) Weak dependency relationship.

[0114] It is worth noting that P(B|A) refers to the probability that entity B will appear given that entity A has already appeared. P(A|B) refers to the probability that entity A will appear given that entity B has already appeared.

[0115] In this embodiment, the massive number of virus name strings collected are analyzed, and the word entities of each virus name are extracted from the massive number of virus name strings. The occurrence frequency of each word entity of a virus name is counted, as well as the occurrence frequency of two pairs of word entities of virus names appearing in the same virus name string at the same time.

[0116] As an example, P(B|A)=(C A∩B ) / C A C A∩BThis indicates the number of times entity A and entity B appear simultaneously in the same virus name string, C. A This represents the number of times entity A appears, or C. A∩B With C A The ratio of B to A is used as the conditional probability P(B|A).

[0117] In this embodiment, the association between the file identifier entity and the virus name term entity is a hierarchical relationship. The hierarchical relationship indicates that the virus name term entity is the entity corresponding to the word appearing in the virus name string corresponding to the file identifier entity.

[0118] In this embodiment, after constructing the virus name knowledge graph, virus family information inference can be performed using the virus name knowledge graph. Specifically, for the binary file to be detected, multiple antivirus engines are first used to perform virus detection on the binary file to be detected, obtaining multiple virus name strings. Next, multiple virus name word entities are extracted from the multiple virus name strings. Then, the multiple virus name word entities are input into the virus name knowledge graph for inference to obtain the family name of the binary file to be detected.

[0119] When performing family name reasoning, the virus name knowledge graph first determines the priority scores of multiple virus name word entities corresponding to the binary file to be detected. Then, it selects several virus name word entities as the family name of the binary file to be detected based on their priority scores. For example, it selects the virus name word entity with the highest priority score as the family name of the binary file to be detected. Alternatively, it sorts the multiple virus name word entities in descending order of priority score and selects several virus name word entities from the top-ranked entities as the family name of the binary file to be detected; there are no restrictions on this process.

[0120] In practical applications, when determining the priority score of each virus name term entity, it can be determined based on one or more of the weight information, importance, and generality of the virus name term entity, without any restrictions.

[0121] In this embodiment, the weight information of virus name word entities represents the frequency of virus name word entities appearing in multiple virus name strings in the binary file to be detected. This can be represented by the number of virus name word entities extracted from the multiple virus name strings in the binary file to be detected. Assuming the i-th virus name word entity among the multiple virus name word entities is denoted as token_i, where i is a positive integer, the weight information of the i-th virus name word entity is denoted as Wi, Wi = log(b × Tni), where Tni refers to the number of token_i extracted from the multiple virus name strings in the binary file to be detected; b is an empirical value set as needed, for example, b = 1.8. The smaller b is, the greater the impact of the number of token_i on the weight information; log represents the logarithmic sign.

[0122] In this embodiment, the importance of virus name term entities represents the range in which these entities appear across multiple virus name strings in the binary file to be detected. This importance can be represented by the number of virus name term entities included in the virus name knowledge graph and the number of files containing these entities. Let Ii denote the importance of the i-th virus name term entity, token_i. Ii = Tci / Tfi, where Tci is the number of token_i entities in the virus name knowledge graph, and Tfi is the number of files containing token_i in the virus name knowledge graph. It is understood that the number of files containing token_i in the virus name knowledge graph can be determined by the association between file identifier entities and virus name term entities in the virus name knowledge graph.

[0123] In this embodiment, the generality of virus name term entities represents the probability that a virus name term entity is selected as a family name. Let the generality of the i-th virus name term entity token_i be denoted as Gi, where Gi = Tsi / (N×C), where Tsi is the number of subsets of token_i in the virus name knowledge graph, N is the total number of virus name term entities in the virus name knowledge graph, C is a constant set as needed, and × represents a multiplication sign. That is, the ratio of Tsi to (N×C) is taken as Gi.

[0124] This embodiment does not restrict the method for determining the priority score of each virus name word entity. For example, suppose the priority score of the i-th virus name word entity is denoted as Tpi. Tpi = Wi + Ii - Gi, that is, the sum of Wi and Ii minus Gi is obtained as Tpi.

[0125] In this embodiment, a method for constructing a knowledge graph of virus names for malicious files is proposed, and family name information is derived using unsupervised graph probabilistic reasoning. Based on unsupervised implementation, no pre-provided labeled dataset is required. No expert knowledge (virus type, virus family, virus name collection, virus format, etc.) is needed; standardized family names can be automatically identified and generated based on a cold start without expert knowledge.

[0126] In this embodiment, virus detection results from multiple antivirus engines are used as input data to generate a virus name knowledge graph representing the relationships between entities. This method can extract virus family names without any prior knowledge.

[0127] In this embodiment, the relationships between entities in virus name terms are determined through a virus name knowledge graph, eliminating the need to use specific or common words, so that virus name terms can be better selected to represent the family name of each malicious binary file.

[0128] In this embodiment, without using an alias table or dataset containing prior knowledge, more commonly used family names are found based on the frequency or scope of use of each token in multiple antivirus engines, thus achieving fully automatic tagging and reducing operation and maintenance costs.

[0129] To better understand family name recognition, the following will combine... Figure 5 The scene diagram shown is used for illustration.

[0130] See Figure 5 In the virus name knowledge graph construction phase, massive amounts of binary files are input into a multi-engine platform for virus detection. The multi-engine results information is then extracted, including the virus detection results for each binary file, which include the virus name string and file identifier. Entities and relationships between entities are extracted from the multi-engine results information, resulting in multiple file identifier entities, multiple virus name term entities, the relationships between file identifier entities and virus name term entities, and the relationships between virus name term entities themselves. A virus name knowledge graph is then constructed based on the extracted entities and their relationships.

[0131] For a specific example, firstly, malicious files mal_1 and mal_2 are input into a multi-engine platform (including antivirus engine A and antivirus engine B). For the malicious file mal_1, antivirus engine A detects a_s_1 = "PUP / Win32.DownloadGuide.R25632", while antivirus engine B detects...

[0132] b_s_1 = "Application.Bundler.DownloadGuide.KF". For the malicious file mal_2, the detection result of antivirus engine A is a_s_2 = "Trojan / Win32.Nitol.V305621", and the detection result of antivirus engine B is b_s_1 = "Generic.ServStar.A.B3Cd2481".

[0133] Next, entity extraction is performed: For the malicious file mal_1, the virus name entity detected by antivirus engine A is [win32, downloadguide], and the virus name entity detected by antivirus engine B is [application, bundler, downloadguide]. For the malicious file mal_2, the virus name entity token detected by antivirus engine A is [trojan, win32, nitol], and the virus name entity detected by antivirus engine B is [generic, servstart]. Additionally, file identifier entities also need to be extracted.

[0134] Next, the relationships between entities are extracted. That is, the relationships between entities containing virus name terms and the relationships between file identifier entities and virus name term entities are extracted.

[0135] Finally, a virus name knowledge graph is constructed based on entities and the relationships between them.

[0136] See Figure 5 In the family name identification stage, the binary file to be detected is input into a multi-engine platform for virus detection, and the multi-engine result information output by the platform is extracted. The virus name term entities corresponding to the binary file to be detected are extracted from the multi-engine result information. The extracted virus name term entities are then input into a virus name knowledge graph for family name identification to obtain the family name corresponding to the binary file to be detected.

[0137] For a specific example, when the malicious file mal_3 of the family to be identified is input into a multi-engine platform, the detection result of antivirus engine A is a_s_3 = "PUP / Win32.DownloadGuide.R78sd9we", and the detection result of antivirus engine B is b_s_1 = "Application.Bundler.DownloadGuide.PTE".

[0138] The virus name knowledge graph is used to identify the family name. Specifically, the priority score of each virus name entity is calculated. For example, win32 has a priority score of -5, downloadguide has a priority score of 2, application has a priority score of -1, and bundler has a priority score of -1. Finally, the token with the highest score is taken as the family name, which is downloadguide.

[0139] Figure 6 This is a schematic diagram of a detection rule determination device provided in an embodiment of this application. See also... Figure 6 The device may include:

[0140] Training module 61 is used to train the model using the first sample file set to obtain the first decision tree; and to train the model using the second sample file sets corresponding to each of the multiple virus types to obtain the second decision trees corresponding to each of the multiple virus types.

[0141] The rule determination module 62 is used to determine the malicious binary file detection rules based on the first decision tree; and to determine the virus type detection rules corresponding to each of the multiple virus types based on the second decision trees corresponding to each of the multiple virus types.

[0142] The sample data of the sample binary files in the first sample file set includes: concatenated virus name strings and malicious result tags indicating whether the binary file is malicious. The concatenated virus name strings are obtained by concatenating multiple virus name strings, which are obtained by using multiple anti-virus engines to perform virus detection on the corresponding sample binary files. The sample data of the sample binary files in the second sample file set includes: concatenated virus name strings and virus type tags indicating the virus type.

[0143] Further optionally, the above apparatus further includes: an acquisition module configured to: acquire an initial sample file set, wherein the sample data of the sample binary files in the initial sample file set includes: a concatenated virus name string, a malicious score, and a virus type; acquire a first sample file set from the initial sample file set, wherein sample binary files in the first sample file set whose malicious score is greater than or equal to a score threshold have malicious result labels indicating that they are malicious binary files, and sample binary files in the first sample file set whose malicious score is less than a score threshold have malicious result labels indicating that they are not malicious binary files; classify the sample binary files in the first sample file set that have malicious result labels indicating that they are malicious binary files to obtain second sample file sets for each of multiple virus types.

[0144] Further optionally, before obtaining the first sample file set from the initial sample file set, the acquisition module is also used to: if the same concatenated virus name string in the initial sample file set has multiple malicious scores, then obtain the number of samples corresponding to each of the multiple malicious scores; and correct the malicious scores of sample binary files with the same concatenated virus name string in the initial sample file set according to the number of samples corresponding to each of the multiple malicious scores.

[0145] Optionally, the acquisition module is further configured to: if the same concatenated virus name string in the initial sample file set has multiple virus types, then acquire the number of samples corresponding to each of the multiple virus types; and, based on the number of samples corresponding to each of the multiple virus types, correct the virus type of the sample binary files with the same concatenated virus name string in the initial sample file set.

[0146] Further optionally, the training module 61 is specifically used for: constructing a first word segmentation lexicon based on multiple concatenated virus name strings obtained from the first sample file set; performing word segmentation on the concatenated virus name strings of any sample binary file in the first sample file set; vectorizing the word segmentation results of the sample binary file using the first word segmentation lexicon to obtain a word vector sequence of the sample binary file; and training the model using the word vector sequences of multiple sample binary files and their malicious result labels to obtain a first decision tree.

[0147] Further optionally, the rule determination module 62 is specifically used to: determine the malicious binary file detection rules based on the first decision tree, including: for the leaf nodes in the first decision tree, determining whether the classification accuracy of the leaf nodes meets the specified conditions, the first decision tree also includes the root node; if the specified conditions are met, then determining the regular expression corresponding to the leaf node based on the sub-regular expressions of multiple branches on the path from the root node to the leaf node; combining the regular expressions corresponding to at least one leaf node in the first decision tree to obtain the malicious binary file detection rules.

[0148] Figure 6 The device shown can perform Figure 2 The implementation principle and technical effects of the method shown will not be elaborated further. Regarding the above embodiments... Figure 6 The specific ways in which each module and unit of the device performs operations have been described in detail in the embodiments of the method, and will not be elaborated here.

[0149] Figure 7 This is a schematic diagram of a malicious binary file detection device provided in an embodiment of this application. See also... Figure 7 The device may include:

[0150] Module 71 is used to acquire the binary file to be detected;

[0151] The first detection module 72 is used to perform virus detection on the binary file to be detected using multiple anti-virus engines to obtain multiple virus name strings.

[0152] The concatenation module 73 is used to concatenate multiple virus name strings to obtain the target virus name string;

[0153] The second detection module 74 is used to detect the target virus name string using malicious binary file detection rules in order to determine whether the binary file to be detected is a malicious binary file.

[0154] The third detection module 75 is used to perform virus type detection on the target virus name string by using the virus type detection rules corresponding to multiple virus types when the binary file to be detected is a malicious binary file, so as to determine the virus type of the binary file to be detected.

[0155] The methods for determining the malicious binary file detection rules and the virus type detection rules corresponding to each of the multiple virus types can be found in the aforementioned content.

[0156] Further optionally, the above device also includes: a family name recognition module, used to extract multiple virus name word entities from multiple virus name strings; and input the multiple virus name word entities into a virus name knowledge graph for family name recognition.

[0157] Further optionally, the above device also includes: a graph construction module, used to analyze the file identifiers and virus name strings of multiple malicious binary files to obtain analysis results, including multiple file identifier entities, multiple virus name word entities, the relationship between file identifier entities and virus name word entities, and the relationship between virus name word entities; and to construct a virus name knowledge graph based on the analysis results.

[0158] Figure 7 The device shown can perform Figure 4 The implementation principle and technical effects of the method shown will not be elaborated further. Regarding the above embodiments... Figure 4 The specific ways in which each module and unit of the device performs operations have been described in detail in the embodiments of the method, and will not be elaborated here.

[0159] It should be noted that the execution subject of each step of the method provided in the above embodiments can be the same device, or the method can be executed by different devices. For example, the execution subject of steps 201 to 204 can be device A; or the execution subject of steps 201 and 202 can be device A, and the execution subject of steps 203 and 204 can be device B; and so on.

[0160] Furthermore, in some of the processes described in the above embodiments and accompanying drawings, multiple operations appear in a specific order. However, it should be clearly understood that these operations may not be executed in the order they appear herein, or they may be executed in parallel. The operation numbers, such as 201, 202, etc., are merely used to distinguish different operations and do not represent any execution order. Additionally, these processes may include more or fewer operations, and these operations may be executed sequentially or in parallel. It should be noted that the descriptions such as "first" and "second" in this document are used to distinguish different messages, devices, modules, etc., and do not represent a sequential order, nor do they limit "first" and "second" to different types.

[0161] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation portals are provided for users to choose to authorize or refuse.

[0162] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 8 As shown, the electronic device includes: a memory 81 and a processor 82;

[0163] Memory 81 is used to store computer programs and can be configured to store various other data to support operation on the computing platform. Examples of this data include instructions for any application or method operating on the computing platform, contact data, phone book data, messages, pictures, videos, etc.

[0164] The memory 81 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random-access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.

[0165] The processor 82, coupled to the memory 81, is used to execute the computer program in the memory 81 for steps in: a detection rule determination method or a malicious binary file detection method.

[0166] Furthermore, such as Figure 8 As shown, the electronic device also includes other components such as a communication component 83, a display 84, a power supply component 85, and an audio component 86. Figure 8 The diagram only shows some components and does not mean that the electronic device includes only these components. Figure 8 The components shown. Additionally... Figure 8 The components within the dashed box are optional, not mandatory, and their specific requirements depend on the product form of the electronic device. The electronic device in this embodiment can be a desktop computer, laptop computer, smartphone, or IoT (Internet of Things) device, or a server-side device such as a conventional server, cloud server, or server array. If the electronic device in this embodiment is a desktop computer, laptop computer, or smartphone, it may include... Figure 8 The components within the dashed box; if the electronic device in this embodiment is implemented as a conventional server, cloud server, or server array, etc., it may be omitted. Figure 8 The component within the dashed box.

[0167] For a detailed description of the implementation process of each action by the processor, please refer to the relevant descriptions in the foregoing method embodiments or device embodiments, which will not be repeated here.

[0168] Accordingly, embodiments of this application also provide a computer-readable storage medium storing a computer program, which, when executed, can implement the steps that can be performed by an electronic device in the above method embodiments.

[0169] Accordingly, this application also provides a computer program product, including a computer program / instructions, which, when executed by a processor, enables the processor to perform the steps that can be executed by an electronic device in the above method embodiments.

[0170] The aforementioned communication components are configured to facilitate wired or wireless communication between the device containing the communication components and other devices. The device containing the communication components can access wireless networks based on communication standards, such as WiFi (Wireless Fidelity), 2G (2nd Generation), 3G (3rd Generation), 4G (4th Generation) / LTE (long Term Evolution), 5G (5th Generation), or combinations thereof. In one exemplary embodiment, the communication components receive broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, the communication components also include a Near Field Communication (NFC) module to facilitate short-range communication. For example, the NFC module may be based on Radio Frequency Identification (RFID), Infrared Data Association (IrDA), Ultra Wide Band (UWB), Bluetooth, and other technologies.

[0171] The aforementioned display includes a screen, which may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a Touch Panel, the screen can be implemented as a touchscreen to receive input signals from the user. The Touch Panel includes one or more touch sensors to sense touches, swipes, and gestures on the Touch Panel. The touch sensors can sense not only the boundaries of touch or swipe actions but also the duration and pressure associated with the touch or swipe operation.

[0172] The aforementioned power supply components provide power to various components within the device in which they reside. These power supply components may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power to the device in which they reside.

[0173] The aforementioned audio component can be configured to output and / or input audio signals. For example, the audio component includes a microphone (MIC) configured to receive external audio signals when the device containing the audio component is in an operating mode, such as call mode, recording mode, or voice recognition mode. The received audio signals can be further stored in memory or transmitted via a communication component. In some embodiments, the audio component also includes a speaker for outputting audio signals.

[0174] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-readable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0175] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0176] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0177] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0178] In a typical configuration, a computing device includes one or more processors (Central Processing Unit, CPU), input / output interfaces, network interfaces, and memory.

[0179] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0180] Computer-readable media, including both permanent and non-permanent, removable and non-removable media, can store information using any method or technology. 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 RAM (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 technologies, CD-ROM, digital versatile disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transfer medium that can be used to store information accessible by a computing device. As defined in this article, computer-readable media do not include transient media, such as modulated data signals and carrier waves.

[0181] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0182] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

Claims

1. A method for determining detection rules, characterized in that, include: The first decision tree is obtained by training the model using the first sample file set; The model was trained using the second sample file sets corresponding to each of the multiple virus types to obtain the second decision trees corresponding to each of the multiple virus types. Based on the first decision tree, determine the rules for detecting malicious binary files; Based on the second decision tree corresponding to each of the multiple virus types, the virus type detection rules corresponding to each of the multiple virus types are determined respectively; The sample data of the sample binary files in the first sample file set includes: a concatenated virus name string and a malicious result label indicating whether it is a malicious binary file. The concatenated virus name string is obtained by concatenating multiple virus name strings, which are obtained by using multiple anti-virus engines to perform virus detection on the corresponding sample binary files. The sample data of the sample binary files in the second sample file set includes: a concatenated virus name string and a virus type label indicating the virus type.

2. The method according to claim 1, characterized in that, Before training the model using the first sample file set to obtain the first decision tree, the following steps are also included: Obtain an initial sample file set, wherein the sample data of the sample binary files in the initial sample file set includes: concatenated virus name string, malicious score and virus type; A first sample file set is obtained from the initial sample file set. Sample binary files in the first sample file set with a malicious score greater than or equal to a score threshold have malicious result tags indicating that they are malicious binary files. Sample binary files in the first sample file set with a malicious score less than the score threshold have malicious result tags indicating that they are not malicious binary files. The sample binary files in the first sample file set that have malicious result tags indicating malicious binary files are classified to obtain second sample file sets for each of the multiple virus types.

3. The method according to claim 2, characterized in that, Before obtaining the first sample file set from the initial sample file set, the process also includes: If the same concatenated virus name string in the initial sample file set has multiple malicious scores, then obtain the number of samples corresponding to each of the multiple malicious scores; Based on the number of samples corresponding to each of the multiple malicious scores, the malicious scores of sample binary files with the same concatenated virus name string in the initial sample file set are corrected.

4. The method according to claim 3, characterized in that, Also includes: If the same concatenated virus name string in the initial sample file set has multiple virus types, then obtain the number of samples corresponding to each of the multiple virus types. Based on the number of samples corresponding to each of the multiple virus types, the virus types of sample binary files with the same concatenated virus name string in the initial sample file set are corrected.

5. The method according to any one of claims 1 to 4, characterized in that, The model is trained using the first sample file set to obtain the first decision tree, including: A first word segmentation lexicon is constructed based on multiple concatenated virus name strings obtained from the first sample file set; For any sample binary file in the first sample file set, the concatenated virus name string of the sample binary file is segmented. The word segmentation results of the sample binary file are vectorized using the first word segmentation dictionary to obtain the word vector sequence of the sample binary file. The first decision tree is obtained by training a model using word vector sequences and malicious result labels from multiple sample binary files.

6. The method according to claim 1, characterized in that, Based on the first decision tree, malicious binary file detection rules are determined, including: For each leaf node in the first decision tree, it is determined whether the classification accuracy of the leaf node meets a specified condition. The first decision tree also includes a root node. If the specified conditions are met, the regular expression corresponding to the leaf node is determined based on the sub-regular expressions of multiple branches on the path from the root node to the leaf node. The malicious binary file detection rule is obtained by combining the regular expressions corresponding to at least one leaf node in the first decision tree.

7. A method for detecting malicious binary files, characterized in that, include: Obtain the binary file to be tested; The binary file to be detected is subjected to virus detection using multiple anti-virus engines, resulting in multiple virus name strings. The multiple virus name strings are concatenated to obtain the target virus name string; The target virus name string is detected using malicious binary file detection rules to determine whether the binary file to be detected is a malicious binary file; In the case where the binary file to be detected is a malicious binary file, the virus type detection rules corresponding to multiple virus types are used to perform virus type detection on the target virus name string in order to determine the virus type of the binary file to be detected. The malicious binary file detection rules and the virus type detection rules corresponding to each of the multiple virus types are determined according to the method described in any one of claims 1-6.

8. The method according to claim 7, characterized in that, Also includes: Extract multiple virus name word entities from the multiple virus name strings; Input the multiple virus name term entities into the virus name knowledge graph for family name identification.

9. The method according to claim 8, characterized in that, The virus name knowledge graph is constructed as follows: The file identifiers and virus name strings of multiple malicious binary files are analyzed to obtain analysis results. The analysis results include multiple file identifier entities, multiple virus name word entities, the relationship between file identifier entities and virus name word entities, and the relationship between virus name word entities. The virus name knowledge graph was constructed based on the analysis results.

10. An electronic device, characterized in that, include: Memory and processor; The memory is used to store computer programs; The processor is coupled to the memory for executing the computer program to perform the steps of the method according to any one of claims 1-9.

11. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it causes the processor to perform the steps of the method according to any one of claims 1-9.

Citation Information

Patent Citations

  • Virus detection method and related device

    CN110210218A

  • Malicious file detection method, device and equipment and readable storage medium

    CN114329462A