Malicious sample detection method, device, electronic device and storage medium

Through static analysis of the samples to be tested and the construction of an abnormal instruction rule base, combined with the machine learning model, the problem of malicious sample detection is solved, the detection efficiency and accuracy are improved, and the massive detection needs are met.

CN114117413BActive Publication Date: 2024-09-27HARBIN ANTIY TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111476731.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-06
Publication Date
2024-09-27
Estimated Expiration
2041-12-06

AI Technical Summary

Technical Problem

Existing malicious sample detection methods are difficult to effectively detect malicious samples. Feature-based detection is easy to be bypassed. Dynamic behavior-based detection has low performance and cannot cope with massive detection needs.

Method used

Through static analysis of the samples to be tested, all behavioral instructions are obtained and abnormal instructions are determined. Static vector extraction and disassembly technology are used to analyze the instruction types and parameters, an abnormal instruction rule base is constructed, and a machine learning model is used to determine whether the sample is a malicious sample.

Benefits of technology

It improves the efficiency and accuracy of malicious sample detection, solves the problem that feature-based detection is easy to be bypassed, copes with massive detection requirements, and enhances the ability to effectively detect malicious samples.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114117413B
    Figure CN114117413B
Patent Text Reader

Abstract

Embodiments of the present invention relate to the field of computer security, and in particular to a method, device, electronic device, and storage medium for detecting malicious samples. The method for detecting malicious samples includes: performing static analysis on the sample to be tested to obtain all behavioral instructions present in the sample to be tested; wherein the behavioral instructions include instruction types and instruction parameters; determining abnormal instructions in all the behavioral instructions; and judging whether the sample to be tested is a malicious sample based on the determined abnormal instructions. The technical solution provided by the present invention accelerates the detection efficiency of the sample to be tested by means of static analysis, and at the same time, can effectively judge whether the sample to be tested is a malicious sample based on the determined abnormal instructions, thereby solving the problem that malicious samples are difficult to be effectively detected.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present invention relate to the field of computer security, and in particular to a method, device, electronic device and storage medium for detecting malicious samples. Background Art

[0002] As all walks of life have been continuously carrying out informatization and intelligent construction in recent years, the continuous improvement of the level of social informatization has also put forward new requirements for the security prevention of information systems, and malicious threats will have a great impact on the security of information systems.

[0003] In the related art, malicious threat detection methods generally include feature-based detection methods and dynamic behavior-based detection methods. Among them, the feature-based detection method uses a malicious code detection engine to detect whether the content of the sample to be tested contains malicious code, and the dynamic behavior-based detection method uses a sandbox to run the sample to be tested. Summary of the invention

[0004] In order to solve the problem that malicious samples are difficult to detect effectively, embodiments of the present invention provide a method, device, electronic device, and storage medium for detecting malicious samples.

[0005] In a first aspect, an embodiment of the present invention provides a method for detecting malicious samples, including:

[0006] Performing static analysis on the sample to be tested to obtain all behavioral instructions existing in the sample to be tested; wherein the behavioral instructions include instruction types and instruction parameters;

[0007] determining abnormal instructions among all said behavioral instructions;

[0008] Based on the determined abnormal instruction, it is determined whether the sample to be tested is a malicious sample.

[0009] In one possible design, the instruction type includes at least one of the following:

[0010] Service instructions, file instructions, window instructions, registry instructions, process instructions, algorithm instructions, communication instructions and hook instructions.

[0011] In one possible design, the abnormal instruction includes at least one of the following:

[0012] Anti-sandbox, anti-antivirus, screen monitoring, keyboard monitoring and data feedback.

[0013] In a possible design, the static analysis is performed on the sample to be tested to obtain all behavioral instructions existing in the sample to be tested, including:

[0014] Analyze the sample to be tested by using static vector extraction technology to obtain the instruction types of all behavioral instructions existing in the sample to be tested;

[0015] The sample to be tested is analyzed by using disassembly technology to obtain instruction parameters of all behavioral instructions existing in the sample to be tested.

[0016] In a possible design, determining abnormal instructions among all behavior instructions includes:

[0017] Building an abnormal instruction rule library based on historical abnormal instructions and instruction types and instruction parameters corresponding to each of the historical abnormal instructions;

[0018] Based on the abnormal instruction rule base and the instruction type and instruction parameters of the current behavior instruction, it is determined whether each behavior instruction is an abnormal instruction, so as to determine the abnormal instructions among all the behavior instructions.

[0019] In a possible design, after determining whether the current behavior instruction is an abnormal instruction, the method further includes:

[0020] If yes, output identification information for characterizing the abnormal instruction;

[0021] The determining, based on the determined abnormal instruction, whether the sample to be tested is a malicious sample includes:

[0022] The identification information of historical abnormal instructions and the preset sample labels are used as input and output respectively, and a preset machine learning model is trained to obtain a malicious sample recognition model; wherein the sample labels are malicious samples and normal samples;

[0023] Based on the malicious sample identification model and the determined identification information of the abnormal instruction, it is determined whether the sample to be tested is a malicious sample.

[0024] In a possible design, the malicious sample identification model is a decision tree model;

[0025] After determining whether the sample to be tested is a malicious sample, the method further includes:

[0026] If not, obtaining a manual judgment result for the sample to be tested;

[0027] If the manual judgment result is that the sample to be tested is a malicious sample, the tree structure of the malicious sample identification model is updated, and the updated malicious sample identification model is used to detect the sample to be tested.

[0028] In a second aspect, an embodiment of the present invention further provides a malicious sample detection device, including:

[0029] An analysis module, used to perform static analysis on the sample to be tested, and obtain all behavioral instructions existing in the sample to be tested; wherein the behavioral instructions include instruction types and instruction parameters;

[0030] A determination module, used for determining abnormal instructions among all behavioral instructions;

[0031] A judgment module is used to judge whether the sample to be tested is a malicious sample based on the determined abnormal instruction.

[0032] In a third aspect, an embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method described in any embodiment of this specification is implemented.

[0033] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, enables the computer to execute the method described in any embodiment of this specification.

[0034] The embodiment of the present invention provides a method, device, electronic device and storage medium for detecting malicious samples. By performing static analysis on the sample to be tested, all behavioral instructions existing in the sample to be tested are obtained, and abnormal instructions in all behavioral instructions are further determined; then, based on the determined abnormal instructions, whether the sample to be tested is a malicious sample is determined. The above scheme accelerates the detection efficiency of the sample to be tested by static analysis, and at the same time, based on the determined abnormal instructions, it can effectively determine whether the sample to be tested is a malicious sample, thereby solving the problem that malicious samples are difficult to be effectively detected. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0036] Figure 1 This is a flow chart of a method for detecting malicious samples provided by an embodiment of the present invention;

[0037] Figure 2 is a flow chart of another method for detecting malicious samples provided by an embodiment of the present invention;

[0038] Figure 3 is a hardware architecture diagram of an electronic device provided by an embodiment of the present invention;

[0039] Figure 4is a structural diagram of a malicious sample detection device provided by an embodiment of the present invention;

[0040] Figure 5 It is a structural diagram of another malicious sample detection device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0041] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0042] With the rapid development of information technology in today's world, people are enjoying the convenience of work and life brought by the Internet, but they are also threatened by computer viruses at all times. As computer virus code writing technology has evolved from the simplest functional destruction to the use of polymorphic deformation, packing and other technologies to avoid detection by antivirus software, attacks by advanced threat actors (i.e. malicious samples) are particularly common.

[0043] In the related art, the detection methods of malicious samples generally include feature-based detection methods and dynamic behavior-based detection methods. Among them, the feature-based detection method uses a malicious code detection engine to detect whether the content of the sample to be tested contains malicious code, and the dynamic behavior-based detection method uses a sandbox to run the sample to be tested.

[0044] During the research and development process, the inventors found that: 1) Although the feature-based detection method can provide relatively accurate detection, it is easy for malicious code to evade detection by adopting methods such as "kill-free", exploiting 0DAY vulnerabilities and encryption obfuscation, so this detection method is difficult to effectively detect malicious samples; 2) Although the dynamic behavior-based detection method can effectively detect malicious samples, because it uses a sandbox to run the samples to be tested, its analysis performance is low and it cannot effectively respond to the current detection needs of the increasing number of massive samples to be tested.

[0045] In order to solve this technical problem, the inventor considered analyzing all behavioral instructions of the sample to be tested and further determining the abnormal instructions among all behavioral instructions. In this way, the inventor judged whether the sample to be tested is a malicious sample based on the abnormal instructions. This can not only increase the detection efficiency of malicious samples, but also effectively detect malicious samples.

[0046] The specific implementation of the above concept is described below.

[0047] Please refer to Figure 1, an embodiment of the present invention provides a method for detecting malicious samples, the method comprising:

[0048] Step 100: Perform static analysis on the sample to be tested to obtain all behavioral instructions in the sample to be tested; wherein the behavioral instructions include instruction types and instruction parameters;

[0049] Step 102: Determine abnormal instructions among all behavior instructions;

[0050] Step 104: Based on the determined abnormal instructions, determine whether the sample to be tested is a malicious sample.

[0051] In the embodiment of the present invention, by statically analyzing the sample to be tested, all the behavior instructions in the sample to be tested are obtained, and the abnormal instructions in all the behavior instructions are further determined; then based on the determined abnormal instructions, it is determined whether the sample to be tested is a malicious sample. The above scheme accelerates the detection efficiency of the sample to be tested by static analysis, and at the same time, based on the determined abnormal instructions, it can effectively determine whether the sample to be tested is a malicious sample, thereby solving the problem that malicious samples are difficult to be effectively detected.

[0052] The static analysis method adopted in the embodiment of the present invention is used to detect malicious samples, which takes into account both detection efficiency and malicious sample detection capabilities. This not only solves the problem that feature-based detection methods are easily bypassed by attacks, but also solves the problem that dynamic behavior-based detection methods cannot effectively cope with massive detection needs.

[0053] It should be noted that abnormal instructions refer to instructions that are abnormal to the basic functions of the sample to be tested. For example, if the sample to be tested is software, during the process of downloading the software, the anti-virus software in the terminal device needs to detect the downloaded software. If there are instructions to avoid the anti-virus software (i.e., anti-kill software) during the detection process, then the instruction can be called an abnormal instruction.

[0054] Described below Figure 1 How the various steps are performed.

[0055] For step 100:

[0056] In some implementations, step 100 may include:

[0057] The static vector extraction technology is used to analyze the sample to be tested, and the instruction types of all behavioral instructions existing in the sample to be tested are obtained;

[0058] The disassembly technology is used to analyze the sample to be tested and obtain the instruction parameters of all behavioral instructions in the sample to be tested.

[0059] In this embodiment, the instruction types of all the behavior instructions in the sample to be tested are obtained by using the static vector extraction technology, and the instruction parameters of all the behavior instructions in the sample to be tested are obtained by using the disassembly technology. The static vector extraction technology and the disassembly technology are well known to those skilled in the art and will not be described in detail here.

[0060] For example, to determine whether it is an abnormal instruction of anti-virus software, we can traverse the process instructions and compare whether the process name in the process instruction is the process name of the anti-virus software. The process instruction is the instruction type, and the process name is the instruction parameter.

[0061] In some implementations, the instruction type includes at least one of the following:

[0062] Service instructions, file instructions, window instructions, registry instructions, process instructions, algorithm instructions, communication instructions and hook instructions.

[0063] Among them, service instructions refer to the relevant instructions provided by the operating system that can be used to modify system services, such as: creating services, deleting services, starting services, stopping services, etc.; window instructions refer to the window operation-related instructions provided by the system or software that can be used by other software, such as: creating windows, destroying windows, pop-up windows, and moving windows, etc.; process instructions refer to the relevant instructions provided by the operating system that can be used to modify system processes, such as: creating processes, monitoring processes, traversing processes, terminating processes, etc.; algorithm instructions refer to the standard or non-standard encryption algorithms used by software programs, such as: symmetric encryption algorithms, asymmetric encryption algorithms, digest algorithms, etc.; communication instructions refer to communication-related instructions provided by the system or program, such as: initializing communication, creating sockets, sending data, receiving data, etc.; hook instructions are related instructions provided by the operating system that can be used by other programs to obtain or modify operating system functions, such as creating hooks, releasing hooks, etc.

[0064] Regarding step 102:

[0065] In some implementations, the abnormal instruction includes at least one of the following:

[0066] Anti-sandbox, anti-antivirus, screen monitoring, keyboard monitoring and data feedback.

[0067] Among them, the anti-sandbox instruction refers to the instruction to avoid the sandbox operation when the sample to be tested is run in the sandbox; the screen monitoring instruction refers to the instruction to monitor the screen during the running of the sample to be tested; the keyboard monitoring instruction refers to the instruction to monitor the keyboard during the running of the sample to be tested; the data return instruction refers to the instruction to return data during the running of the sample to be tested.

[0068] In order to detect the abnormal instructions in the sample to be tested quickly and easily, the sample to be tested cannot be in a dynamic running state. To this end, the embodiment of the present invention detects by using static analysis, specifically, by analyzing the instruction type and instruction parameters of the behavior instruction to determine whether each behavior instruction is an abnormal instruction.

[0069] In some implementations, step 100 may include:

[0070] Building an abnormal instruction rule library based on historical abnormal instructions and instruction types and instruction parameters corresponding to each historical abnormal instruction;

[0071] Based on the abnormal instruction rule base and the instruction type and instruction parameters of the current behavior instruction, it is determined whether each behavior instruction is an abnormal instruction to determine the abnormal instructions among all behavior instructions.

[0072] In this embodiment, an abnormal instruction rule library is constructed based on historical abnormal instructions, so that whether each behavior instruction is an abnormal instruction can be quickly determined based on the abnormal instruction rule library, thereby quickly determining the abnormal instructions in all behavior instructions of the sample to be tested.

[0073] It is understandable that the abnormal instruction rule base is a mapping relationship table, specifically the mapping relationship between the set of instruction types and instruction parameters and abnormal instructions. By continuously summarizing and generalizing historical abnormal instructions, the accuracy of malicious judgment using the abnormal instruction rule base can be effectively improved.

[0074] Of course, it can also be based on other methods, such as the judgment method of machine learning models, that is, taking the set of instruction types and instruction parameters as input and the preset abnormal instructions as output, training the preset machine learning model, and obtaining the abnormal instruction judgment model, so that the abnormal instruction judgment model can be used to judge whether each behavior instruction is an abnormal instruction. However, compared with the machine learning model method, the abnormal instruction rule library method can effectively guarantee the accuracy of the judgment; and because abnormal instructions are relatively scattered, if the machine learning model method is used for judgment, it is easy to cause the expansion of the model.

[0075] In some implementations, after determining whether the current behavior instruction is an abnormal instruction, the method further includes:

[0076] If so, the identification information used to characterize the abnormal instruction is output.

[0077] In this implementation, the identification information of the output abnormal instruction can be used to determine whether the sample to be tested is a malicious sample. Please refer to the description of step 104 for details.

[0078] Regarding step 104:

[0079] In some implementations, step 104 may include:

[0080] The identification information of historical abnormal instructions and the preset sample labels are used as input and output respectively, and a preset machine learning model is trained to obtain a malicious sample recognition model; wherein the sample labels are malicious samples and normal samples;

[0081] Based on the malicious sample recognition model and the identification information of the determined abnormal instructions, it is determined whether the sample to be tested is a malicious sample.

[0082] In this embodiment, the identification information of historical abnormal instructions and the preset sample labels are used as the data basis to train the preset machine learning model. In this way, the trained malicious sample recognition model can be used to determine whether the sample to be tested is a malicious sample, thereby improving the detection efficiency of malicious samples.

[0083] At the same time, since the data volume of abnormal instructions may be relatively large, in order to increase the training rate, you can consider reducing the data volume of abnormal instructions. Therefore, you can train the machine learning model based on the identification information of historical abnormal instructions.

[0084] In some embodiments, the malicious sample identification model may be a decision tree model or a neural network model, wherein the decision tree model can further improve the rate of malicious sample identification while ensuring a certain recognition accuracy, and can greatly reduce the complexity of the malicious sample identification model compared to the neural network model.

[0085] It should be noted that when judging whether the sample to be tested is a malicious sample based on the determined abnormal instructions, the model recognition method is used instead of the database recognition method. This is because the former has the ability of self-learning, while the latter can only judge known threats. In this way, when the abnormal instructions in the sample to be tested are unknown threats, the judgment result can be output through the model recognition method, while the judgment result cannot be output through the database recognition method.

[0086] If the judgment result of step 104 is yes, the detection result that the sample to be tested is a malicious sample is output; if the judgment result of step 104 is no, the current process can be terminated. However, in some cases, the result of the decision tree model detection is not the accurate result that the user wants. For example, a malicious sample initially needs to hit six abnormal instructions A, B, C, D, E, and F. If only five of the abnormal instructions are hit, such as A, B, C, D, and E, then the user can also think that the sample to be tested is still a malicious sample. Therefore, the decision tree model at this time is not very accurate.

[0087] In order to solve this technical problem, it is possible to consider using the user's feedback results as the basis for updating the decision tree model to update the decision tree model.

[0088] Therefore, in some embodiments, the above detection method further comprises:

[0089] If the judgment result of step 104 is no, then obtaining the manual judgment result for the sample to be tested;

[0090] If the manual judgment result is that the sample to be tested is a malicious sample, the tree structure of the malicious sample identification model is updated, and the updated malicious sample identification model is used to detect the sample to be tested.

[0091] In this embodiment, the tree structure of the malicious sample identification model is updated according to the obtained manual judgment results for the sample to be tested, so that the accuracy of the detection of the sample to be tested can be improved.

[0092] In summary, by performing static analysis on the sample to be tested, all the behavior instructions in the sample to be tested are obtained, and the abnormal instructions in all the behavior instructions are further determined; then based on the determined abnormal instructions, it is determined whether the sample to be tested is a malicious sample. The above scheme uses static analysis to speed up the detection efficiency of the sample to be tested, and at the same time, based on the determined abnormal instructions, it can effectively determine whether the sample to be tested is a malicious sample, thereby solving the problem that malicious samples are difficult to be effectively detected.

[0093] Figure 2 A flowchart of a method for detecting malicious samples according to another embodiment is shown. Figure 2 , the method comprising:

[0094] Step 200: Analyze the sample to be tested by using static vector extraction technology to obtain the instruction types of all behavioral instructions in the sample to be tested;

[0095] Step 202: Analyze the sample to be tested by using the disassembly technology to obtain the instruction parameters of all the behavior instructions in the sample to be tested;

[0096] Step 204: construct an abnormal instruction rule library based on the historical abnormal instructions and the instruction type and instruction parameters corresponding to each historical abnormal instruction;

[0097] Step 206: Based on the abnormal instruction rule library and the instruction type and instruction parameters of the current behavior instruction, determine whether each behavior instruction is an abnormal instruction; if so, execute step 208; if not, end the current process;

[0098] Step 208: Output identification information for characterizing abnormal instructions;

[0099] Step 210: using the identification information of historical abnormal instructions and the preset sample labels as input and output respectively, training a preset machine learning model, and obtaining a malicious sample recognition model;

[0100] Step 212: Based on the malicious sample identification model and the identification information of the determined abnormal instructions, determine whether the sample to be tested is a malicious sample; if so, execute step 214; if not, execute step 216;

[0101] Step 214: outputting a detection result that the sample to be tested is a malicious sample;

[0102] Step 216: Obtaining manual judgment results for the sample to be tested;

[0103] Step 218: If the result of manual judgment is that the sample to be tested is a malicious sample, the tree structure of the malicious sample identification model is updated, and the updated malicious sample identification model is used to detect the sample to be tested.

[0104] like Figure 3 , Figure 4 As shown, an embodiment of the present invention provides a malicious sample detection device. The device embodiment can be implemented by software, or by hardware or a combination of software and hardware. From the hardware level, Figure 3 As shown, it is a hardware architecture diagram of an electronic device where a malicious sample detection device provided by an embodiment of the present invention is located, except Figure 3 In addition to the processor, memory, network interface, and non-volatile memory shown, the electronic device in the embodiment may also include other hardware, such as a forwarding chip responsible for processing messages, etc. Taking software implementation as an example, Figure 4 As shown, as a device in a logical sense, the CPU of the electronic device in which it is located reads the corresponding computer program in the non-volatile memory into the internal memory and runs it.

[0105] like Figure 4 As shown, a malicious sample detection device provided in this embodiment includes:

[0106] The analysis module 400 is used to perform static analysis on the sample to be tested to obtain all behavioral instructions existing in the sample to be tested; wherein the behavioral instructions include instruction types and instruction parameters;

[0107] A determination module 402, used to determine abnormal instructions among all behavior instructions;

[0108] The judgment module 404 is used to judge whether the sample to be tested is a malicious sample based on the determined abnormal instructions.

[0109] In the embodiment of the present invention, the analysis module 400 may be used to execute step 100 in the above method embodiment, the determination module 402 may be used to execute step 102 in the above method embodiment, and the judgment module 404 may be used to execute step 104 in the above method embodiment.

[0110] In one embodiment of the present invention, the instruction type includes at least one of the following:

[0111] Service instructions, file instructions, window instructions, registry instructions, process instructions, algorithm instructions, communication instructions and hook instructions.

[0112] In one embodiment of the present invention, the abnormal instruction includes at least one of the following:

[0113] Anti-sandbox, anti-antivirus, screen monitoring, keyboard monitoring and data feedback.

[0114] In one embodiment of the present invention, the analysis module 400 is used to perform the following operations:

[0115] The static vector extraction technology is used to analyze the sample to be tested, and the instruction types of all behavioral instructions existing in the sample to be tested are obtained;

[0116] The disassembly technology is used to analyze the sample to be tested and obtain the instruction parameters of all behavioral instructions in the sample to be tested.

[0117] In one embodiment of the present invention, the determination module 402 is configured to perform the following operations:

[0118] Building an abnormal instruction rule library based on historical abnormal instructions and instruction types and instruction parameters corresponding to each historical abnormal instruction;

[0119] Based on the abnormal instruction rule base and the instruction type and instruction parameters of the current behavior instruction, it is determined whether each behavior instruction is an abnormal instruction to determine the abnormal instructions among all behavior instructions.

[0120] In one embodiment of the present invention, the determination module 402 is further configured to perform the following operations:

[0121] If yes, output identification information for characterizing the abnormal instruction;

[0122] The judgment module 404 is used to perform the following operations:

[0123] The identification information of historical abnormal instructions and the preset sample labels are used as input and output respectively, and a preset machine learning model is trained to obtain a malicious sample recognition model; wherein the sample labels are malicious samples and normal samples;

[0124] Based on the malicious sample recognition model and the identification information of the determined abnormal instructions, it is determined whether the sample to be tested is a malicious sample.

[0125] like Figure 5 As shown, in one embodiment of the present invention, the malicious sample identification model is a decision tree model;

[0126] Also includes:

[0127] The acquisition module 406 is used to obtain the manual judgment result for the sample to be tested when the sample to be tested is not a malicious sample;

[0128] The updating module 408 is used to update the tree structure of the malicious sample identification model when the manual judgment result shows that the sample to be tested is a malicious sample, and then use the updated malicious sample identification model to detect the sample to be tested.

[0129] It is understandable that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on a malicious sample detection device. In other embodiments of the present invention, a malicious sample detection device may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0130] The information interaction, execution process and other contents between the modules in the above-mentioned device are based on the same concept as the embodiment of the method of the present invention. For the specific contents, please refer to the description in the embodiment of the method of the present invention, and no further description is given here.

[0131] An embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, a malicious sample detection method in any embodiment of the present invention is implemented.

[0132] An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the processor executes a malicious sample detection method in any embodiment of the present invention.

[0133] Specifically, a system or device equipped with a storage medium can be provided, on which software program code that implements the functions of any of the above-mentioned embodiments is stored, and a computer (or CPU or MPU) of the system or device can read and execute the program code stored in the storage medium.

[0134] In this case, the program code itself read from the storage medium can realize the function of any one of the above-mentioned embodiments, and thus the program code and the storage medium storing the program code constitute a part of the present invention.

[0135] The storage medium embodiments for providing the program code include a floppy disk, a hard disk, a magneto-optical disk, an optical disk (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD+RW), a magnetic tape, a non-volatile memory card, and a ROM. Alternatively, the program code can be downloaded from a server computer by a communication network.

[0136] In addition, it should be clear that the functions of any of the above embodiments can be implemented not only by executing the program code read by the computer, but also by enabling an operating system operating on the computer to complete part or all of the actual operations based on instructions from the program code.

[0137] In addition, it can be understood that the program code read from the storage medium is written to a memory provided in an expansion board inserted into the computer or to a memory provided in an expansion module connected to the computer, and then based on the instructions of the program code, a CPU installed on the expansion board or expansion module is enabled to perform part or all of the actual operations, thereby realizing the functions of any of the above-mentioned embodiments.

[0138] In summary, the present invention provides a method, device, electronic device and storage medium for detecting malicious samples. The present invention has at least the following beneficial effects:

[0139] 1. In one embodiment of the present invention, by performing static analysis on the sample to be tested, all behavioral instructions existing in the sample to be tested are obtained, and the abnormal instructions in all behavioral instructions are further determined; then based on the determined abnormal instructions, it is determined whether the sample to be tested is a malicious sample. The above scheme uses static analysis to speed up the detection efficiency of the sample to be tested, and at the same time, based on the determined abnormal instructions, it can effectively determine whether the sample to be tested is a malicious sample, thereby solving the problem that malicious samples are difficult to be effectively detected.

[0140] 2. In one embodiment of the present invention, an abnormal instruction rule library is constructed based on historical abnormal instructions, so that each behavioral instruction can be quickly judged based on the abnormal instruction rule library to determine whether it is an abnormal instruction, thereby quickly determining the abnormal instructions among all behavioral instructions of the sample to be tested.

[0141] 3. In one embodiment of the present invention, the identification information of historical abnormal instructions and the preset sample labels are used as the data basis to train the preset machine learning model. In this way, the trained malicious sample recognition model can be used to determine whether the sample to be tested is a malicious sample, thereby improving the detection efficiency of malicious samples.

[0142] The malicious sample identification model is a decision tree model, which can further improve the malicious sample identification rate while ensuring a certain recognition accuracy rate, and can greatly reduce the complexity of the malicious sample identification model.

[0143] 4. In one embodiment of the present invention, the tree structure of the malicious sample identification model is updated according to the manual judgment results obtained for the sample to be tested, so as to improve the accuracy of the detection of the sample to be tested.

[0144] 5. In one embodiment of the present invention, in order to conveniently and quickly detect the above abnormal instructions in the sample to be tested, the sample to be tested cannot be in a dynamic running state. To this end, the embodiment of the present invention detects by using a static analysis method, specifically by analyzing the instruction type and instruction parameters of the behavior instruction to determine whether each behavior instruction is an abnormal instruction.

[0145] It should be noted that, in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or equipment including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or equipment. In the absence of further restrictions, the elements defined by the statement "comprise a ..." do not exclude the existence of other identical factors in the process, method, article or equipment including the elements.

[0146] A person of ordinary skill in the art can understand that all or part of the steps of implementing the above method embodiments can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiments; and the aforementioned storage medium includes: ROM, RAM, magnetic disk or optical disk, etc., various media that can store program codes.

[0147] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for detecting malicious samples, characterized in that: include: Performing static analysis on the sample to be tested to obtain all behavioral instructions existing in the sample to be tested; wherein the behavioral instructions include instruction types and instruction parameters; Determine abnormal instructions among all the behavior instructions; wherein the abnormal instructions refer to instructions that are abnormal to the basic functions of the sample to be tested; Based on the determined abnormal instruction, determining whether the sample to be tested is a malicious sample; The instruction type includes at least one of the following: Service instructions, file instructions, window instructions, registry instructions, process instructions, algorithm instructions, communication instructions and hook instructions; wherein, the service instructions refer to the relevant instructions provided by the operating system that can be used to modify system services, including creating services, deleting services, starting services, and stopping services; the window instructions refer to the window operation-related instructions provided by the system or software that can be used by other software, including creating windows, destroying windows, pop-up windows, and moving windows; the process instructions refer to the relevant instructions provided by the operating system that can be used to modify system processes, including creating processes, monitoring processes, traversing processes, and terminating processes; the algorithm instructions refer to the standard or non-standard encryption algorithms used by software programs, including symmetric encryption algorithms, asymmetric encryption algorithms, and digest algorithms; the communication instructions refer to the communication-related instructions provided by the system or program, including initializing communication, creating sockets, sending data, and receiving data; the hook instructions refer to the relevant instructions provided by the operating system that can be used by other programs to obtain or modify operating system functions, including creating hooks and releasing hooks; The abnormal instruction includes at least one of the following: Anti-sandbox, anti-killing software, screen monitoring, keyboard monitoring and data feedback; among them, the anti-sandbox instruction refers to the instruction to avoid the sandbox when running the sample to be tested in the sandbox; the screen monitoring instruction refers to the instruction to monitor the screen during the running of the sample to be tested; the keyboard monitoring instruction refers to the instruction to monitor the keyboard during the running of the sample to be tested; the data feedback instruction refers to the instruction to return data during the running of the sample to be tested; The static analysis of the sample to be tested is performed to obtain all behavioral instructions existing in the sample to be tested, including: Analyze the sample to be tested by using static vector extraction technology to obtain the instruction types of all behavioral instructions existing in the sample to be tested; Analyze the sample to be tested by using disassembly technology to obtain instruction parameters of all behavioral instructions existing in the sample to be tested; The step of determining abnormal instructions among all behavior instructions includes: Building an abnormal instruction rule library based on historical abnormal instructions and instruction types and instruction parameters corresponding to each of the historical abnormal instructions; Based on the abnormal instruction rule base and the instruction type and instruction parameters of the current behavior instruction, determine whether each behavior instruction is an abnormal instruction to determine the abnormal instructions among all behavior instructions; After determining whether the current behavior instruction is an abnormal instruction, it also includes: If yes, output identification information for characterizing the abnormal instruction; The determining, based on the determined abnormal instruction, whether the sample to be tested is a malicious sample includes: The identification information of historical abnormal instructions and the preset sample labels are used as input and output respectively, and a preset machine learning model is trained to obtain a malicious sample recognition model; wherein the sample labels are malicious samples and normal samples; Based on the malicious sample identification model and the determined identification information of the abnormal instruction, it is determined whether the sample to be tested is a malicious sample.

2. The method according to claim 1, characterized in that The malicious sample identification model is a decision tree model; After determining whether the sample to be tested is a malicious sample, the method further includes: If not, obtaining a manual judgment result for the sample to be tested; If the manual judgment result is that the sample to be tested is a malicious sample, the tree structure of the malicious sample identification model is updated, and the updated malicious sample identification model is used to detect the sample to be tested.

3. A malicious sample detection device, characterized in that: include: An analysis module, used to perform static analysis on the sample to be tested, and obtain all behavioral instructions existing in the sample to be tested; wherein the behavioral instructions include instruction types and instruction parameters; A determination module, used to determine abnormal instructions among all behavioral instructions; wherein the abnormal instructions refer to instructions that are abnormal to the basic functions of the sample to be tested; A judgment module, used to judge whether the sample to be tested is a malicious sample based on the determined abnormal instruction; The instruction type includes at least one of the following: Service instructions, file instructions, window instructions, registry instructions, process instructions, algorithm instructions, communication instructions and hook instructions; wherein, the service instructions refer to the relevant instructions provided by the operating system that can be used to modify system services, including creating services, deleting services, starting services, and stopping services; the window instructions refer to the window operation-related instructions provided by the system or software that can be used by other software, including creating windows, destroying windows, pop-up windows, and moving windows; the process instructions refer to the relevant instructions provided by the operating system that can be used to modify system processes, including creating processes, monitoring processes, traversing processes, and terminating processes; the algorithm instructions refer to the standard or non-standard encryption algorithms used by software programs, including symmetric encryption algorithms, asymmetric encryption algorithms, and digest algorithms; the communication instructions refer to the communication-related instructions provided by the system or program, including initializing communication, creating sockets, sending data, and receiving data; the hook instructions refer to the relevant instructions provided by the operating system that can be used by other programs to obtain or modify operating system functions, including creating hooks and releasing hooks; The abnormal instruction includes at least one of the following: Anti-sandbox, anti-killing software, screen monitoring, keyboard monitoring and data feedback; among them, the anti-sandbox instruction refers to the instruction to avoid the sandbox when running the sample to be tested in the sandbox; the screen monitoring instruction refers to the instruction to monitor the screen during the running of the sample to be tested; the keyboard monitoring instruction refers to the instruction to monitor the keyboard during the running of the sample to be tested; the data feedback instruction refers to the instruction to return data during the running of the sample to be tested; The analysis module is used to perform the following operations: Analyze the sample to be tested by using static vector extraction technology to obtain the instruction types of all behavioral instructions existing in the sample to be tested; Analyze the sample to be tested by using disassembly technology to obtain instruction parameters of all behavioral instructions existing in the sample to be tested; The determining module is used to perform the following operations: Building an abnormal instruction rule library based on historical abnormal instructions and instruction types and instruction parameters corresponding to each of the historical abnormal instructions; Based on the abnormal instruction rule base and the instruction type and instruction parameters of the current behavior instruction, determine whether each behavior instruction is an abnormal instruction to determine the abnormal instructions among all behavior instructions; The determining module is further configured to perform the following operations: If yes, output identification information for characterizing the abnormal instruction; The judgment module is used to perform the following operations: The identification information of historical abnormal instructions and the preset sample labels are used as input and output respectively, and a preset machine learning model is trained to obtain a malicious sample recognition model; wherein the sample labels are malicious samples and normal samples; Based on the malicious sample identification model and the determined identification information of the abnormal instruction, it is determined whether the sample to be tested is a malicious sample.

4. An electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method according to any one of claims 1 to 2 is implemented.

5. A computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute the method according to any one of claims 1 to 2.