Malicious file detection method and device and electronic equipment

The malicious file family information database is constructed through local sensitive hashing algorithms, which solves the problem of insufficient detection capabilities of new malicious files that are not recorded in the library in the existing technology, and realizes rapid detection and accurate identification of malicious files, reducing resource consumption , adapt to the rapidly changing cyber threat environment.

CN118886002APending Publication Date: 2024-11-01HILLSTONE NETWORKS CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411056982.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-02
Publication Date
2024-11-01

AI Technical Summary

Technical Problem

The existing blacklisting methods lack the ability to identify new malicious files that are not recorded in the library, resulting in frequent updates of blacklist databases, which consumes a lot of manpower and material resources, making it difficult to deal with the rapidly evolving cyber threat environment.

Method used

The local sensitive hash algorithm is used to build the information database of the malicious file family. By extracting the local sensitive hash value of the file content, it is necessary to determine the malicious file family to which the file to be detected belongs, and improve the detection ability and rapid detection of malicious files. efficiency.

Benefits of technology

It realizes rapid detection of suspected malicious files, reduces the consumption of human and material resources, improves the accuracy and real-timeness of malicious file detection, and can deal with rapidly changing cyber threats.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118886002A_ABST
    Figure CN118886002A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a malicious file detection method and device and electronic equipment, and the method comprises the steps: extracting multiple types of file contents from a to-be-detected file, and obtaining local sensitive hash values corresponding to the multiple types of file contents; splicing the locality sensitive hash values corresponding to the multiple types of file contents to obtain a target hash value of the to-be-detected file; performing similarity calculation on the target hash value and hash values in a plurality of malicious file information bases to obtain a plurality of similarities; the hash value of any malicious file is obtained by splicing local sensitive hash values corresponding to multiple types of file contents in the malicious file; and determining a malicious file family to which the to-be-detected file belongs from the plurality of malicious file families according to the similarities. According to the embodiment of the invention, similarity comparison can be carried out on the locality sensitive hash of the unknown sample in the malicious file information base, so that malicious file detection can be quickly and accurately carried out.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of network security, and more specifically, to a malicious file detection method and device, and electronic equipment. Background Art

[0002] Malicious files are those designed to damage computer systems, steal sensitive information, or interfere with normal operations. In existing security protection mechanisms, blacklist methods are widely used to detect known malicious files. In order to improve detection efficiency and accuracy, hash algorithms are used in combination to build and maintain blacklist databases.

[0003] However, although the blacklist-based detection mechanism can effectively identify known malicious files, it lacks the ability to identify new malicious files that are not recorded in the database. Therefore, in order to maintain the real-time and effectiveness of protection, the blacklist database needs to be continuously updated and maintained to incorporate the characteristics of newly discovered malicious files.

[0004] Obviously, the above process requires a lot of human and material resources and is difficult to cope with the rapidly evolving cyber threat environment. Summary of the invention

[0005] The purpose of the embodiments of the present application is to provide a malicious file detection method and device, and an electronic device, which can perform file detection based on a malicious file information library of a malicious file family constructed based on a local sensitive hash algorithm when identifying malicious files, thereby improving the detection capability of malicious files and achieving rapid detection of suspected malicious files, so that it can cope with the rapidly evolving network threat environment; at the same time, it can also reduce the consumption of human and material resources.

[0006] The first aspect of the present application provides a malicious file detection method, comprising:

[0007] Extract multiple types of file contents from the file to be detected, and obtain local sensitive hash values ​​corresponding to the multiple types of file contents;

[0008] Concatenate the local sensitive hash values ​​corresponding to the contents of the files of multiple types to obtain the target hash value of the file to be detected;

[0009] The target hash value is respectively calculated with hash values ​​in a plurality of malicious file information repositories to obtain a plurality of similarities, wherein different malicious file information repositories are constructed based on hash values ​​of malicious files belonging to different malicious file families; and the hash value of any malicious file is obtained by splicing local sensitive hash values ​​corresponding to the contents of multiple types of files in the malicious file;

[0010] According to each of the similarities, the malicious file family to which the file to be detected belongs is determined from the multiple malicious file families.

[0011] In the above implementation process, the method can first extract multiple types of file contents from the file to be detected, and obtain the local sensitive hash values ​​corresponding to the multiple types of file contents, and splice the local sensitive hash values ​​corresponding to the multiple types of file contents to obtain the target hash value of the file to be detected. The corresponding local sensitive hash values ​​can be calculated based on the different parts of the malicious file, so as to record the similarity of each content part, so as to facilitate the subsequent judgment of whether the unknown file is a malicious file, thereby solving the directional detection problem of the traditional blacklist detection mechanism and improving the detection ability of malicious files. Then, the target hash value is respectively calculated with the hash values ​​in multiple malicious file information libraries to obtain multiple similarities, wherein different malicious file information libraries are constructed based on the hash values ​​of malicious files belonging to different malicious file families; the hash value of any malicious file is obtained by splicing the local sensitive hash values ​​corresponding to the multiple types of file contents in the malicious file. Finally, the method can determine the malicious file family to which the file to be detected belongs from multiple malicious file families according to each similarity, so as to realize the similarity detection at the file level and improve the detection rate of malicious files by the malicious file information library.

[0012] Further, the malicious file set of the target malicious file family is obtained; wherein the target malicious file family is any malicious file family among multiple malicious file families;

[0013] Mapping malicious files in the malicious file set to the created cache areas respectively, to obtain a mapping file set corresponding to the malicious file set;

[0014] Extracting multiple types of file contents included in each mapping file in the mapping file set, and obtaining local sensitive hash values ​​corresponding to each type of the file contents;

[0015] For each of the mapping files, concatenate the local sensitive hash values ​​corresponding to the file contents of each type of the mapping file to obtain a hash value of the mapping file;

[0016] According to the hash value of each mapping file in the mapping file set, a malicious file information library corresponding to the target malicious file family is constructed.

[0017] In the above implementation process, the method can construct a malicious file information library of the malicious file family based on the local sensitive hash algorithm, thereby improving the detection capability of malicious files and realizing rapid detection of suspected malicious files.

[0018] Furthermore, the malicious files in the malicious file set are respectively mapped to the created cache area to obtain a mapping file set corresponding to the malicious file set, including:

[0019] Extracting suspected malicious files with shells and malicious files without shells included in the malicious file set;

[0020] De-shelling the suspected malicious file to obtain a de-shelled malicious file;

[0021] The malicious files in the unshelled malicious file and the deshelled malicious file are respectively mapped to the created buffer area to obtain a mapping file set corresponding to the malicious file set.

[0022] In the above implementation process, the method can identify and unpack suspected malicious files to obtain unpacked malicious files, so that the construction of the malicious file information library will not be affected by the outer structure of the malicious files, thereby improving the effectiveness of the constructed malicious file information library.

[0023] Furthermore, the method further comprises:

[0024] For the malicious file information libraries of the multiple malicious file families constructed, determining whether there are multiple hash values ​​that meet a preset condition in the malicious file information libraries of the multiple malicious file families; wherein when the similarity between the multiple hash values ​​is greater than a first similarity threshold, the multiple hash values ​​meet the preset condition;

[0025] Transferring multiple hash values ​​that meet the preset conditions from the malicious file information repositories of the multiple malicious file families to a general information repository, wherein the general information repository is different from any one of the malicious file information repositories of the multiple malicious file families.

[0026] Furthermore, the multiple types of file contents include code segments and data segments; and obtaining the local sensitive hash values ​​corresponding to the multiple types of file contents respectively includes:

[0027] Obtaining a first distribution feature extracted according to an operation code sequence corresponding to each of the code segments, and obtaining a first local sensitive hash value according to each of the extracted first distribution features;

[0028] Obtain a second distribution feature extracted from a file character string corresponding to each of the data segments, and obtain a second locally sensitive hash value based on each of the extracted second distribution features.

[0029] Furthermore, the multiple types of file contents include code segments and file contents different from the code segments; obtaining the local sensitive hash value corresponding to the code segments includes:

[0030] For each code segment extracted from the file to be detected, perform the following operations:

[0031] Extracting an executable function in the code segment;

[0032] Determining whether an execution entry point of the executable function is detected;

[0033] If yes, the execution entry point is recorded as a pointer variable; if no, the address of the starting position of the code segment is recorded as a pointer variable;

[0034] Traversing the code segment based on the pointer variable, and extracting the operation codes included in all instructions in the executable function during the traversal process to obtain an operation code sequence corresponding to each of the executable functions;

[0035] Performing hash calculations on each of the operation code sequences respectively to obtain a plurality of first hash values;

[0036] extracting a first distribution feature based on the plurality of first hash values, and generating a first feature dictionary for the code segment based on the first distribution feature;

[0037] Merging the first feature dictionaries of all the code segments to obtain a first target feature dictionary;

[0038] A first local sensitive hash value is calculated according to a first distribution feature in the first target feature dictionary.

[0039] Furthermore, the multiple types of file contents include data segments and file contents different from the data segments; obtaining the local sensitive hash values ​​corresponding to the data segments includes:

[0040] For each data segment extracted from the file to be detected, the following operations are performed:

[0041] extracting a file string from the data segment;

[0042] Performing denoising processing on the file character string to obtain a denoised file character string;

[0043] Segmenting the denoised file character string to obtain a plurality of segmented character strings;

[0044] extracting a second distribution feature based on the multiple segmented character strings, and generating a second feature dictionary for the data segment based on the second distribution feature;

[0045] Merging the second feature dictionaries of all the data segments to obtain a second target feature dictionary;

[0046] A second locality sensitive hash value is calculated based on a second distribution feature in the second target feature dictionary.

[0047] Furthermore, the method further comprises:

[0048] In a case where the detection result of the file to be detected indicates the existence of a malicious file family to which the file to be detected belongs, receiving a verification result of the detection result of the file to be detected;

[0049] When the verification result indicates that the detection result is correct, storing the target hash value of the file to be detected in a malicious file information library of the malicious file family indicated by the detection result;

[0050] In the case where the verification result indicates that the detection result is wrong, the target hash value of the file to be detected is stored in a malicious file information library of the malicious file family indicated by the verification result.

[0051] A second aspect of the present application provides a malicious file detection device, the malicious file detection device comprising:

[0052] An extraction unit, used for extracting multiple types of file contents from the file to be detected;

[0053] A first acquisition unit is used to obtain local sensitive hash values ​​corresponding to multiple types of file contents respectively;

[0054] A first concatenation unit is used to concatenate the local sensitive hash values ​​corresponding to the contents of the files of multiple types to obtain a target hash value of the file to be detected;

[0055] A first calculation unit is used to perform similarity calculations on the target hash value and hash values ​​in a plurality of malicious file information repositories respectively, to obtain a plurality of similarities, wherein different malicious file information repositories are constructed based on hash values ​​of malicious files belonging to different malicious file families; and the hash value of any malicious file is obtained by splicing local sensitive hash values ​​corresponding to the contents of multiple types of files in the malicious file;

[0056] The first determining unit is used to determine the malicious file family to which the file to be detected belongs from the multiple malicious file families according to the similarities.

[0057] Furthermore, the malicious file detection device also includes:

[0058] A second acquisition unit is used to acquire a malicious file set of a target malicious file family; wherein the target malicious file family is any malicious file family among multiple malicious file families;

[0059] A mapping unit, used to map malicious files in the malicious file set to the created cache area respectively, to obtain a mapping file set corresponding to the malicious file set;

[0060] An extraction unit, used for extracting multiple types of file contents included in each mapping file in the mapping file set;

[0061] A third acquisition unit is used to obtain the local sensitive hash value corresponding to each type of file content;

[0062] A second concatenation unit is configured to concatenate, for each of the mapping files, the local sensitive hash values ​​corresponding to the file contents of each type of the mapping file to obtain a hash value of the mapping file;

[0063] The information library construction unit is used to construct a malicious file information library corresponding to the target malicious file family according to the hash value of each mapping file in the mapping file set.

[0064] Furthermore, the mapping unit includes:

[0065] An extraction subunit, used to extract suspected shelled malicious files and unshelled malicious files included in the malicious file set;

[0066] The de-shelling sub-unit is used to de-shell the suspected malicious file to obtain a de-shelled malicious file;

[0067] The mapping subunit is used to map the malicious files in the shell-free malicious files and the shell-removed malicious files to the created cache areas respectively, so as to obtain a mapping file set corresponding to the malicious file set.

[0068] Furthermore, the unpacking sub-unit is specifically used to obtain the suspected packed malicious file; and perform sandbox simulation on the suspected packed malicious file, and identify the file running behavior and the suspected packed features during the sandbox simulation process; and based on the file running behavior and the suspected packed features, unpack the suspected packed malicious file through a reverse engineering tool to obtain an unpacked malicious file.

[0069] Furthermore, the malicious file detection device also includes:

[0070] A second determination unit is used to determine whether there are multiple hash values ​​that meet a preset condition in the malicious file information library of the multiple malicious file families constructed; wherein when the similarity between the multiple hash values ​​is greater than a first similarity threshold, the multiple hash values ​​meet the preset condition;

[0071] A transfer unit is used to transfer multiple hash values ​​that meet the preset conditions from the malicious file information libraries of the multiple malicious file families to a general information library, wherein the general information library is different from any malicious file information library in the malicious file information libraries of the multiple malicious file families.

[0072] Furthermore, the multiple types of file contents include code segments and data segments; the first acquisition unit includes:

[0073] A first acquisition subunit is used to acquire a first distribution feature extracted according to an operation code sequence corresponding to each of the code segments, and acquire a first local sensitive hash value according to each of the extracted first distribution features;

[0074] The second acquisition subunit is used to obtain the second distribution feature extracted according to the file character string corresponding to each of the data segments, and obtain the second local sensitive hash value according to each of the extracted second distribution features.

[0075] Further, the multiple types of file contents include code segments and file contents different from the code segments;

[0076] The first acquisition unit is specifically used to perform the following operations for each code segment extracted from the file to be detected: extract an executable function from the code segment; determine whether an execution entry point of the executable function is detected; if so, record the execution entry point as a pointer variable; if not, record the address of the starting position of the code segment as a pointer variable; traverse the code segment based on the pointer variable, and extract the operation codes included in all instructions in the executable function during the traversal process to obtain an operation code sequence corresponding to each executable function; perform hash calculation on each operation code sequence to obtain multiple first hash values; extract a first distribution feature based on the multiple first hash values, and generate a first feature dictionary for the code segment based on the first distribution feature; merge the first feature dictionaries of all the code segments to obtain a first target feature dictionary; calculate a first locally sensitive hash value according to the first distribution feature in the first target feature dictionary.

[0077] Further, the plurality of types of file contents include data segments and file contents different from the data segments;

[0078] The first acquisition unit is specifically used to perform the following operations for each data segment extracted from the file to be detected: extract a file string from the data segment; perform denoising on the file string to obtain a denoised file string; segment the denoised file string to obtain a plurality of segmented strings; extract a second distribution feature based on the plurality of segmented strings, and generate a second feature dictionary for the data segment based on the second distribution feature; merge the second feature dictionaries of all the data segments to obtain a second target feature dictionary; and calculate a second local sensitive hash value based on the second distribution feature in the second target feature dictionary.

[0079] Furthermore, the malicious file detection device also includes:

[0080] A receiving unit, configured to receive a verification result of the detection result of the file to be detected when the detection result of the file to be detected indicates the existence of a malicious file family to which the file to be detected belongs;

[0081] A storage unit, configured to store the target hash value of the file to be detected in a malicious file information library of the malicious file family indicated by the detection result if the verification result indicates that the detection result is correct;

[0082] The storage unit is further configured to store the target hash value of the file to be detected in a malicious file information library of the malicious file family indicated by the verification result when the verification result indicates that the detection result is wrong.

[0083] A third aspect of the present application provides an electronic device, including a memory and a processor, wherein the memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to execute the malicious file detection method described in any one of the first aspects of the present application.

[0084] A fourth aspect of the present application provides a computer-readable storage medium storing computer program instructions. When the computer program instructions are read and executed by a processor, the malicious file detection method described in any one of the first aspects of the present application is executed. BRIEF DESCRIPTION OF THE DRAWINGS

[0085] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0086] Figure 1A flowchart of a malicious file detection method provided in an embodiment of the present application;

[0087] Figure 2 A flowchart of another malicious file detection method provided in an embodiment of the present application;

[0088] Figure 3 A schematic diagram of an example process of enriching a malicious family information database provided in an embodiment of the present application;

[0089] Figure 4 A schematic diagram of a process for calculating a first local sensitive hash value based on all code segments provided in an embodiment of the present application;

[0090] Figure 5 A schematic diagram of an example flow chart of calculating a first local sensitive hash value based on all code segments provided in an embodiment of the present application;

[0091] Figure 6 A schematic diagram of a process for calculating a second local sensitive hash value based on all strings provided in an embodiment of the present application;

[0092] Figure 7 A schematic diagram of an example flow chart of calculating a second local sensitive hash value based on all strings provided in an embodiment of the present application;

[0093] Figure 8 A schematic diagram of the structure of a malicious file detection device provided in an embodiment of the present application;

[0094] Fig. 9 A schematic diagram of the structure of another malicious file detection device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0095] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.

[0096] The embodiments or examples of the present disclosure are not exhaustive, but are only illustrative of some embodiments or examples, and are not intended to be specific limitations on the scope of protection of the present disclosure. In the absence of contradiction, each step in a certain embodiment or example can be implemented as an independent example, and the steps can be combined arbitrarily. For example, the scheme after removing some steps in a certain embodiment or example can also be implemented as an independent example, and the order of the steps in a certain embodiment or example can be arbitrarily exchanged. In addition, the optional methods or optional examples in a certain embodiment or example can be combined arbitrarily; in addition, the various embodiments or examples can be combined arbitrarily, for example, some or all steps of different embodiments or examples can be combined arbitrarily, and a certain embodiment or example can be combined arbitrarily with the optional methods or optional examples of other embodiments or examples.

[0097] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.

[0098] Example 1

[0099] Please see Figure 1 , Figure 1 A flowchart of a malicious file detection method provided in this embodiment. The malicious file detection method includes:

[0100] S101. Extract multiple types of file contents from the file to be detected, and obtain local sensitive hash values ​​corresponding to the multiple types of file contents.

[0101] S102. Concatenate the local sensitive hash values ​​corresponding to the contents of multiple types of files to obtain a target hash value of the file to be detected.

[0102] S103: Calculate similarities between the target hash value and hash values ​​in multiple malicious file information repositories respectively to obtain multiple similarities.

[0103] In this embodiment, different malicious file information libraries are constructed based on hash values ​​of malicious files belonging to different malicious file families.

[0104] In this embodiment, the hash value of any malicious file is obtained by concatenating local sensitive hash values ​​corresponding to multiple types of file contents in the malicious file.

[0105] S104: Determine, from the plurality of malicious file families, the malicious file family to which the file to be detected belongs according to each similarity.

[0106] In this embodiment, the method can calculate the local sensitive hash values ​​corresponding to multiple types of file contents in the file to be detected, and then compare the hash value obtained by splicing multiple local sensitive hash values ​​(for example, all_LSH) with the hash values ​​in the malicious file information library (or called "gene library") of different families, and determine whether the file to be detected belongs to a certain malicious file family based on the comparison result.

[0107] Here, a malicious file family is used to describe a group of malicious files with similar characteristics, behaviors, or codes. These malicious files are usually created by the same group of attackers or use the same code base, techniques, and strategies.

[0108] In some embodiments, the multiple types of file contents include code segments and data segments; in the above step S101, obtaining the local sensitive hash values ​​corresponding to the multiple types of file contents may include:

[0109] Obtaining first distribution features extracted according to the operation code sequence corresponding to each code segment, and obtaining a first local sensitive hash value according to each extracted first distribution feature;

[0110] Obtain a second distribution feature extracted from a file character string corresponding to each data segment, and obtain a second locally sensitive hash value based on each extracted second distribution feature.

[0111] In this embodiment, when the method calculates the similarity between the hash value obtained by concatenating all_LSH (i.e., the target hash value) of the file to be detected and the hash values ​​(also called "genes") in different information repositories, a similarity threshold can be set in advance and a judgment can be made based on the similarity threshold.

[0112] When the calculated similarity is greater than a preset similarity threshold, it is determined that the file to be detected may belong to the malicious file family. In actual implementation, similarity determination is usually performed based on multiple malicious file information repositories, and when the file to be detected passes the determination of multiple malicious file information repositories, the method determines the malicious file family to which the malicious file information repositories corresponding to the highest similarity belong as the malicious file family to which the file to be detected should belong.

[0113] In addition, when the similarity between the file to be detected and the general information library is the largest, it is determined that the file to be detected does not belong to any malicious file family, and the general information library is different from any malicious file family.

[0114] In this embodiment, the method does not impose any limitation on the method for calculating the similarity. Exemplarily, the method for calculating the similarity may use the Hamming distance as a measure of the similarity.

[0115] As an optional implementation, the method further includes:

[0116] Perform multi-source cross-validation on the files to be tested to obtain cross-validation results;

[0117] When the cross-validation result is passed, the target hash value of the file to be detected is added to the malicious file information library of the malicious file family corresponding to the target similarity;

[0118] When the cross-validation result is not verified, the malicious file information library corresponding to the target similarity is corrected based on the cross-validation result, and the target hash value of the file to be detected is added to the corrected malicious file information library.

[0119] In this embodiment, the method may also additionally determine whether the file to be detected should be added to the corresponding malicious file information library to enrich the malicious file information library.

[0120] In this embodiment, when the method has the intention to enrich the malicious file information library (the intention can be indicated by a certain instruction), multi-source cross-validation can be performed on the file to be detected to obtain a cross-validation result (the cross-validation result is used to determine the correctness of the detection result, that is, to determine whether the file to be detected should really belong to the malicious file information library).

[0121] Among them, when the verification passes, the method can include the target hash value into the corresponding malicious family information library; when the verification fails, it is necessary to correct the detection result and enter the target hash value into the corrected malicious family information library.

[0122] In this embodiment, the execution subject of the method may be a computing device such as a computer or a server, and no limitation is made in this embodiment.

[0123] It can be seen that the implementation of the malicious file detection method described in this embodiment can build a malicious file information library of the malicious file family based on the local sensitive hash algorithm, thereby improving the detection capability of malicious files and realizing rapid detection of suspected malicious files, so that it can cope with the rapidly evolving network threat environment; at the same time, it can also reduce the consumption of human and material resources.

[0124] Example 2

[0125] Please see Figure 2 , Figure 2 A flowchart of a malicious file detection method provided in this embodiment. The malicious file detection method includes:

[0126] S201. Obtain a malicious file set of a target malicious file family.

[0127] In this embodiment, the target malicious file family is any malicious file family among multiple malicious file families.

[0128] As an optional implementation, obtaining a malicious file set of a target malicious file family includes:

[0129] Obtain download configuration information corresponding to the malicious file set in the target malicious file family;

[0130] Identify in the download configuration information the download platform corresponding to the malicious file set and the file download tool used to download the malicious file set;

[0131] A file download tool is used to download multiple malicious files in the target malicious file family on the download platform to obtain a malicious file collection.

[0132] For example, the method may first obtain a list of malicious families, and then for all malicious families, collect as many PE (Portable Executable) type malware file sets belonging to the family as possible.

[0133] Among them, the above-mentioned file download tool can specifically be a malwoverview tool or a Virus Total platform. The malwoverview tool is a threat hunting tool, and the Virus Total platform is a suspicious file analysis service platform. The malwoverview tool or the Virus Total platform can be used to download malicious family sample PE files (corresponding to the above-mentioned malicious file set).

[0134] S202: extract suspected shelled malicious files and unshelled malicious files included in the malicious file set.

[0135] S203: Obtain a suspected malicious file that is packed.

[0136] S204: Perform sandbox simulation on the suspected malicious file with a shell, and identify the file running behavior and suspected shell features during the sandbox simulation process.

[0137] S205: Based on the file running behavior and the suspected packed features, the suspected packed malicious file is unpacked by using a reverse engineering tool to obtain an unpacked malicious file.

[0138] For example, the method can obtain the target path of the PE file in the malicious file collection. For unpacked PE files, the method can directly map the file into the memory; for suspected packed PE files, the method can put the PE file into a sandbox or simulator to run, and record its runtime behavior to identify possible packing features, and then use reverse engineering technology to depack it, and finally obtain the depacked malicious file, and map the depacked malicious file into the memory.

[0139] S206: Map the malicious files in the unshelled malicious files and the deshelled malicious files to the created buffer areas respectively, to obtain a mapping file set corresponding to the malicious file set.

[0140] In this embodiment, the method can create a cache area in advance.

[0141] For example, the method pre-creates a buffer of file mapping data and names it buffer. Then, it uses buffer to create a pefile::PeFile object (referring to the object used to handle Windows PE files) and names it pefbuf to represent the PE mapping file.

[0142] S207. Extract multiple types of file contents included in each mapping file in the mapping file set, and obtain the local sensitive hash value corresponding to each type of file content.

[0143] In this embodiment, the method can extract multiple types of file content, such as code segments, character strings, etc., from a malicious file collection.

[0144] In this embodiment, the method can calculate multiple local sensitive hash values ​​according to the characteristics of different content information (such as code segments, character strings). Among them, code segments and character strings are only used as examples for illustration in this embodiment. In specific practice, other content information can also be processed in a similar manner to obtain additional local sensitive hash values.

[0145] In some examples, the optional implementation method of obtaining the local sensitive hash value corresponding to each type of file content in step S207 can refer to the optional implementation method of obtaining the local sensitive hash values ​​corresponding to multiple types of file content in the aforementioned step S101 and its related content, which will not be repeated here.

[0146] S208. For each mapping file, concatenate the local sensitive hash values ​​corresponding to the file contents of each type of the mapping file to obtain a hash value of the mapping file.

[0147] S209: Construct a malicious file information library corresponding to the target malicious file family according to the hash value of each mapping file in the mapping file set.

[0148] In this embodiment, the method can calculate and store the hash values ​​of all malicious files in a specified malicious file family, thereby obtaining a malicious file information library based on malicious file families.

[0149] S210: For the constructed malicious file information libraries of the multiple malicious file families, determine whether there are multiple hash values ​​that meet preset conditions in the malicious file information libraries of the multiple malicious file families.

[0150] In this embodiment, when the similarity between the multiple hash values ​​is greater than the first similarity threshold, the multiple hash values ​​meet the preset condition.

[0151] S211. Transferring multiple hash values ​​that meet preset conditions from malicious file information repositories of multiple malicious file families to a general information repository.

[0152] In this embodiment, the general information library is different from any one of the malicious file information libraries of multiple malicious file families.

[0153] In this embodiment, the method can filter based on malicious file information bases of different families. The filtering refers to removing genes that are widely present in multiple families or genes with high similarity in different families. The filtered malicious file genes can construct a general information base.

[0154] S212: extracting multiple types of file contents from the file to be detected.

[0155] In some examples, multiple types of file content may include code segments and data segments, and the local sensitive hash values ​​corresponding to the multiple types of file content respectively obtained in the aforementioned step S101 can be implemented by implementing steps S213 to S214.

[0156] Here, the code segment includes the opcodes and the data segment includes the character string.

[0157] S213: Obtain first distribution features extracted according to the operation code sequence corresponding to each code segment, and obtain a first local sensitive hash value according to each extracted first distribution feature.

[0158] As an optional implementation, the multiple types of file contents include code segments and file contents different from the code segments (for example, data segments or other file contents); obtaining the first local sensitive hash value corresponding to the code segment includes:

[0159] For each code snippet extracted from the file to be tested, perform the following operations:

[0160] Extract executable functions from the code segment;

[0161] Determine whether the execution entry point of the executable function is detected;

[0162] If yes, the execution entry point is recorded as a pointer variable; if no, the address of the starting position of the code segment is recorded as a pointer variable;

[0163] Traversing the code segment based on the pointer variable, and extracting the operation codes included in all instructions in the executable function during the traversal process, to obtain the operation code sequence corresponding to each executable function;

[0164] Performing hash calculations on each operation code sequence respectively to obtain multiple first hash values;

[0165] Extracting a first distribution feature based on a plurality of first hash values; generating a first feature dictionary of the code segment based on the first distribution feature;

[0166] Merging the first feature dictionaries of all code segments to obtain a first target feature dictionary;

[0167] A first local sensitive hash value is calculated according to a first distribution feature in a first target feature dictionary.

[0168] In the above embodiment, when multiple types of file contents include code segments, the method can pre-construct a local sensitive hash calculation function based on an opcode (the opcode included in the code segment) and calculate a local sensitive hash value based on the local sensitive hash calculation function.

[0169] In the above implementation, after merging all first feature dictionaries corresponding to all code segments to obtain a first target feature dictionary, a local sensitive hash value is calculated according to the first distribution feature in the first target feature dictionary.

[0170] In the above implementation, the obtained local sensitive hash value can be named opc_LSH (ie, the first local sensitive hash value).

[0171] For example, the method concatenates str_LSH and opc_LSH to obtain all_LSH (i.e., the target hash value), and uses the all_LSH as the malicious file gene.

[0172] S214. Obtain second distribution features extracted from the file character strings corresponding to each data segment, and obtain a second locally sensitive hash value based on each extracted second distribution feature.

[0173] As an optional implementation, the multiple types of file contents include data segments and file contents different from the data segments (such as code segments or other file contents); obtaining the second local sensitive hash value corresponding to the data segment includes:

[0174] For each data segment extracted from the file to be detected, perform the following operations:

[0175] Extract file string in data segment;

[0176] De-noising the file string to obtain a de-noised file string;

[0177] Segment the denoised file string to obtain multiple segmented strings;

[0178] Extracting a second distribution feature based on the plurality of segmented character strings, and generating a second feature dictionary for the data segment based on the second distribution feature;

[0179] Merging the second feature dictionaries of all data segments to obtain a second target feature dictionary;

[0180] A second locality sensitive hash value is calculated based on a second distribution feature in the second target feature dictionary.

[0181] In the above implementation, when multiple types of file contents include character strings, the method can pre-construct a local sensitive hash calculation function based on the character string, and calculate the local sensitive hash value based on the local sensitive hash calculation function.

[0182] In the above implementation, after merging all second feature dictionaries corresponding to all character strings to obtain a second target feature dictionary, a local sensitive hash value is calculated according to the second distribution feature in the second target feature dictionary.

[0183] In the above implementation, the obtained local sensitive hash value can be named str_LSH (ie, the second local sensitive hash value).

[0184] S215. Concatenate the local sensitive hash values ​​corresponding to the contents of multiple types of files to obtain a target hash value of the file to be detected.

[0185] In this embodiment, the local sensitive hash values ​​corresponding to the contents of multiple types of files are spliced, that is, the first local sensitive hash value and the second local sensitive hash value are spliced ​​to obtain the target hash value of the file to be detected.

[0186] S216: Calculate similarities between the target hash value and hash values ​​in multiple malicious file information repositories to obtain multiple similarities.

[0187] In this embodiment, different malicious file information repositories are constructed based on hash values ​​of malicious files belonging to different malicious file families; the hash value of any malicious file is obtained by splicing local sensitive hash values ​​corresponding to multiple types of file contents in the malicious file.

[0188] S217: Determine, from the plurality of malicious file families, the malicious file family to which the file to be detected belongs according to each similarity.

[0189] S218. When the detection result of the file to be detected indicates that there is a malicious file family to which the file to be detected belongs, receiving a verification result of the detection result of the file to be detected.

[0190] S219. When the verification result indicates that the detection result is correct, the target hash value of the file to be detected is stored in the malicious file information library of the malicious file family indicated by the detection result; or, when the verification result indicates that the detection result is wrong, the target hash value of the file to be detected is stored in the malicious file information library of the malicious file family indicated by the verification result.

[0191] In this embodiment, the implementation of steps S216 to S217 can continuously enrich and update the malicious file information library of the malicious file family to improve the detection range of malicious files. Figure 3 , Figure 3 FIG. 2 shows an example process diagram of enriching a malicious family information database. Figure 3 As shown, the gene library of each malicious file family is a malicious file information library. After the judgment result is obtained, the judgment result is verified, and the verification result of the detection result of the file to be detected is received. Then, when the verification result indicates that the detection result is correct, the target hash value of the file to be detected is stored in the malicious file information library of the malicious file family indicated by the detection result; or, when the verification result indicates that the detection result is wrong, the target hash value of the file to be detected is stored in the malicious file information library of the malicious file family indicated by the verification result.

[0192] In this embodiment, the execution subject of the method may be a computing device such as a computer or a server, and no limitation is made in this embodiment.

[0193] It can be seen that the implementation of the malicious file detection method described in this embodiment can build a malicious file information library of the malicious file family based on the local sensitive hash algorithm, thereby improving the detection capability of malicious files and realizing rapid detection of suspected malicious files, so that it can cope with the rapidly evolving network threat environment; at the same time, it can also reduce the consumption of human and material resources.

[0194] Example 3

[0195] Please see Figure 4 , Figure 4 A flowchart of calculating a first local sensitive hash value based on all code segments provided in this embodiment. Among them, multiple types of file content include code segments and file content different from code segments. For each code segment extracted from the file to be detected, the following steps are performed:

[0196] S11. Extract executable functions from the code segment.

[0197] Please also see Figure 5 , Figure 5 FIG. 1 shows an example flow chart of calculating the first local sensitive hash value based on all code segments. Figure 5 As shown, the method can filter out sections with executable attributes (the section includes machine code instructions of the executable program) from various sections ("section" refers to the PE section, which is an important component in the PE file) in the malicious file (PE file) according to the pefbuf object.

[0198] Among them, the section obtained by screening is called a code segment in this application, the code segment is named exeSection, and the collection of the code segments is named exeSections.

[0199] In this embodiment, the code segment includes multiple executable functions, the executable function includes multiple executable instructions (the executable instructions may be operation code instructions), and the executable instruction includes multiple operation codes.

[0200] S12: Determine whether the execution entry point of the executable function is detected. If so, execute step S13; if not, execute step S14.

[0201] In this embodiment, in exeSections, exeSection is used to represent the elements therein.

[0202] like Figure 5 As shown, this method can search for the entry point of function execution for each exeSection, and if the entry point is found, the address of the entry point is returned; if not found, the address of the starting position of exeSection is returned. A pointer variable is used to point to the returned address, and the pointer variable is recorded as startPos.

[0203] S13. Record the execution entry point as a pointer variable, and execute step S15.

[0204] S14. Record the address of the starting position of the code segment as a pointer variable, and execute step S15.

[0205] S15. Traverse the code segment based on the pointer variable, and extract the operation codes included in all instructions in the executable function during the traversal process to obtain the operation code sequence corresponding to each executable function.

[0206] like Figure 5 As shown, the method can start traversing the content of the exeSection based on startPos. During the traversal, the method extracts all executable instructions in the executable function and all opcodes in the executable instructions based on the executable function, forming an opcode sequence, and naming the opcode sequence opcodeSeq.

[0207] S16. Perform hash calculations on each operation code sequence to obtain multiple first hash values.

[0208] like Figure 5 As shown, the method can use a hash algorithm to calculate the hash value of opcodeSeq (ie, the first hash value), and the hash value is used as a token (which can be understood as an identifier).

[0209] In this embodiment, the method does not limit the hash algorithm, and the hash algorithm used by default has good "anti-collision" properties.

[0210] In this embodiment, the method can obtain all opcodeSeq extracted in units of functions in the section by traversing all the contents of exeSection. At the same time, by repeatedly executing this step, all calculated tokens are stored in order to obtain tokens (corresponding to multiple first hash values).

[0211] S17. Extracting a first distribution feature based on the multiple first hash values.

[0212] In this embodiment, by implementing the above steps S11 to S17, it is possible to obtain the first distribution feature extracted according to the operation code sequence corresponding to each code segment.

[0213] like Figure 5 As shown, the method can count the distribution information of tokens according to the calculated tokens and extract distribution features (i.e., first distribution features) therefrom, and generate a feature dictionary features based on multiple distribution features (where features includes multiple features, and feature refers to distribution features). The distribution features can be multivariate grammatical features of tokens.

[0214] In this embodiment, the method does not limit the way of extracting the first distribution feature.

[0215] S18. Generate a first feature dictionary of the code segment based on the first distribution feature.

[0216] S19. Merge the first feature dictionaries of all code segments to obtain a first target feature dictionary.

[0217] S20. Calculate a first locally sensitive hash value according to a first distribution feature in a first target feature dictionary.

[0218] In this embodiment, by implementing the above steps S18 to S20, the first local sensitive hash value can be obtained according to the extracted first distribution features.

[0219] In this embodiment, after each traversal of an exeSection in exeSections, the first feature dictionary is updated until all exeSections are traversed to obtain the final features (first target feature dictionary).

[0220] In this embodiment, all first feature dictionaries corresponding to all code segments are updated and the first distribution features after iteration are calculated to calculate the local sensitive hash value.

[0221] like Figure 5 As shown, this method can calculate the local sensitive hash value of the PE file based on the opcode according to the information of features, which is recorded as opc_LSH.

[0222] In this embodiment, the method does not limit the local sensitive hashing algorithm.

[0223] In this embodiment, the execution subject of the method may be a computing device such as a computer or a server, and no limitation is made in this embodiment.

[0224] It can be seen that the implementation of the first locally sensitive hash value calculation method described in this embodiment can realize the similarity hash value calculation for some files, thereby providing data protection for the subsequent malicious file detection step.

[0225] Example 4

[0226] Please see Figure 6 , Figure 6 A flowchart of calculating a second local sensitive hash value based on all strings provided in this embodiment. In which, multiple types of file content include data segments and file content different from data segments; for each data segment extracted from the file to be detected, the following steps are performed:

[0227] S21. Extract the file character string in the data segment.

[0228] Please also see Figure 7 , Figure 7 An example flow chart of calculating the second local sensitive hash value based on all strings is shown. Figure 7 As shown, the method can filter out sections with data attributes (the sections include file strings) from various sections in a malicious file (PE file) according to the pefbuf object. The filtered sections are referred to as strings in this application, the strings are named dataSection, and the set of the strings is named dataSections.

[0229] In this embodiment, in dataSections, dataSection is used to represent the elements therein.

[0230] In this embodiment, the data information corresponding to the data attribute may be character string information of the executable program (ie, file character string).

[0231] S22, performing denoising processing on the file character string to obtain a denoised file character string.

[0232] like Figure 7As shown, the method can use a preset string matching template to match each dataSection to obtain a printable type string (ie, a filter string) containing a specific string in the template.

[0233] In this embodiment, this step can filter out printable character strings based on a preset character string matching template, thereby achieving the effect of filtering out noise in the character strings.

[0234] S23, segmenting the denoised file character string to obtain a plurality of segmented character strings.

[0235] like Figure 7 As shown, after obtaining the printable string, the method segments the printable string to obtain multiple segmented strings, and determines the segmented strings as tokens (which can be understood as identifiers). The obtained tokens can be stored in sequence to further obtain tokens (corresponding to multiple segmented strings).

[0236] S24. Extracting a second distribution feature based on the multiple segmented character strings.

[0237] In this embodiment, by implementing the above steps S21 to S24, the second distribution feature extracted from the file character string corresponding to each data segment can be obtained.

[0238] S25. Generate a second feature dictionary for the data segment based on the second distribution feature.

[0239] like Figure 7 As shown, the method can count the distribution information of tokens according to the calculated tokens and extract distribution features (i.e., second distribution features) therefrom, and generate a feature dictionary features based on multiple distribution features (where features includes multiple features, and feature refers to distribution features). The distribution features can be multivariate grammatical features of tokens.

[0240] In this embodiment, the method does not limit the way of extracting the second distribution feature.

[0241] S26. Merge the second feature dictionaries of all data segments to obtain a second target feature dictionary.

[0242] In this embodiment, after each traversal of a dataSection in dataSections, the second feature dictionary is updated until all dataSections are traversed to obtain the final features (second target feature dictionary).

[0243] S27. Calculate a second local sensitive hash value based on the second distribution feature in the second target feature dictionary.

[0244] In this embodiment, by implementing the above steps S25 to S27, the second local sensitive hash value can be obtained according to the extracted second distribution features.

[0245] For example, this method can calculate the string-based local sensitive hash value of the PE file based on the features information, denoted as str_LSH.

[0246] In this embodiment, the method does not limit the local sensitive hashing algorithm.

[0247] In this embodiment, the execution subject of the method may be a computing device such as a computer or a server, and no limitation is made in this embodiment.

[0248] It can be seen that the implementation of the second locally sensitive hash value calculation method described in this embodiment can realize the similarity hash value calculation for some files, thereby providing data protection for the subsequent malicious file detection step.

[0249] Example 5

[0250] Please see Figure 8 , Figure 8 A schematic diagram of the structure of a malicious file detection device provided in this embodiment. Figure 8 As shown, the malicious file detection device includes:

[0251] The extraction unit 410 is used to extract multiple types of file contents from the file to be detected.

[0252] A first acquisition unit 420 is used to obtain local sensitive hash values ​​corresponding to multiple types of file contents;

[0253] A first concatenation unit 430 is used to concatenate the local sensitive hash values ​​corresponding to the contents of multiple types of files to obtain a target hash value of the file to be detected;

[0254] A first calculation unit 440 is used to calculate similarities between a target hash value and hash values ​​in a plurality of malicious file information repositories, respectively, to obtain a plurality of similarities, wherein different malicious file information repositories are constructed based on hash values ​​of malicious files belonging to different malicious file families; and a hash value of any malicious file is obtained by concatenating local sensitive hash values ​​corresponding to multiple types of file contents in the malicious file;

[0255] The first determining unit 450 is configured to determine, from among the multiple malicious file families, the malicious file family to which the file to be detected belongs according to the respective similarities.

[0256] In this embodiment, the explanation of the malicious file detection device can refer to the description in Embodiments 1 to 5, which will not be further described in this embodiment.

[0257] It can be seen that the malicious file detection device described in this embodiment can build a malicious file information library of the malicious file family based on the local sensitive hash algorithm, thereby improving the detection capability of malicious files and realizing rapid detection of suspected malicious files, so that it can cope with the rapidly evolving network threat environment; at the same time, it can also reduce the consumption of human and material resources.

[0258] Example 6

[0259] Please see Fig. 9 , Fig. 9 A schematic diagram of the structure of a malicious file detection device provided in this embodiment. Fig. 9 As shown, the malicious file detection device includes:

[0260] An extraction unit 410 is used to extract multiple types of file contents from the file to be detected;

[0261] A first acquisition unit 420 is used to obtain local sensitive hash values ​​corresponding to multiple types of file contents;

[0262] A first concatenation unit 430 is used to concatenate the local sensitive hash values ​​corresponding to the contents of multiple types of files to obtain a target hash value of the file to be detected;

[0263] A first calculation unit 440 is used to calculate similarities between a target hash value and hash values ​​in a plurality of malicious file information repositories, respectively, to obtain a plurality of similarities, wherein different malicious file information repositories are constructed based on hash values ​​of malicious files belonging to different malicious file families; and a hash value of any malicious file is obtained by concatenating local sensitive hash values ​​corresponding to multiple types of file contents in the malicious file;

[0264] The first determining unit 450 is configured to determine, from among the multiple malicious file families, the malicious file family to which the file to be detected belongs according to the respective similarities.

[0265] As an optional implementation, the malicious file detection device further includes:

[0266] The second acquisition unit 460 is used to acquire a malicious file set of a target malicious file family; wherein the target malicious file family is any malicious file family among the multiple malicious file families;

[0267] A mapping unit 470, used to map malicious files in the malicious file set to the created buffer area respectively, to obtain a mapping file set corresponding to the malicious file set;

[0268] An extraction unit 480, configured to extract multiple types of file contents included in each mapping file in the mapping file set;

[0269] The third acquisition unit 490 is used to obtain the local sensitive hash value corresponding to each type of file content;

[0270] The second concatenation unit 500 is used to concatenate the local sensitive hash values ​​corresponding to the file contents of each type of the mapping file for each mapping file to obtain the hash value of the mapping file;

[0271] The information library construction unit 510 is used to construct a malicious file information library corresponding to the target malicious file family according to the hash value of each mapping file in the mapping file set.

[0272] As an optional implementation, the mapping unit 470 includes:

[0273] An extraction subunit 471 is used to extract suspected shelled malicious files and unshelled malicious files included in the malicious file set;

[0274] The de-shelling sub-unit 472 is used to de-shell the suspected malicious file to obtain the de-shelled malicious file;

[0275] The mapping subunit 473 is used to map the malicious files in the shell-less malicious files and the shell-removed malicious files to the created buffer areas respectively, and obtain a mapping file set corresponding to the malicious file set.

[0276] As an optional implementation, the unpacking sub-unit 472 is specifically used to obtain suspected packed malicious files; and perform sandbox simulation on the suspected packed malicious files, and identify the file running behavior and suspected packed features during the sandbox simulation process; and based on the file running behavior and suspected packed features, unpack the suspected packed malicious files through reverse engineering tools to obtain unpacked malicious files.

[0277] As an optional implementation, the malicious file detection device further includes:

[0278] The second determination unit 520 is used to determine whether there are multiple hash values ​​that meet a preset condition in the malicious file information library of the multiple malicious file families constructed; wherein when the similarity between the multiple hash values ​​is greater than a first similarity threshold, the multiple hash values ​​meet the preset condition;

[0279] The first transfer unit 530 is used to transfer multiple hash values ​​that meet preset conditions from the malicious file information libraries of the multiple malicious file families to the general information library, wherein the general information library is different from any malicious file information library of the malicious file information libraries of the multiple malicious file families.

[0280] As an optional implementation manner, the multiple types of file contents include code segments and data segments; the first acquisition unit 420 includes:

[0281] A first acquisition subunit 421 is used to acquire first distribution features extracted according to the operation code sequence corresponding to each code segment, and acquire a first local sensitive hash value according to each extracted first distribution feature;

[0282] The second acquisition subunit 422 is used to obtain second distribution features extracted according to the file character strings corresponding to each data segment, and obtain a second local sensitive hash value according to each extracted second distribution feature.

[0283] As an optional implementation, multiple types of file content include code segments and file content different from code segments; the first acquisition unit 420 is specifically used to perform the following operations for each code segment extracted from the file to be detected: extract an executable function from the code segment; determine whether an execution entry point of the executable function is detected; if so, record the execution entry point as a pointer variable; if not, record the address of the starting position of the code segment as a pointer variable; traverse the code segment based on the pointer variable, and extract the operation codes included in all instructions in the executable function during the traversal process to obtain an operation code sequence corresponding to each executable function; perform hash calculations on each operation code sequence to obtain multiple first hash values; extract a first distribution feature based on the multiple first hash values, and generate a first feature dictionary for the code segment based on the first distribution feature; merge the first feature dictionaries of all code segments to obtain a first target feature dictionary; calculate a first locally sensitive hash value based on the first distribution feature in the first target feature dictionary.

[0284] As an optional implementation, multiple types of file content include data segments and file content different from the data segments; the first acquisition unit 420 is specifically used to perform the following operations for each data segment extracted from the file to be detected: extract the file string in the data segment; denoise the file string to obtain a denoised file string; segment the denoised file string to obtain multiple segmented strings; extract a second distribution feature based on the multiple segmented strings, and generate a second feature dictionary for the data segment based on the second distribution feature; merge the second feature dictionaries of all data segments to obtain a second target feature dictionary; and calculate a second local sensitive hash value based on the second distribution feature in the second target feature dictionary.

[0285] As an optional implementation, the malicious file detection device further includes:

[0286] A receiving unit 540 is configured to receive a verification result of the detection result of the file to be detected when the detection result of the file to be detected indicates the existence of a malicious file family to which the file to be detected belongs;

[0287] A storage unit 550 is used to store the target hash value of the file to be detected in a malicious file information library of the malicious file family indicated by the detection result when the verification result indicates that the detection result is correct;

[0288] The storage unit 550 is further configured to store the target hash value of the file to be detected in a malicious file information library of the malicious file family indicated by the verification result when the verification result indicates that the detection result is wrong.

[0289] In this embodiment, the explanation of the malicious file detection device can refer to the description in Embodiments 1 to 4, which will not be further described in this embodiment.

[0290] It can be seen that the malicious file detection device described in this embodiment can build a malicious file information library of the malicious file family based on the local sensitive hash algorithm, thereby improving the detection capability of malicious files and realizing rapid detection of suspected malicious files, so that it can cope with the rapidly evolving network threat environment; at the same time, it can also reduce the consumption of human and material resources.

[0291] An embodiment of the present application provides an electronic device, including a memory and a processor, wherein the memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to execute a method provided by any one of the aforementioned embodiments of the present application.

[0292] An embodiment of the present application provides a computer-readable storage medium storing computer program instructions. When the computer program instructions are read and executed by a processor, the method provided by any one of the aforementioned embodiments of the present application is executed.

[0293] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0294] In addition, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.

[0295] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0296] The above description is only an embodiment of the present application and is not intended to limit the scope of protection of the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the scope of protection of the present application. It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings.

[0297] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0298] It should be noted that, in this article, relational terms such as first and second, etc. 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 a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

Claims

1. A malicious file detection method, characterized in that: include: Extract multiple types of file contents from the file to be detected, and obtain local sensitive hash values ​​corresponding to the multiple types of file contents; Concatenate the local sensitive hash values ​​corresponding to the contents of the files of multiple types to obtain the target hash value of the file to be detected; The target hash value is respectively calculated with hash values ​​in a plurality of malicious file information repositories to obtain a plurality of similarities, wherein different malicious file information repositories are constructed based on hash values ​​of malicious files belonging to different malicious file families; and the hash value of any malicious file is obtained by splicing local sensitive hash values ​​corresponding to the contents of multiple types of files in the malicious file; According to each of the similarities, the malicious file family to which the file to be detected belongs is determined from the multiple malicious file families.

2. The method according to claim 1, characterized in that The method further comprises: Obtaining a malicious file set of a target malicious file family; wherein the target malicious file family is any malicious file family among multiple malicious file families; Mapping malicious files in the malicious file set to the created cache areas respectively, to obtain a mapping file set corresponding to the malicious file set; Extracting multiple types of file contents included in each mapping file in the mapping file set, and obtaining local sensitive hash values ​​corresponding to each type of the file contents; For each of the mapping files, concatenate the local sensitive hash values ​​corresponding to the file contents of each type of the mapping file to obtain a hash value of the mapping file; According to the hash value of each mapping file in the mapping file set, a malicious file information library corresponding to the target malicious file family is constructed.

3. The method according to claim 2, characterized in that The method of mapping the malicious files in the malicious file set to the created cache areas to obtain a mapping file set corresponding to the malicious file set includes: Extracting suspected malicious files with shells and malicious files without shells included in the malicious file set; De-shelling the suspected malicious file to obtain a de-shelled malicious file; The malicious files in the unshelled malicious file and the deshelled malicious file are respectively mapped to the created buffer area to obtain a mapping file set corresponding to the malicious file set.

4. The method according to claim 3, characterized in that The step of de-shelling the suspected malicious file to obtain the de-shelled malicious file includes: Obtain the suspected malicious file; Performing sandbox simulation on the suspected malicious file, and identifying the file running behavior and suspected malicious features during the sandbox simulation; Based on the file running behavior and the suspected packed features, the suspected packed malicious file is unpacked by using a reverse engineering tool to obtain an unpacked malicious file.

5. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: For the malicious file information libraries of the multiple malicious file families constructed, determining whether there are multiple hash values ​​that meet a preset condition in the malicious file information libraries of the multiple malicious file families; wherein when the similarity between the multiple hash values ​​is greater than a first similarity threshold, the multiple hash values ​​meet the preset condition; Transferring multiple hash values ​​that meet the preset conditions from the malicious file information repositories of the multiple malicious file families to a general information repository, wherein the general information repository is different from any one of the malicious file information repositories of the multiple malicious file families.

6. The method according to claim 1, characterized in that Multiple types of file contents include code segments and data segments; The obtaining of local sensitive hash values ​​corresponding to the contents of multiple types of files respectively includes: Obtaining a first distribution feature extracted according to an operation code sequence corresponding to each of the code segments, and obtaining a first local sensitive hash value according to each of the extracted first distribution features; Obtain a second distribution feature extracted from a file character string corresponding to each of the data segments, and obtain a second locally sensitive hash value based on each of the extracted second distribution features.

7. The method according to claim 1 or 6, characterized in that: The multiple types of file contents include code segments and file contents different from the code segments; obtaining a first locally sensitive hash value corresponding to the code segments, comprising: For each code segment extracted from the file to be detected, perform the following operations: Extracting an executable function in the code segment; Determining whether an execution entry point of the executable function is detected; If yes, the execution entry point is recorded as a pointer variable; if no, the address of the starting position of the code segment is recorded as a pointer variable; Traversing the code segment based on the pointer variable, and extracting the operation codes included in all instructions in the executable function during the traversal process to obtain an operation code sequence corresponding to each of the executable functions; Performing hash calculations on each of the operation code sequences respectively to obtain a plurality of first hash values; extracting a first distribution feature based on the plurality of first hash values, and generating a first feature dictionary for the code segment based on the first distribution feature; Merging the first feature dictionaries of all the code segments to obtain a first target feature dictionary; A first local sensitive hash value is calculated according to a first distribution feature in the first target feature dictionary.

8. The method according to claim 1 or 7, characterized in that: The multiple types of file contents include data segments and file contents different from the data segments; obtaining a second locally sensitive hash value corresponding to the data segment includes: For each data segment extracted from the file to be detected, the following operations are performed: extracting a file string from the data segment; Performing denoising processing on the file character string to obtain a denoised file character string; Segmenting the denoised file character string to obtain a plurality of segmented character strings; extracting a second distribution feature based on the multiple segmented character strings, and generating a second feature dictionary for the data segment based on the second distribution feature; Merging the second feature dictionaries of all the data segments to obtain a second target feature dictionary; A second locality sensitive hash value is calculated based on a second distribution feature in the second target feature dictionary.

9. The method according to claim 1, characterized in that: The method further comprises: In a case where the detection result of the file to be detected indicates the existence of a malicious file family to which the file to be detected belongs, receiving a verification result of the detection result of the file to be detected; When the verification result indicates that the detection result is correct, storing the target hash value of the file to be detected in a malicious file information library of the malicious file family indicated by the detection result; In the case where the verification result indicates that the detection result is wrong, the target hash value of the file to be detected is stored in a malicious file information library of the malicious file family indicated by the verification result.

10. A malicious file detection device, characterized in that: The malicious file detection device comprises: An extraction unit, used for extracting multiple types of file contents from the file to be detected; A first acquisition unit is used to obtain local sensitive hash values ​​corresponding to multiple types of file contents respectively; A first concatenation unit is used to concatenate the local sensitive hash values ​​corresponding to the contents of the files of multiple types to obtain a target hash value of the file to be detected; A first calculation unit is used to perform similarity calculations on the target hash value and hash values ​​in a plurality of malicious file information repositories respectively, to obtain a plurality of similarities, wherein different malicious file information repositories are constructed based on hash values ​​of malicious files belonging to different malicious file families; and the hash value of any malicious file is obtained by splicing local sensitive hash values ​​corresponding to the contents of multiple types of files in the malicious file; The first determining unit is used to determine the malicious file family to which the file to be detected belongs from the multiple malicious file families according to the similarities.

11. An electronic device, characterized in that: The electronic device comprises a memory and a processor, the memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to execute the malicious file detection method according to any one of claims 1 to 9.