A virtual machine detection countermeasure method, device, electronic device and storage medium
By replacing the virtual machine characteristic values obtained by the query function with non-virtual machine characteristic values, it solves the problem of malicious samples evading detection through the virtual machine detection code, realizes virtual machine detection against malicious samples, avoids sample omissions, and improves the identification system recognition ability.
Patent Information
- Application Number
- CN202010171002.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-03-12
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2040-03-12
AI Technical Summary
Malicious samples use virtual machine detection code to avoid being captured by the dynamic identification system, leading to the problem of missing malicious samples.
By modifying the program, the virtual machine characteristic values obtained by the query function are replaced with non-virtual machine characteristic values, so that the sample to be detected cannot recognize that the current running environment is a virtual machine environment, thus bypassing the virtual machine detection of malicious samples.
It effectively avoids the omission of malicious samples caused by identifying the current operating environment, improves the identification capability of the dynamic identification system, and provides a reliable guarantee for subsequent identification of malicious samples.
Smart Images

Figure CN113391874B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of network security technology, and in particular to a virtual machine detection and countermeasure method, device, electronic device and storage medium. Background Art
[0002] The rapid development of information technology and Internet technology has also brought huge challenges to network security. The existence of malicious samples can cause serious damage to user data and network security. In order to quickly and timely identify the maliciousness of a large number of samples appearing on the network, static feature scanning combined with dynamic identification systems are usually used to identify malicious samples.
[0003] At present, in order to avoid being captured by the dynamic identification system, the authors of malicious samples often add virtual machine detection code to the malicious samples. If the malicious sample finds that the current running environment is a virtual machine environment when running the virtual machine detection code, it will perform some false actions or exit directly. In this way, it can avoid being identified as a malicious sample and avoid the subsequent interception of the malicious sample by the system. Therefore, in order to avoid missing the capture of the above malicious samples, it is necessary to effectively counter the virtual machine detection in the malicious samples. Summary of the invention
[0004] In view of this, the present application provides a virtual machine detection countermeasure method, device, electronic device and storage medium, which uses a modification program to replace the virtual machine feature value obtained by the query function with a non-virtual machine feature value, so that the sample to be detected cannot conclude that the current operating environment is a virtual machine environment based on the received query results. It can effectively counter the virtual machine detection in malicious samples and avoid the omission of malicious samples due to the identification of the current operating environment.
[0005] To achieve the above objectives, on the one hand, the present application provides a virtual machine detection countermeasure method, including:
[0006] Run the sample to be tested;
[0007] When receiving a query instruction sent by the sample to be detected, running the query function corresponding to the query instruction, and in the process of running the query function, using the corresponding modification program to replace the virtual machine feature value obtained by the query function with the non-virtual machine feature value;
[0008] The query function is used to obtain a query result according to the non-virtual machine feature value, and the query result is returned to the sample to be detected.
[0009] In a possible implementation, before running the sample to be detected, the method further includes:
[0010] The modification program is injected into the query function.
[0011] In yet another possible implementation, injecting the modification program into the query function includes:
[0012] Obtaining the address of the query function;
[0013] According to the address, the modification procedure is hooked into the query function.
[0014] In another possible implementation, when the query function is a search object query function, using a corresponding modification program to replace the virtual machine feature value obtained by the query function with a non-virtual machine feature value includes:
[0015] Using the modification program to determine whether the virtual machine characteristic value exists in the query instruction received by the retrieval object query function;
[0016] If the virtual machine characteristic value exists, a replacement string different from the virtual machine characteristic value is generated as the non-virtual machine characteristic value to replace the virtual machine characteristic value.
[0017] In another possible implementation, when the query function is an enumeration result retrieval function, using a corresponding modification program to replace the virtual machine feature value obtained by the query function with a non-virtual machine feature value includes:
[0018] Using the modification program to obtain the attribute field corresponding to the attribute value parameter in the process information obtained by the enumeration result retrieval function, and determining whether there is a preset attribute field in the attribute field;
[0019] If the preset attribute field exists, obtaining the attribute value corresponding to the preset attribute field;
[0020] Determining whether the attribute value is a characteristic value of the virtual machine;
[0021] If it is the virtual machine characteristic value, a replacement string different from the virtual machine characteristic value is generated as the non-virtual machine characteristic value to replace the virtual machine characteristic value.
[0022] In another possible implementation, the step of generating a replacement string different from the virtual machine characteristic value as the non-virtual machine characteristic value includes:
[0023] A replacement string having a different prefix from the virtual machine feature value and the same suffix as the virtual machine feature value is generated as the non-virtual machine feature value.
[0024] In another aspect, the present application provides a virtual machine detection countermeasure device, comprising:
[0025] A sample operation module is used to operate the sample to be tested;
[0026] A query function running module, configured to run the query function corresponding to the query instruction when receiving the query instruction sent by the sample to be detected, and in the process of running the query function, replace the virtual machine feature value obtained by the query function with the non-virtual machine feature value by using the corresponding modification program, and use the query function to obtain the query result according to the non-virtual machine feature value;
[0027] The query result returning module is used to return the query result to the sample to be detected.
[0028] In another aspect, the present application also provides an electronic device, comprising:
[0029] Memory for storing computer programs;
[0030] A processor is used to implement the virtual machine detection countermeasure method of any embodiment of the present application when executing the computer program.
[0031] On the other hand, the present application further provides a storage medium, in which computer executable instructions are stored. When the computer executable instructions are loaded and executed by a processor, the virtual machine detection countermeasure method of any embodiment of the present application is implemented.
[0032] It can be seen that in the embodiment of the present application, the virtual machine feature values involved in the query function started by the sample to be detected are replaced with non-virtual machine feature values by using a modification program, so that the query result finally obtained by the query function will not contain any data information that can characterize the current operating environment as a virtual machine environment. In addition, the sample to be detected cannot conclude that the current operating environment is a virtual machine environment based on the received query result, thereby bypassing the virtual machine detection of the malicious sample and achieving the purpose of hiding the true identity of the current system. That is, this method can effectively counteract the virtual machine detection in malicious samples, provide a reliable guarantee for the subsequent identification of malicious samples, and avoid the omission of malicious samples caused by the identification of the current operating environment.
[0033] Correspondingly, the embodiments of the present application also provide a virtual machine detection countermeasure device, an electronic device and a storage medium corresponding to the above-mentioned virtual machine detection countermeasure method, which have the above-mentioned technical effects and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are merely embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0035] Figure 1 A schematic diagram of a hardware composition framework applicable to a virtual machine detection countermeasure method according to an embodiment of the present application is shown;
[0036] Figure 2 A schematic diagram of a hardware composition framework applicable to another virtual machine detection countermeasure method according to an embodiment of the present application is shown;
[0037] Figure 3 A schematic diagram of a process flow of a virtual machine detection countermeasure method according to an embodiment of the present application is shown;
[0038] Figure 4 A schematic diagram of a process flow of another virtual machine detection countermeasure method according to an embodiment of the present application is shown;
[0039] Figure 5 A schematic diagram of a process flow of another virtual machine detection countermeasure method according to an embodiment of the present application is shown;
[0040] Figure 6 A schematic diagram of a virtual machine detection result according to an embodiment of the present application is shown;
[0041] Figure 7 It shows the prior art Figure 6 The corresponding schematic diagram of the virtual machine detection results;
[0042] Figure 8 Another schematic diagram of virtual machine detection results according to an embodiment of the present application is shown;
[0043] Fig. 9 It shows the prior art Figure 8 The corresponding schematic diagram of the virtual machine detection results;
[0044] Fig.10 A block diagram showing the composition structure of an embodiment of a virtual machine detection and countermeasure device according to an embodiment of the present application is shown;
[0045] Fig.11 A block diagram showing the composition structure of an embodiment of another virtual machine detection and countermeasure device according to an embodiment of the present application is shown. DETAILED DESCRIPTION
[0046] The existence of malicious samples will pose a serious threat to user data security and network security. At present, in order to quickly and timely identify the malicious situations of a large number of samples appearing on the network, in addition to the commonly used static feature scanning, it is often necessary to combine the results of the dynamic identification system. The dynamic identification system usually simulates a real system environment through a sandbox environment, that is, forming a virtual machine environment, running the sample to be tested in the simulated system environment, capturing the sample dynamic behavior generated by the sample operation, and then judging whether the sample is a malicious sample and the corresponding malicious situation based on the sample dynamic behavior.
[0047] At present, in order to avoid the malicious samples being captured by the dynamic identification system, the authors of malicious samples often use virtual machine detection technology, that is, adding virtual machine detection code to the malicious samples. If the malicious samples find that the current operating environment is a virtual machine environment when running the virtual machine detection code, they will perform some false actions or exit directly. This prevents the real behavior of the sample from being captured by the dynamic identification system, or in other words, being captured by the sandbox environment, and then being identified as a malicious sample, avoiding the subsequent interception of the malicious sample by the system. In order to solve this technical problem, the embodiment of the present application can replace the virtual machine feature value obtained by the query function with a non-virtual machine feature value, so as to hide the virtual machine environment of the system, effectively counteract the virtual machine detection process in the malicious sample, and avoid the omission of malicious samples due to the identification of the current operating environment.
[0048] Among them, the sandbox environment can refer to the construction of a safe simulation environment through virtual machine technology (such as VMware (providing virtual machine-based solutions) / VirtualBox (an open source virtual machine software), etc.), so that the sample (such as an executable file EXE) can run normally in the simulation environment as in a real system. After the sample runs, the simulation environment can be directly restored without affecting the user's real system or the real user environment. The sandbox environment can also be understood as a virtual machine environment. The samples to be detected can refer to executable files or executable scripts on platforms such as Windows, Linux, and Android, as well as common daily files (such as DOCX files, PPT files, XLS files, and EML files). The dynamic behavior of the sample can refer to the behavior generated after the sample runs on the operating system. The behavior can be: creating files, deleting files, encrypting files, creating processes, ending processes, accessing the network, downloading other samples, modifying the registry, stealing files, stealing system information, etc. Virtual machine detection technology can refer to the technology used to detect whether the current operating environment is a virtual machine environment, which is often used by malware developers to detect the system operating environment.
[0049] For ease of understanding, the hardware composition framework applicable to the solution corresponding to the virtual machine detection countermeasure method of this application is first introduced. Figure 1 to Figure 2 ,in, Figure 1 It shows a schematic diagram of a hardware composition framework applicable to a virtual machine detection countermeasure method of the present application.
[0050] Depend on Figure 1 It can be known that the hardware composition framework may include: an electronic device 10 , wherein the electronic device 10 may include: a processor 11 , a memory 12 , a communication interface 13 , an input unit 14 , a display 15 and a communication bus 16 .
[0051] The processor 11 , the memory 12 , the communication interface 13 , the input unit 14 , and the display 15 all communicate with each other via the communication bus 16 .
[0052] In the embodiment of the present application, the processor 11 may be a central processing unit (CPU), a specific application integrated circuit, a digital signal processor, a readily available programmable gate array, or other programmable logic devices, etc. The processor may call a program stored in the memory 12. Specifically, the processor may perform the operations performed by the electronic device side in the embodiment of the following virtual machine detection countermeasure method.
[0053] The memory 12 is used to store one or more programs, which may include program codes, and the program codes include computer operation instructions. In the embodiment of the present application, the memory at least stores programs for implementing the following functions:
[0054] Run the sample to be tested;
[0055] When receiving a query instruction sent by the sample to be detected, running the query function corresponding to the query instruction, and in the process of running the query function, using the corresponding modification program to replace the virtual machine feature value obtained by the query function with the non-virtual machine feature value;
[0056] The query function is used to obtain the query result according to the non-virtual machine feature value, and the query result is returned to the sample to be detected.
[0057] In one possible implementation, the memory 12 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and application programs required for at least one function (such as a data processing function, etc.); the data storage area may store data created during the use of the computer.
[0058] In addition, the memory 12 may also include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device or other volatile solid-state storage device.
[0059] The communication interface 13 may be an interface of a communication module, such as an interface of a GSM module.
[0060] The present application may further include a display 14 and an input unit 15 and the like.
[0061] certainly, Figure 1 The structure of the computer device shown does not constitute a limitation on the computer device in the embodiment of the present application. In actual applications, the computer device may include Figure 1 More or fewer components than shown, or combinations of certain components.
[0062] in, Figure 1 The electronic device 10 in the example may be a terminal (such as a mobile terminal such as a mobile phone, a tablet computer, or a fixed terminal such as a PC) or a server.
[0063] In an embodiment of the present application, the electronic device 10 can use the network to receive samples to be tested sent by other external devices according to the communication interface 13; it can also obtain samples to be tested through its own input unit 14 (such as a keyboard, touch screen, voice input device, etc.).
[0064] Correspondingly, the processor 11 in the electronic device 10 can receive the sample to be detected from the communication interface 13 or the input unit 14 through the communication bus 16, and call the program stored in the memory 12 to run the sample to be detected.
[0065] It is understandable that the number of electronic devices is not limited in the embodiments of the present application. For example, two electronic devices may work together to complete the virtual machine detection countermeasure function. Figure 2 .Depend on Figure 2 It can be known that the hardware component framework may include: a first electronic device 1 and a second electronic device 2. The first electronic device 1 and the second electronic device 2 are connected to each other through a network 3.
[0066] In the embodiment of the present application, the hardware structure of the first electronic device 1 and the second electronic device 2 can refer to Figure 1 The electronic device 10 in the embodiment can be understood as having two electronic devices 10 in this embodiment, which exchange data to realize the virtual machine detection and confrontation function. Further, the form of the network 3 is not limited in the embodiment of the present application. For example, the network 3 can be a wireless network (such as WIFI, Bluetooth, mobile communication network, etc.) or a wired network; it can be a wide area network, and a local area network can also be used when the situation permits.
[0067] Among them, the first electronic device 1 and the second electronic device 2 can be the same electronic device, such as the first electronic device 1 and the second electronic device 2 are both terminals (such as PCs); they can also be different types of electronic devices, such as the first electronic device 1 can be a terminal and the second electronic device 2 can be a server.
[0068] Combination Figure 2 The implementation process of the virtual machine detection countermeasure method under the system can be as follows: after the first electronic device obtains the sample to be detected, it sends the sample to be detected to the second electronic device through the network. After receiving the sample to be detected, the second electronic device runs the sample to be detected in the established sandbox environment (i.e., virtual machine environment), and then when receiving the query instruction sent by the sample to be detected, it runs the query function corresponding to the query instruction, and in the process of running the query function, uses the corresponding modification program to replace the virtual machine feature value obtained by the query function with a non-virtual machine feature value, and uses the query function to obtain the query result according to the non-virtual machine feature value; and returns the query result to the sample to be detected. In this way, the sample to be detected cannot conclude that the current operating environment is a virtual machine environment based on the received query result, thereby bypassing the virtual machine detection of the malicious sample and achieving the purpose of hiding the true identity of the current system.
[0069] Combining the above commonalities, see Figure 3 , which shows a flowchart of an embodiment of a virtual machine detection countermeasure method of the present application. The method of this embodiment may include:
[0070] S101, running the sample to be tested.
[0071] It should be noted that the embodiment of the present application does not limit the execution subject of the virtual machine detection countermeasure method, which can be any electronic device that can build a virtual machine environment. For example, the electronic device can be a terminal (such as a PC) or a server. In the embodiment of the present application, a real system environment (i.e., a virtual machine environment) can be simulated in an electronic device through a sandbox environment as a dynamic identification system, and the sample to be detected can be run in the simulated system environment. Of course, the embodiment of the present application does not limit the way to build a virtual machine environment in the electronic device. For example, a safe virtual machine environment can be built through virtual machine technology.
[0072] It is understandable that the method of obtaining the samples to be detected is not limited in the embodiments of the present application. For example, samples sent by other electronic devices can be directly received as samples to be detected; samples transmitted by users through input devices (such as USB flash drives, etc.) can also be received as samples to be detected; the required samples to be detected can also be obtained through a sample database; or samples obtained by the electronic device through analysis of network traffic data can be used as samples to be detected, etc. Of course, the embodiments of the present application do not limit the number of samples to be detected, and the number can be determined according to the actual application scenario.
[0073] Among them, the embodiments of the present application do not limit the specific content of the sample to be detected. The sample to be detected can refer to executable files or executable scripts on platforms such as Windows, Linux, Android, and common daily files (such as DOCX files, PPT files, XLS files, EML files), etc.
[0074] S102. When receiving a query instruction sent by a sample to be detected, executing a query function corresponding to the query instruction, and in the process of executing the query function, replacing the virtual machine feature value obtained by the query function with a non-virtual machine feature value using a corresponding modification program.
[0075] The embodiment of the present application runs the sample to be detected in the constructed virtual machine environment. During the operation, the sample to be detected can obtain some information data of the current operating environment, i.e., the query result, by calling the API provided by the system according to its own needs. For example, during the operation, the sample to be detected can call the API provided by the system through the virtual machine detection related code to traverse the process list, file list, registry, etc. of the current system, and then determine whether the environment in which it is currently located is a simulated environment (i.e., a virtual machine environment) or a physical machine environment according to the returned query result. If the malicious sample in the sample to be detected determines that the current environment is a virtual machine environment through the above method, then the malicious sample is identified as a malicious sample in order to avoid its real behavior being captured by the dynamic identification system, or captured by the sandbox environment. The malicious sample will perform some false actions, or exit directly, so that the dynamic identification system cannot capture it. The embodiment of the present application is to avoid the occurrence of this situation. Therefore, it is necessary to make the query result obtained by the sample to be detected not contain any data information that can characterize the current operating environment as a virtual machine environment. Then, the sample to be detected cannot obtain the conclusion that the current operating environment is a virtual machine environment according to the received query result. That is, the embodiment of the present application can bypass the virtual machine detection of the malicious sample and play the purpose of hiding the true identity of the current system. It can effectively detect virtual machines in anti-malicious samples, provide reliable guarantees for the subsequent identification of malicious samples, and avoid the omission of malicious samples due to the identification of the current operating environment.
[0076] API is the abbreviation of Application Programming Interface, also known as application programming interface, which is the agreement for connecting different components of a software system. A virtual machine environment can refer to a safe simulation environment built through virtual machine technology. A physical machine environment can refer to the current system running on a real physical device, rather than a simulation environment virtualized by virtualization technology.
[0077] It should be noted that the embodiments of the present application do not limit the specific content of the query instruction sent by the sample to be detected. The specific content of the query instruction is related to the specific API called by the sample to be detected and the target object to be queried. Usually, the query instruction contains query parameters or query objects. Among them, the embodiments of the present application do not limit the API called by the sample to be detected, which can be a system file query API (such as Windows file query API), a system process query API (such as Windows process query API), or a system management specification interface (such as WMI interface). For example, when the sample to be detected sends a query instruction by calling the WMI interface, the content of the query instruction can be the name of the object to be retrieved, that is, the query parameter, or it can be the query object to be enumerated and retrieved (such as all processes currently running in the system)
[0078] Among them, the WMI (Windows Management Instrumentation) interface refers to a series of extensions to the Windows Driver Model. It provides an operating system interface by providing information and notifications through instrument components. WMI is Microsoft's implementation of the Web-based Enterprise Management Class (WBEM) and Common Information Model (CIM) standards of the Distributed Management Task Force (DMTF). WMI allows scripting languages (such as VBScript or Windows PowerShell) to manage Microsoft Windows personal computers and servers locally or remotely. Support for executing system management from a command line interface and command scripts can also be provided through WMIC (an extension tool for WMI).
[0079] When the system receives the query instruction sent by the sample to be detected, the embodiment of the present application runs the query function corresponding to the query instruction, that is, the embodiment of the present application can determine the query function that needs to be run according to the parameter content that needs to be queried by the query instruction. For example, the query instruction currently received is: objWMIService.ExecQuery("select*fromwin32_process"), then the corresponding query function is the IEnumWbemClassObject::Next function under the WMI interface (i.e., the enumeration result retrieval function). Among them, the meaning of the query instruction is to call the function under the WMI interface to query and return all process information in the current system. For another example, the query instruction currently received is: objWMIService.ExecQuery("select*fromwin32_process where name='vmtoolsd.exe'"), then the corresponding query function is the IWbemServices::ExecQuery function under the WMI interface (i.e., the retrieval object query function). Among them, the meaning of the query instruction is to call the function under the WMI interface to query and return the process information of the process named vmtoolsd.exe in the current system. The vmtoolsd.exe process is a process that only exists in a virtual machine environment and does not exist in a normal physical machine. Therefore, the virtual machine environment can be detected through this feature.
[0080] In order to prevent the query function from returning data information that can characterize the current operating environment as a virtual machine environment as a query result to the sample to be detected during the query process. Therefore, it is necessary to use the modification program corresponding to the query function in the process of running the query function to replace the virtual machine feature value obtained by the query function with a non-virtual machine feature value, so that the query function obtains the query result according to the non-virtual machine feature value, so that the query result does not contain any data information that can characterize the current operating environment as a virtual machine environment. In addition, the sample to be detected cannot draw the conclusion that the current operating environment is a virtual machine environment based on the received query result. That is, the embodiment of the present application can bypass the virtual machine detection of malicious samples, play the purpose of hiding the true identity of the current system, and can effectively achieve the virtual machine detection against malicious samples.
[0081] It should be noted that the embodiments of the present application do not limit the content of the virtual machine characteristic value. Any data information that can characterize the current operating environment as a virtual machine environment, or data information that only exists in a virtual machine environment, is a virtual machine characteristic value. For example, the virtual machine characteristic value may include: vmtoolsd.exe, vmacthlp.exe, VBoxService.exe, VBoxTray.exe, VirtualBox.exe, VMware.exe, vmvss.exe, VMTools.exe, VGAuthService.exe, etc. Therefore, the process of the modification program in determining whether there is a virtual machine characteristic value in the content obtained by the query function can be: the modification program matches all the virtual machine characteristic values with the content obtained by the query function, and then determines whether there is a virtual machine characteristic value in the content obtained by the query function, and replaces the virtual machine characteristic value obtained by the query function determined by the matching result with a non-virtual machine characteristic value.
[0082] The embodiment of the present application realizes the replacement of the virtual machine feature value through the modification program corresponding to the query function. That is, the query function and the modification program in the embodiment of the present application have a one-to-one correspondence. Since there is more than one query function that can be called by the sample to be detected in the embodiment of the present application, and the embodiment of the present application does not limit the number of query functions, it can only perform the virtual machine detection confrontation process for one query function, or it can perform the virtual machine detection confrontation process for multiple query functions. In other words, the embodiment of the present application also does not limit the number of modification programs included in the present application, which corresponds one-to-one with the query function, that is, each query function included in the embodiment of the present application has a modification program corresponding thereto.
[0083] It is understandable that the main function of the modification program provided in the embodiment of the present application is to replace the virtual machine feature value obtained by the query function with a non-virtual machine feature value, so that the query function obtains the query result according to the non-virtual machine feature value, thereby avoiding the sample to be detected from determining that the current system environment is a virtual machine environment according to the query result. Of course, the embodiment of the present application does not limit the specific content of the modification program, which corresponds to the query method of the corresponding query function.
[0084] For example, when the query function is to find the search object, then the content of the modified program is to determine whether there is a search object containing a virtual machine feature value in the query instruction received by the query function; if there is no search object containing a virtual machine feature value, it means that there is no content that needs to be modified by the modified program in this query process, and this query process will not expose that the current operating environment of the system is a virtual machine environment, then the query function is executed normally and returns the query result. If there is a search object containing a virtual machine feature value, in order to prevent the query function from finding the search object, it is necessary to replace the virtual machine feature value contained in the search object with a non-virtual machine feature value, so that the query function performs a query based on the non-virtual machine feature value to obtain the query result. Obviously, the query result will not necessarily contain a search object containing a virtual machine feature value in the current system, because the search object queried by the query function has changed. For example, if the current query function is the IWbemServices::ExecQuery function, the current search object is vmtoolsd.exe. Then, when the IWbemServices::ExecQuery function receives the search object vmtoolsd.exe, the modification program will modify vmtoolsd.exe to a search object (e.g., 0X9MjY1.exe) of a non-virtual machine characteristic value that does not exist in the system. It can be seen that the actual query object of the IWbemServices::ExecQuery function is not vmtoolsd.exe, but 0X9MjY1.exe. Of course, the generation method of 0X9MjY1.exe is not limited in the embodiments of the present application, for example, it can be randomly generated.
[0085] For another example, when the query function is to enumerate the results, that is, to traverse the current system to obtain the query results, then the content of the modified program is to determine whether there are query results related to the virtual machine feature values in the query results obtained by the query function; if there are no query results containing virtual machine feature values, it means that there is no content that needs to be modified in the current query process, and the current query process will not expose that the current operating environment of the system is a virtual machine environment, then the query function is executed normally and returns the query results. If there are query results containing virtual machine feature values, in order to avoid the query function returning the query results containing virtual machine feature values to the sample to be detected, it is necessary to modify the program to replace the content of the virtual machine feature values contained in the query results with non-virtual machine feature values, so that the query function returns the modified query results to the sample to be detected. Obviously, the final query results obtained by the sample to be detected will not necessarily contain query results containing virtual machine feature values in the current system. For example, if the current query function is the IEnumWbemClassObject::Next function, the current retrieval object is all process information in the current system. Then, the modification program needs to obtain the attribute field corresponding to the wszName parameter (i.e., the attribute value parameter) in the process information obtained by the IEnumWbemClassObject::Next function, and determine whether there is a preset attribute field in the attribute field; if there is no preset attribute field, it proves that all the process information traversed by the query function does not contain process information that can prove that the current system is a virtual machine system. If there is a preset attribute field, it proves that all the process information traversed by the query function may contain process information that can prove that the current system is a virtual machine system. Therefore, it is necessary to determine again whether all the process information traversed by the query function contains process information that can prove that the current system is a virtual machine system. Accordingly, the modification program needs to obtain the attribute value corresponding to the preset attribute field; and determine whether the attribute value is a virtual machine characteristic value; if it is not a virtual machine characteristic value, it proves that all the process information traversed by the query function does not contain process information that can prove that the current system is a virtual machine system. If it is a virtual machine feature value, it proves that all the process information traversed by the query function contains process information that can prove that the current system is a virtual machine system. At this time, it is necessary to generate a replacement string different from the virtual machine feature value as a non-virtual machine feature value to replace the virtual machine feature value, so that the query result returned to the sample to be detected will not contain the query result containing the virtual machine feature value in the current system. Of course, the current search object can also be other information in the current system that needs to be traversed and queried.
[0086] In the embodiments of the present application, the location where the modification program is set is not limited, as long as the modification program corresponding to the query function can be run simultaneously during the operation of the query function. For example, the modification program can be injected into the query function. Optionally, in the embodiments of the present application, the modification program can be injected into the query function before the sample to be detected is run. So that when the sample to be detected starts to run, the modification program in the query function is in an executable state. Of course, in the embodiments of the present application, the specific method of injecting the modification program into the query function is not limited. For example, the process of injecting the modification program into the query function may include: obtaining the address of the query function; and hooking the modification program into the query function according to the address.
[0087] Among them, the specific method of obtaining the address of the query function is not limited in the embodiment of the present application, which is related to the specific situation of the query function. For example, when the query function is the IWbemServices::ExecQuery function under the WMI interface, the corresponding process of obtaining the address of the IWbemServices::ExecQuery function may include: first, obtaining the address of the IWbemLocator object (that is, the initial namespace pointer to obtain the interface object); then, using the address of the IWbemLocator object, obtaining the address of the IWbemServices object (that is, the WMI service access interface object); finally, according to the address of the IWbemServices object, obtaining the address of the IWbemServices::ExecQuery function.
[0088] The specific method of hooking the modification program to the query function is not limited in the embodiments of the present application. For example, an application programming interface hook method, i.e., an API HOOK method, can be used to implement the operation of hooking the modification program to the query function. The API HOOK method is a software development technology that achieves the purpose of modifying the system API result by hooking one's own code to the system API code.
[0089] It should be noted that the embodiment of the present application does not limit the method for generating non-virtual machine feature values, as long as it is possible to obtain non-virtual machine feature values. For example, the non-virtual machine feature value can be obtained by generating a random string, or by traversing the query objects existing in the current system and generating a string different from the query object as the non-virtual machine feature value, or by modifying the value of the character in the virtual machine feature value to obtain the non-virtual machine feature value. Of course, the embodiment of the present application does not limit the specific content of the replaced non-virtual machine feature value, as long as it can be achieved that the replaced content cannot reflect that the current operating system is a virtual machine environment. For example, the string corresponding to the non-virtual machine feature value can be composed entirely of numbers, or entirely of letters, or a mixture of numbers, letters and symbols.
[0090] Furthermore, in order to improve the reliability of the generated non-virtual machine characteristic value, and thus improve the reliability of the system hiding the virtual machine environment. When generating a non-virtual machine characteristic value, the embodiment of the present application can make the non-virtual machine characteristic value have the same suffix content as the virtual machine characteristic value to be replaced. That is, a replacement string with a different prefix and the same suffix as the virtual machine characteristic value is generated as the non-virtual machine characteristic value. For example, the virtual machine characteristic value is vmtoolsd.exe, and the generated non-virtual machine characteristic value is 0X9MjY1.exe, both of which have the same suffix exe.
[0091] S103: Utilize the query function to obtain the query result according to the non-virtual machine feature value, and return the query result to the sample to be detected.
[0092] In the embodiment of the present application, the query function obtains the query result based on the non-virtual machine feature value and returns it to the sample to be detected. Since the query result does not contain any data information indicating that the current operating environment is a virtual machine environment, the sample to be detected cannot conclude that the operating environment is a virtual machine environment based on the received query result, thereby bypassing the virtual machine detection of the malicious sample and hiding the true identity of the current system. This improves the identification capability of the dynamic identification system and can also improve the subsequent virus identification capability based on malicious samples.
[0093] In an embodiment of the present application, when the running sample to be detected wants to determine whether the current operating environment is a virtual machine environment by whether there is a virtual machine feature value in the relevant environmental information obtained, the present application replaces the virtual machine feature values involved in the query process of the query function started by the sample to be detected using the query instruction with non-virtual machine feature values, so that the query function obtains the query result according to the non-virtual machine feature value, and naturally the query function obtains the query result without any data information characterizing that the current operating environment is a virtual machine environment. In addition, the sample to be detected cannot obtain the conclusion that the operating environment is a virtual machine environment based on the received query result, thereby bypassing the virtual machine detection of malicious samples, hiding the true identity of the current system, and effectively realizing the virtual machine detection in the anti-malicious samples. It can provide a reliable guarantee for the subsequent identification of malicious samples and avoid the omission of malicious samples caused by the identification of the current operating environment.
[0094] Based on the above embodiments, due to the continuous development of information technology, the developers of malicious samples have further updated the virtual machine detection technology. Currently, there are a large number of malicious samples on the Internet that call the WMI interface to query process lists, file lists, hardware information lists and other information, and then compare the returned query results to determine whether the current running environment is a real physical machine or a virtual machine environment. In response to this possible situation, the embodiments of this application provide two processes based on WMI interface interception to counter virtual machine detection; please refer to Figure 4 and Figure 5 ,in, Figure 4 The query function in question is the retrieval object query function under the WMI interface (IWbemServices::ExecQuery function), and its specific execution process is as follows:
[0095] S401, run the sample to be tested.
[0096] The specific content of this step can refer to step S101 in the above embodiment, which will not be repeated here.
[0097] S402: When receiving a query instruction sent by the sample to be detected, execute a search object query function corresponding to the query instruction; wherein the search object query function obtains the query instruction.
[0098] In the embodiment of the present application, the search object query function determines the query object according to the specific content in the query instruction. For example, when the query instruction is: objWMIService.ExecQuery("select*from win32_process where name='vmtoolsd.exe'"), the query object determined is vmtoolsd.exe.
[0099] S403, using the modification program to determine whether there is a virtual machine feature value in the query instruction received by the retrieval object query function; if so, execute step S404, if so, execute step S406.
[0100] The embodiment of the present application determines whether there is a virtual machine feature value in the query instruction by modifying the program. The process can be to match the character string corresponding to the query object in the query instruction with all the preset virtual machine feature values, and then determine whether there is a virtual machine feature value in the query instruction received by the retrieval object query function. Since the second parameter strQuery (representing the WMI query statement) in the IWbemServices::ExecQuery function definition contains the query parameters in the obtained query instruction, that is, the query object. Therefore, the process can be: using the modification program to match the query parameters in strQuery with all the virtual machine feature values respectively, to determine whether there is a virtual machine feature value in the query instruction received by the retrieval object query function.
[0101] It should be noted that when the sample to be detected calls the WMI interface to perform an object query, it is actually implemented by calling the IWbemServices::ExecQuery function. Therefore, to implement virtual machine detection against the sample to be detected, it is necessary to hook the code corresponding to the modification program to the function, and then modify the query parameters in the query instruction according to actual needs through the modification program to achieve confrontation. That is, in the embodiment of the present application, the corresponding modification program can be injected into the retrieval object query function. The process can be: obtaining the address of the retrieval object query function; according to the address, hooking the modification program to the retrieval object query function.
[0102] The process of obtaining the address of the search object query function may be:
[0103] Get the address of the IWbemLocator object (that is, the initial namespace pointer to obtain the interface object);
[0104] Using the address of the IWbemLocator object, obtain the address of the IWbemServices object (i.e., the WMI service access interface object);
[0105] According to the address of the IWbemServices object, obtain the address of the IWbemServices::ExecQuery function.
[0106] It is understandable that in order to hook the modification program to the retrieval object query function, the embodiment of the present application needs to obtain the address of the retrieval object query function. When obtaining the address of the retrieval object query function, it is necessary to first obtain the address of the IWbemLocator object. The embodiment of the present application does not limit the method of obtaining the address of the IWbemLocator object. For example, the address of the IWbemLocator object can be obtained by calling the CoCreateInstance function or the CoCreateInstanceEx function by passing specific parameters. Among them, CoCreateInstance and CoCreateInstanceEx are both function names, and a Com object can be created with a specified class identifier. The interface definitions of the two functions are as follows:
[0107]
[0108] The following uses the CoCreateInstance function as an example to explain how to obtain the address of the IWbemLocator object. Since the CoCreateInstance function is a standard function of the Windows system, its function address can be directly obtained through its function name. Specifically, the CoCreateInstance function can be hooked through the API HOOK method, and in the hook code, the first parameter rclsid (the rclsid parameter is a unique identifier used to indicate the address of the Com component object to be obtained) is equal to
[0109] {0x4590f811,0x1d3a,0x11d0,{0x89,0x1f,0x00,0xaa,0x00,0x4b,0x2e,0x24},}, it means that the function is executed successfully, and the return value of the last parameter LPVOID*ppv can be obtained, which is the address of the IWbemLocator object. Among them, COM component is a new software development technology developed by Microsoft to make the software production of the computer industry more in line with human behavior.
[0110] Then, using the address of the IWbemLocator object, the address of the IWbemServices object is obtained by calling the IWbemLocator object function IWbemLocator::ConnectServer (connection of the WMI namespace on the specified computer). The specific pseudo code for obtaining the address can be as follows: Among them, the last parameter stores the address of the IWbemServices object.
[0111]
[0112] Finally, according to the address of the IWbemServices object, the address of the member function IWbemServices::ExecQuery of the object can be directly obtained, and then the modification program corresponding to the function can be hooked to the IWbemServices::ExecQuery function.
[0113] S404: Generate a replacement string different from the virtual machine characteristic value as a non-virtual machine characteristic value to replace the virtual machine characteristic value.
[0114] S405: Utilize the search object query function to obtain the query result according to the non-virtual machine feature value, and return the query result to the sample to be detected.
[0115] When a virtual machine feature value exists, it indicates that the sample to be detected is undergoing virtual machine environment detection. In order to achieve confrontation, a replacement string different from the virtual machine feature value can be generated as a non-virtual machine feature value to replace the virtual machine feature value. The retrieval object query function obtains an empty query result based on the non-virtual machine feature value, thereby achieving the purpose of countering virtual machine detection.
[0116] S406: Utilize the search object query function to obtain the query result according to the query instruction, and return the query result to the sample to be detected.
[0117] The embodiment of the present application can still implement the normal query function through step S406. Therefore, the embodiment of the present application can basically not affect the implementation of the original calling function of the WMI interface and does not affect the normal operation of the sample to be detected.
[0118] in, Figure 5 The query function targeted is the enumeration result retrieval function under the WMI interface (ie IEnumWbemClassObject::Next), and its specific execution process is as follows:
[0119] S501, run the sample to be tested.
[0120] The specific content of this step can refer to step S101 in the above embodiment, which will not be repeated here.
[0121] S502: When receiving a query instruction sent by a sample to be detected, executing an enumeration result retrieval function corresponding to the query instruction, and obtaining process information.
[0122] The embodiment of the present application can obtain all the search objects existing in the current system through the enumeration result retrieval function. For example, when the query instruction contains the "select * from win32_process" statement, the enumeration result retrieval function can obtain all the process information of the current system.
[0123] S503: Use the modification program to obtain the attribute field corresponding to the attribute value parameter in the process information.
[0124] It should be noted that when the sample to be detected calls the WMI interface to perform an enumeration result retrieval query, it is actually implemented by calling the IEnumWbemClassObject::Next function. Therefore, to implement virtual machine detection against the sample to be detected, it is necessary to hook the code corresponding to the modification program to the function, and then modify the query results according to actual needs through the modification program to achieve confrontation. That is, in the embodiment of the present application, the corresponding modification program can be injected into the enumeration result retrieval function. The process can be: obtain the address of the enumeration result retrieval function; according to the address, hook the modification program to the enumeration result retrieval function.
[0125] The process of obtaining the address of the enumeration result retrieval function may be: obtaining the address of the IEnumWbemClassObject object by calling the IWbemServices::ExecQuery function; and obtaining the address of the IEnumWbemClassObject::Next function according to the address of the IEnumWbemClassObject object.
[0126] It is understandable that the address of the IWbemServices::ExecQuery function in the embodiment of the present application can refer to the above-mentioned records. After obtaining the address of the IWbemServices::ExecQuery function, the IWbemServices::ExecQuery function can be called to obtain the address of the IEnumWbemClassObject object (i.e., the common information model object enumeration interface). The specific pseudo code for obtaining can be as follows: Among them, the last parameter stores the address of the IEnumWbemClassObject object.
[0127]
[0128] Finally, according to the address of the IEnumWbemClassObject object, the address of the member function IEnumWbemClassObject::Next of the object can be directly obtained, and then the modification program corresponding to the function can be hooked to the IEnumWbemClassObject::Next function.
[0129] S504, determine whether there is a preset attribute field in the attribute field; if so, execute step S505, if so, execute step S508.
[0130] The embodiment of the present application matches the attribute field with all the preset attribute fields by modifying the program, and then determines whether there is a preset attribute field in the attribute field. Of course, the number and content of the preset attribute fields are not limited in the embodiment of the present application, and all attribute fields whose attribute values correspond to the characteristic values of the virtual machine can be used as preset attribute fields. For example, the preset attribute fields can include: Name, Caption, CommandLine, Description, ExecutablePath, ProcessName, Path, SMBIOSBIOSVersion, and SerialNumber.
[0131] S505: Obtain the attribute value corresponding to the preset attribute field.
[0132] S506, determine whether the attribute value is a virtual machine characteristic value; if so, execute step S507, if not, execute step S508.
[0133] In the embodiment of the present application, the modification program obtains the attribute value corresponding to the preset attribute field, and determines whether the attribute value is a virtual machine characteristic value. The process can be to match the attribute value with all the preset virtual machine characteristic values, and then determine whether there is a virtual machine characteristic value in the attribute value. Of course, the embodiment of the present application does not limit the way in which the modification program obtains the attribute value. Due to the first parameter wszName (i.e., the attribute value parameter, indicating the attribute value to be obtained) in the definition of the IWbemClassObject::Get function, where IWbemClassObject::Get is a specific attribute value acquisition function. Therefore, in the embodiment of the present application, the modification program can obtain the corresponding attribute field in the process information through the wszName parameter. Therefore, in the embodiment of the present application, the modification program can use the wszName parameter in the IWbemClassObject::Get function to determine each attribute field, and obtain the corresponding attribute value through the wszName parameter, match the attribute value with all the preset virtual machine characteristic values, and then determine whether there is a virtual machine characteristic value in the attribute value.
[0134] S507: Generate a replacement string different from the virtual machine feature value as a non-virtual machine feature value to replace the virtual machine feature value, and use the enumeration result retrieval function to send the replaced process information as a query result to the sample to be detected.
[0135] When a virtual machine feature value exists, it indicates that the sample to be detected is undergoing virtual machine environment detection. In order to achieve confrontation, a replacement string different from the virtual machine feature value can be generated as a non-virtual machine feature value to replace the virtual machine feature value. The embodiment of the present application does not limit the replacement method. For example, the modification program can use the IWbemClassObject::Put function to replace the virtual machine feature value with a non-virtual machine feature value. Among them, the IWbemClassObject::Put function is a function for updating or creating a specific attribute value.
[0136] S508. Use the enumeration result retrieval function to send the process information obtained in S502 as the query result to the sample to be detected.
[0137] The embodiment of the present application can still implement the normal query function through step S508. Therefore, the embodiment of the present application can basically not affect the implementation of the original calling function of the WMI interface, and does not affect the normal operation of the sample to be detected.
[0138] In the embodiment of the present application, it is possible to implement the countermeasure of virtual machine detection using the WMI interface, so that the query function obtains the query result without any data information characterizing that the current operating environment is a virtual machine environment. As a result, the sample to be detected cannot obtain the conclusion that the operating environment is a virtual machine environment based on the received query result, thereby bypassing the virtual machine detection of malicious samples, hiding the true identity of the current system, and effectively implementing the countermeasure of virtual machine detection in malicious samples. It can provide a reliable guarantee for the subsequent identification of malicious samples, avoiding the omission of malicious samples caused by the identification of the current operating environment. It greatly increases the concealment of the virtual machine environment and improves the identification capability of the dynamic identification system.
[0139] For ease of understanding, this solution is introduced in conjunction with an application scenario, and the following takes the dynamic identification system on the server as an application scenario. The virtual machine detection confrontation method provided in the embodiment of the present application is described in detail. Among them, after receiving the sample to be detected, the dynamic identification system constructed in the server puts the sample to be detected into a virtualized virtual machine environment to run all the samples to be detected, and captures the dynamic behavior of the sample generated during the sample operation, and judges the malicious degree of the sample by the captured dynamic behavior of the sample. The virtual machine detection confrontation method provided in the embodiment of the present application can be included in the monitoring module in the dynamic identification system, and its purpose is to hide the virtual machine environment used by the dynamic identification system as much as possible, to prevent malicious samples from detecting that the operating environment is a virtual machine environment, rather than a real physical machine environment, and then evading and avoiding being captured by the dynamic identification system.
[0140] Case 1:
[0141] When the virtual machine detection code present in the running sample to be detected needs to call the IWbemServices::ExecQuery function through the WMI interface to query whether the vmtoolsd.exe process exists in the current running system, it is necessary to send a query instruction through the WMI interface: objWMIService.ExecQuery("select*from win32_processwhere name='vmtoolsd.exe'"). When the system receives the query instruction, it runs the IWbemServices::ExecQuery function. However, at this time, since the present application hooks the modification program to the IWbemServices::ExecQuery function, when the IWbemServices::ExecQuery function receives the above query instruction, the modification program immediately determines that there is a virtual machine characteristic value vmtoolsd.exe in the query instruction received by the retrieval object query function. Therefore, the modification program randomly generates a replacement string with a different prefix and the same suffix as the virtual machine characteristic value as the non-virtual machine characteristic value, so that the IWbemServices::ExecQuery function obtains the query result based on the non-virtual machine characteristic value and returns the query result to the sample to be detected. Please refer to the query result obtained by the sample to be detected. Figure 6 The same process is run in a virtual machine system without the modified program. Please refer to the query results Figure 7 .
[0142] Case 2:
[0143] When the virtual machine detection code existing in the running sample to be detected needs to call the IEnumWbemClassObject::Next function through the WMI interface to query whether the current running system is a virtual machine environment, it is necessary to send a query instruction through the WMI interface: objWMIService.ExecQuery("select*from win32_process"). When the system receives the query instruction, it runs the IEnumWbemClassObject::Next function. However, at this time, this application hooks the modification program to the IEnumWbemClassObject::Next function. Therefore, when the IEnumWbemClassObject::Next function obtains the query result, the modification program immediately determines that the virtual machine feature value vmtoolsd.exe exists in the query result. Therefore, the modification program randomly generates a replacement string with a different prefix and the same suffix as the virtual machine feature value as a non-virtual machine feature value, replacing vmtoolsd.exe in the query result, so that the query result no longer contains a virtual machine feature value. Finally, the IEnumWbemClassObject::Next function sends the replaced process information as the query result to the sample to be detected. Please refer to the query result obtained by the sample to be detected. Figure 8 The same process is run in a virtual machine system without the modified program. Please refer to the query results Fig. 9 .
[0144] Through the above two actual examples, we can see that after the system hooks the modification function, the sample to be detected is run in a virtual machine environment. Even if there is a virtual machine detection code in the sample to be detected, it is still impossible to successfully detect that the current running environment is a virtual machine environment. Successful countermeasures against virtual machine detection are achieved. Finally, by modifying the log input of the program, it can be queried that in case one, vmtoolsd.exe is replaced with a randomly generated string 0X9MjY1.exe. In case two, vmtoolsd.exe is replaced with a randomly generated string 0wTSamSN.exe. It can be proved that the virtual machine detection countermeasure method provided in the embodiment of the present application can counter the virtual machine detection process in the sample, and can counter the virtual machine detection process based on the WMI interface.
[0145] On the other hand, the embodiment of the present application also provides a virtual machine detection countermeasure device. Fig.10 , which shows a schematic diagram of the composition structure of an embodiment of a virtual machine detection and countermeasure device of the present application. The device of this embodiment can be applied to the terminal in the above embodiment, and the device may include:
[0146] The sample operation module 110 is used to operate the sample to be tested;
[0147] The query function running module 120 is used to run the query function corresponding to the query instruction when receiving the query instruction sent by the sample to be detected, and in the process of running the query function, use the corresponding modification program to replace the virtual machine feature value obtained by the query function with the non-virtual machine feature value, and use the query function to obtain the query result according to the non-virtual machine feature value;
[0148] The query result returning module 130 is used to return the query result to the sample to be detected.
[0149] Optional, please refer to Fig.11 The embodiment of the present application further provides another virtual machine detection countermeasure device, which may also include:
[0150] The injection module 140 is used to inject the modification program into the query function.
[0151] Optionally, the injection module 140 may include:
[0152] An address acquisition unit, used to acquire the address of a query function;
[0153] The hook unit is used to hook the modification program into the query function according to the address.
[0154] Optionally, the query function execution module 120 may include:
[0155] The first replacement unit is used to, when the query function is a retrieval object query function, use a modification program to determine whether a virtual machine feature value exists in the query instruction received by the retrieval object query function; and when a virtual machine feature value exists in the query instruction, generate a replacement string different from the virtual machine feature value as a non-virtual machine feature value to replace the virtual machine feature value.
[0156] Optionally, the query function execution module 120 may include:
[0157] The second replacement unit is used to, when the query function is an enumeration result retrieval function, use a modification program to obtain the attribute field corresponding to the attribute value parameter in the process information obtained by the enumeration result retrieval function, and determine whether there is a preset attribute field in the attribute field; if there is a preset attribute field in the attribute field, obtain the attribute value corresponding to the preset attribute field; determine whether the attribute value is a virtual machine characteristic value; and when the attribute value is a virtual machine characteristic value, generate a replacement string different from the virtual machine characteristic value as a non-virtual machine characteristic value to replace the virtual machine characteristic value.
[0158] Optionally, the first replacement unit and / or the second replacement unit may include:
[0159] The non-virtual machine characteristic value generating subunit is used to generate a replacement string which is different from the prefix of the virtual machine characteristic value and has the same suffix as the non-virtual machine characteristic value.
[0160] It should be noted that the various modules or units and sub-units in the virtual machine detection countermeasure device provided in the embodiment of the present application can be applied to the above-mentioned electronic device.
[0161] On the other hand, an embodiment of the present application further provides an electronic device, which may include a processor and a memory. The relationship between the processor and the memory in the electronic device can be referred to as Figure 1 .
[0162] Wherein, the processor of the electronic device is used to execute the program stored in the memory;
[0163] The memory of the electronic device is used to store a program, which is at least used to:
[0164] Run the sample to be tested;
[0165] When receiving a query instruction sent by the sample to be detected, running the query function corresponding to the query instruction, and in the process of running the query function, using the corresponding modification program to replace the virtual machine feature value obtained by the query function with the non-virtual machine feature value;
[0166] The query function is used to obtain the query result according to the non-virtual machine feature value, and the query result is returned to the sample to be detected.
[0167] Of course, the electronic device may also include a communication interface, a display unit, an input device, etc., which are not specifically limited here.
[0168] On the other hand, an embodiment of the present application further provides a storage medium, in which a computer program is stored. When the computer program is loaded and executed by a processor, it is used to implement the virtual machine detection countermeasure method described in any of the above embodiments.
[0169] It should be noted that each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the embodiments can be referred to each other. For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0170] Finally, 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 presence of other identical elements in the process, method, article or device including the elements.
[0171] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
[0172] The above are only preferred embodiments of the present invention. It should be pointed out that, for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A virtual machine detection countermeasure method, characterized in that: include: Run the sample to be tested; When receiving a query instruction sent by the sample to be detected, running the query function corresponding to the query instruction, and in the process of running the query function, using the corresponding modification program to replace the virtual machine feature value obtained by the query function with the non-virtual machine feature value; Obtaining a query result according to the non-virtual machine feature value using the query function, and returning the query result to the sample to be detected, wherein the query result does not include data information indicating that the current operating environment is a virtual environment; When the query function is a search object query function, the use of a corresponding modification program to replace the virtual machine feature value obtained by the query function with a non-virtual machine feature value includes: Using the modification program to determine whether the virtual machine characteristic value exists in the query instruction received by the retrieval object query function; If the virtual machine characteristic value exists, generating a replacement string different from the virtual machine characteristic value as the non-virtual machine characteristic value to replace the virtual machine characteristic value; When the query function is an enumeration result retrieval function, the use of a corresponding modification program to replace the virtual machine feature value obtained by the query function with a non-virtual machine feature value includes: Using the modification program to obtain the attribute field corresponding to the attribute value parameter in the process information obtained by the enumeration result retrieval function, and determining whether there is a preset attribute field in the attribute field; If the preset attribute field exists, obtaining the attribute value corresponding to the preset attribute field; Determining whether the attribute value is a characteristic value of the virtual machine; If it is the virtual machine characteristic value, a replacement string different from the virtual machine characteristic value is generated as the non-virtual machine characteristic value to replace the virtual machine characteristic value.
2. The virtual machine detection countermeasure method according to claim 1, characterized in that: Before running the sample to be detected, the method further includes: The modification program is injected into the query function.
3. The virtual machine detection countermeasure method according to claim 2, characterized in that: The injecting the modification program into the query function comprises: Obtaining the address of the query function; According to the address, the modification procedure is hooked into the query function.
4. The virtual machine detection countermeasure method according to claim 1, characterized in that: The step of generating a replacement string different from the virtual machine characteristic value as the non-virtual machine characteristic value includes: A replacement string having a different prefix from the virtual machine feature value and the same suffix as the virtual machine feature value is generated as the non-virtual machine feature value.
5. A virtual machine detection countermeasure device, characterized in that: include: A sample operation module is used to operate the sample to be tested; a query function running module, configured to run the query function corresponding to the query instruction when receiving the query instruction sent by the sample to be detected, and in the process of running the query function, replace the virtual machine feature value obtained by the query function with a non-virtual machine feature value by using a corresponding modification program, and use the query function to obtain a query result according to the non-virtual machine feature value, wherein the query result does not contain data information indicating that the current operating environment is a virtual environment; A query result returning module, used for returning the query result to the sample to be detected; When the query function is a search object query function, the query function execution module includes: a first replacement unit, configured to use the modification program to determine whether the virtual machine characteristic value exists in the query instruction received by the search object query function; if the virtual machine characteristic value exists, generate a replacement string different from the virtual machine characteristic value as the non-virtual machine characteristic value to replace the virtual machine characteristic value; When the query function is an enumeration result retrieval function, the query function running module includes: The second replacement unit is used to use the modification program to obtain the attribute field corresponding to the attribute value parameter in the process information obtained by the enumeration result retrieval function, and determine whether there is a preset attribute field in the attribute field; if there is a preset attribute field, obtain the attribute value corresponding to the preset attribute field; determine whether the attribute value is the virtual machine characteristic value; if it is the virtual machine characteristic value, generate a replacement string different from the virtual machine characteristic value as the non-virtual machine characteristic value to replace the virtual machine characteristic value.
6. The virtual machine detection countermeasure device according to claim 5, characterized in that: Also includes: An injection module is used to inject the modification program into the query function.
7. The virtual machine detection and countermeasure device according to claim 6, characterized in that: The injection module comprises: An address acquisition unit, used to acquire the address of a query function; The hook unit is used to hook the modification program into the query function according to the address.
8. The virtual machine detection and countermeasure device according to claim 5, characterized in that: The first replacement unit and / or the second replacement unit comprises: The non-virtual machine characteristic value generating subunit is used to generate a replacement string which is different from the prefix of the virtual machine characteristic value and has the same suffix as the non-virtual machine characteristic value.
9. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the virtual machine detection countermeasure method according to any one of claims 1 to 4 when executing the computer program.
10. A storage medium, characterized in that: The storage medium stores computer executable instructions, and when the computer executable instructions are loaded and executed by the processor, the virtual machine detection countermeasure method according to any one of claims 1 to 4 is implemented.
