CN117763538B - Dynamic link library injection method, device and computer readable medium - Google Patents
Dynamic link library injection method, device and computer readable medium Download PDFInfo
- Publication number
- CN117763538B CN117763538B CN202311789928.8A CN202311789928A CN117763538B CN 117763538 B CN117763538 B CN 117763538B CN 202311789928 A CN202311789928 A CN 202311789928A CN 117763538 B CN117763538 B CN 117763538B
- Authority
- CN
- China
- Prior art keywords
- driver
- dynamic link
- link library
- file
- uefi
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Landscapes
- Stored Programmes (AREA)
Abstract
提供了动态链接库的注入方法、装置和计算机可读介质。一种动态链接库的注入方法,其特征在于,包括:获取已固化到存储装置中的UEFI启动文件;以及利用所述UEFI启动文件执行动态链接库的注入。
A method, device and computer-readable medium for injecting a dynamic link library are provided. A method for injecting a dynamic link library is characterized by comprising: obtaining a UEFI startup file that has been solidified into a storage device; and injecting a dynamic link library using the UEFI startup file.
Description
技术领域Technical Field
本公开涉及一种动态链接库(Dynamic Link Library,缩写DLL)的注入方法、装置和计算机可读介质。具体地,本公开涉及向进程中注入动态链接库,使得所注入的动态链接库不会被关闭并且能够持久驻留于计算机系统中。The present invention relates to a method, device and computer-readable medium for injecting a dynamic link library (DLL). Specifically, the present invention relates to injecting a dynamic link library into a process so that the injected dynamic link library will not be closed and can be permanently resident in a computer system.
背景技术Background Art
动态链接库是一种共享库的实现方式,用于在诸如Windows和OS/2的操作系统中实现共享库的概念。动态链接库注入是一种技术,它允许将动态链接库文件加载到目标进程中,并执行其中的代码。动态链接库注入有多种形式,包括异步过程调用(AsynchronousProcedure Call,缩写APC)注入、消息注入、注册表注入、远程线程注入、输入法注入等。Dynamic link library is a shared library implementation used to implement the concept of shared libraries in operating systems such as Windows and OS/2. Dynamic link library injection is a technique that allows dynamic link library files to be loaded into a target process and the code in it to be executed. There are many forms of dynamic link library injection, including asynchronous procedure call (APC) injection, message injection, registry injection, remote thread injection, input method injection, etc.
上述常规的注入方式缺点包括容易暴露所注入的动态链接库,导致其可能会被快速终止或关闭甚至被删除,不容易实现持久驻留。例如,远程线程注入是在用户态实现注入,而且,其注入过程可能会被安全软件发现,因此,可能会被拦截而导致注入失败。此外,由于这种注入方式存在于用户态,因此,无法注入到高特权的进程中,例如,不能够注入到services.exe、lsass.exe、smss.exe等进程中。此外,远程线程注入也无法实现持久驻留。另外,如果动态链接库的文件源一旦被删除,那么动态链接库就彻底消失了。从用户端来说,这会导致与服务器失联,从而导致无法跟踪用户产品的状态。例如,对诸如计算机的计算设备来说,当在计算机中将诸如显卡的硬件的驱动程序安装完成之后,在该计算机中将存在与之对应的管理器。但是,该管理器可能会被不正常地关闭或者卸载,这会导致该计算机与服务器失联,使得服务器无法收集显卡的状态信息等数据。这种失联还会妨碍对显卡的管理以及漏洞修复。The above conventional injection methods have the disadvantages of easily exposing the injected dynamic link library, which may cause it to be quickly terminated or closed or even deleted, and it is not easy to achieve persistent residence. For example, remote thread injection is implemented in user mode, and its injection process may be discovered by security software, so it may be intercepted and cause injection failure. In addition, since this injection method exists in user mode, it cannot be injected into high-privilege processes, for example, it cannot be injected into services.exe, lsass.exe, smss.exe and other processes. In addition, remote thread injection cannot achieve persistent residence. In addition, if the file source of the dynamic link library is deleted, the dynamic link library disappears completely. From the user side, this will cause a loss of connection with the server, resulting in the inability to track the status of the user's product. For example, for a computing device such as a computer, after the driver of a hardware such as a graphics card is installed in the computer, a corresponding manager will exist in the computer. However, the manager may be abnormally closed or uninstalled, which will cause the computer to lose connection with the server, making it impossible for the server to collect data such as the status information of the graphics card. This loss of connection will also hinder the management of the graphics card and the repair of vulnerabilities.
统一可扩展固件接口(Unified Extensible Firmware Interface,缩写UEFI)用来定义操作系统与系统固件之间的软件界面,作为BIOS的替代方案。UEFI负责加电自检(POST)、联系操作系统以及提供连接操作系统与硬件的接口。外壳代码(Shellcode)是一种用于利用软件漏洞的机器码(二进制代码)片段,它通常用于计算机安全领域,特别是在渗透测试、漏洞利用和恶意软件开发中。Unified Extensible Firmware Interface (UEFI) is used to define the software interface between the operating system and the system firmware as an alternative to BIOS. UEFI is responsible for the power-on self-test (POST), contacting the operating system, and providing an interface between the operating system and the hardware. Shellcode is a piece of machine code (binary code) used to exploit software vulnerabilities. It is commonly used in the field of computer security, especially in penetration testing, vulnerability exploitation, and malware development.
发明内容Summary of the invention
根据本公开的一个方面,提供了一种动态链接库的注入方法,其特征在于,包括:获取已固化到存储装置中的UEFI启动文件;以及利用所述UEFI启动文件执行动态链接库的注入。通过该方法,可以将用于注入的功能都实现在已固化在存储装置中的UEFI启动文件中,从而在文件源头就提供了保护,因为所述UEFI启动文件是不容易被破坏的。另外,利用所述UEFI启动文件来执行动态链接库的注入,使得能够在内核态进行注入,从而克服了上文所述在用户态中的注入方式存在的缺点。According to one aspect of the present disclosure, a method for injecting a dynamic link library is provided, characterized in that it includes: obtaining a UEFI startup file that has been solidified in a storage device; and using the UEFI startup file to perform the injection of the dynamic link library. Through this method, the functions for injection can be implemented in the UEFI startup file that has been solidified in the storage device, thereby providing protection at the source of the file, because the UEFI startup file is not easily damaged. In addition, using the UEFI startup file to perform the injection of the dynamic link library enables the injection to be performed in the kernel state, thereby overcoming the shortcomings of the injection method in the user state described above.
在一个方面中,所述方法还包括:将UEFI启动文件与所述存储装置的固件链接成映像文件;以及将所述映像文件固化到所述存储装置中。通过该方法,所述存储装置的固件在文件源头进一步提供了硬件固件保护,保证了源头的安全性。另外,将UEFI启动文件和存储装置的固件链接成一个文件,可以使计算机在启动时直接加载这个文件,从而实现快速启动和高效运行。In one aspect, the method further includes: linking the UEFI boot file and the firmware of the storage device into an image file; and fixing the image file into the storage device. Through this method, the firmware of the storage device further provides hardware firmware protection at the source of the file, ensuring the security of the source. In addition, linking the UEFI boot file and the firmware of the storage device into one file allows the computer to directly load this file at startup, thereby achieving fast startup and efficient operation.
在一个方面中,所述固化包括借助于所述存储装置的固件升级接口将所述映像文件升级到所述存储装置中。通过该方法,只有在经过固件升级的硬件上,才能解除绑定并访问所述UEFI启动文件。这样可以控制对所述UEFI启动文件的访问权限,从而提升注入的安全性。In one aspect, the curing includes upgrading the image file to the storage device by means of a firmware upgrade interface of the storage device. Through this method, the UEFI boot file can be unbound and accessed only on hardware that has undergone a firmware upgrade. In this way, access rights to the UEFI boot file can be controlled, thereby improving the security of injection.
在一个方面中,利用所述UEFI启动文件执行动态链接库的注入包括:运行所述UEFI启动文件以执行启动工作,进入操作系统内核环境;在所述操作系统内核环境下利用所述UEFI启动文件加载驱动程序;利用所述UEFI启动文件操作所加载的驱动程序以埋设进程监控来监控指定进程的创建;以及响应于所述指定进程的创建,利用所述UEFI启动文件操作所加载的驱动程序以将所述动态链接库注入到所述指定进程的内部。通过该方法,可以在操作系统内核环境下将动态链接库注入到指定的进程中,从而克服了上文所述在用户态中的注入方式存在的缺点。In one aspect, using the UEFI boot file to perform dynamic link library injection includes: running the UEFI boot file to perform the boot work and enter the operating system kernel environment; using the UEFI boot file to load the driver program in the operating system kernel environment; using the driver program loaded by the UEFI boot file operation to bury process monitoring to monitor the creation of a specified process; and in response to the creation of the specified process, using the driver program loaded by the UEFI boot file operation to inject the dynamic link library into the specified process. Through this method, the dynamic link library can be injected into the specified process in the operating system kernel environment, thereby overcoming the shortcomings of the injection method in user mode described above.
在一个方面中,在所述操作系统内核环境下利用所述UEFI启动文件加载驱动程序包括:将所述驱动程序从外壳代码数据区提取出来;在所述操作系统内核环境的内存池中分配一段可容纳内存对齐后的所述驱动程序的内存;将所述驱动程序复制到所分配的内存中;修复所述驱动程序的重定位表项与导入表项;创建驱动对象,获取所述驱动程序的入口点;初始化所述驱动对象;以及调用所述驱动程序的入口点,对所述驱动对象执行二次初始化。通过该方法,从外壳代码数据区提取驱动程序增加了驱动程序的安全性,减少被检测和识别的风险。通过该方法为驱动程序分配内存对齐后的内存,然后将驱动程序复制到所分配的内存中并修复驱动程序的重定位表项与导入表项,确保了驱动程序可以正确地链接和执行。In one aspect, loading a driver using the UEFI boot file in the operating system kernel environment includes: extracting the driver from the shell code data area; allocating a section of memory in the memory pool of the operating system kernel environment that can accommodate the driver after memory alignment; copying the driver to the allocated memory; repairing the relocation table entry and import table entry of the driver; creating a driver object, obtaining the entry point of the driver; initializing the driver object; and calling the entry point of the driver to perform secondary initialization on the driver object. Through this method, extracting the driver from the shell code data area increases the security of the driver and reduces the risk of being detected and identified. Through this method, memory alignment is allocated to the driver, and then the driver is copied to the allocated memory and the relocation table entry and import table entry of the driver are repaired, ensuring that the driver can be correctly linked and executed.
在一个方面中,利用所述UEFI启动文件操作所加载的驱动程序以埋设进程监控来监控指定进程的创建包括:在所述驱动程序初始化过程中创建随机名称的设备对象;以及注册所述驱动程序的进程通知回调函数,以监控所述指定进程的创建。通过该方法注册所述驱动程序的进程通知回调函数,可以监控操作系统内核环境中的进程创建和销毁事件,从而可以在进程运行之前对其进行必要的操作,例如注入动态链接库。In one aspect, using the driver loaded by the UEFI boot file operation to embed process monitoring to monitor the creation of a specified process includes: creating a device object with a random name during the initialization of the driver; and registering a process notification callback function of the driver to monitor the creation of the specified process. By registering the process notification callback function of the driver by this method, the process creation and destruction events in the operating system kernel environment can be monitored, so that necessary operations can be performed on the process before it runs, such as injecting a dynamic link library.
在一个方面中,响应于所述指定进程的创建,利用所述UEFI启动文件操作所加载的驱动程序以将所述动态链接库注入到所述指定进程的内部包括:注册所述驱动程序的回调函数,以挂靠到所述指定进程;在所述驱动程序的回调函数中打开已创建的设备对象;在所述驱动程序中将设备句柄与中断向量号以及随机令牌存入到用户态外壳代码中;在所述驱动程序的回调函数中从所述指定进程的虚拟地址空间中分配一段可读写可执行的内存;将指定的外壳代码和所述动态链接库按内存复制方式写入所述可读写可执行的内存中;将所述指定进程的原始入口点替换为所述动态链接库的入口点;将所述动态链接库的入口点的地址作为参数,更新中央处理器的转译后备缓冲器,以清除所述转译后备缓冲器;以及解除所述驱动程序对于所述指定进程的挂靠。通过该方法,可以确保安全并且正确地在操作系统内核环境中将动态链接库注入到期望的指定进程中,而不影响该指定进程之后的运行。此外,通过该方法,用户模式下的程序可以使用设备句柄、中断向量号和随机token与驱动程序通信,也即进行双向验证,进一步提高了硬件设备驱动程序和用户端之间通信的安全性。In one aspect, in response to the creation of the designated process, the driver loaded by the UEFI boot file operation is used to inject the dynamic link library into the interior of the designated process, including: registering the callback function of the driver to attach to the designated process; opening the created device object in the callback function of the driver; storing the device handle, interrupt vector number and random token in the user state shell code in the driver; allocating a readable, writable and executable memory from the virtual address space of the designated process in the callback function of the driver; writing the designated shell code and the dynamic link library into the readable, writable and executable memory in a memory copy manner; replacing the original entry point of the designated process with the entry point of the dynamic link library; using the address of the entry point of the dynamic link library as a parameter to update the translation back buffer of the central processing unit to clear the translation back buffer; and releasing the driver from attaching to the designated process. Through this method, it can be ensured that the dynamic link library is safely and correctly injected into the desired designated process in the operating system kernel environment without affecting the subsequent operation of the designated process. In addition, through this method, programs in user mode can use device handles, interrupt vector numbers and random tokens to communicate with the driver, that is, perform two-way verification, further improving the security of communication between the hardware device driver and the user end.
在一个方面中,所述方法还包括在注入了所述动态链接库之后通过所述外壳代码来初始化所述动态链接库,包括:所述外壳代码获得所述指定进程的最初执行权来进行最早的初始化;所述外壳代码基于所述动态链接库的入口点执行所述动态链接库的重定位工作;所述动态链接库执行自身的初始化,并在结束后返回所述外壳代码;以及所述外壳代码返回到所述指定进程的原始入口点,使得开始初始化所述指定进程。通过该方法,可以确保安全并且正确地使所注入的动态链接库完成初始化并生效,并且确保被注入动态链接库的指定进程后续安全且正确地初始化和运行。In one aspect, the method further includes initializing the dynamic link library through the shell code after the dynamic link library is injected, including: the shell code obtains the initial execution right of the specified process to perform the earliest initialization; the shell code performs the relocation work of the dynamic link library based on the entry point of the dynamic link library; the dynamic link library performs its own initialization and returns to the shell code after completion; and the shell code returns to the original entry point of the specified process, so as to start initializing the specified process. Through this method, it can be ensured that the injected dynamic link library is initialized and takes effect safely and correctly, and that the specified process injected into the dynamic link library is subsequently initialized and runs safely and correctly.
根据本公开的一个方面,提供了一种动态链接库的注入装置,其特征在于,包括:启动文件获取模块,用于获取已固化到存储装置中的UEFI启动文件;以及注入模块,用于利用所述UEFI启动文件执行动态链接库的注入。According to one aspect of the present disclosure, a dynamic link library injection device is provided, characterized in that it includes: a startup file acquisition module, used to obtain a UEFI startup file that has been solidified into a storage device; and an injection module, used to perform dynamic link library injection using the UEFI startup file.
在一个方面中,所述装置还包括:链接模块,用于将UEFI启动文件与所述存储装置的固件链接成映像文件;以及固化模块,用于将所述映像文件固化到所述存储装置中。In one aspect, the device further includes: a linking module, configured to link a UEFI boot file and a firmware of the storage device into an image file; and a curing module, configured to curate the image file into the storage device.
在一个方面中,所述固化包括借助于所述存储装置的固件升级接口将所述映像文件升级到所述存储装置中。In one aspect, the flashing includes upgrading the image file to the storage device via a firmware upgrade interface of the storage device.
在一个方面中,所述注入模块利用所述UEFI启动文件执行动态链接库的注入包括:运行所述UEFI启动文件以执行启动工作,进入操作系统内核环境;在所述操作系统内核环境下利用所述UEFI启动文件加载驱动程序;利用所述UEFI启动文件操作所加载的驱动程序以埋设进程监控来监控指定进程的创建;以及响应于所述指定进程的创建,利用所述UEFI启动文件操作所加载的驱动程序以将所述动态链接库注入到所述指定进程的内部。In one aspect, the injection module uses the UEFI startup file to perform injection of the dynamic link library, including: running the UEFI startup file to perform startup work and enter the operating system kernel environment; using the UEFI startup file to load a driver program in the operating system kernel environment; using the driver program loaded by the UEFI startup file operation to embed process monitoring to monitor the creation of a specified process; and in response to the creation of the specified process, using the driver program loaded by the UEFI startup file operation to inject the dynamic link library into the interior of the specified process.
在一个方面中,所述注入模块在所述操作系统内核环境下利用所述UEFI启动文件加载驱动程序包括:将所述驱动程序从外壳代码数据区提取出来;在所述操作系统内核环境的内存池中分配一段可容纳内存对齐后的所述驱动程序的内存;将所述驱动程序复制到所分配的内存中;修复所述驱动程序的重定位表项与导入表项;创建驱动对象,获取所述驱动程序的入口点;初始化所述驱动对象;以及调用所述驱动程序的入口点,对所述驱动对象执行二次初始化。In one aspect, the injection module uses the UEFI boot file to load the driver in the operating system kernel environment, including: extracting the driver from the shell code data area; allocating a section of memory in the memory pool of the operating system kernel environment that can accommodate the driver after memory alignment; copying the driver to the allocated memory; repairing the relocation table entries and import table entries of the driver; creating a driver object and obtaining the entry point of the driver; initializing the driver object; and calling the entry point of the driver to perform secondary initialization on the driver object.
在一个方面中,所述注入模块利用所述UEFI启动文件操作所加载的驱动程序以埋设进程监控来监控指定进程的创建包括:在所述驱动程序初始化过程中创建随机名称的设备对象;以及注册所述驱动程序的进程通知回调函数,以监控所述指定进程的创建。In one aspect, the injection module uses the driver loaded by the UEFI boot file operation to embed process monitoring to monitor the creation of a specified process, including: creating a device object with a random name during the driver initialization process; and registering the driver's process notification callback function to monitor the creation of the specified process.
在一个方面中,所述注入模块响应于所述指定进程的创建,利用所述UEFI启动文件操作所加载的驱动程序以将所述动态链接库注入到所述指定进程的内部包括:注册所述驱动程序的回调函数,以挂靠到所述指定进程;在所述驱动程序的回调函数中打开已创建的设备对象;在所述驱动程序中将设备句柄与中断向量号以及随机令牌存入到用户态外壳代码中;在所述驱动程序的回调函数中从所述指定进程的虚拟地址空间中分配一段可读写可执行的内存;将指定的外壳代码和所述动态链接库按内存复制方式写入所述可读写可执行的内存中;将所述指定进程的原始入口点替换为所述动态链接库的入口点;将所述动态链接库的入口点的地址作为参数,更新中央处理器的转译后备缓冲器,以清除所述转译后备缓冲器;以及解除所述驱动程序对于所述指定进程的挂靠。In one aspect, the injection module responds to the creation of the designated process, and utilizes the driver loaded by the UEFI startup file operation to inject the dynamic link library into the interior of the designated process, including: registering the callback function of the driver to attach to the designated process; opening the created device object in the callback function of the driver; storing the device handle, interrupt vector number and random token in the user-mode shell code in the driver; allocating a readable, writable and executable memory from the virtual address space of the designated process in the callback function of the driver; writing the designated shell code and the dynamic link library into the readable, writable and executable memory in a memory copy manner; replacing the original entry point of the designated process with the entry point of the dynamic link library; using the address of the entry point of the dynamic link library as a parameter to update the translation lookaside buffer of the central processing unit to clear the translation lookaside buffer; and releasing the driver from attaching to the designated process.
在一个方面中,所述装置还包括初始化模块,用于在注入了所述动态链接库之后通过所述外壳代码来初始化所述动态链接库,包括:所述外壳代码获得所述指定进程的最初执行权来进行最早的初始化;所述外壳代码基于所述动态链接库的入口点执行所述动态链接库的重定位工作;所述动态链接库执行自身的初始化,并在结束后返回所述外壳代码;以及所述外壳代码返回到所述指定进程的原始入口点,使得开始初始化所述指定进程。In one aspect, the device also includes an initialization module, which is used to initialize the dynamic link library through the shell code after the dynamic link library is injected, including: the shell code obtains the initial execution right of the specified process to perform the earliest initialization; the shell code performs the relocation of the dynamic link library based on the entry point of the dynamic link library; the dynamic link library performs its own initialization and returns to the shell code after completion; and the shell code returns to the original entry point of the specified process to start initializing the specified process.
根据本公开的一个方面,提供了一种电子设备,包括:处理器;用于存储处理器可执行指令的存储器;其中,所述处理器被配置为调用所述存储器存储的指令,以执行上述方法。According to one aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing processor-executable instructions; wherein the processor is configured to call the instructions stored in the memory to execute the above method.
根据本公开的一个方面,提供了一种其上存储有指令的计算机可读介质,所述指令当被执行时使得计算设备执行根据本公开所描述的方法。According to one aspect of the present disclosure, a computer readable medium having instructions stored thereon is provided, wherein when the instructions are executed, the computing device is caused to perform the method described according to the present disclosure.
通过本公开,可以将动态链接库受保护地安全注入期望的进程中。根据本公开的注入从文件源头就开始得到诸如硬件固件的保护,并且可以将动态链接库在内核环境中注入系统进程中,使得其无法被强制终止或关闭。因此,根据本公开的注入有效地解决了诸如显卡的硬件设备管理器被不正常卸载而导致用户端与服务器失联的问题。Through the present disclosure, the dynamic link library can be protected and safely injected into the desired process. The injection according to the present disclosure is protected from the source of the file, such as hardware firmware, and the dynamic link library can be injected into the system process in the kernel environment, so that it cannot be forcibly terminated or closed. Therefore, the injection according to the present disclosure effectively solves the problem of the user terminal losing connection with the server due to the abnormal uninstallation of the hardware device manager such as the graphics card.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
现在将参照附图描述本公开的具体示例性实施例。然而,本公开可以以很多不同的形式实施,并且不应该被解读为限于本文所阐述的实施例;相反,这些实施例被提供以便使该公开全面而完整,并且将向本领域技术人员完全表达本公开的范围。在对附图所示特定示例性实施例的详细描述中所使用的术语不打算对本公开是限制性的。在附图中,类似的数字指代类似的部件。Specific exemplary embodiments of the present disclosure will now be described with reference to the accompanying drawings. However, the present disclosure may be implemented in many different forms and should not be construed as being limited to the embodiments set forth herein; rather, these embodiments are provided to make the disclosure comprehensive and complete and will fully convey the scope of the present disclosure to those skilled in the art. The terms used in the detailed description of specific exemplary embodiments shown in the accompanying drawings are not intended to be limiting of the present disclosure. In the accompanying drawings, like numbers refer to like parts.
图1是根据本公开实施例示出动态链接库的注入方法的流程图。FIG. 1 is a flow chart showing a method for injecting a dynamic link library according to an embodiment of the present disclosure.
图2是根据本公开另一实施例示出利用UEFI启动文件执行动态链接库的注入的方法的流程图。FIG. 2 is a flow chart showing a method for performing injection of a dynamic link library using a UEFI startup file according to another embodiment of the present disclosure.
图3是根据本公开另一实施例示出在Windows操作系统启动过程中注入动态链接库的示意性视图。FIG. 3 is a schematic diagram showing the injection of a dynamic link library during the startup process of a Windows operating system according to another embodiment of the present disclosure.
图4是根据本公开另一实施例示出动态链接库的注入装置的框图。FIG. 4 is a block diagram showing a device for injecting a dynamic link library according to another embodiment of the present disclosure.
图5是示出根据本公开实施例的计算设备的框图。FIG. 5 is a block diagram illustrating a computing device according to an embodiment of the present disclosure.
具体实施方式DETAILED DESCRIPTION
为使本公开的目的、技术方案及优点更加清楚明白,以下参照附图并举实施例,对本公开技术方案作进一步说明。应该进一步理解,使用在该说明书中,术语“包括”意指存在所陈述的特征、步骤、操作、部件和/或组件,但是并不排除存在或添加一个或更多个其他特征、步骤、操作、部件、组件和/或其组成的组。In order to make the purpose, technical solution and advantages of the present disclosure more clear, the technical solution of the present disclosure is further described below with reference to the accompanying drawings and examples. It should be further understood that the term "comprising" used in this specification means the presence of the stated features, steps, operations, parts and/or components, but does not exclude the presence or addition of one or more other features, steps, operations, parts, components and/or groups thereof.
图1是根据本公开实施例示出动态链接库的注入方法100的流程图。FIG. 1 is a flow chart showing a method 100 for injecting a dynamic link library according to an embodiment of the present disclosure.
如图1中所示,在步骤102处,获取已固化到存储装置中的UEFI启动文件。UEFI启动文件可以包括用于启动诸如计算机的计算设备的所有的启动功能,它包含了诸如计算机的计算设备的操作系统的启动程序和其他必要的启动信息。在一个实施例中,UEFI启动文件可以包括根据本公开实现的所有功能,例如与注入动态链接库相关的所有功能。存储装置可以包括用于存储代码和数据的各种类型的存储装置,例如硬盘(例如,固态硬盘等)、可移动存储装置(例如,USB闪存驱动器、SD卡、CF卡、外部硬盘驱动器等)、光盘(例如,CD-ROM、DVD-ROM和蓝光盘等)、磁带存储装置等等。在本公开中,UEFI启动文件可以优选地固化到以下一个或多个存储装置中:硬盘,特别是在硬盘的系统分区或可扩展固件接口(ExtensibleFirmware Interface",缩写EFI)系统分区中;可移动存储装置,UEFI启动文件也可以固化在可移动存储装置中,从而可以将其连接到计算机来实现从该可移动存储装置启动;光盘,UEFI启动文件也可以被固化在光盘中,例如制作UEFI启动光盘或安装光盘,从而计算机可以从光盘启动并加载UEFI启动文件。这样,可以有效地保护根据本公开所实现的各种功能,因为体现这些功能的数据和代码可以全部实现在已固化到上述非易失性存储装置中的UEFI启动文件中,这样的UEFI启动文件是难以被破坏和篡改的。As shown in Figure 1, at step 102, a UEFI boot file that has been solidified into a storage device is obtained. The UEFI boot file may include all boot functions for starting a computing device such as a computer, which includes a boot program and other necessary boot information of an operating system of a computing device such as a computer. In one embodiment, the UEFI boot file may include all functions implemented according to the present disclosure, such as all functions related to injecting a dynamic link library. The storage device may include various types of storage devices for storing code and data, such as a hard disk (e.g., a solid-state hard disk, etc.), a removable storage device (e.g., a USB flash drive, an SD card, a CF card, an external hard drive, etc.), an optical disk (e.g., a CD-ROM, a DVD-ROM, and a Blu-ray disc, etc.), a tape storage device, and the like. In the present disclosure, the UEFI boot file can preferably be fixed to one or more of the following storage devices: a hard disk, especially in a system partition of the hard disk or an Extensible Firmware Interface (EFI) system partition; a removable storage device, in which the UEFI boot file can also be fixed, so that it can be connected to a computer to realize booting from the removable storage device; an optical disk, in which the UEFI boot file can also be fixed, for example, to make a UEFI boot optical disk or an installation optical disk, so that the computer can boot from the optical disk and load the UEFI boot file. In this way, the various functions implemented according to the present disclosure can be effectively protected, because the data and code embodying these functions can all be implemented in the UEFI boot file that has been fixed to the above-mentioned non-volatile storage device, and such a UEFI boot file is difficult to be destroyed and tampered with.
在一个示例中,可以通过如下操作来获取已固化到存储装置中的UEFI启动文件:在计算机上电之后进入UEFI设置接口;以及在UEFI设置接口中的启动(Boot)或类似选项中导航到启动顺序(Boot Order)或类似选项,从而可以查找到并相应地获取UEFI启动文件。In one example, the UEFI boot file that has been solidified into the storage device can be obtained by the following operations: entering the UEFI setting interface after the computer is powered on; and navigating to the boot order (Boot Order) or similar options in the boot (Boot) or similar options in the UEFI setting interface, so that the UEFI boot file can be found and obtained accordingly.
可替代地或附加地,在一个实施例中,可以将UEFI启动文件与存储装置的固件链接成映像文件,以及将所述映像文件固化到存储装置中。存储装置的固件是一种用于管理硬件设备的软件,它包含了硬件设备的驱动程序和其他必要的信息。映像文件包含了对特定系统、应用程序或数据进行完整复制或备份的映像,例如只读存储器(Read-OnlyMemory,缩写ROM)文件、BIN(Binary)文件、ISO文件、IMG(Image)文件等等。只读存储器文件用于存储对计算机系统中的只读存储器进行的镜像或备份。在一个示例中,可以将UEFI启动文件与存储装置的固件链接成只读存储器文件,并将该只读存储器文件固化到存储装置中。例如,可以通过专用的映像工具、只读存储器复制设备或仿真器来将UEFI启动文件与存储装置的固件链接在一起作为只读存储器文件,并通过烧录的方式将该只读存储器文件固化到存储装置中。可替换地,可以通过直接复制的方式将只读存储器文件存储到存储装置中。由于只读存储器文件是只读的,无法被修改或删除,因此通过如上所述的链接和固化,包括根据本公开的所有功能的UEFI启动文件得到进一步硬件固件保护,保证了文件源头的安全性。另外,将UEFI启动文件和存储装置的固件链接成一个文件,可以使计算机在启动时直接加载这个文件,从而实现快速启动和高效运行。Alternatively or additionally, in one embodiment, the UEFI boot file and the firmware of the storage device can be linked into an image file, and the image file can be fixed to the storage device. The firmware of the storage device is a software for managing hardware devices, which contains the driver and other necessary information of the hardware device. The image file contains an image that completely copies or backs up a specific system, application or data, such as a read-only memory (ROM) file, a BIN (Binary) file, an ISO file, an IMG (Image) file, and the like. The read-only memory file is used to store a mirror or backup of the read-only memory in the computer system. In one example, the UEFI boot file and the firmware of the storage device can be linked into a read-only memory file, and the read-only memory file can be fixed to the storage device. For example, the UEFI boot file and the firmware of the storage device can be linked together as a read-only memory file by a dedicated imaging tool, a read-only memory copy device or an emulator, and the read-only memory file can be fixed to the storage device by burning. Alternatively, the read-only memory file can be stored in the storage device by direct copying. Since the read-only memory file is read-only and cannot be modified or deleted, the UEFI boot file including all functions according to the present disclosure is further protected by hardware firmware through the linking and solidification as described above, thereby ensuring the security of the file source. In addition, linking the UEFI boot file and the firmware of the storage device into one file allows the computer to directly load this file when it starts, thereby achieving fast startup and efficient operation.
可替换地或附加地,还可以通过以下方式将UEFI启动文件与存储装置的固件作为整体固化到存储装置中:文件系统,将UEFI启动文件和存储装置的固件作为文件存储在存储装置的文件系统中;将UEFI启动文件与存储装置的固件嵌入到操作系统的安装介质中,这样,在安装操作系统时,UEFI启动文件与存储装置的固件可以一并写入到存储装置中;特殊分区,创建一个专门的分区来存储UEFI启动文件与存储装置的固件,等等。Alternatively or additionally, the UEFI boot file and the firmware of the storage device may be solidified as a whole into the storage device in the following ways: file system, storing the UEFI boot file and the firmware of the storage device as files in the file system of the storage device; embedding the UEFI boot file and the firmware of the storage device into the installation medium of the operating system, so that when the operating system is installed, the UEFI boot file and the firmware of the storage device can be written into the storage device together; special partition, creating a special partition to store the UEFI boot file and the firmware of the storage device, and so on.
可替代地或附加地,所述固化包括借助于所述存储装置的固件升级接口将所述映像文件升级到所述存储装置中。通过该方法,只有在经过固件升级的硬件上,才能解除绑定并访问所述UEFI启动文件。这样可以控制对所述UEFI启动文件的访问权限,从而进一步提高根据本公开的注入的安全性。Alternatively or additionally, the curing includes upgrading the image file to the storage device by means of a firmware upgrade interface of the storage device. Through this method, the UEFI startup file can be unbound and accessed only on hardware that has undergone a firmware upgrade. In this way, access rights to the UEFI startup file can be controlled, thereby further improving the security of the injection according to the present disclosure.
可替代地或附加地,在将UEFI启动文件与存储装置的固件链接成只读存储器文件的实施例中,可以通过如下操作来获取已固化在存储装置中的UEFI启动文件:在计算机上电之后,存储装置的该只读存储器文件启动并初始化;UEFI和/或BIOS(基本输入输出系统)检测存储装置的UEFI分区来查找UEFI启动文件;存储装置的固件接收到查找请求,从只读存储器文件中读取UEFI启动文件,返回给UEFI和/或BIOS指定的内存区。Alternatively or additionally, in an embodiment in which the UEFI boot file and the firmware of the storage device are linked into a read-only memory file, the UEFI boot file solidified in the storage device can be obtained by the following operations: after the computer is powered on, the read-only memory file of the storage device is started and initialized; the UEFI and/or BIOS (basic input and output system) detects the UEFI partition of the storage device to search for the UEFI boot file; the firmware of the storage device receives the search request, reads the UEFI boot file from the read-only memory file, and returns it to the memory area specified by the UEFI and/or BIOS.
在步骤104处,利用所述UEFI启动文件执行动态链接库的注入。如上所述,在一个实施例中,所获取的UEFI启动文件可以包括根据本公开实现的所有功能,例如与注入动态链接库相关的所有功能。这样,在计算机上电并且UEFI执行了计算机操作系统的初始化从而进入操作系统内核环境之后,可以在该操作系统内核环境中执行动态链接库的注入。换言之,在该实施例中,根据本公开的动态链接库的注入可以在内核态中进行,使得注入过程不会被安全软件拦截而导致注入失败,并且可以将动态链接库注入到高特权的进程(例如,services.exe,lsass.exe,smss.exe等进程)中,从而能够持久驻留在操作系统中。相应地,使用所注入的动态链接库的用户端能够持久地与服务器通信,从而能够持久地跟踪用户产品的状态。At step 104, the injection of the dynamic link library is performed using the UEFI boot file. As described above, in one embodiment, the UEFI boot file obtained may include all functions implemented according to the present disclosure, such as all functions related to the injection of the dynamic link library. In this way, after the computer is powered on and UEFI performs the initialization of the computer operating system to enter the operating system kernel environment, the injection of the dynamic link library can be performed in the operating system kernel environment. In other words, in this embodiment, the injection of the dynamic link library according to the present disclosure can be performed in the kernel state, so that the injection process will not be intercepted by the security software and cause the injection failure, and the dynamic link library can be injected into a high privileged process (for example, services.exe, lsass.exe, smss.exe and other processes), so that it can be permanently resident in the operating system. Accordingly, the user end using the injected dynamic link library can communicate with the server persistently, so that the status of the user product can be tracked persistently.
下面将结合图2来进一步描述利用UEFI启动文件执行动态链接库的注入的方法。图2是根据本公开另一实施例示出利用UEFI启动文件执行动态链接库的注入的方法200的流程图。The method of using a UEFI startup file to perform dynamic link library injection will be further described below in conjunction with Figure 2. Figure 2 is a flow chart showing a method 200 of using a UEFI startup file to perform dynamic link library injection according to another embodiment of the present disclosure.
如图2中所示,在步骤202处,运行UEFI启动文件以执行启动工作,进入操作系统内核环境。UEFI启动文件可以通过如前文所述的方式来获取。在获取了UEFI启动文件之后,UEFI可以执行针对操作系统的一系列初始化操作,以进入操作系统内核环境。例如,在Windows操作系统的实施例中,可以对其内核环境中的如下一个或多个模块进行初始化:EFIDXE,其是EFI驱动程序运行环境(Driver Execution Environment,或DXE);加载器模块Loader.efi,其被执行时从BCDedit数据库(其是微软公司开发的数据库)读取系统启动数据;监控模块EfiMonitor.efi,用于启用对系统启动的监控;Bootmgrfw.efi模块,用于执行正常的开机启动流程;WinPE模块,其是一种轻量级的操作系统环境,用于部署、维护和恢复Windows操作系统;EFIBootService模块,其是EFI启动服务器,包含了事件服务、内存管理服务、各种协议服务等;BootMgr模块,用于管理启动操作并加载操作系统;Winload.efi模块,用于加载Windows操作系统的内核(ntoskrnl.exe)和其他必要的系统文件;EFI运行时服务(EFI Runtime Services)模块,用于在操作系统运行时与固件进行交互;Ntkrnlmp.exe模块,其包含操作系统的核心组件和功能,负责管理和控制计算机的各种资源和操作;硬件抽象层(Hardware Abstraction Layer,缩写Hal)模块,其位于操作系统内核和硬件之间,提供了对硬件的抽象和统一访问接口,等等,如参照图3所示。在对内核环境中的这些模块进行初始化的过程中,可以通过诸如钩子(Hook)这样的消息处理机制来监视和拦截在系统启动期间产生的各种消息,以及通过补丁(Patch)这样的程序修改手段,来控制操作系统内核环境的初始化过程。As shown in FIG2 , at step 202, the UEFI startup file is run to perform the startup work and enter the operating system kernel environment. The UEFI startup file can be obtained in the manner described above. After obtaining the UEFI startup file, the UEFI can perform a series of initialization operations for the operating system to enter the operating system kernel environment. For example, in an embodiment of the Windows operating system, one or more of the following modules in its kernel environment may be initialized: EFIDXE, which is the EFI driver execution environment (Driver Execution Environment, or DXE); the loader module Loader.efi, which reads system startup data from the BCDedit database (which is a database developed by Microsoft) when executed; the monitoring module EfiMonitor.efi, which is used to enable monitoring of system startup; the Bootmgrfw.efi module, which is used to execute a normal boot process; the WinPE module, which is a lightweight operating system environment for deploying, maintaining and restoring the Windows operating system; the EFIBootService module, which is the EFI boot server, which includes event services, memory management services, various protocol services, etc.; the BootMgr module, which is used to manage startup operations and load the operating system; the Winload.efi module, which is used to load the kernel (ntoskrnl.exe) and other necessary system files of the Windows operating system; the EFI Runtime Service (EFI Runtime Service). Services) module, which is used to interact with the firmware when the operating system is running; Ntkrnlmp.exe module, which contains the core components and functions of the operating system and is responsible for managing and controlling various resources and operations of the computer; Hardware Abstraction Layer (Hal) module, which is located between the operating system kernel and the hardware and provides an abstract and unified access interface to the hardware, etc., as shown in Figure 3. In the process of initializing these modules in the kernel environment, various messages generated during system startup can be monitored and intercepted through message processing mechanisms such as hooks, and program modification methods such as patches can be used to control the initialization process of the operating system kernel environment.
在步骤204处,在所述操作系统内核环境下利用所述UEFI启动文件加载驱动程序。驱动程序是一种用于控制硬件设备的程序,它可以与硬件设备进行交互,从而实现对硬件设备的控制。例如,根据本公开,在硬件设备为显卡的示例中,与显卡对应的驱动程序可以是显卡的内核模式显示驱动程序(Kernel Mode Display Driver,缩写KMD),它直接与显卡硬件进行交互并提供对显卡功能的访问接口。当操作系统内核环境被建立后,就可以加载驱动程序,并将其与硬件设备联系在一起,从而实现对硬件设备的控制。加载驱动程序可以包括对驱动程序进行初始化和配置。初始化操作可以包括设置驱动程序的参数、分配内存、注册回调函数等。回调函数是一种函数,它作为参数传递给另一个函数,并在该函数执行完毕后被调用。根据本公开,对驱动程序进行初始化和配置是根据在UEFI启动文件中实现的功能来进行的。具体地,包括了根据本公开的功能的UEFI启动文件可以控制驱动程序的初始化,以例如分配所期望大小的内存以及注册特定的回调函数来实现期望的操作,例如动态链接库注入等等。At step 204, the driver is loaded using the UEFI boot file in the operating system kernel environment. The driver is a program for controlling a hardware device, which can interact with the hardware device to achieve control of the hardware device. For example, according to the present disclosure, in an example where the hardware device is a graphics card, the driver corresponding to the graphics card can be a kernel mode display driver (KMD) of the graphics card, which directly interacts with the graphics card hardware and provides an access interface to the graphics card function. When the operating system kernel environment is established, the driver can be loaded and linked to the hardware device to achieve control of the hardware device. Loading the driver may include initializing and configuring the driver. The initialization operation may include setting driver parameters, allocating memory, registering callback functions, etc. A callback function is a function that is passed as a parameter to another function and is called after the function is executed. According to the present disclosure, initialization and configuration of the driver is performed according to the functions implemented in the UEFI boot file. Specifically, the UEFI boot file including the functions according to the present disclosure can control the initialization of the driver, such as allocating the desired size of memory and registering a specific callback function to achieve the desired operation, such as dynamic link library injection, etc.
可替换地或附加地,利用所述UEFI启动文件加载驱动程序可以包括将所述驱动程序从外壳代码数据区提取出来。这意味着可以将驱动程序预先存储在外壳代码数据区中,因此驱动程序可以不必以明文形式存储在存储装置中,增加了驱动程序的安全性。此外,通过将驱动程序嵌入外壳代码数据区中,可以使驱动程序具备跨平台或跨架构支持。外壳代码是特定平台和架构的可执行代码,通过加载和执行外壳代码,可以在不同的操作系统或架构上运行相同的驱动程序。利用所述UEFI启动文件加载驱动程序还可以包括在所述操作系统内核环境的内存池中分配一段可容纳内存对齐后的所述驱动程序的内存。这样,可以将驱动程序存储到操作系统内核环境的内存池中,使得驱动程序具有更高的性能和可控性,从而实现对硬件设备的高效控制。利用所述UEFI启动文件加载驱动程序还可以包括将所述驱动程序复制到所分配的内存中。在一个示例中,可以将驱动程序逐区域按4k对齐复制到所述内存中,也即进行可移植可执行文件(Portable Executable,缩写PE)的分区加载。4K对齐是一种内存对齐方式,它可以提高内存访问的效率,从而提高计算机的性能。具体来说,4K对齐是将数据按照4K字节的倍数进行对齐,例如,如果数据的起始地址是0x1000,则按照4K对齐的方式,数据的起始地址应该是0x1000的倍数,即0x1000、0x2000、0x3000等。Alternatively or additionally, using the UEFI boot file to load the driver may include extracting the driver from the shell code data area. This means that the driver can be pre-stored in the shell code data area, so the driver does not need to be stored in a storage device in plain text, which increases the security of the driver. In addition, by embedding the driver in the shell code data area, the driver can be provided with cross-platform or cross-architecture support. Shell code is an executable code for a specific platform and architecture. By loading and executing the shell code, the same driver can be run on different operating systems or architectures. Using the UEFI boot file to load the driver may also include allocating a section of memory that can accommodate the driver after memory alignment in the memory pool of the operating system kernel environment. In this way, the driver can be stored in the memory pool of the operating system kernel environment, so that the driver has higher performance and controllability, thereby achieving efficient control of hardware devices. Using the UEFI boot file to load the driver may also include copying the driver to the allocated memory. In one example, the driver can be copied to the memory region by region according to 4k alignment, that is, partition loading of a portable executable file (Portable Executable, abbreviated PE) is performed. 4K alignment is a memory alignment method that can improve the efficiency of memory access and thus improve computer performance. Specifically, 4K alignment is to align data in multiples of 4K bytes. For example, if the starting address of the data is 0x1000, then according to the 4K alignment method, the starting address of the data should be a multiple of 0x1000, that is, 0x1000, 0x2000, 0x3000, etc.
进一步的,利用所述UEFI启动文件加载驱动程序还可以包括修复所述驱动程序的重定位表项与导入表项。在上文进行PE文件的分区加载的示例中,在驱动程序被加载到内核内存中后,需要对PE文件中的重定位项和导入表项进行修复,以确保驱动程序可以正确地链接和执行。利用所述UEFI启动文件加载驱动程序还可以包括创建驱动对象,获取所述驱动程序的入口点。驱动对象是驱动程序的一个实例,它包含了驱动程序的状态和属性。驱动程序的入口点是指驱动程序的主函数,它是驱动程序的执行入口。在驱动程序被加载到内核内存中后,需要创建驱动对象,并获取驱动的入口点,以便于操作系统可以调用驱动程序的主要函数,从而实现对硬件设备的控制。利用所述UEFI启动文件加载驱动程序还可以包括初始化所述驱动对象。初始化驱动对象的过程可以包括设置驱动对象的参数、分配内存、注册回调函数等。利用所述UEFI启动文件加载驱动程序还可以包括调用所述驱动程序的入口点,对所述驱动对象执行二次初始化。对驱动对象执行二次初始化,可以进一步配置和初始化设备对象以实现另外的功能,例如注册另外的回调函数、分配资源、建立通信通道等,这是因为一些初始化步骤需要在设备对象创建后才能执行。Further, using the UEFI boot file to load the driver can also include repairing the relocation table entries and import table entries of the driver. In the above example of partition loading of PE files, after the driver is loaded into the kernel memory, the relocation items and import table entries in the PE file need to be repaired to ensure that the driver can be correctly linked and executed. Using the UEFI boot file to load the driver can also include creating a driver object and obtaining the entry point of the driver. The driver object is an instance of a driver, which contains the status and properties of the driver. The entry point of the driver refers to the main function of the driver, which is the execution entry of the driver. After the driver is loaded into the kernel memory, it is necessary to create a driver object and obtain the entry point of the driver so that the operating system can call the main function of the driver to achieve control of the hardware device. Using the UEFI boot file to load the driver can also include initializing the driver object. The process of initializing the driver object can include setting the parameters of the driver object, allocating memory, registering callback functions, etc. Using the UEFI boot file to load the driver can also include calling the entry point of the driver and performing secondary initialization on the driver object. Performing secondary initialization on the driver object can further configure and initialize the device object to implement additional functions, such as registering additional callback functions, allocating resources, establishing communication channels, etc. This is because some initialization steps need to be performed after the device object is created.
在步骤206处,利用所述UEFI启动文件操作所加载的驱动程序以埋设进程监控来监控指定进程的创建。根据本公开,指定进程可以是任何可以被注入动态链接库的进程,例如应用程序进程、系统进程、服务进程等等。特别地,在一个实施例中,可以将动态链接库注入诸如services.exe、lsass.exe和smss.exe的系统进程中。通过将动态链接库注入到系统进程中,其无法被强制终止或关闭,从而避免了与用户端与服务器失联的问题。At step 206, the driver loaded by the UEFI boot file operation is used to embed process monitoring to monitor the creation of the specified process. According to the present disclosure, the specified process can be any process that can be injected with a dynamic link library, such as an application process, a system process, a service process, etc. In particular, in one embodiment, the dynamic link library can be injected into system processes such as services.exe, lsass.exe, and smss.exe. By injecting the dynamic link library into the system process, it cannot be forcibly terminated or closed, thereby avoiding the problem of losing connection with the client and the server.
可替代地或附加地,埋设进程监控还可以包括在所述驱动程序初始化过程中创建随机名称的设备对象。在创建设备对象时,可以为其创建一个随机名称的设备对象。在一个示例中,也可以为设备对象的指定特定的名称,本公开不受此限制。埋设进程监控还可以包括注册所述驱动程序的进程通知回调函数,以监控所述指定进程的创建。通过注册所述驱动程序的进程通知回调函数,可以监控操作系统内核环境中的进程创建和销毁事件,从而可以在进程运行之前对其进行必要的操作,例如将动态链接库注入到指定的进程中。可选地,埋设进程监控还可以包括注册中断处理,使驱动程序向操作系统提供中断处理函数,用于处理特定的中断事件。这样,在动态链接库注入与中断处理程序存在关联的某些特定情况下,可以通过注册中断处理函数来截获相应的输入事件,并在动态链接库中执行自定义的操作。Alternatively or additionally, the embedded process monitoring may also include creating a device object with a random name during the initialization process of the driver. When creating a device object, a device object with a random name may be created for it. In one example, a specific name may also be specified for the device object, but the present disclosure is not limited thereto. The embedded process monitoring may also include registering a process notification callback function of the driver to monitor the creation of the specified process. By registering the process notification callback function of the driver, the process creation and destruction events in the operating system kernel environment may be monitored, so that necessary operations may be performed on the process before it runs, such as injecting a dynamic link library into a specified process. Optionally, the embedded process monitoring may also include registering interrupt handling, so that the driver provides an interrupt handling function to the operating system for handling specific interrupt events. In this way, in certain specific cases where dynamic link library injection is associated with an interrupt handler, the corresponding input event may be intercepted by registering an interrupt handling function, and custom operations may be performed in the dynamic link library.
在步骤208处,响应于所述指定进程的创建,利用所述UEFI启动文件操作所加载的驱动程序以将所述动态链接库注入到所述指定进程的内部。根据本公开,可以使用各种方式在内核环境下向进程中注入动态链接库,包括但不限于:内核模块加载(Kernel ModuleLoading),在内核环境下,可以通过加载自定义的内核模块来实现动态链接库注入,内核模块可以包含自定义的代码和数据,可以在指定进程的上下文中执行自定义操作;内核钩子(Kernel Hooking),通过在指定进程的系统函数中设置钩子,可以截获函数调用并将其重定向到自定义的代码;以及内核驱动程序注入(Kernel Driver Injection),通过在内核环境中加载驱动程序并注册相应的回调函数,将其与指定进程建立关联,可以在指定进程的上下文中执行自定义的代码,实现动态链接库注入,如下文所进一步描述的。At step 208, in response to the creation of the specified process, the driver loaded by the UEFI boot file operation is used to inject the dynamic link library into the inside of the specified process. According to the present disclosure, various methods can be used to inject the dynamic link library into the process under the kernel environment, including but not limited to: kernel module loading (Kernel Module Loading), under the kernel environment, dynamic link library injection can be achieved by loading a custom kernel module, the kernel module can contain custom code and data, and custom operations can be performed in the context of the specified process; kernel hook (Kernel Hooking), by setting a hook in the system function of the specified process, function calls can be intercepted and redirected to custom code; and kernel driver injection (Kernel Driver Injection), by loading the driver in the kernel environment and registering the corresponding callback function, it is associated with the specified process, and the custom code can be executed in the context of the specified process to achieve dynamic link library injection, as further described below.
可替代地或附加地,将所述动态链接库注入到所述指定进程可以包括注册所述驱动程序的回调函数,以挂靠到所述指定进程。在该操作中,可以在驱动程序的初始化过程中,先创建回调对象并注册回调函数,然后等待指定进程的创建。在该过程中,并不需要知道指定进程的信息。当指定进程被创建时,系统会调用驱动程序注册的回调函数,以响应进程创建事件。将所述动态链接库注入到所述指定进程还可以包括在所述驱动程序的回调函数中打开已创建的设备对象。在回调函数中,驱动程序可以打开自己创建的设备对象,并执行一些必要的操作,例如读取数据、写入数据、更新状态等。将所述动态链接库注入到所述指定进程还可以包括在所述驱动程序中将设备句柄与中断向量号以及随机令牌存入到用户态外壳代码中。通过该操作,当处于用户模式时,用户模式下的程序可以使用上述设备句柄、中断向量号和随机令牌与驱动程序通信,也即可以进行针对该通信的双向验证,以提高安全性。Alternatively or additionally, injecting the dynamic link library into the specified process may include registering a callback function of the driver to attach to the specified process. In this operation, a callback object may be created and a callback function may be registered during the initialization process of the driver, and then the creation of the specified process may be waited for. In this process, it is not necessary to know the information of the specified process. When the specified process is created, the system will call the callback function registered by the driver to respond to the process creation event. Injecting the dynamic link library into the specified process may also include opening the created device object in the callback function of the driver. In the callback function, the driver may open the device object created by itself and perform some necessary operations, such as reading data, writing data, updating status, etc. Injecting the dynamic link library into the specified process may also include storing the device handle, interrupt vector number and random token in the user state shell code in the driver. Through this operation, when in user mode, the program in user mode can use the above-mentioned device handle, interrupt vector number and random token to communicate with the driver, that is, two-way verification for the communication can be performed to improve security.
将所述动态链接库注入到所述指定进程还可以包括在所述驱动程序的回调函数中从所述指定进程的虚拟地址空间中分配一段可读写可执行的内存。虚拟地址空间是操作系统为每个进程分配的一块内存空间,用于存储代码、数据和堆栈等信息。需要注意的是,驱动程序可以通过调用ZwAllocateVirtualMemory函数从指定进程的虚拟地址空间的高端地址分配一段可读写可执行的内存,以确保分配的内存能够被指定进程访问。ZwAllocateVirtualMemory是Windows内核中的一个函数,用于在指定进程的虚拟地址空间中分配一段内存。将所述动态链接库注入到所述指定进程还可以包括将指定的外壳代码和所述动态链接库按内存复制方式写入所述可读写可执行的内存中。从指定进程的虚拟地址空间分配的该段内存也称为该指定进程的用户模式内存,其只在指定进程的用户模式下可见和操作。每个进程的用户模式内存是相互隔离的。可以使用各种函数(例如WriteProcessMemory)将外壳代码和动态链接库写入到指定进程的所分配内存中。例如,可以首先将外壳代码的二进制数据写入该内存的起始位置。然后,将动态链接库的二进制数据写入该内存的适当位置,通常是外壳代码之后的位置。Injecting the dynamic link library into the specified process may also include allocating a readable, writable and executable memory from the virtual address space of the specified process in the callback function of the driver. The virtual address space is a piece of memory space allocated by the operating system for each process, which is used to store information such as code, data and stack. It should be noted that the driver can allocate a readable, writable and executable memory from the high-end address of the virtual address space of the specified process by calling the ZwAllocateVirtualMemory function to ensure that the allocated memory can be accessed by the specified process. ZwAllocateVirtualMemory is a function in the Windows kernel that is used to allocate a segment of memory in the virtual address space of the specified process. Injecting the dynamic link library into the specified process may also include writing the specified shell code and the dynamic link library into the readable, writable and executable memory in a memory copy manner. The segment of memory allocated from the virtual address space of the specified process is also called the user mode memory of the specified process, which is only visible and operated in the user mode of the specified process. The user mode memory of each process is isolated from each other. Various functions (such as WriteProcessMemory) can be used to write the shell code and the dynamic link library into the allocated memory of the specified process. For example, the binary data of the shell code may be first written to the beginning of the memory, and then the binary data of the dynamic link library may be written to an appropriate location of the memory, usually a location after the shell code.
将所述动态链接库注入到所述指定进程还可以包括将所述指定进程的原始入口点替换为所述动态链接库的入口点。通过该操作,可以确保写入的数据(例如,注入的动态链接库)能够被指定进程访问,从而在指定进程进行初始化之前,对所注入的动态链接库进行初始化。将所述动态链接库注入到所述指定进程还可以包括将所述动态链接库的入口点的地址作为参数,更新中央处理器的转译后备缓冲器,以清除所述转译后备缓冲器。转译后备缓冲器(Translation Lookaside Buffer,缩写TLB)是一种高速缓存,用于存储虚拟地址到物理地址的映射关系。当CPU访问内存时,内存管理单元(MMU)会先在转译后备缓冲器中查找虚拟地址对应的物理地址,如果转译后备缓冲器中没有命中,则需要查询页表,从而得到物理地址。将新的入口点的地址作为参数更新转译后备缓冲器,可以使转译后备缓冲器失效以对其进行清除,这样可以防止CPU在取指时内存管理单元命中原始转译后备缓冲器中的物理地址。进行清除后,CPU在取指令时,内存管理单元不命中,从而强制CPU重新刷新查询页表或段表,来重新载入用于所注入的动态链接库的新的物理内存。将所述动态链接库注入到所述指定进程还可以包括解除所述驱动程序对于所述指定进程的挂靠。通过解除挂靠,从指定进程中移除已经进行的操作(例如,注入、钩子等),将指定进程恢复到原始状态。例如,解除挂靠可以包括关闭或释放指定进程的句柄、释放从指定进程中分配的内存等等。Injecting the dynamic link library into the specified process may also include replacing the original entry point of the specified process with the entry point of the dynamic link library. Through this operation, it can be ensured that the written data (for example, the injected dynamic link library) can be accessed by the specified process, so that the injected dynamic link library is initialized before the specified process is initialized. Injecting the dynamic link library into the specified process may also include using the address of the entry point of the dynamic link library as a parameter to update the translation lookaside buffer of the central processing unit to clear the translation lookaside buffer. Translation lookaside buffer (TLB) is a high-speed cache for storing the mapping relationship between virtual addresses and physical addresses. When the CPU accesses the memory, the memory management unit (MMU) will first search the physical address corresponding to the virtual address in the translation lookaside buffer. If there is no hit in the translation lookaside buffer, it is necessary to query the page table to obtain the physical address. Using the address of the new entry point as a parameter to update the translation lookaside buffer can invalidate the translation lookaside buffer to clear it, which can prevent the memory management unit of the CPU from hitting the physical address in the original translation lookaside buffer when fetching instructions. After clearing, when the CPU fetches instructions, the memory management unit does not hit, thereby forcing the CPU to refresh the query page table or segment table to reload the new physical memory for the injected dynamic link library. Injecting the dynamic link library into the specified process can also include de-pending the driver to the specified process. By de-pending, the operations that have been performed (for example, injection, hook, etc.) are removed from the specified process, and the specified process is restored to the original state. For example, de-pending can include closing or releasing the handle of the specified process, releasing the memory allocated from the specified process, etc.
可替代或附加地,在注入了所述动态链接库之后,可以通过所述外壳代码来初始化所述动态链接库。例如,在通过如上文所述监控到指定进程被创建后,对所述动态链接库进行初始化。通过所述外壳代码来初始化所述动态链接库可以包括:所述外壳代码获得所述指定进程的最初执行权来进行最早的初始化。在该操作能够,外壳代码可以获取指定进程的句柄,以便后续的操作;以及在指定进程中分配内存,以用于加载和执行动态链接库或其他初始化代码。通过所述外壳代码来初始化所述动态链接库还可以包括:所述外壳代码基于所述动态链接库的入口点执行所述动态链接库的重定位工作。重定位是指在将动态链接库加载到内存并开始执行之前,根据实际的内存布局情况,调整动态链接库中的地址引用,以确保代码和数据能够正确地访问到它们所需的内存位置。该重定位操作可以包括加载动态链接库到内存、解析动态链接库的导入表、执行重定位处理等等。应当注意的是,重定位操作可以通过操作系统内部使用的函数来进行,因此不需要修复动态链接库的导出表。通过所述外壳代码来初始化所述动态链接库还可以包括:所述动态链接库执行自身的初始化,并在结束后返回所述外壳代码。例如,可以通过调用Windows操作系统的DllMain函数来执行动态链接库自身的初始化,使得其可以生效并供其他程序调用和使用。此外,在动态链接库执行初始化过程中,可以将驱动注入的数据进行保存,以便在动态链接库的其他函数中使用。例如,可以在DllMain函数中将注入的数据复制到一个全局变量中以供之后使用。这里注入的数据可以包括操作系统或应用程序中的句柄或对象引用以及配置信息等等。通过所述外壳代码来初始化所述动态链接库还可以包括:所述外壳代码返回到所述指定进程的原始入口点,使得开始初始化所述指定进程。当动态链接库初始化完成之后,外壳代码返回到指定进程的原始入口点,继续执行指定进程的后续操作,以对指定进程进行初始化。Alternatively or additionally, after the dynamic link library is injected, the dynamic link library can be initialized by the shell code. For example, after the specified process is created by monitoring as described above, the dynamic link library is initialized. Initializing the dynamic link library by the shell code may include: the shell code obtains the initial execution right of the specified process to perform the earliest initialization. In this operation, the shell code can obtain the handle of the specified process for subsequent operations; and allocate memory in the specified process for loading and executing the dynamic link library or other initialization code. Initializing the dynamic link library by the shell code may also include: the shell code performs the relocation of the dynamic link library based on the entry point of the dynamic link library. Relocation refers to adjusting the address reference in the dynamic link library according to the actual memory layout before loading the dynamic link library into the memory and starting to execute, so as to ensure that the code and data can correctly access the memory location they need. The relocation operation may include loading the dynamic link library into the memory, parsing the import table of the dynamic link library, performing relocation processing, etc. It should be noted that the relocation operation can be performed by the function used inside the operating system, so there is no need to repair the export table of the dynamic link library. Initializing the dynamic link library through the shell code can also include: the dynamic link library performs its own initialization and returns the shell code after completion. For example, the initialization of the dynamic link library itself can be performed by calling the DllMain function of the Windows operating system, so that it can take effect and be called and used by other programs. In addition, during the initialization process of the dynamic link library, the data injected by the driver can be saved for use in other functions of the dynamic link library. For example, the injected data can be copied to a global variable in the DllMain function for later use. The data injected here can include handles or object references in the operating system or application program, configuration information, etc. Initializing the dynamic link library through the shell code can also include: the shell code returns to the original entry point of the specified process, so that the specified process starts to be initialized. When the dynamic link library is initialized, the shell code returns to the original entry point of the specified process and continues to perform subsequent operations of the specified process to initialize the specified process.
在根据以上描述的过程完成之后,所注入的动态链接库开始生效,从而可供其他程序调用和使用。具体地,动态链接库可以提供一些函数或者数据,在其生效以后,其他程序可以通过调用动态链接库中的这些函数或者数据来实现期望的功能。例如,所注入的动态链接库可以用于保护显卡驱动程序,并且所注入的动态链接库的生效使得能够帮助所述显卡驱动程序实现以下功能中的一个或多个:用户端的程序可以借助于例如上文所述存储到用户模式外壳代码中的设备句柄或中断向量,使用随机令牌来与显卡驱动程序进行双向认证,以提高安全性;对显卡固件进行在线升级;调用显卡驱动程序以执行各种性能策略,从而对显卡进行各种性能优化(例如,调整显卡的工作频率、电压、风扇转速等参数);以及搜集与显卡和/或显卡驱动程序相关联的出错日志,以用于日志记录和/或服务器上传。应当理解的是,显卡在此处仅作为示例,所注入的动态链接库可以对任何合适的硬件设备实现上述功能中的一个或多个。After the process described above is completed, the injected dynamic link library becomes effective, so that it can be called and used by other programs. Specifically, the dynamic link library can provide some functions or data, and after it becomes effective, other programs can implement the desired functions by calling these functions or data in the dynamic link library. For example, the injected dynamic link library can be used to protect the graphics card driver, and the effectiveness of the injected dynamic link library enables the graphics card driver to implement one or more of the following functions: the user-side program can use the device handle or interrupt vector stored in the user mode shell code as described above, for example, to use a random token to perform two-way authentication with the graphics card driver to improve security; perform online upgrades on the graphics card firmware; call the graphics card driver to execute various performance strategies, thereby performing various performance optimizations on the graphics card (for example, adjusting the operating frequency, voltage, fan speed and other parameters of the graphics card); and collect error logs associated with the graphics card and/or the graphics card driver for logging and/or server upload. It should be understood that the graphics card is used as an example here only, and the injected dynamic link library can implement one or more of the above functions for any suitable hardware device.
图3是根据本公开另一实施例示出在Windows操作系统启动过程中注入动态链接库的示意性视图。FIG. 3 is a schematic diagram showing the injection of a dynamic link library during the startup process of a Windows operating system according to another embodiment of the present disclosure.
如图3中所示,可以通过上文所描述的各种方式,将UEFI启动文件和硬盘固件链接在一起并烧录到硬盘固件中。在诸如计算机的计算设备上电之后,从硬盘固件中返回UEFI启动文件,从而获取包括根据本公开的各种功能的UEFI启动文件。在获取了UEFI启动文件之后,UEFI可以执行针对操作系统的一系列初始化操作,以进入操作系统内核环境。例如,在图3所示的Windows操作系统的实施例中,可以对其内核环境中的一个或多个模块进行初始化,如上文关于图2中所描述的。As shown in FIG3 , the UEFI boot file and the hard disk firmware can be linked together and burned into the hard disk firmware in the various ways described above. After a computing device such as a computer is powered on, the UEFI boot file is returned from the hard disk firmware to obtain a UEFI boot file including various functions according to the present disclosure. After obtaining the UEFI boot file, the UEFI can perform a series of initialization operations for the operating system to enter the operating system kernel environment. For example, in the embodiment of the Windows operating system shown in FIG3 , one or more modules in its kernel environment can be initialized, as described above with respect to FIG2 .
当操作系统的初始化操作进行到加载驱动程序时,可以如上文所描述的执行根据本公开的动态链接库注入操作。如图3所示,通过在内核环境加载驱动程序的过程中将动态链接库注入到指定进程中,在所注入的动态链接库生效之后,处于用户模式中的图形管理器可以调用该动态链接库来实现各种功能。具体地,图形管理器可以向CPU发送中断触发以发起与驱动程序的交互。作为响应,CPU可以向驱动程序发起中断处理,使得驱动程序和图形管理器可以进行通信和交互,例如实现上文所述的各种功能。When the initialization operation of the operating system proceeds to loading the driver, the dynamic link library injection operation according to the present disclosure can be performed as described above. As shown in Figure 3, by injecting the dynamic link library into the specified process in the process of loading the driver in the kernel environment, after the injected dynamic link library takes effect, the graphics manager in the user mode can call the dynamic link library to implement various functions. Specifically, the graphics manager can send an interrupt trigger to the CPU to initiate interaction with the driver. In response, the CPU can initiate interrupt processing to the driver so that the driver and the graphics manager can communicate and interact, such as implementing the various functions described above.
图4是根据本公开另一实施例示出动态链接库的注入装置的框图。参照图4,示出了根据本公开一个实施例的动态链接库的注入装置的框图400。如图4中所示,装置400可以包括启动文件获取模块402和注入模块404。具体地,启动文件获取模块402用于获取已固化到存储装置中的UEFI启动文件。固化到存储装置中的UEFI启动文件可以包括根据本公开实现的所有功能,例如与注入动态链接库相关的所有功能。注入模块404用于利用所述UEFI启动文件执行动态链接库的注入。在一个实施例中,注入模块404可以用于:运行UEFI启动文件以执行启动工作,进入操作系统内核环境;在操作系统内核环境下利用UEFI启动文件加载驱动程序;利用UEFI启动文件操作所加载的驱动程序以埋设进程监控来监控指定进程的创建;以及响应于指定进程的创建,利用UEFI启动文件操作所加载的驱动程序以将动态链接库注入到指定进程的内部。在另一个实施例中,注入模块404可以用于将驱动程序从外壳代码数据区提取出来;在操作系统内核环境的内存池中分配一段可容纳内存对齐后的驱动程序的内存;将驱动程序复制到所分配的内存中;修复驱动程序的重定位表项与导入表项;创建驱动对象,获取驱动程序的入口点;初始化驱动对象;以及调用驱动程序的入口点,对驱动对象执行二次初始化。在另一个实施例中,注入模块404可以用于在驱动程序初始化过程中创建随机名称的设备对象;以及注册驱动程序的进程通知回调函数,以监控指定进程的创建。在另一个实施例中,注入模块404可以用于注册驱动程序的回调函数,以挂靠到指定进程;在驱动程序的回调函数中打开已创建的设备对象;在驱动程序中将设备句柄与中断向量号以及随机令牌存入到用户态外壳代码中;在驱动程序的回调函数中从指定进程的虚拟地址空间中分配一段可读写可执行的内存;将指定的外壳代码和动态链接库按内存复制方式写入可读写可执行的内存中;将指定进程的原始入口点替换为动态链接库的入口点;将动态链接库的入口点的地址作为参数,更新中央处理器的转译后备缓冲器,以清除转译后备缓冲器;以及解除驱动程序对于指定进程的挂靠。此外,注入模块404可以根据上文所描述的用于执行动态链接库的注入的任何方法,来利用UEFI启动文件执行注入,在此不再赘述。FIG4 is a block diagram showing a dynamic link library injection device according to another embodiment of the present disclosure. Referring to FIG4, a block diagram 400 of a dynamic link library injection device according to an embodiment of the present disclosure is shown. As shown in FIG4, the device 400 may include a boot file acquisition module 402 and an injection module 404. Specifically, the boot file acquisition module 402 is used to acquire a UEFI boot file that has been solidified into a storage device. The UEFI boot file solidified into the storage device may include all functions implemented according to the present disclosure, such as all functions related to injecting a dynamic link library. The injection module 404 is used to perform the injection of the dynamic link library using the UEFI boot file. In one embodiment, the injection module 404 can be used to: run the UEFI boot file to perform the startup work and enter the operating system kernel environment; load the driver using the UEFI boot file in the operating system kernel environment; use the UEFI boot file to operate the loaded driver to bury the process monitoring to monitor the creation of the specified process; and in response to the creation of the specified process, use the UEFI boot file to operate the loaded driver to inject the dynamic link library into the inside of the specified process. In another embodiment, the injection module 404 can be used to extract the driver from the shell code data area; allocate a section of memory in the memory pool of the operating system kernel environment that can accommodate the driver after memory alignment; copy the driver to the allocated memory; repair the relocation table entry and import table entry of the driver; create a driver object, obtain the entry point of the driver; initialize the driver object; and call the entry point of the driver to perform secondary initialization on the driver object. In another embodiment, the injection module 404 can be used to create a device object with a random name during the driver initialization process; and register the driver's process notification callback function to monitor the creation of a specified process. In another embodiment, the injection module 404 can be used to register the callback function of the driver to attach to the specified process; open the created device object in the callback function of the driver; store the device handle, interrupt vector number and random token in the user-mode shell code in the driver; allocate a readable, writable and executable memory from the virtual address space of the specified process in the callback function of the driver; write the specified shell code and dynamic link library into the readable, writable and executable memory in a memory copy manner; replace the original entry point of the specified process with the entry point of the dynamic link library; use the address of the entry point of the dynamic link library as a parameter to update the translation backup buffer of the central processing unit to clear the translation backup buffer; and release the driver from attaching to the specified process. In addition, the injection module 404 can perform injection using the UEFI boot file according to any method described above for performing injection of the dynamic link library, which will not be repeated here.
可替代地或附加地,装置400还可以包括:链接模块,用于将UEFI启动文件与存储装置的固件链接成映像文件;以及固化模块,用于将映像文件固化到所述存储装置中。同样地,该链接模块和固化模块可以根据上文描述的任何方法来执行上述操作,在此不再赘述。Alternatively or additionally, the device 400 may further include: a linking module, configured to link the UEFI boot file and the firmware of the storage device into an image file; and a curing module, configured to curate the image file into the storage device. Similarly, the linking module and the curing module may perform the above operations according to any of the methods described above, which will not be described in detail herein.
可替换地或附加地,装置400还可以包括初始化模块,用于在注入了动态链接库之后通过外壳代码来初始化动态链接库。动态链接库被初始化之后可以生效,从而可以被其他程序调用和使用。在一个实施例中,初始化模块通过外壳代码来初始化动态链接库可以包括:外壳代码获得指定进程的最初执行权来进行最早的初始化;外壳代码基于动态链接库的入口点执行动态链接库的重定位工作;动态链接库执行自身的初始化,并在结束后返回外壳代码;以及外壳代码返回到指定进程的原始入口点,使得开始初始化指定进程。同样地,该初始化模块可以根据上文描述的任何方法来执行上述操作,在此不再赘述。Alternatively or additionally, the device 400 may also include an initialization module for initializing the dynamic link library through a shell code after the dynamic link library is injected. After the dynamic link library is initialized, it can take effect, so that it can be called and used by other programs. In one embodiment, the initialization module initializing the dynamic link library through the shell code may include: the shell code obtains the initial execution right of the specified process to perform the earliest initialization; the shell code performs the relocation of the dynamic link library based on the entry point of the dynamic link library; the dynamic link library performs its own initialization and returns the shell code after completion; and the shell code returns to the original entry point of the specified process, so that the specified process begins to be initialized. Similarly, the initialization module can perform the above operations according to any method described above, which will not be repeated here.
应理解的是,在各种实施例中,装置400可以用于执行如上文所描述的任何方法的步骤。It should be understood that, in various embodiments, the apparatus 400 may be used to perform the steps of any method as described above.
附加地或可替换地,可以使用计算机处理器、存储器单元、存储设备、计算机软件和其他组件在一台或更多台计算机或服务器或类似设备上实现本公开的上述方法、通用对接模块、服务平台或第三方平台。这种计算机或服务器的高级框图在图5中示出。在此,计算机、服务器或其他包括处理器的设备统称为计算设备。计算设备502包含处理器504,处理器504通过执行定义了整体操作的计算机程序指令来控制计算机502的操作。可以将计算机程序指令存储在存储设备512(例如磁盘)中并在需要执行计算机程序指令时将其加载到存储器510中。因此,参照图1和图2的方法的步骤可以由存储在存储器510和/或存储设备512中的计算机程序指令定义,并由执行该计算机程序指令的处理器504控制。计算设备502还包括一个或多个网络接口506,用于经由网络与其他设备进行通信。计算设备502还包括使用户能够与计算机502进行交互的其他输入/输出设备508(例如,显示器、键盘、鼠标、扬声器、按钮等)。本领域的技术人员将认识到,实际计算机的实施方式也可以包含其他组件,并且图5是用于说明目的的这种计算机的一些组件的高级表示。Additionally or alternatively, the above-mentioned method, universal docking module, service platform or third-party platform of the present disclosure can be implemented on one or more computers or servers or similar devices using computer processors, memory units, storage devices, computer software and other components. A high-level block diagram of such a computer or server is shown in FIG5. Here, computers, servers or other devices including processors are collectively referred to as computing devices. The computing device 502 includes a processor 504, which controls the operation of the computer 502 by executing computer program instructions that define the overall operation. The computer program instructions can be stored in a storage device 512 (e.g., a disk) and loaded into a memory 510 when the computer program instructions need to be executed. Therefore, the steps of the method with reference to FIG1 and FIG2 can be defined by computer program instructions stored in a memory 510 and/or a storage device 512, and controlled by a processor 504 that executes the computer program instructions. The computing device 502 also includes one or more network interfaces 506 for communicating with other devices via a network. The computing device 502 also includes other input/output devices 508 (e.g., a display, keyboard, mouse, speakers, buttons, etc.) that enable a user to interact with the computer 502. Those skilled in the art will recognize that an actual computer implementation may also include other components, and that FIG5 is a high-level representation of some components of such a computer for purposes of illustration.
存储设备512和存储器510均包括有形的非暂时性计算机可读存储介质。存储设备512和存储器510均可包括高速随机存取存储器,诸如动态随机存取存储器(DRAM)、静态随机存取存储器(SRAM)、双倍数据速率同步动态随机存取存储器(DDR RAM)或其他随机存取固态存储器设备,并且可以包括非易失性存储器,诸如一个或多个磁盘存储设备(诸如内部硬盘和可移动磁盘)、磁光盘存储设备、光盘存储设备、闪存设备、半导体存储器设备(诸如可擦除可编程只读存储器(EPROM)、电可擦可编程只读存储器(EEPROM))、紧凑盘只读存储器(CD-ROM)、数字多功能盘只读存储器(DVD-ROM)盘或其他非易失性固态存储设备。The storage device 512 and the memory 510 each include a tangible, non-transitory computer-readable storage medium. The storage device 512 and the memory 510 may each include a high-speed random access memory, such as a dynamic random access memory (DRAM), a static random access memory (SRAM), a double data rate synchronous dynamic random access memory (DDR RAM), or other random access solid-state memory devices, and may include non-volatile memory, such as one or more magnetic disk storage devices (such as internal hard disks and removable disks), magneto-optical disk storage devices, optical disk storage devices, flash memory devices, semiconductor memory devices (such as erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM)), compact disk read-only memory (CD-ROM), digital versatile disk read-only memory (DVD-ROM) disks, or other non-volatile solid-state storage devices.
在另一实施例中,可以在基于网络的云计算系统中实现上述方法、通用对接模块、服务平台或第三方平台。在这样的基于网络的云计算系统中,服务器经由网络与一个或多个客户端计算机通信。客户端计算机可以例如经由驻留在客户端计算机上并在其上运行的网络浏览器应用与服务器进行通信。客户端计算机可以将数据存储在服务器上,并经由网络访问该数据。客户端计算机可以经由网络将数据请求或在线服务请求传送到服务器。服务器可以实施所请求的服务,并将数据提供给(一个或多个)客户端计算机。服务器还可以传送被适配为使客户端计算机实施指定功能(例如,实施计算,在屏幕上显示指定数据等)的数据。上述方法的某些步骤可以由服务器或由基于网络的云计算系统中的其他计算机/处理器实施。上述方法的某些步骤可以由基于网络的云计算系统中的客户端计算机本地实施。上述方法的步骤可以由基于网络的云计算系统中的一个或多个设备或者由本地客户端计算机以任何组合来实施。In another embodiment, the above method, universal docking module, service platform or third-party platform can be implemented in a network-based cloud computing system. In such a network-based cloud computing system, the server communicates with one or more client computers via a network. The client computer can communicate with the server, for example, via a web browser application resident on and running on the client computer. The client computer can store data on the server and access the data via the network. The client computer can transmit data requests or online service requests to the server via the network. The server can implement the requested service and provide the data to (one or more) client computers. The server can also transmit data adapted to enable the client computer to implement a specified function (e.g., implement calculations, display specified data on the screen, etc.). Some steps of the above method can be implemented by a server or by other computers/processors in a network-based cloud computing system. Some steps of the above method can be implemented locally by a client computer in a network-based cloud computing system. The steps of the above method can be implemented in any combination by one or more devices in a network-based cloud computing system or by a local client computer.
本公开实施例还提出一种计算机可读存储介质,其上存储有计算机程序指令,所述计算机程序指令被处理器执行时实现上述方法。计算机可读存储介质可以是易失性或非易失性计算机可读存储介质。The embodiment of the present disclosure also provides a computer-readable storage medium, on which computer program instructions are stored, and when the computer program instructions are executed by a processor, the above method is implemented. The computer-readable storage medium can be a volatile or non-volatile computer-readable storage medium.
本公开实施例还提出一种电子设备,包括:处理器;用于存储处理器可执行指令的存储器;其中,所述处理器被配置为调用所述存储器存储的指令,以执行上述方法。An embodiment of the present disclosure further proposes an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to call the instructions stored in the memory to execute the above method.
本公开实施例还提供了一种计算机程序产品,包括计算机可读代码,或者承载有计算机可读代码的非易失性计算机可读存储介质,当所述计算机可读代码在电子设备的处理器中运行时,所述电子设备中的处理器执行上述方法。The embodiments of the present disclosure also provide a computer program product, including a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the above method.
电子设备可以被提供为终端、服务器或其它形态的设备。The electronic device may be provided as a terminal, a server, or a device in other forms.
应认识到为了清楚起见在单独实施例的上下文中描述的本公开的某些特征还可以在单个实施例中以组合的方式提供。相反,为了简便起见在单个实施例的上下文中描述的本公开的各种特征还可以单独地或以任何适当的子组合或在本公开的任何其他所述实施例中适当地提供。不应将在各种实施例的上下文中描述的某些特征视为那些实施例的必要特征,除非该实施例在没有那些元素的情况下无效。It should be appreciated that certain features of the disclosure described in the context of separate embodiments for clarity may also be provided in combination in a single embodiment. Conversely, various features of the disclosure described in the context of a single embodiment for simplicity may also be provided individually or in any suitable sub-combination or as appropriate in any other described embodiment of the disclosure. Certain features described in the context of various embodiments should not be considered essential features of those embodiments unless the embodiment is ineffective without those elements.
虽然已结合本公开的具体实施例描述了本公开,但是很明显,许多替换、修改和变更对于本领域的技术人员来说将是显而易见的。因此,旨在涵盖属于随附权利要求的精神和广泛范围内的所有此类替换、修改和变更。Although the present disclosure has been described in conjunction with the specific embodiments of the present disclosure, it is obvious that many substitutions, modifications and changes will be obvious to those skilled in the art. Therefore, it is intended to cover all such substitutions, modifications and changes that fall within the spirit and broad scope of the appended claims.
本说明中提及的所有公开、专利和专利申请通过引用整体地结合于本文中,引用的程度如同具体且特别地指示每个单独的公开、专利或专利申请以通过引用结合于本文一样。另外,不应将本公开中的任何参考的引用或识别理解为允许此类参考作为现有技术可用于本公开。在使用分段标题的情况下,不应将其理解为一定是限制性的。All publications, patents, and patent applications mentioned in this specification are incorporated herein by reference in their entirety to the same extent as if each individual publication, patent, or patent application was specifically and particularly indicated to be incorporated herein by reference. In addition, citation or identification of any reference in this disclosure should not be construed as allowing such reference to be used as prior art in the present disclosure. Where section headings are used, they should not be construed as necessarily limiting.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311789928.8A CN117763538B (en) | 2023-12-22 | 2023-12-22 | Dynamic link library injection method, device and computer readable medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311789928.8A CN117763538B (en) | 2023-12-22 | 2023-12-22 | Dynamic link library injection method, device and computer readable medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN117763538A CN117763538A (en) | 2024-03-26 |
CN117763538B true CN117763538B (en) | 2024-09-27 |
Family
ID=90321666
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311789928.8A Active CN117763538B (en) | 2023-12-22 | 2023-12-22 | Dynamic link library injection method, device and computer readable medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117763538B (en) |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105955762A (en) * | 2016-04-19 | 2016-09-21 | 北京金山安全软件有限公司 | Method and device for injecting dynamic link library file and electronic equipment |
CN106126282A (en) * | 2016-06-20 | 2016-11-16 | 北京金山安全软件有限公司 | Injection method and device for dynamic link library file and terminal equipment |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106648749B (en) * | 2016-11-11 | 2019-12-31 | 广州华多网络科技有限公司 | Method and system for dynamically calling executable program |
CN113703859A (en) * | 2020-05-08 | 2021-11-26 | 腾讯科技(深圳)有限公司 | Dynamic link library injection method, device, equipment and storage medium |
CN113377370B (en) * | 2021-05-18 | 2024-10-25 | 龙芯中科(西安)科技有限公司 | File processing method and device, electronic equipment and storage medium |
CN115563628B (en) * | 2022-01-17 | 2023-09-22 | 荣耀终端有限公司 | A variable reading and writing method and a variable reading and writing device |
-
2023
- 2023-12-22 CN CN202311789928.8A patent/CN117763538B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105955762A (en) * | 2016-04-19 | 2016-09-21 | 北京金山安全软件有限公司 | Method and device for injecting dynamic link library file and electronic equipment |
CN106126282A (en) * | 2016-06-20 | 2016-11-16 | 北京金山安全软件有限公司 | Injection method and device for dynamic link library file and terminal equipment |
Also Published As
Publication number | Publication date |
---|---|
CN117763538A (en) | 2024-03-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105637479B (en) | Method for modifying computer program, computer system and computer readable medium | |
US9747172B2 (en) | Selective access to executable memory | |
US9832226B2 (en) | Automatic curation and modification of virtualized computer programs | |
CN103718165B (en) | BIOS flash memory attack protection and notice | |
US9535855B2 (en) | Reorganization of virtualized computer programs | |
JP4793733B2 (en) | High integrity firmware | |
US9230116B2 (en) | Technique for providing secure firmware | |
JP6054908B2 (en) | Method for repairing variable sets, computer program and computer | |
JP5889933B2 (en) | Method for preventing malfunction of computer, computer program, and computer | |
US9098300B2 (en) | Providing silicon integrated code for a system | |
US8910155B1 (en) | Methods and systems for injecting endpoint management agents into virtual machines | |
US8533445B2 (en) | Disabling a feature that prevents access to persistent secondary storage | |
US7069445B2 (en) | System and method for migration of a version of a bootable program | |
US20090300307A1 (en) | Protection and security provisioning using on-the-fly virtualization | |
CN117763538B (en) | Dynamic link library injection method, device and computer readable medium | |
Alba Cerveró | UEFI-based Malware |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
CP03 | Change of name, title or address | ||
CP03 | Change of name, title or address |
Address after: B655, 4th Floor, Building 14, Cuiwei Zhongli, Haidian District, Beijing, 100036 Patentee after: Mole Thread Intelligent Technology (Beijing) Co.,Ltd. Country or region after: China Address before: 209, 2nd Floor, No. 31 Haidian Street, Haidian District, Beijing Patentee before: Moore Threads Technology Co., Ltd. Country or region before: China |