Method, device, electronic device and storage medium for detecting disguised viruses based on file similarity in the same directory
By monitoring the startup file and calculating similarity using multiple factors, the problem of camouflage virus detection in the existing technology is solved, and accurate identification and interception of camouflage viruses is achieved, which is suitable for detection of unknown viruses.
Patent Information
- Application Number
- CN202411164886.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-23
- Publication Date
- 2024-11-01
- Estimated Expiration
- 2044-08-23
AI Technical Summary
The prior art is difficult to accurately detect camouflage viruses, especially those that disguise as business software by changing file names and icons, resulting in the inability to identify and intercept antivirus software.
By listening to the startup file in the target folder, using multiple factors (digital signature, creation time, creation process, access to network address, compiler used and startup process) to calculate the file similarity. If the similarity is lower than the preset threshold, it is determined is an exception file.
Accurate detection and interception of camouflage viruses is realized, and the restrictions on relying on virus characteristics are avoided, and it is suitable for detection and security protection scenarios of unknown viruses.
Smart Images

Figure CN118690367B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer virus detection, and in particular to a method, device, electronic device and storage medium for detecting disguised viruses based on file similarity in the same directory. Background Art
[0002] Some computer viruses disguise themselves as business software files by changing file names and icons and placing them in business software directories to avoid detection by antivirus software or gain the trust of users. For example, a virus changes its file name to WeChat.exe and places it in the WeChat installation directory folder to disguise its identity. When running, users will mistake it for a WeChat program file, and antivirus software and other antivirus products will usually allow the running file to run if they find it in a business file. In addition, if the antivirus software sets the business software directory to be trusted, it will not generate an alarm for such disguised viruses.
[0003] Currently, the virus detection mechanism generally relies on virus characteristics for identification and detection. Summary of the invention
[0004] In view of this, the embodiments of the present invention provide a method, device, electronic device and storage medium for detecting disguised viruses based on file similarity in the same directory, which can detect disguised viruses without relying on virus features, thereby facilitating accurate discovery of disguised viruses.
[0005] In order to achieve the above-mentioned invention object, the following technical scheme is adopted:
[0006] In a first aspect, an embodiment of the present invention provides a method for detecting disguised viruses based on file similarity in the same directory, comprising:
[0007] Monitor the startup file in the target folder;
[0008] When the execution operation of the startup file is monitored, the similarity judgment standard corresponding to each factor is obtained from the similarity judgment standard knowledge base, and the similarity between the startup file and other files in the target folder is comprehensively calculated based on multiple factors; wherein the similarity judgment standard knowledge base stores the similarity judgment standard corresponding to each factor;
[0009] Comparing the calculated similarity with a preset similarity threshold, determining whether the startup file is abnormal;
[0010] If the similarity is lower than the similarity threshold, it is determined that there is an abnormality in the startup file;
[0011] If the similarity is higher than the similarity threshold, it is determined that there is no abnormality in the startup file.
[0012] Optionally, the multiple factors include: at least two of: digital signature, creation time, creation process, access network address, compiler used and startup process.
[0013] Optionally, after acquiring the similarity determination standard corresponding to each factor from the similarity determination standard knowledge base, the method further includes:
[0014] For each factor, the similarity score corresponding to the factor is determined based on the corresponding similarity judgment criteria;
[0015] The comprehensive calculation of the similarity between the startup file and other files in the target folder based on multiple factors includes:
[0016] According to the obtained similarity score corresponding to each factor, a corresponding weight is assigned to each factor to obtain the similarity weighted score corresponding to each factor;
[0017] The obtained similarity weighted scores corresponding to each factor are summed up to obtain the similarity between the startup file and other files in the target folder.
[0018] Optionally, the multiple factors include: a digital signature, a compiler used, and a startup process;
[0019] For each factor, determining the similarity score corresponding to the factor based on the corresponding similarity determination criteria includes:
[0020] For the digital signature, the similarity determination standard corresponding to the digital signature is obtained from the similarity determination standard knowledge base, and the digital signatures of the startup file and other files in the target folder are obtained; wherein the similarity determination standard corresponding to the digital signature specifies the similarity score standard corresponding to the digital signature;
[0021] If the startup file has no digital signature, and other files have digital signatures, the similarity score corresponding to this factor is determined to be 0;
[0022] If the startup file and other files do not have digital signatures, the similarity score corresponding to this factor is determined to be 70 points;
[0023] If both the startup file and the other files have digital signatures, then the digital signature of the startup file is compared with the digital signatures of the other files;
[0024] If the number of matched matches reaches a first predetermined number standard, the similarity score corresponding to the factor is determined to be full score;
[0025] If the number of matched matches does not reach the first predetermined number standard, the similarity score corresponding to the factor is determined to be 0 points;
[0026] And, for the compiler used, obtaining the similarity determination standard of the compiler used from the similarity determination standard knowledge base, and obtaining the compiler used by the startup file and other files in the target folder; wherein the similarity determination standard corresponding to the compiler used specifies the similarity score standard corresponding to the compiler used;
[0027] Comparing the compiler used in the startup file with the compiler used in the other files;
[0028] If the number of matched matches reaches the second predetermined number standard, the similarity score corresponding to the factor is determined to be full score;
[0029] If the number of matched matches does not reach the second predetermined number standard, the similarity score corresponding to the factor is determined to be 0;
[0030] And, for the startup process, the startup events of all files under the target file are monitored in advance.
[0031] Collect the startup process information of each file, including process name, startup time, and command line parameters of execution;
[0032] The collected startup process information is stored in a startup process information list;
[0033] The determining of the similarity score corresponding to each factor based on the corresponding similarity judgment standard includes: obtaining the similarity judgment standard of the startup process from the similarity judgment standard knowledge base, and obtaining the startup process of the startup file and other files in the target folder; wherein the similarity judgment standard corresponding to the startup process specifies the similarity score standard corresponding to the startup process;
[0034] Comparing the startup process information of the startup file with a pre-formed startup process information list;
[0035] Determine whether the startup process information of the startup file is in the startup process list of other files in the target folder;
[0036] If it is in the startup process list of other files, the similarity score corresponding to this factor is determined to be full score;
[0037] If it is not in the startup process list of other files, the similarity score corresponding to this factor is determined to be 0.
[0038] Optionally, the multiple factors also include:
[0039] Creation time, creation process and access network address;
[0040] The step of determining the similarity score corresponding to each factor based on the corresponding similarity determination criteria also includes:
[0041] For the creation time, obtaining the similarity determination standard corresponding to the creation time from the similarity determination standard knowledge base, and obtaining the creation time of the startup file and other files in the target folder; wherein the similarity determination standard corresponding to the creation time specifies the similarity score standard corresponding to the creation time;
[0042] Compare the creation time of the startup file with the creation time of the other files;
[0043] If the creation time of the startup file is different from the creation time of the other files, the similarity score corresponding to the factor is determined to be 0;
[0044] If the creation time of the startup file is the same as the creation time of the other files, then count the number of files with the same creation time;
[0045] If the number of the same creation time reaches the third predetermined number standard, the similarity score corresponding to the factor is determined to be 50 points;
[0046] If the number of the same creation time reaches the fourth predetermined number standard, the similarity score corresponding to the factor is determined to be 100 points; wherein the third predetermined number standard is less than the fourth predetermined number standard;
[0047] And, for the creation process, pre-monitor all file creation process events under the target file;
[0048] Collect the creation process information of each file, including process name, file path, creation time, and command line parameters;
[0049] The collected creation process information is stored in a creation process information list;
[0050] The determining of the similarity score corresponding to each factor based on the corresponding similarity judgment standard includes: obtaining the similarity judgment standard of the creation process from the similarity judgment standard knowledge base, and obtaining the creation process of the startup file and other files in the target folder; wherein the similarity judgment standard corresponding to the creation process specifies the similarity score standard corresponding to the creation process;
[0051] Comparing the creation process information of the startup file with a pre-formed creation process information list;
[0052] Determine whether the creation process information of the startup file is in the creation process list of other files in the target folder;
[0053] If it is in the creation process list of other files, the similarity score corresponding to this factor is determined to be full score;
[0054] If it is not in the creation process list of other files, the similarity score corresponding to this factor is determined to be 0;
[0055] And, for accessing the network address, pre-monitoring the access network events of all files under the target file;
[0056] Collect the access network address of each file;
[0057] The collected access network addresses are stored in an access network address list;
[0058] The determining of the similarity score corresponding to each factor based on the corresponding similarity determination standard includes: obtaining the similarity determination standard of the access network address from the similarity determination standard knowledge base, and obtaining the access network addresses of the startup file and other files in the target folder; wherein the similarity determination standard corresponding to the access network address specifies the similarity score standard corresponding to the access network address;
[0059] Comparing the access network address information of the startup file with a pre-formed access network address information list;
[0060] Determine whether the access network address information of the startup file is in the access network address list of other files in the target folder;
[0061] If it is in the list of access network addresses of other files, the similarity score corresponding to this factor is determined to be full score;
[0062] If it is not in the access network address list of other files, the similarity score corresponding to this factor is determined to be 0.
[0063] Optionally, the similarity and a preset similarity threshold are between 0 and 1, and comparing the calculated similarity with the preset similarity threshold to determine whether the startup file is abnormal includes:
[0064] If the similarity is higher than the preset similarity threshold, it is determined that there is no abnormality in the startup file;
[0065] If the similarity is lower than the preset similarity threshold, it is determined that there is an abnormality in the startup file.
[0066] In a second aspect, an embodiment of the present invention further provides a device for detecting disguised viruses based on the similarity of files in the same directory, comprising:
[0067] A monitoring program unit is used to monitor the startup file in the target folder;
[0068] A calculation program unit is used for obtaining the similarity judgment standard corresponding to each factor from the similarity judgment standard knowledge base when monitoring the execution operation of the startup file, and comprehensively calculating the similarity between the startup file and other files in the target folder based on multiple factors; wherein the similarity judgment standard knowledge base stores the similarity judgment standard corresponding to each factor;
[0069] The determination program unit is used to compare the calculated similarity with a preset similarity threshold to determine whether the startup file is abnormal.
[0070] Optionally, it further includes: a single factor similarity determination module, used to determine the similarity score corresponding to each factor based on the corresponding similarity determination standard;
[0071] The computing program unit is specifically used for:
[0072] According to the obtained similarity score corresponding to each factor, a corresponding weight is assigned to each factor to obtain the similarity weighted score corresponding to each factor;
[0073] The obtained similarity weighted scores corresponding to each factor are summed up to obtain the similarity between the startup file and other files in the target folder.
[0074] In a third aspect, an embodiment of the present invention provides an electronic device, comprising: one or more processors; a memory; one or more executable programs are stored in the memory, and the one or more processors read the executable program code stored in the memory to execute any method of detecting disguised viruses based on file similarity in the same directory as described in the first aspect.
[0075] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to execute any method of detecting disguised viruses based on file similarity in the same directory as described in the first aspect.
[0076] The method, system, electronic device and storage medium for detecting disguised viruses based on the similarity of files in the same directory provided by the embodiments of the present invention obtain the similarity judgment standard corresponding to each factor from the similarity judgment standard knowledge base when monitoring the execution of the startup file, and comprehensively calculate the similarity between the startup file and other files in the target folder based on multiple factors, and compare the calculated similarity with the preset similarity threshold to determine whether the startup file is abnormal. In this way, compared with traditional virus detection methods, the detection of disguised viruses can be achieved without relying on virus features; in addition, since the similarity is calculated by comprehensively considering multiple factors, the similarity calculated from multiple dimensions is used to determine whether the startup file is abnormal, which is easier to find disguised viruses than calculating similarity from a single feature dimension as the basis for determination. BRIEF DESCRIPTION OF THE DRAWINGS
[0077] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0078] Figure 1 This is a flow chart of a method for detecting disguised viruses based on file similarity in the same directory according to an embodiment of the present invention;
[0079] Figure 2 This is a flow chart of a method for detecting disguised viruses based on file similarity in the same directory according to another embodiment of the present invention;
[0080] Figure 3 This is a schematic block diagram of a program architecture of a device for detecting disguised viruses based on similarity of files in the same directory according to an embodiment of the present invention;
[0081] Figure 4 The present invention is a schematic block diagram of a program architecture of an embodiment of an electronic device. DETAILED DESCRIPTION
[0082] The embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0083] It should be clear that the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0084] The method for detecting disguised viruses based on the similarity of files in the same directory provided by the embodiment of the present invention can be applied to computer virus detection scenarios. By calculating the similarity between the startup file and other files in the same directory folder based on a multi-factor algorithm and comparing the similarity with a preset threshold, disguised viruses can be quickly detected.
[0085] It should be noted that the method can be solidified in a certain manufactured physical product in the form of software, and when the user uses the product, the method flow of the present application can be reproduced.
[0086] Figure 1 FIG. 1 is a flow chart of a method for detecting disguised viruses based on file similarity in the same directory according to an embodiment of the present invention; Figure 1 As shown, the method for detecting disguised viruses based on the similarity of files in the same directory to be analyzed may include the following steps:
[0087] S110, monitoring the startup file in the target folder.
[0088] In this embodiment, the monitoring of the startup file can be realized by monitoring the activities of the folder through the hook function. For different operating systems, a specific hook function can be written and registered in the operating system or file system to perform the task of monitoring when the startup file under the target folder is executed.
[0089] For example, for a Linux system, one implementation method for implementing the above monitoring may be: using the inotify library to create a monitor for monitoring file activities in a target folder.
[0090] Specify the folder path to be monitored and add the said folder path to the inotify listener.
[0091] Define an event processing function handle event, which is used to process the event captured by the inotify listener;
[0092] When the startup file is opened and run, if the event type matches IN OPEN (an inotify constant indicating that a file is opened), the handler will print out the name of the startup file that was opened.
[0093] After the configuration is completed, the event monitoring loop is started, and the inotify listener will continuously generate events.
[0094] For each event generated, the processing function is called to repeat the above monitoring process to implement monitoring of the file.
[0095] Similarly, the monitoring implementation in Windows system can use FileSystemWatcher class to monitor folders. Set the path of FileSystemWatcher to the target folder, and set the filter to focus only on executable files (.exe), that is, startup files. Define a callback function, which will be called when the file changes, such as being modified. The function will print out the name of the modified file. Activate FileSystemWatcher to make it start monitoring the startup file in the folder to implement the monitoring of the startup file.
[0096] S120. When the startup file execution operation is monitored, the similarity determination standard corresponding to each factor is obtained from the similarity determination standard knowledge base, and the similarity between the startup file and other files in the target folder is comprehensively calculated based on multiple factors; wherein the similarity determination standard knowledge base stores the similarity determination standard corresponding to each factor.
[0097] The similarity judgment standard knowledge base needs to be pre-built and maintained. The specific construction method can be: extracting static and dynamic features of files from known file samples, such as static features such as file digital signature, creation time, file structure, metadata, and dynamic features such as creation process, access network address, compiler used, startup process, etc. Each feature is regarded as a factor participating in the similarity calculation, and a similarity judgment standard is set for each feature separately. Depending on the situation, two or more of these features can also be used together as the basis for similarity judgment calculation. Then store to form a similarity judgment standard knowledge base.
[0098] In some embodiments, the multiple factors include at least two of: digital signature, creation time, creation process, access network address, compiler used, and startup process.
[0099] S130: Determine whether the startup file is abnormal by comparing the calculated similarity with a preset similarity threshold.
[0100] S140A: If the similarity is lower than the similarity threshold, determine that there is an abnormality in the startup file.
[0101] S140B: If the similarity is higher than the similarity threshold, determine that there is no abnormality in the startup file.
[0102] In this embodiment, when a startup file is monitored to execute an operation, the similarity judgment standard related to each factor involved in the calculation is obtained from the knowledge base, and then multiple factors are used to perform a comprehensive similarity calculation to compare the similarity between the startup file and other files in the target folder. If the similarity exceeds a preset threshold, it indicates that the startup file is relatively similar to the other files, which is normal. On the contrary, if the similarity is low, it indicates an abnormality, and it is determined that the startup file is abnormal.
[0103] The method for detecting disguised viruses based on file similarity in the same directory provided by the embodiment of the present invention monitors the startup file, performs comprehensive similarity calculation with other files from multiple factors, and determines whether the startup file is abnormal based on the similarity calculation result. Compared with the traditional virus detection method, the detection of disguised viruses can be achieved without relying on virus features. In addition, since the similarity is calculated by comprehensively considering multiple factors, the similarity calculated from multiple dimensions is used to determine whether the startup file is abnormal. Compared with performing similarity calculation from a single feature dimension as the basis for determination, it is easy to discover disguised viruses.
[0104] In some embodiments, after obtaining the similarity determination standard corresponding to each factor from the similarity determination standard knowledge base, step S120 further includes: for each factor, determining the similarity score corresponding to the factor based on the corresponding similarity determination standard.
[0105] Exemplarily, the multiple factors include: a digital signature, a compiler used, and a startup process.
[0106] For a factor being a digital signature, obtaining a similarity determination standard corresponding to the digital signature from the similarity determination standard knowledge base, and obtaining digital signatures of the startup file and other files in the target folder; wherein the similarity determination standard corresponding to the digital signature specifies a similarity score standard corresponding to the digital signature;
[0107] If the startup file has no digital signature, and other files have digital signatures, the similarity score corresponding to this factor is determined to be 0 points; if neither the startup file nor other files have digital signatures, the similarity score corresponding to this factor is determined to be 70 points; if both the startup file and other files have digital signatures, the digital signature of the startup file is compared with the digital signatures of the other files; if the number of consistent comparisons reaches a first predetermined number standard, the similarity score corresponding to this factor is determined to be full marks; if the number of consistent comparisons does not reach the first predetermined number standard, the similarity score corresponding to this factor is determined to be 0 points.
[0108] For the factor of the used compiler, the similarity determination standard of the used compiler is obtained from the similarity determination standard knowledge base, and the compiler used by the startup file and other files in the target folder is obtained; wherein the similarity determination standard corresponding to the used compiler specifies the similarity score standard corresponding to the used compiler;
[0109] The types of compilers used in the startup file and compilers used in the other files are compared; if the number of consistent comparisons reaches a second predetermined number standard, the similarity score corresponding to the factor is determined to be full marks; if the number of consistent comparisons does not reach the second predetermined number standard, the similarity score corresponding to the factor is determined to be 0 points.
[0110] In other embodiments, for the factor of startup process, the startup events of all files under the target file are monitored in advance; the startup process information of each file is collected, including the process name, startup time, and command line parameters of execution; and the collected startup process information is stored in a startup process information list.
[0111] The determining of the similarity score corresponding to each factor based on the corresponding similarity judgment standard includes: obtaining the similarity judgment standard of the startup process from the similarity judgment standard knowledge base, and obtaining the startup process of the startup file and other files in the target folder; wherein the similarity judgment standard corresponding to the startup process specifies the similarity score standard corresponding to the startup process;
[0112] Compare the startup process information of the startup file with a pre-formed startup process information list; determine whether the startup process information of the startup file is in the startup process list of other files under the target folder; if it is in the startup process list of other files, determine that the similarity score corresponding to this factor is full marks; if it is not in the startup process list of other files, determine that the similarity score corresponding to this factor is 0 points.
[0113] In still other embodiments, the multiple factors further include: creation time, creation process, and access network address;
[0114] The step of determining the similarity score corresponding to each factor based on the corresponding similarity determination criteria also includes:
[0115] For the factor being the creation time, obtaining the similarity determination standard corresponding to the creation time from the similarity determination standard knowledge base, and obtaining the creation time of the startup file and other files in the target folder; wherein the similarity determination standard corresponding to the creation time specifies the similarity score standard corresponding to the creation time;
[0116] Comparing the creation time of the startup file with the creation time of the other files;
[0117] If the creation time of the startup file is different from the creation time of the other files, the similarity score corresponding to the factor is determined to be 0;
[0118] If the creation time of the startup file is the same as the creation time of the other files, then count the number of files with the same creation time;
[0119] If the number of the same creation time reaches the third predetermined number standard, the similarity score corresponding to the factor is determined to be 50 points;
[0120] If the number of the same creation time reaches the fourth predetermined number standard, the similarity score corresponding to the factor is determined to be 100 points; wherein the third predetermined number standard is less than the fourth predetermined number standard;
[0121] And, for the creation process, pre-monitor all file creation process events under the target file; collect the creation process information of each file, including the process name, file path, creation time, and command line parameters; and store the collected creation process information into a creation process information list;
[0122] The method of determining the similarity score corresponding to each factor based on the corresponding similarity judgment standard includes: obtaining the similarity judgment standard of the creation process from the similarity judgment standard knowledge base, and obtaining the creation process of the startup file and other files in the target folder; wherein the similarity judgment standard corresponding to the creation process specifies the similarity score standard corresponding to the creation process; comparing the creation process information of the startup file with a pre-formed creation process information list; determining whether the creation process information of the startup file is in the creation process list of other files in the target folder; if so, determining that the similarity score corresponding to the factor is full marks; if not in the creation process list of other files, determining that the similarity score corresponding to the factor is 0.
[0123] With respect to the access network address, the access network events of all files under the target file are monitored in advance; the access network address of each file is collected; and the collected access network addresses are formed into an access network address list for storage.
[0124] The method of determining the similarity score corresponding to each factor based on the corresponding similarity judgment standard includes: obtaining the similarity judgment standard of the access network address from the similarity judgment standard knowledge base, and obtaining the access network addresses of the startup file and other files in the target folder; wherein the similarity judgment standard corresponding to the access network address specifies the similarity score standard corresponding to the access network address; comparing the access network address information of the startup file with a pre-formed access network address information list; determining whether the access network address information of the startup file is in the access network address list of other files in the target folder; if so, determining that the similarity score corresponding to the factor is full marks; if not in the access network address list of other files, determining that the similarity score corresponding to the factor is 0.
[0125] At present, there are some methods for homology detection of similar virus firmware, but they are mainly based on a single feature dimension such as file hash value to determine similarity. However, similarity determination based on a single feature such as file hash value is easily affected by slight changes. Even if there is a slight change in the file content, the hash value will be completely different, leading to misjudgment. In addition, some methods for homology detection are mainly based on the currently popular neural network model for detection, but the neural network structure is relatively complex and requires large computing resources.
[0126] Therefore, see Figure 3 As shown, in some embodiments of the present invention, in step S120, the similarity between the startup file and other files in the target folder is calculated based on multiple factors, including:
[0127] According to the obtained similarity score corresponding to each factor, a corresponding weight is assigned to each factor to obtain the similarity weighted score corresponding to each factor;
[0128] The obtained similarity weighted scores corresponding to each factor are summed up to obtain the similarity between the startup file and other files in the target folder.
[0129] Specifically, similarity = (digital signature similarity × N1 + file creation time similarity × N2 + file creation process similarity × N3 + network access address similarity × N4 + file compiler similarity × N5 + startup process similarity × N6…) / 100 × 100%.
[0130] Among them, N1, N2, N3, N4, N5, N6...Nx are the weights corresponding to each factor, and the weights can be customized according to the user's business protection level and scenario. For example, assume that the user's business protection is the security protection of financial institutions and the file server security of ordinary enterprises.
[0131] In the security protection scenario of a financial institution, the weight N1 of the digital signature similarity may be very high, because the documents of financial institutions usually have strict digital signature requirements. The weight can be set to 0.9.
[0132] The weights of file creation time similarity and file creation process similarity will also be higher, because financial institutions usually have fixed processes and times for file creation. The weights of these two factors can be set to 0.8 and 0.85 respectively. The weight of network access address similarity (N4) may be lower, because financial institutions usually have strict network access control and are less likely to have malicious files. The weight can be set to 0.6.
[0133] In the file server security scenario of an ordinary enterprise, the weight N1 of the digital signature similarity may not need to be so high, because not all files have digital signatures. The weight can be set to 0.7.
[0134] The weight N2 of the file creation time similarity can be moderate, because the file creation time may fluctuate to a certain extent. The weight can be set to 0.75. The weight of the network access address similarity (N4) may be higher, because ordinary enterprises may frequently access multiple network addresses, which increases the risk of malicious files. The weight can be set to 0.8.
[0135] In this way, according to different business scenarios and protection requirements, we can adjust the weight of each factor to more effectively identify and protect potential disguised virus files.
[0136] It should be noted that the above weight value examples are only to help understand the settings. In actual situations, these weight values need to be tested and adjusted according to actual conditions to achieve the best protection effect.
[0137] In order to help understand the technical solution and technical effects provided by the embodiment of the present invention, a specific example is described below:
[0138] The attacker disguised a virus as WechatAppLauncher.exe and replaced the file icon with the WeChat icon. The bait file was used to launch the virus. The virus file signature was not in the virus signature library, so the antivirus software could not detect it. Although the system would prompt for startup, the user discovered that it was a WeChat directory file and the file name was also the WeChat program name, which led to its mistaken release.
[0139] The technical solution provided by the embodiment of the present invention is deployed in the protection software. When the WeChat software directory file is monitored to be added, started, modified, etc., the similarity detection is performed on the operated startup file according to this solution. When calculating the similarity, multiple factors of the startup file are calculated, and a similarity score is calculated for each factor according to the corresponding similarity judgment standard. Then, according to the weight of each factor, the total similarity score is added and calculated. The calculation formula is as follows: Similarity = (digital signature similarity × N1 + file creation time similarity × N2 + file creation process similarity × N3 + network access address similarity × N4 + file compiler similarity × N5 + startup process similarity × N6...) / 100 × 100%; Nx represents the weight coefficient, which can be customized based on the user's business protection level and scenario.
[0140] Among them, each factor is based on the corresponding similarity judgment criteria and scores as shown in the following table:
[0141]
[0142]
[0143] The system calculates the similarity value based on the above multiple factors. When the similarity is lower than the threshold, the file can be determined as a risky file and the launch of the file can be blocked.
[0144] In addition, by applying this solution, if it is found that the three factors of the virus file, namely the signature, modification time, and startup process, are significantly different, the file can also be determined to be a risky file and intercepted.
[0145] Therefore, compared with the traditional virus detection method that relies on the virus feature library, the method for detecting disguised viruses based on the similarity of files in the same directory provided by the embodiment of the present invention does not rely on virus features, is convenient for accurately discovering disguised viruses, and is particularly suitable for the detection and security protection scenarios of unknown viruses. Embodiment 2
[0146] Figure 3 This is a schematic block diagram of the binary executable file similarity analysis system architecture according to an embodiment of the present invention. Figure 3 As shown, based on the same technical concept as the embodiments in the above-mentioned embodiment 1, a device for detecting disguised viruses based on the similarity of files in the same directory is also provided, including:
[0147] A monitoring program unit 210 is used to monitor the startup file in the target folder;
[0148] The calculation program unit 220 is used to obtain the similarity judgment standard corresponding to each factor from the similarity judgment standard knowledge base when monitoring the execution operation of the startup file, and comprehensively calculate the similarity between the startup file and other files in the target folder based on multiple factors; wherein the similarity judgment standard knowledge base stores the similarity judgment standard corresponding to each factor;
[0149] The determination program unit 230 is used to compare the calculated similarity with a preset similarity threshold to determine whether the startup file is abnormal.
[0150] In some embodiments, the device further comprises: a single factor similarity determination module, configured to determine, for each factor, a similarity score corresponding to the factor based on a corresponding similarity determination criterion;
[0151] The calculation program unit 220 is further used to: assign a corresponding weight value according to the obtained similarity score corresponding to each factor, and obtain the similarity weighted score corresponding to each factor; sum up the obtained similarity weighted score corresponding to each factor, and obtain the similarity between the startup file and other files in the target folder. The system of this embodiment can be used to execute Figure 1 The technical solution of the method embodiment shown has similar implementation principles and technical effects to those of the first embodiment, which will not be described in detail here and can be referenced by each other.
[0152] In addition, it is understandable that Figure 4 The system shown is also applicable to the execution step processes of other embodiments in Example 1. For details, please refer to the method-related description in Example 1, which will not be repeated here.
[0153] The device for detecting disguised viruses based on the similarity of files in the same directory provided by the embodiment of the present invention comprehensively calculates the similarity of multiple factors and determines the disguised viruses according to the similarity. Compared with the traditional virus detection method that relies on the virus feature library, it does not rely on virus features, and is convenient for accurately discovering disguised viruses. It is particularly suitable for the detection and security protection scenarios of unknown viruses.
[0154] The present invention also provides an electronic device according to an embodiment, comprising: one or more processors; a memory; one or more executable programs are stored in the memory, and the one or more processors read the executable program code stored in the memory to execute the method for detecting disguised viruses based on file similarity in the same directory as described in any one of the first embodiments.
[0155] Figure 4 FIG. 1 is a schematic diagram of the architecture of an electronic device according to an embodiment of the present invention, which can implement any method described in Embodiment 1 of the present invention, such as Figure 4As shown, as an optional embodiment, the above-mentioned electronic device may include: a shell 41, a processor 42, a memory 43, a circuit board 44 and a power supply circuit 45, wherein the circuit board 44 is arranged inside the space enclosed by the shell 41, and the processor 42 and the memory 43 are arranged on the circuit board 44; the power supply circuit 45 is used to supply power to various circuits or devices of the above-mentioned electronic device; the memory 43 is used to store executable program codes; the processor 42 reads the executable program codes stored in the memory 43 to execute the method for detecting disguised viruses based on file similarity in the same directory as described in any of the above-mentioned embodiments one.
[0156] The specific execution process of the above steps by the processor 42 and the steps further executed by the processor 42 by running the executable program code can be found in the description of the first embodiment of the method for detecting disguised viruses based on file similarity in the same directory of the present invention, which will not be repeated here.
[0157] The electronic device exists in various forms, including but not limited to: (1) Mobile communication devices: These devices are characterized by having mobile communication functions and are mainly aimed at providing voice and data communications. Such terminals include: smart phones, multimedia phones, functional phones, and low-end phones. (2) Ultra-mobile personal computer devices: These devices belong to the category of personal computers, have computing and processing functions, and generally also have mobile Internet access features. Such terminals include: PDA, MID and UMPC devices, such as iPad. (3) Portable entertainment devices: These devices can display and play multimedia content. Such devices include: audio and video playback modules (such as iPod), handheld game consoles, e-books, as well as smart toys and portable car navigation devices. (4) Servers: Devices that provide computing services. The server's composition includes processors, hard disks, memory, system buses, etc. The server is similar to the general computer architecture, but because it needs to provide highly reliable services, it has higher requirements in terms of processing power, stability, reliability, security, scalability, manageability, etc. (5) Other electronic devices with data interaction functions.
[0158] An embodiment of the present invention also provides a computer-readable storage medium, which stores one or more programs. The one or more programs can be executed by one or more processors to implement the method for detecting disguised viruses based on file similarity in the same directory as described in any of the above-mentioned embodiments.
[0159] In summary, according to the description of the above embodiments, the method for detecting disguised viruses based on file similarity in the same directory disclosed in the embodiments of the present invention does not rely on virus features to detect disguised viruses, compared with traditional virus detection methods. Therefore, it is not only applicable to known virus detection, but also to unknown virus detection. In addition, since multiple factors are comprehensively considered to calculate the similarity, the similarity calculated from multiple dimensions is used to determine whether there is an abnormality in the startup file, which is easier to detect disguised viruses than calculating the similarity from a single feature dimension as the basis for determination.
[0160] 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.
[0161] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.
[0162] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can also be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0163] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims
1. A method for detecting disguised viruses based on file similarity in the same directory, characterized in that: include: Monitor the startup file in the target folder; When the execution operation of the startup file is monitored, the similarity judgment standard corresponding to each factor is obtained from the similarity judgment standard knowledge base, and the similarity between the startup file and other files in the target folder is comprehensively calculated based on multiple factors; wherein the similarity judgment standard knowledge base stores the similarity judgment standard corresponding to each factor; Comparing the calculated similarity with a preset similarity threshold, determining whether the startup file is abnormal; If the similarity is lower than the similarity threshold, it is determined that there is an abnormality in the startup file; If the similarity is higher than the similarity threshold, it is determined that there is no abnormality in the startup file; The multiple factors include: at least two of: digital signature, creation time, creation process, access network address, compiler used, and startup process; After acquiring the similarity determination standard corresponding to each factor from the similarity determination standard knowledge base, the method further includes: For each factor, determine the similarity score corresponding to the factor based on the corresponding similarity judgment standard; When the multiple factors include: a digital signature, a compiler used, and a startup process; The determining of the similarity score corresponding to each factor based on the corresponding similarity determination criteria includes: For the digital signature, the similarity determination standard corresponding to the digital signature is obtained from the similarity determination standard knowledge base, and the digital signatures of the startup file and other files in the target folder are obtained; wherein the similarity determination standard corresponding to the digital signature specifies the similarity score standard corresponding to the digital signature; If the startup file has no digital signature, and other files have digital signatures, the similarity score corresponding to the factor is determined to be 0; If the startup file and other files do not have digital signatures, the similarity score corresponding to the factor is determined to be 70 points; If both the startup file and the other files have digital signatures, then the digital signature of the startup file is compared with the digital signatures of the other files; If the number of matched matches reaches a first predetermined number standard, the similarity score corresponding to the factor is determined to be full score; If the number of matched matches does not reach the first predetermined number standard, the similarity score corresponding to the factor is determined to be 0; And, for the compiler used, obtaining the similarity determination standard of the compiler used from the similarity determination standard knowledge base, and obtaining the compiler used by the startup file and other files in the target folder; wherein the similarity determination standard corresponding to the compiler used specifies the similarity score standard corresponding to the compiler used; Comparing the compiler used in the startup file with the compiler used in the other files; If the number of matched matches reaches the second predetermined number standard, the similarity score corresponding to the factor is determined to be full score; If the number of matched matches does not reach the second predetermined number standard, the similarity score corresponding to the factor is determined to be 0; And, for the startup process, pre-monitoring the startup events of all files under the target file; Collect the startup process information of each file, including process name, startup time, and command line parameters of execution; The collected startup process information is stored in a startup process information list; Determining the similarity score corresponding to each factor based on the corresponding similarity judgment standard includes: acquiring the similarity judgment standard of the startup process from the similarity judgment standard knowledge base, and acquiring the startup process of the startup file and other files in the target folder; wherein the similarity judgment standard corresponding to the startup process specifies the similarity score standard corresponding to the startup process; Comparing the startup process information of the startup file with a pre-formed startup process information list; Determine whether the startup process information of the startup file is in the startup process list of other files in the target folder; If it is in the startup process list of other files, the similarity score corresponding to the factor is determined to be full score; If it is not in the startup process list of other files, the similarity score corresponding to the factor is determined to be 0.
2. The method for detecting disguised viruses based on file similarity in the same directory according to claim 1 is characterized in that: The comprehensive calculation of the similarity between the startup file and other files in the target folder based on multiple factors includes: According to the obtained similarity score corresponding to each factor, a corresponding weight is assigned to each factor to obtain the similarity weighted score corresponding to each factor; The obtained similarity weighted scores corresponding to each factor are summed up to obtain the similarity between the startup file and other files in the target folder.
3. The method for detecting disguised viruses based on file similarity in the same directory according to claim 1, characterized in that: The multiple factors also include: creation time, creation process and access network address; The step of determining the similarity score corresponding to each factor based on the corresponding similarity determination criteria also includes: For the creation time, obtaining the similarity determination standard corresponding to the creation time from the similarity determination standard knowledge base, and obtaining the creation time of the startup file and other files in the target folder; wherein the similarity determination standard corresponding to the creation time specifies the similarity score standard corresponding to the creation time; Compare the creation time of the startup file with the creation time of the other files; If the creation time of the startup file is different from the creation time of the other files, the similarity score corresponding to the factor is determined to be 0; If the creation time of the startup file is the same as the creation time of the other files, then count the number of files with the same creation time; If the number of the same creation time reaches the third predetermined number standard, the similarity score corresponding to the factor is determined to be 50 points; If the number of the same creation time reaches the fourth predetermined number standard, the similarity score corresponding to the factor is determined to be 100 points; wherein the third predetermined number standard is less than the fourth predetermined number standard; And, for the creation process, pre-monitor all file creation process events under the target file; Collect the creation process information of each file, including process name, file path, creation time, and command line parameters; The collected creation process information is stored in a creation process information list; The determining of the similarity score corresponding to each factor based on the corresponding similarity determination standard includes: obtaining the similarity determination standard of the creation process from the similarity determination standard knowledge base, and obtaining the creation process of the startup file and other files in the target folder; wherein the similarity determination standard corresponding to the creation process specifies the similarity score standard corresponding to the creation process; Comparing the creation process information of the startup file with a pre-formed creation process information list; Determine whether the creation process information of the startup file is in the creation process list of other files in the target folder; If it is in the creation process list of other files, the similarity score corresponding to the factor is determined to be full score; If it is not in the creation process list of other files, the similarity score corresponding to the factor is determined to be 0; And, for accessing the network address, pre-monitoring the access network events of all files under the target file; Collect the access network address of each file; The collected access network addresses are stored in an access network address list; The determining of the similarity score corresponding to each factor based on the corresponding similarity determination standard includes: obtaining the similarity determination standard of the access network address from the similarity determination standard knowledge base, and obtaining the access network addresses of the startup file and other files in the target folder; wherein the similarity determination standard corresponding to the access network address specifies the similarity score standard corresponding to the access network address; Comparing the access network address information of the startup file with a pre-formed access network address information list; Determine whether the access network address information of the startup file is in the access network address list of other files in the target folder; If it is in the list of access network addresses of other files, the similarity score corresponding to this factor is determined to be full score; If it is not in the access network address list of other files, the similarity score corresponding to the factor is determined to be 0.
4. The method for detecting disguised viruses based on file similarity in the same directory according to claim 1, characterized in that: The similarity and the preset similarity threshold are between 0 and 1, and the comparing the calculated similarity with the preset similarity threshold to determine whether the startup file is abnormal includes: If the similarity is higher than the preset similarity threshold, it is determined that there is no abnormality in the startup file; If the similarity is lower than the preset similarity threshold, it is determined that there is an abnormality in the startup file.
5. A device for detecting disguised viruses based on the similarity of files in the same directory, characterized in that: include: A monitoring program unit is used to monitor the startup file in the target folder; A calculation program unit is used for obtaining the similarity judgment standard corresponding to each factor from the similarity judgment standard knowledge base when monitoring the execution operation of the startup file, and comprehensively calculating the similarity between the startup file and other files in the target folder based on multiple factors; wherein the similarity judgment standard knowledge base stores the similarity judgment standard corresponding to each factor; A determination program unit, used for comparing the calculated similarity with a preset similarity threshold to determine whether the startup file is abnormal; The multiple factors include: at least two of: digital signature, creation time, creation process, access network address, compiler used, and startup process; The computing program unit includes: a single factor similarity determination module, which is used to determine the similarity score corresponding to each factor based on the corresponding similarity determination standard; When the multiple factors include: a digital signature, a compiler used, and a startup process; The determining of the similarity score corresponding to each factor based on the corresponding similarity determination criteria includes: For the digital signature, the similarity determination standard corresponding to the digital signature is obtained from the similarity determination standard knowledge base, and the digital signatures of the startup file and other files in the target folder are obtained; wherein the similarity determination standard corresponding to the digital signature specifies the similarity score standard corresponding to the digital signature; If the startup file has no digital signature, and other files have digital signatures, the similarity score corresponding to the factor is determined to be 0; If the startup file and other files do not have digital signatures, the similarity score corresponding to the factor is determined to be 70 points; If both the startup file and the other files have digital signatures, then the digital signature of the startup file is compared with the digital signatures of the other files; If the number of matched matches reaches a first predetermined number standard, the similarity score corresponding to the factor is determined to be full score; If the number of matched matches does not reach the first predetermined number standard, the similarity score corresponding to the factor is determined to be 0; And, for the compiler used, obtaining the similarity determination standard of the compiler used from the similarity determination standard knowledge base, and obtaining the compiler used by the startup file and other files in the target folder; wherein the similarity determination standard corresponding to the compiler used specifies the similarity score standard corresponding to the compiler used; Comparing the compiler used in the startup file with the compiler used in the other files; If the number of matched matches reaches the second predetermined number standard, the similarity score corresponding to the factor is determined to be full score; If the number of matched matches does not reach the second predetermined number standard, the similarity score corresponding to the factor is determined to be 0; And, for the startup process, pre-monitoring the startup events of all files under the target file; Collect the startup process information of each file, including process name, startup time, and command line parameters of execution; The collected startup process information is stored in a startup process information list; Determining the similarity score corresponding to each factor based on the corresponding similarity judgment standard includes: acquiring the similarity judgment standard of the startup process from the similarity judgment standard knowledge base, and acquiring the startup process of the startup file and other files in the target folder; wherein the similarity judgment standard corresponding to the startup process specifies the similarity score standard corresponding to the startup process; Comparing the startup process information of the startup file with a pre-formed startup process information list; Determine whether the startup process information of the startup file is in the startup process list of other files in the target folder; If it is in the startup process list of other files, the similarity score corresponding to the factor is determined to be full score; If it is not in the startup process list of other files, the similarity score corresponding to the factor is determined to be 0.
6. The device for detecting disguised viruses based on file similarity in the same directory according to claim 5, characterized in that: It is characterized in that The computing program unit is further specifically used for: According to the obtained similarity score corresponding to each factor, a corresponding weight is assigned to each factor to obtain the similarity weighted score corresponding to each factor; The obtained similarity weighted scores corresponding to each factor are summed up to obtain the similarity between the startup file and other files in the target folder.
7. An electronic device, characterized in that: include: One or more processors; Memory; The memory stores one or more executable programs, and the one or more processors read the executable program code stored in the memory to execute the method for detecting disguised viruses based on file similarity in the same directory as described in any one of claims 1 to 4.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to execute the method for detecting disguised viruses based on file similarity in the same directory as described in any one of claims 1 to 4.
