WO2012152212A1 - 一种注册表操作的执行方法及装置 - Google Patents
一种注册表操作的执行方法及装置 Download PDFInfo
- Publication number
- WO2012152212A1 WO2012152212A1 PCT/CN2012/075155 CN2012075155W WO2012152212A1 WO 2012152212 A1 WO2012152212 A1 WO 2012152212A1 CN 2012075155 W CN2012075155 W CN 2012075155W WO 2012152212 A1 WO2012152212 A1 WO 2012152212A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- registry
- routine
- kernel
- value
- logic
- 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.)
- Ceased
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/50—Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
- G06F21/55—Detecting local intrusion or implementing counter-measures
- G06F21/56—Computer malware detection or handling, e.g. anti-virus arrangements
- G06F21/568—Computer malware detection or handling, e.g. anti-virus arrangements eliminating virus, restoring damaged files
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
- G06F9/44505—Configuring for program initiating, e.g. using registry, configuration files
Definitions
- the present application relates to the technical field of operating system penetration, and in particular to a method for executing a registry operation and an execution device for a registry operation. Background technique
- the structure determines the risk that the data stream is tampered with on its call chain. Therefore, ensuring the authenticity and reliability of the registry operation process becomes a basic requirement of security software. From the perspective of the operating system, there are potential tampering points in the execution of registry operations:
- the caller 101 calls the kernel interface layer 102, and the kernel interface layer 102 calls the kernel execution layer.
- the kernel execution layer 103 calls the registry parsing routine 104
- the registry parsing routine 104 calls the Cm* registry implementation routine 105
- the Cm* registry implementation routine 105 invokes the third party driver 106 and the HvpGetCellPaged/HvpGetCellMapped object routine. Wait 107.
- the caller 101 and the kernel interface layer 102 belong to the operating system user state, the kernel execution layer 103, the registry parsing routine 104, the Cm* registry implementation routine 105, the third party driver 106, and the HvpGetCellPaged/HvpGetCellMapped object routine, etc. 107 Belonging to the operating system kernel State.
- IAT Hook Import Address Table Hook
- EAT Hook Export Table Hook
- Cm* registry implementation routine 105 calls the third party driver 106 when the CmpCallBack callback mechanism
- One of the purposes of the present application is to provide a method of performing registry operations to enhance and drive The ability of aggressive malicious programs to attack and defend, and to avoid the potential for incompatibility between security software due to registry operations.
- the application also provides an execution device for a registry operation to ensure the application and implementation of the above method in practice.
- the embodiment of the present application discloses a method for executing a registry operation, including:
- the kernel execution logic includes: tampering point detection repair logic and registry function call logic;
- Performing the tampering point detection repair logic specifically, detecting a preset kernel execution flow tampering point, and recovering an original value of the kernel execution flow tampering point when the kernel performs a change of the original value of the flow tampering point;
- the method further includes:
- the kernel After the function of the registry is called, the kernel performs stream tampering, and the original value of ⁇ is changed back to the changed value.
- the preset kernel performs a flow change point including:
- the registry object parsing routine is hooked
- Cm* registry implementation routine calls CmpCallBack callback mechanism when third-party driver is called; Cm* registry function inline hook;
- the step of detecting a preset kernel to perform a flow tampering point and recovering the original value of the tampering point when the kernel performs a change of the original value of the tampering point includes:
- Sub-step Sl detecting whether the original value hooked by the registry object parsing routine changes, if yes, executing sub-step S2, otherwise, performing sub-step S3;
- Sub-step S3 calling Cm* registry implementation routine, detecting Cm* registry function inline hanging Whether the original value of the hook has changed, and if so, sub-step S4 is performed, otherwise, the sub-step is performed
- Sub-step S5 blocking the CmpCallBack callback mechanism, the rotor step S6;
- Sub-step S6 detecting whether the original value hooked by the HvpGetCellPaged/HvpGetCellMapped object routine changes, if yes, executing sub-step S7, otherwise ending;
- Sub-step S7 restoring the original value hooked by the HvpGetCellPaged/HvpGetCellMapped object routine.
- the original value of the kernel execution flow tampering point is obtained at initialization, and the change value of the kernel execution flow tampering point is cached in the kernel memory.
- the method further includes:
- the caller initiates a registry operation request, and invokes a corresponding registry operation interface routine; wherein the request includes a caller input parameter;
- the kernel state structure parameter is constructed according to the type of the system platform, and the corresponding registry operation control code is generated according to the kernel state structure parameter, and the registry operation control code is sent to the operating system kernel state driver.
- each of the registry operation interface routines includes a narrow character routine and a wide character routine.
- the method further includes:
- the registry operation interface narrow character routine converts the ANSI related parameters in the caller input parameters to the UNICODE type and calls the corresponding registry operation interface wide character routine.
- the method further comprises: verifying the caller input parameter according to the registry operation request, and if the verification passes, performing the step of setting the registry kernel execution logic.
- the caller input parameter has a user mode address; before the setting of the registry kernel execution logic, the method further includes:
- the method further includes: If the function calling the registry succeeds, the corresponding handle is returned;
- the registry operation interface routine and the WINDOWS standard API include: a registry key creation routine BRegCreateKey, a registry enhancement key creation routine BRegCreateKeyEx, a registry key open routine BRegOpenKey, a registry enhancement key open Routine BRegOpenKeyEx, Registry Enhanced Query Value Routine BRegQuery ValueEx, Registry Set Value Routine BRegSetValueEx, Registry Enumeration Key Routine BRegEnumKey, Registry Enhanced Enumeration Key Routine BRegEnumKeyEx, Registry Enumeration Value Routine BRegEnum Value
- the control code comprises: a registry creation control code REGCTL - CREATE - KEY, a registry open control code REGCTL - OPEN - KEY, a registry query value control code REGCTL - QUERY - VALUE - KEY, registry setting value control Code REGCTL - SET - VALUE - KEY, registry enumeration key control code REGCTL - ENUMERATE - KEY, registry enumeration value control code REGCTL - ENUMERATE - VALUE - KEY, registry delete key control code REGCTL - DELETE - KEY and / Or the registry deletes the value control code REGCTX_DELETE_VALUE_KEY.
- the embodiment of the present application further discloses an apparatus for executing a registry operation, including: a request acquisition module, configured to obtain a registry operation request, where the request includes a caller input parameter;
- the kernel execution logic setting module is configured to set a registry kernel execution logic according to the caller input parameter, the kernel execution logic comprising: a tamper point detection repair logic and a registry function call logic;
- the tampering point detection repair logic execution module is configured to execute the tamper point detection repair logic, specifically, detecting a preset kernel execution flow tampering point, and performing flow tampering on the kernel When the original value of the point changes, the original value of the stream tampering point is restored by the kernel;
- the registry function calls the logic execution module, which is set to invoke the logic with the registry function and call the corresponding registry function.
- the device further includes:
- the tampering point write back module is set to change the original value of the kernel execution flow change point back to the change value after calling the function of the registry.
- the preset kernel performs a flow change point including:
- the registry object parsing routine is hooked
- Cm* registry implementation routine calls CmpCallBack callback mechanism when third-party driver is called; Cm* registry function inline hook;
- the original value of the kernel execution flow tampering point is obtained at initialization, and the change value of the kernel execution flow tampering point is cached in the kernel memory.
- the device further includes:
- a user mode request sending module configured to initiate a registry operation request, and invoke a corresponding registry operation interface routine; wherein the request includes a caller input parameter;
- the control code sending module is configured to construct a kernel state structure parameter according to the type of the system platform, generate a corresponding registry operation control code according to the kernel state structure parameter, and send the registration table operation control code to the operating system kernel state driver.
- the device further includes:
- the parameter verification module is configured to verify the caller input parameter according to the registry operation request, and if the verification passes, the kernel execution logic setting module is called.
- the caller input parameter has a user mode address; the device further includes: an address reconstruction module, configured to reconstruct the user state address to a kernel state memory space.
- the device further includes:
- the handle returns a module, and is set to return a corresponding handle when the function calling the registry succeeds;
- Error code return module set to generate error when function calling the registry fails Error and return to user mode.
- the embodiment of the present application further discloses a computer readable recording medium on which a program for executing an execution method of a registry operation is recorded, wherein the method for executing the registry operation includes:
- the kernel execution logic includes: tampering point detection repair logic and registry function call logic;
- Performing the tampering point detection repair logic specifically, detecting a preset kernel execution flow tampering point, and recovering an original value of the kernel execution flow tampering point when the kernel performs a change of the original value of the flow tampering point;
- the present application builds a trusted environment for registry operations based on the full lifecycle of the registry behavior, and completely implements a registry operation call library in the operating system user interface, and the kernel state driver receives the registry operation request from the user state.
- the caller input parameters included in the request are checked. If the check passes, the registry function call logic can be set by constructing the PARSE-CONTEXT structure, and the settings are executed before the registry function call.
- the tampering point detection repair logic that is, to actively "simulate" the behavior of the kernel execution layer, and then execute the tampering point detection repair logic and registry function call logic, detect/restore object parsing hooks, and block kernel registry callbacks.
- the mechanism and other methods enable the third-party driver to be penetrated (or called bypass) to ensure the authenticity and credibility of the registry operation request environment.
- the kernel synchronous call returns the user state handle information and the call state.
- the present application proposes an overall solution for the registry penetration operation, which not only provides attack and defense of the operating system user state, but also provides an attack and defense of the operating system kernel state, which can effectively avoid interference due to registry operations.
- the potential for incompatibility between security software; on the other hand, the program can effectively enhance the ability of attack and defense of malicious programs.
- 1 is a schematic diagram of an operating system registry operation execution process
- FIG. 2 is a flow chart of the steps of Embodiment 1 of the execution method of the registry operation of the present application;
- FIG. 3 is a flow chart of the steps of detecting/recovering the kernel execution flow change point in the present application;
- FIG. 4 is a registration of the present application;
- Example 2 is a flowchart of the embodiment of the execution device of the registry operation of the present application. detailed description
- One of the core concepts of the embodiment of the present application is to construct a trusted environment for the registry operation based on the full life cycle of the registry behavior, and completely implement a set of registry operation call libraries in the operating system user interface, and the kernel state driver receives the After the user mode registry operation request, the caller input parameters included in the request are verified.
- the registry function call logic can be set by constructing a PARSE_CONTEXT (context resolution) structure, and , set the tampering point detection repair logic executed before the registry function call, that is, to actively "simulate" the behavior of the kernel execution layer, and then execute the tampering point detection repair logic and the registry function call logic, detect/restore Object parsing hooks, blocking kernel registry callback mechanisms, etc., so that third-party drivers are penetrated (or bypassed, bypass), thus ensuring the authenticity and credibility of the registry operation request environment. Also, the kernel synchronous call returns the user state handle information and the call state.
- PARSE_CONTEXT context resolution
- the present application proposes an overall solution for the registry penetration operation, which not only provides attack and defense of the operating system user state, but also provides an attack and defense of the operating system kernel state, which can effectively avoid interference due to registry operations.
- the potential for incompatibility between security software; on the other hand, the program can effectively enhance the ability of attack and defense of malicious programs.
- Embodiment 1 of a method for performing a registry operation of the present application is shown, which may specifically include the following steps:
- Step 201 Acquire a registry operation request, where the request includes a caller input parameter;
- Step 202 Set registry kernel execution logic according to the caller input parameter, where the kernel execution logic includes: tampering point detection repair logic and registry function call logic;
- the registry function when the registry operation request is obtained, the caller input parameters included in the request are verified, and if the check is passed, the registry function can be set by constructing a PARSE_CONTEXT (context resolution) structure.
- the system underlying function is called.
- the kernel file on the disk can be mapped to the memory by "forging" the kernel, and after the relocation, the relevant execution layer function is completely extracted (because it is a complete extraction) , so its internal includes "build - PARSE - CONTEXT structure,".
- Step 203 Perform the tampering point detection repair logic, specifically, detecting a preset kernel execution flow tampering point, and recovering, when the kernel performs a change of the original value of the flow tampering point, the kernel performing a flow tampering point Original value;
- the preset kernel execution flow change point may include: a registry object parsing routine hooking; a Cm* registry implementation routine calling a third party driver CmpCallBack callback mechanism; Cm* registry function Linked; and, HvpGetCellPaged/HvpGetCellMapped object routine hooked.
- the raw values for each kernel to perform rogue redirection can be obtained at system initialization.
- kernel execution flow change point is only used as an example, and the preset kernel execution flow change point can be arbitrarily set by a person skilled in the art according to actual needs, and the present application does not need to be limited thereto.
- the detecting preset kernel performs a flow tampering point, and restores the tampering point when the kernel performs a change of the original value of the flow tampering point.
- the steps of the original value may specifically include the following sub-steps:
- Sub-step Sl detecting whether the original value hooked by the registry object parsing routine changes, if yes, executing sub-step S2, otherwise, performing sub-step S3;
- Sub-step S3 calling Cm* registry implementation routine, detecting whether the original value of the Cm* registry function inline hook is changed, and if so, executing sub-step S4, otherwise, performing sub-step S5;
- Sub-step S5 blocking the CmpCallBack callback mechanism, the rotor step S6;
- Sub-step S6 detecting whether the original value hooked by the HvpGetCellPaged/HvpGetCellMapped object routine changes, if yes, executing sub-step S7, otherwise ending;
- Sub-step S7 restoring the original value hooked by the HvpGetCellPaged/HvpGetCellMapped object routine.
- the change value may be recorded in the kernel state memory space, so that the write back is performed after the registry function call is completed.
- the above detection and repair method of the tampering point is only used as an example, and the tampering is arbitrarily set by a person skilled in the art according to actual needs, and the detection and repair operation process of the i is feasible.
- the detection may be unified before the occurrence occurs.
- the tampering point of change is unified and restored, and this application does not limit this.
- Step 204 Call the logic by the registry function to call the corresponding registry function.
- the embodiment of the present application may further include the following steps:
- Step 205 After calling the function of the registry, change the original value of the kernel execution flow change point back to the change value.
- kernels perform rogue modification because they are changed by other security software. Therefore, after the implementation of the system's underlying registry is completed, in order to ensure the normal operation of other security software, the kernel needs to be Perform a rogue change point to write back, specifically The change value saved in the process of restoring the original value is extracted from the kernel state memory space, and the corresponding kernel execution flow tampering point is written back to the change value.
- step 2 of a method for performing a registry operation of the present application is shown, which may specifically include:
- Step 401 Load a registry operation interface routine, and obtain a preset value of a preset kernel execution flow tampering point;
- routines are collections of functional interfaces or services provided by a system externally.
- the operating system's API, services, etc. are routines.
- the registry operation interface routine may include: a registry key creation routine BRegCreateKey, a registry enhancement key creation routine BRegCreateKeyEx, a registry key open routine BRegOpenKey, a registry enhancement key open example BRegOpenKeyEx, registry enhanced query value routine BRegQuery ValueEx, registry setting value routine BRegSetValueEx, registry enumeration key routine BRegEnumKey, registry enhanced enumeration key routine BRegEnumKeyEx, registry enumeration value routine BRegEnum Value, The registry delete key routine BRegDeleteKey, the registry enhanced delete key routine BRegDeleteKeyEx, the registry delete value routine BRegDelete Value, and/or the registry close handle routine BRegCloseKey.
- the settings of the registry operation interface routine such as calling conventions, calling parameters, and corresponding WINDOWS standard APIs.
- Each of the above routines includes a narrow character routine and a wide character routine.
- BRegCreateKey including the narrow character routine BRegCreateKeyA and the wide character routine BRegCreateKeyW
- BRegCreateKeyA converts the input parameter to the UNICODE type, BRegCreateKeyW Actually complete parameter conversion, control code communication, and the like.
- Step 402 The caller initiates a registry operation request, and invokes a corresponding registry operation interface routine; wherein the request includes a caller input parameter;
- Step 403 If the registry operation interface routine is a narrow character routine, convert the ANSI related parameter in the caller input parameter to a UNICODE type, and invoke a corresponding registry operation interface wide character routine;
- Step 404 Construct a kernel state structure parameter according to a type of the system platform, generate a corresponding registry operation control code according to the kernel state structure parameter, and send the registry operation control code to an operating system kernel state driver;
- the control code corresponding to the registry operation interface routine includes: a registry creation control code REGCTL - CREATE - KEY, a registry open control code REGCTL - OPEN - KEY, a registry query Value control code REGCTL_QUERY_VALUE_KEY, registry setting value control code REGCTL SET VALUE KEY, registry enumeration key control code REGCTL_ ENUMERATE_KEY, registry enumeration value control code REGCTL_ ENUMERATE_VALUE_KEY, Registry delete key control code REGCTL - DELETE - KEY and / or registry delete value control code REGCTL - DELETE - VALUE - KEY.
- the control code defines a unified identifier when the operating system user mode and the kernel mode drive communication.
- the input and output buffers can be transmitted in the METHOD-BUFFERED mode when the operating system user mode and the kernel mode drive communication.
- METHOD The BUFFERED mode is: First allocate the buffer, then copy the data from this buffer. The buffer size is the larger space between the input buffer and the output buffer. The read buffer is copied to the new buffer. Before returning, just Copy returns the value to the same buffer. The return value is placed in 10—STATUS—BLOCK, and the 10 manager copies the data to the output buffer.
- Step 405 The operating system kernel state obtains a registry operation request, verifies the caller input parameter, and reconstructs the user state address to the kernel state memory space.
- Step 406 If the input parameter check passes, construct a PARSE_CONTEXT structure according to the caller input parameter, set a registry function call logic, and set a registry kernel execution logic;
- Step 407 Perform the tampering point detection repair logic, specifically, detecting a preset kernel execution flow tampering point, and restoring, when the kernel performs a change of the original value of the flow tampering point, the kernel performing a flow tampering point Original value;
- Step 408 using the registry function call logic, call the corresponding registry function; if the call is successful, step 409; if the call fails, step 410;
- Step 409 returning a corresponding handle
- Step 410 Generate an error code and return a user mode.
- the user interface can set the corresponding error code, so that the caller thread can get detailed error information through the GetLastError routine.
- Step 411 After calling the function of the registry, change the original value of the kernel execution flow change point back to the change value.
- the caller process initiates a BRegCreateKeyA registry creation request
- the BRegCreateKeyA routine converts ANSI related parameters to the UNICODE type and calls the BRegCreateKeyW routine;
- the BRegCreateKeyW routine determines the system platform (32-bit, 64-bit or 32-bit compatible mode) to construct the structure parameters, sends the control code REGCTL_CREATE-KEY and waits for the synchronization to return;
- the kernel part of the BRegCreateKeyW routine receives the user state request, and verifies the input parameters. Number, Captured address to kernel memory;
- BRegCreateKeyW routine build - PARSE - CONTEXT structure, call the system's underlying registry implementation function; perform the following tamper-detection repair operations before calling:
- FIG. 5 a structural block diagram of an embodiment of an execution apparatus of a registry operation of the present application is shown, which may specifically include the following modules:
- the request obtaining module 51 is configured to obtain a registry operation request, where the request includes a caller input parameter;
- the kernel execution logic setting module 52 is configured to set the registry core execution logic according to the caller input parameter, the kernel execution logic comprising: a tamper point detection repair logic and a registry function call logic;
- the tampering point detection repair logic execution module 53 is configured to execute the tamper point detection repair logic, specifically, detecting a preset kernel execution flow tampering point, and executing rogue in the kernel When the original value of the change is changed, the original value of the kernel execution flow change point is restored; the registry function call logic execution module 54 is configured to invoke the corresponding registry function by using the registry function call logic.
- the apparatus may further include the following modules:
- the tampering point write back module 55 is set to change the original value of the kernel execution flow change point back to the change value after calling the function of the registry.
- the preset kernel performing the flow change point may include:
- the registry object parsing routine is hooked
- Cm* registry implementation routine calls CmpCallBack callback mechanism when third-party driver is called; Cm* registry function inline hook;
- the original value of the kernel execution flow change point can be obtained at initialization time, and the kernel execution flow change point change value can be cached in the kernel memory.
- the apparatus may further include the following modules: a user state request sending module, configured to initiate a registry operation request, and invoke a corresponding registry operation interface routine; wherein, the request Including the caller input parameters;
- the control code sending module is configured to construct a kernel state structure parameter according to the type of the system platform, generate a corresponding registry operation control code according to the kernel state structure parameter, and send the registration table operation control code to the operating system kernel state driver.
- the apparatus may further include the following modules:
- the parameter verification module is configured to verify the caller input parameter according to the registry operation request, and if the verification passes, the kernel execution logic setting module is called.
- the caller input parameter has a user mode address; the device may further include the following modules:
- the address reconstruction module is configured to reconstruct the user state address to the kernel state memory space.
- the apparatus may further include the following modules:
- the handle returns a module, which is set to return when the function calling the registry succeeds Handle
- the error code return module is set to generate an error code and return a user mode when the function calling the registry fails.
- the description of the present embodiment is not exhaustive, and reference may be made to the related description in the foregoing embodiment, and details are not described herein. .
- the embodiment of the present application further discloses a computer readable recording medium on which a program for executing an execution method of a registry operation is recorded, wherein the method for executing the registry operation may include the following steps:
- the kernel execution logic includes: tampering point detection repair logic and registry function call logic;
- Performing the tampering point detection repair logic specifically, detecting a preset kernel execution flow tampering point, and recovering an original value of the kernel execution flow tampering point when the kernel performs a change of the original value of the flow tampering point;
- the computer readable recording medium includes any mechanism for storing or transmitting information in a form readable by a computer (e.g., a computer).
- a machine readable medium includes a read only memory
- ROM read only memory
- RAM random access memory
- magnetic disk storage media magnetic disk storage media
- optical storage media flash storage media
- electrical, optical, acoustic or other forms of propagating signals eg, carrier waves, infrared signals, digital signals, etc.
- This application can be used in a variety of general purpose or special purpose computing system environments or configurations.
- personal computer server computer, handheld or portable device, tablet device, multiprocessor system, microprocessor based system, set-top box, programmable consumer electronics device, network PC, small computer, mainframe computer, including A distributed computing environment of any of the above systems or devices, and the like.
- the application can be described in the general context of computer-executable instructions executed by a computer, such as a program module.
- program modules include performing specific tasks or implementing specific pumping Routines, programs, objects, components, data structures, and so on, like data types.
- the present application can also be practiced in distributed computing environments where tasks are performed by remote processing devices that are connected through a communication network.
- program modules can be located in both local and remote computer storage media including storage devices.
Landscapes
- Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Health & Medical Sciences (AREA)
- Virology (AREA)
- Computer Hardware Design (AREA)
- General Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- General Health & Medical Sciences (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
Description
一种注册表操作的执行方法及装置
技术领域
本申请涉及操作系统穿透的技术领域, 特别是涉及一种注册表操作 的执行方法和一种注册表操作的执行装置。 背景技术
在面对复杂问题的时候, 人们往往会釆用分而治之的方法分割、 缩 小问题的范围, 这一点在操作系统的设计中亦是如此, Windows 操作系 统借助分层的设计思想解决复杂的问题, 这一做法带来了可移植性、 可 扩展性等优点。 不过, 由于在设计理论上存在着安全性缺陷 (例如缺乏 完整性校验机制等), 高可扩展性的另一方面也意味着系统存在大量的被 篡改可能。 例如, 安全软件在操作 (创建、 打开、 枚举、 读写、 删除等) 自身、 系统或恶意程序的注册表键值时, 往往希望访问的过程真实可信, 但是微软 Windows 操作系统的分层式结构决定了其调用链上存在数据 流被篡改的风险。 因此, 保证注册表操作过程的真实、 可靠成了安全软 件的一个基本要求。 从操作系统的角度看, 注册表操作的执行过程存在 着如下潜在的篡改点:
参考图 1 所示的操作系统注册表操作执行流的示意图, 在执行注册 表操作釆用如下分层调用的方式:
调用者 101 调用内核接口层 102 , 内核接口层 102调用内核执行层
103 , 内核执行层 103调用注册表解析例程 104, 注册表解析例程 104调 用 Cm*注册表实现例程 105 , Cm*注册表实现例程 105调用第三方驱动 106和 HvpGetCellPaged/HvpGetCellMapped对象例程等 107。 其中, 调用 者 101和内核接口层 102属于操作系统用户态, 内核执行层 103、 注册表 解析例程 104、 Cm*注册表实现例程 105、 第三方驱动 106 和 HvpGetCellPaged/HvpGetCellMapped对象例程等 107属于操作系统内核
态。
从操作系统的角度看, 注册表操作执行流存在着如下潜在的篡改点:
1 )内核接口层的用户态 IAT Hook ( Import Address Table Hook, 导入 表钩挂) /EAT Hook ( Export Address Table Hook, 导出表钩挂);
2 ) 内核接口层的用户态 Inline Hook (内联钩挂);
3 )内核接口层调用内核执行层时的 Int 2E (中断) /SysEnter Hook (用 户态进入内核态钩挂);
4 ) 内核执行层的 Native API SSDT Hook ( System Service Dispatch Table Hook, 系统服务分派表钩挂);
5 ) 内核执行层的 Native API Inline Hook;
6 ) 注册表解析例程的 Object Parse Routine Hook (对象解析例程钩 挂);
7 ) Cm*注册表实现例程的 Cm* Routine Hook;
8 ) Cm*注册表实现例程 105调用第三方驱动 106时的 CmpCallBack 回调机制;
9 ) HvpGetCellPaged/HvpGetCellMapped Object Routine Hook (对象 例程钩挂)。
传统安全软件厂商虽然意识到了种种注册表操作调用被劫持的可能 性, 但是现有的解决方案大多只考虑了操作系统用户态的劫持风险, 在 操作系统内核态的攻防上往往体现出较为明显的能力缺失, 驱动级恶意 程序 (Rootkit )对抗能力偏弱。
因此, 目前需要本领域技术人员迫切解决的一个技术问题就是: 提 出一种注册表操作的执行机制, 以增强和驱动级恶意程序攻防的对抗能 力, 并避免因注册表操作干扰而导致安全软件间产生不兼容的潜在可能 性。 发明内容
本申请的目的之一是提供一种注册表操作的执行方法, 以增强和驱
动级恶意程序攻防的对抗能力, 并避免因注册表操作干扰而导致安全软 件间产生不兼容的潜在可能性。
本申请还提供了一种注册表操作的执行装置, 用以保证上述方法在 实际中的应用及实现。
为了解决上述问题, 本申请实施例公开了一种注册表操作的执行方 法, 包括:
获取注册表操作请求, 所述请求中包括调用者输入参数;
依据所述调用者输入参数设置注册表内核执行逻辑, 所述内核执行 逻辑包括: 篡改点检测修复逻辑和注册表函数调用逻辑;
执行所述篡改点检测修复逻辑, 具体为, 检测预置的内核执行流篡 改点, 并在所述内核执行流篡改点的原始值发生变化时, 恢复所述内核 执行流篡改点的原始值;
釆用所述注册表函数调用逻辑, 调用对应的注册表函数。
优选地, 所述的方法还包括:
在调用完所述注册表的函数后, 将所述内核执行流篡改, ^的原始值 改回变化值。
优选地, 所述预置的内核执行流篡改点包括:
注册表对象解析例程钩挂;
Cm*注册表实现例程调用第三方驱动时的 CmpCallBack回调机制; Cm*注册表函数内联挂钩;
HvpGetCellPaged/HvpGetCellMapped对象例程钩挂。
优选地, 所述检测预置的内核执行流篡改点, 并在内核执行流篡改 点的原始值发生变化时恢复所述篡改点原始值的步骤具体包括:
子步骤 Sl、 检测注册表对象解析例程钩挂的原始值是否发生改变, 若是, 则执行子步骤 S2, 否则, 执行子步骤 S3;
子步骤 S2、 恢复所述注册表对象解析例程钩挂的原始值, 转子步骤
S3;
子步骤 S3、 调用 Cm*注册表实现例程, 检测 Cm*注册表函数内联挂
钩的原始值是否发生改变, 若是, 则执行子步骤 S4, 否则, 执行子步骤
S5;
子步骤 S4、 恢复所述 Cm*注册表函数内联挂钩的原始值, 转子步骤
S5;
子步骤 S5、 阻断 CmpCallBack回调机制, 转子步骤 S6;
子步骤 S6、 检测 HvpGetCellPaged/HvpGetCellMapped对象例程钩挂 的原始值是否发生改变, 若是, 则执行子步骤 S7, 否则结束;
子步骤 S7、 恢复所述 HvpGetCellPaged/HvpGetCellMapped对象例程 钩挂的原始值。
优选地, 所述内核执行流篡改点的原始值在初始化时获得, 所述内 核执行流篡改点的变化值緩存在内核内存中。
优选地, 在获取注册表操作请求之前, 还包括:
调用者发起注册表操作请求, 调用对应的注册表操作接口例程; 其 中, 所述请求中包括调用者输入参数;
依据系统平台的类型构建内核态结构参数, 依据所述内核态结构参 数生成相应的注册表操作控制码, 并发送所述注册表操作控制码至操作 系统内核态驱动。
优选地, 各注册表操作接口例程包括窄字符例程和宽字符例程, 在 构建内核态结构参数之前, 所述的方法还包括:
所述注册表操作接口窄字符例程将调用者输入参数中的 ANSI 相关 参数转换为 UNICODE类型, 并调用对应的注册表操作接口宽字符例程。
优选地, 在设置注册表内核执行逻辑之前, 所述的方法还包括: 依据所述注册表操作请求校验调用者输入参数, 若校验通过, 则执 行设置注册表内核执行逻辑的步骤。
优选地, 所述调用者输入参数具有用户态地址; 在设置注册表内核 执行逻辑之前, 所述的方法还包括:
重构所述用户态地址至内核态内存空间。
优选地, 所述的方法, 还包括:
若调用所述注册表的函数成功, 则返回相应的句柄;
若调用所述注册表的函数失败, 则生成错误码并返回用户态。
优选地, 所述注册表操作接口例程与 WINDOWS标准 API—致, 包 括: 注册表键创建例程 BRegCreateKey、 注册表增强键创建例程 BRegCreateKeyEx, 注册表键打开例程 BRegOpenKey、 注册表增强键打 开例程 BRegOpenKeyEx、 注册表增强查询值例程 BRegQuery ValueEx、 注 册表设置值例程 BRegSetValueEx、 注册表枚举键例程 BRegEnumKey、 注 册表增强枚举键例程 BRegEnumKeyEx、 注册表枚举值例程 BRegEnum Value、 注册表删除键例程 BRegDeleteKey、 注册表增强删除键 例程 BRegDeleteKeyEx、注册表删除值例程 BRegDelete Value和 /或注册表 关闭句柄例程 BRegCloseKey。
优 选 地 , 所 述 控 制 码 包 括 : 注 册 表 创 建 控 制 码 REGCTL— CREATE— KEY、 注册表打开控制码 REGCTL— OPEN— KEY、 注 册表查询值控制码 REGCTL— QUERY— VALUE— KEY、 注册表设置值控制 码 REGCTL— SET— VALUE— KEY 、 注 册 表 枚 举 键 控 制 码 REGCTL— ENUMERATE— KEY 、 注 册 表 枚 举 值 控 制 码 REGCTL— ENUMERATE— VALUE— KEY 、 注 册 表删 除键 控 制 码 REGCTL— DELETE— KEY 和 / 或 注 册 表 删 除 值 控 制 码 REGCTX— DELETE— VALUE— KEY。 本申请实施例还公开了一种注册表操作的执行装置, 包括: 请求获取模块, 设置为获取注册表操作请求, 所述请求中包括调用 者输入参数;
内核执行逻辑设置模块, 设置为依据所述调用者输入参数设置注册 表内核执行逻辑, 所述内核执行逻辑包括: 篡改点检测修复逻辑和注册 表函数调用逻辑;
篡改点检测修复逻辑执行模块, 设置为执行所述篡改点检测修复逻 辑, 具体为, 检测预置的内核执行流篡改点, 并在所述内核执行流篡改
点的原始值发生变化时, 恢复所述内核执行流篡改点的原始值;
注册表函数调用逻辑执行模块, 设置为釆用所述注册表函数调用逻 辑, 调用对应的注册表函数。
优选地, 所述的装置还包括:
篡改点回写模块, 设置为在调用完所述注册表的函数后, 将所述内 核执行流篡改点的原始值改回变化值。
优选地, 所述预置的内核执行流篡改点包括:
注册表对象解析例程钩挂;
Cm*注册表实现例程调用第三方驱动时的 CmpCallBack回调机制; Cm*注册表函数内联挂钩;
HvpGetCellPaged/HvpGetCellMapped对象例程钩挂。
优选地, 所述内核执行流篡改点的原始值在初始化时获得, 所述内 核执行流篡改点的变化值緩存在内核内存中。
优选地, 所述的装置还包括:
用户态请求发送模块, 设置为发起注册表操作请求, 调用对应的注 册表操作接口例程; 其中, 所述请求中包括调用者输入参数;
控制码发送模块, 设置为依据系统平台的类型构建内核态结构参数, 依据所述内核态结构参数生成相应的注册表操作控制码, 并发送所述注 册表操作控制码至操作系统内核态驱动。
优选地, 所述的装置还包括:
参数校验模块, 设置为依据所述注册表操作请求校验调用者输入参 数, 若校验通过, 则调用内核执行逻辑设置模块。
优选地, 所述调用者输入参数具有用户态地址; 所述的装置还包括: 地址重构模块, 设置为重构所述用户态地址至内核态内存空间。 优选地, 所述的装置还包括:
句柄返回模块, 设置为在调用所述注册表的函数成功时, 返回相应 的句柄;
错误码返回模块, 设置为在调用所述注册表的函数失败时, 生成错
误码并返回用户态。
本申请实施例还公开了一种在其上记录有用于执行一种注册表操作 的执行方法的程序的计算机可读记录介质, 其中, 所述一种注册表操作 的执行方法, 包括:
获取注册表操作请求, 所述请求中包括调用者输入参数;
依据所述调用者输入参数设置注册表内核执行逻辑, 所述内核执行 逻辑包括: 篡改点检测修复逻辑和注册表函数调用逻辑;
执行所述篡改点检测修复逻辑, 具体为, 检测预置的内核执行流篡 改点, 并在所述内核执行流篡改点的原始值发生变化时, 恢复所述内核 执行流篡改点的原始值;
釆用所述注册表函数调用逻辑, 调用对应的注册表函数。 与现有技术相比, 本申请具有以下优点:
本申请基于注册表行为的全生命周期构建注册表操作的可信环境, 在操作系统用户态接口完整实现一套注册表操作调用库, 内核态驱动接 收到来自用户态的注册表操作请求后, 会对请求中包含的调用者输入参 数进行校验, 若校验通过, 则可以通过构建 — PARSE— CONTEXT (上下 文解析) 结构来设置注册表函数调用逻辑, 以及, 设置在注册表函数调 用之前执行的篡改点检测修复逻辑,即自己主动去"模拟"内核执行层的行 为, 然后通过执行所述篡改点检测修复逻辑和注册表函数调用逻辑, 检 测 / 恢复对象解析挂钩、 阻断内核注册表回调机制等方法, 使第三方驱 动被穿透 (或称之为旁路, bypass ), 从而保证注册表操作请求环境的真 实、 可信。 并且, 内核同步调用返回用户态句柄信息以及调用状态。 本 申请提出了一种注册表穿透操作的整体解决方案, 不仅提供了操作系统 用户态的攻防, 还进一步提供了操作系统内核态的攻防, 该方案一方面 可有效避免因注册表操作干扰而导致安全软件间产生不兼容的潜在可能 性; 另一方面, 该方案能有效增强和驱动级恶意程序攻防的对抗能力。
附图说明
图 1是一种操作系统注册表操作执行过程的示意图;
图 2是本申请的一种注册表操作的执行方法实施例 1的步骤流程图; 图 3是本申请中检测 /恢复内核执行流篡改点的步骤流程图; 图 4是本申请的一种注册表操作的执行方法实施例 2的步骤流程图; 图 5是本申请的一种注册表操作的执行装置实施例的结构框图。 具体实施方式
为使本申请的上述目的、 特征和优点能够更加明显易懂, 下面结合 附图和具体实施方式对本申请作进一步详细的说明。
本申请实施例的核心构思之一在于, 基于注册表行为的全生命周期 构建注册表操作的可信环境, 在操作系统用户态接口完整实现一套注册 表操作调用库, 内核态驱动接收到来自用户态的注册表操作请求后, 会 对请求中包含的调用者输入参数进行校验, 若校验通过, 则可以通过构 建 —PARSE— CONTEXT (上下文解析 )结构来设置注册表函数调用逻辑, 以及, 设置在注册表函数调用之前执行的篡改点检测修复逻辑, 即自己 主动去 "模拟 "内核执行层的行为,然后通过执行所述篡改点检测修复逻辑 和注册表函数调用逻辑,,检测 / 恢复对象解析挂钩、 阻断内核注册表回 调机制等方法, 使第三方驱动被穿透 (或称之为旁路, bypass ), 从而保 证注册表操作请求环境的真实、 可信。 并且, 内核同步调用返回用户态 句柄信息以及调用状态。 本申请提出了一种注册表穿透操作的整体解决 方案, 不仅提供了操作系统用户态的攻防, 还进一步提供了操作系统内 核态的攻防, 该方案一方面可有效避免因注册表操作干扰而导致安全软 件间产生不兼容的潜在可能性; 另一方面, 该方案能有效增强和驱动级 恶意程序攻防的对抗能力。
参考图 2,示出了本申请的一种注册表操作的执行方法实施例 1的步 骤流程图, 具体可以包括以下步骤:
步骤 201、 获取注册表操作请求, 所述请求中包括调用者输入参数;
步骤 202、 依据所述调用者输入参数设置注册表内核执行逻辑, 所述 内核执行逻辑包括: 篡改点检测修复逻辑和注册表函数调用逻辑;
在具体实现中, 当获取到注册表操作请求, 会对请求中包含的调用 者输入参数进行校验,若校验通过,则可以通过构建 —PARSE— CONTEXT (上下文解析) 结构来设置注册表函数调用逻辑, 以及, 设置在注册表 函数调用之前执行的篡改点检测修复逻辑。本实施例即通过主动去"模拟" 内核执行层, 自己实现构建 —PARSE— CONTEXT 结构后, 再去调用系统 底层函数。
在本申请的另一种优选实施例中,还可以通过"伪造"内核的方法,把 磁盘上的内核文件影射到内存, 结合重定位后, 完整的提取出相关执行 层函数(因为是完整提取,所以其内部包括"构建 —PARSE— CONTEXT 结 构,,)。
当然, 上述设置注册表内核执行逻辑的方法仅仅用作示例, 本领域 技术人员根据实际情况釆用任一种方式设置注册表内核执行逻辑均是可 行的, 本申请对此不作限制。
步骤 203、 执行所述篡改点检测修复逻辑, 具体为, 检测预置的内核 执行流篡改点, 并在所述内核执行流篡改点的原始值发生变化时, 恢复 所述内核执行流篡改点的原始值;
在具体实现中, 所述预置的内核执行流篡改点可以包括: 注册表对 象解析例程钩挂; Cm*注册表实现例程调用第三方驱动时的 CmpCallBack 回 调 机 制 ; Cm* 注 册 表 函 数 内 联 挂 钩 ; 以 及 , HvpGetCellPaged/HvpGetCellMapped对象例程钩挂。各内核执行流篡改点 的原始值可以在系统初始化时获得。
当然, 上述内核执行流篡改点仅仅用作示例, 所述预置的内核执行 流篡改点可以由本领域技术人员按照实际需求任意设置, 本申请对此无 需加以限制。
参考图 3 , 在本申请的一种优选实施例中, 所述检测预置的内核执行 流篡改点, 并在内核执行流篡改点的原始值发生变化时恢复所述篡改点
原始值的步骤具体可以包括以下子步骤:
子步骤 Sl、 检测注册表对象解析例程钩挂的原始值是否发生改变, 若是, 则执行子步骤 S2, 否则, 执行子步骤 S3;
子步骤 S2、 恢复所述注册表对象解析例程钩挂的原始值, 转子步骤
S3;
子步骤 S3、 调用 Cm*注册表实现例程, 检测 Cm*注册表函数内联挂 钩的原始值是否发生改变, 若是, 则执行子步骤 S4, 否则, 执行子步骤 S5;
子步骤 S4、 恢复所述 Cm*注册表函数内联挂钩的原始值, 转子步骤
S5;
子步骤 S5、 阻断 CmpCallBack回调机制, 转子步骤 S6;
子步骤 S6、 检测 HvpGetCellPaged/HvpGetCellMapped对象例程钩挂 的原始值是否发生改变, 若是, 则执行子步骤 S7, 否则结束;
子步骤 S7、 恢复所述 HvpGetCellPaged/HvpGetCellMapped对象例程 钩挂的原始值。
在具体实现中, 如检测到某个内核执行流篡改点发生变化, 则可记 录其变化值在内核态内存空间, 以便在注册表函数调用完成后进行回写。
当然, 上述篡改点的检测及修复方法仅仅用作示例, 本领域技术人 员依据实际需求任意设置所述篡改, i的检 及修复操作过程都是可行 的, 例如, 可以先统一检测, 再对发生变化的篡改点统一恢复, 本申请 对此不作限制。
步骤 204、 釆用所述注册表函数调用逻辑, 调用对应的注册表函数。 在具体实现中, 本申请实施例还可以包括如下步骤:
步骤 205、 在调用完所述注册表的函数后, 将所述内核执行流篡改点 的原始值改回变化值。
在实际中, 某些内核执行流篡改点是因为被其它的安全软件改写而 发生变化, 故在系统底层注册表的实现函数调用完成后, 为保证其它安 全软件的正常运行, 需要对所述内核执行流篡改点进行回写, 具体可以
从内核态内存空间中提取在恢复原始值过程中保存的变化值, 将对应的 内核执行流篡改点写回该变化值。
当注册表函数调用完成后, 注册表操作执行流将继续调用注册表解 析例程, 再由注册表解析例程调用 Cm*注册表实现例程, Cm*注册表实 现例程直接调用 HvpGetCellPaged/HvpGetCellMapped 对象例程; 由于 CmpCallBack回调机制被阻断, 故 Cm*注册表实现例程将不再调用第三 方驱动, 从而使得第三方驱动 (其他安全软件、 驱动级恶意程序)被穿 透。 参考图 4,示出了本申请的一种注册表操作的执行方法实施例 2的步 骤流程图, 具体可以包括:
步骤 401、 加载注册表操作接口例程, 获取预置的内核执行流篡改点 的原始值;
公知的是, 例程是某个系统对外提供的功能接口或服务的集合。 比 如操作系统的 API、 服务等就是例程。
作为具体应用的一种示例, 所述注册表操作接口例程可以包括: 注 册表键创 建例程 BRegCreateKey、 注册表增 强键创 建例程 BRegCreateKeyEx, 注册表键打开例程 BRegOpenKey、 注册表增强键打 开例程 BRegOpenKeyEx、 注册表增强查询值例程 BRegQuery ValueEx、 注 册表设置值例程 BRegSetValueEx、 注册表枚举键例程 BRegEnumKey、 注 册表增强枚举键例程 BRegEnumKeyEx、 注册表枚举值例程 BRegEnum Value、 注册表删除键例程 BRegDeleteKey、 注册表增强删除键 例程 BRegDeleteKeyEx、注册表删除值例程 BRegDelete Value和 /或注册表 关闭句柄例程 BRegCloseKey。 所述注册表操作接口例程的设置, 如调用 约定、 调用参数和对应的 WINDOWS标准 API—致。 上述每个例程均包 括窄字符例程和宽字符例程, 例如对于 BRegCreateKey 而言, 包括窄字 符 例 程 BRegCreateKeyA 和 宽 字 符 例 程 BRegCreateKeyW , BRegCreateKeyA会转换输入参数为 UNICODE 类型, BRegCreateKeyW
实际完成参数转换、 控制码通信等。
步骤 402、 调用者发起注册表操作请求, 调用对应的注册表操作接口 例程; 其中, 所述请求中包括调用者输入参数;
步骤 403、 若所述注册表操作接口例程为窄字符例程, 则将调用者输 入参数中的 ANSI相关参数转换为 UNICODE类型,并调用对应的注册表 操作接口宽字符例程;
公知的是, ANSI 中的字符釆用 8bit, 而 UNICODE 中的字符釆用 16bit。 (对于字符来说 ANSI以单字节存放英文字符, 以双字节存放中文 等字符,而 Unicode下, 英文和中文的字符都以双字节存放)。
当然, 若在实际中直接调用的是宽字符例程, 则无需执行本步骤。 步骤 404、 依据系统平台的类型构建内核态结构参数, 依据所述内核 态结构参数生成相应的注册表操作控制码, 并发送所述注册表操作控制 码至操作系统内核态驱动;
所述系统平台的类型包括 32位、 64位以及 32位兼容模式。 作为本 申请一种具体应用的示例, 与所述注册表操作接口例程对应的控制码包 括: 注册表创建控制码 REGCTL— CREATE— KEY、 注册表打开控制码 REGCTL— OPEN— KEY 、 注 册 表 查 询 值 控 制 码 REGCTL— QUERY— VALUE— KEY 、 注 册 表 设 置 值 控 制 码 REGCTL SET VALUE KEY 、 注 册 表 枚 举 键 控 制 码 REGCTL— ENUMERATE— KEY 、 注 册 表 枚 举 值 控 制 码 REGCTL— ENUMERATE— VALUE— KEY 、 注 册 表删 除键 控 制 码 REGCTL— DELETE— KEY 和 / 或 注 册 表 删 除 值 控 制 码 REGCTL— DELETE— VALUE— KEY。 所述控制码定义了操作系统用户态和 内核态驱动通信时的统一标识。
在实际中, 操作系统用户态和内核态驱动通信时输入、 输出緩冲区 可以釆用 METHOD— BUFFERED方式传输。 METHOD— BUFFERED方式 为: 先分配緩冲, 再从这个緩冲 copy数据, 緩冲区大小是输入緩冲和输 出緩冲间空间较大的那个。 读緩冲被 copy到新的緩冲。 在返回前, 只是
copy返回值到相同的緩冲。 返回值被放到 10— STATUS— BLOCK , 10管 理器 copy数据到输出緩冲。
步骤 405、 操作系统内核态获取注册表操作请求, 校验调用者输入参 数, 并重构 (Captured ) 所述用户态地址至内核态内存空间;
步骤 406、 若输入参数校验通过, 则依据所述调用者输入参数构建 —PARSE— CONTEXT 结构, 以设置注册表函数调用逻辑, 并设置注册表 内核执行逻辑;
步骤 407、 执行所述篡改点检测修复逻辑, 具体为, 检测预置的内核 执行流篡改点, 并在所述内核执行流篡改点的原始值发生变化时, 恢复 所述内核执行流篡改点的原始值;
步骤 408、 釆用所述注册表函数调用逻辑, 调用对应的注册表函数; 若调用成功, 则执行步骤 409; 若调用失败, 则执行步骤 410;
步骤 409、 返回相应的句柄;
步骤 410、 生成错误码并返回用户态;
在具体实现中, 如果调用失败, 用户态接口可以设置相应的错误码, 这样, 调用者线程可以通过 GetLastError 例程得到详细的错误信息。
步骤 411、 在调用完所述注册表的函数后, 将所述内核执行流篡改点 的原始值改回变化值。 为使本领域技术人员更好地理解本申请, 以下通过以注册表创建过 程为例详细说明本申请。
( 1 ) 调用者进程发起 BRegCreateKeyA 注册表创建请求;
( 2 ) BRegCreateKeyA 例程转换 ANSI 相关参数为 UNICODE 类 型并调用 BRegCreateKeyW 例程;
( 3 ) BRegCreateKeyW 例程判断系统平台 ( 32位、 64位或 32位兼 容模式)构建结构参数, 发送控制码 REGCTL— CREATE— KEY 并同步等 待返回;
( 4 ) BRegCreateKeyW 例程内核部分接收用户态请求, 校验输入参
数, Captured 地址到内核内存;
( 5 ) BRegCreateKeyW 例程构建 —PARSE— CONTEXT 结构, 调用 系统底层注册表实现函数; 在调用之前执行以下篡改点检测修复操作:
Al、 检测、 恢复潜在的注册表对象解析例程挂钩问题;
A2、 检测、 恢复潜在的 CmpCallback 内核回调问题;
A3、 检测、 恢复潜在的 Cm* 级注册表函数内联挂钩问题;
A4、 检测、 恢复潜在的 HvpGetCellPaged / HvpGetCellMapped 对象 例程挂钩问题。
( 6 )如调用成功则返回相应的句柄; 如例程调用错误, 驱动返回用 户态相应的错误码。
( 7 )同步请求返回, 如果调用失败, 用户态接口设置相应的错误码, 这样, 调用者线程可以通过 GetLastError 例程得到详细的错误信息。
需要说明的是, 对于方法实施例, 为了简单描述, 故将其都表述为 一系列的动作组合, 但是本领域技术人员应该知悉, 本申请并不受所描 述的动作顺序的限制, 因为依据本申请, 某些步骤可以釆用其他顺序或 者同时进行。 其次, 本领域技术人员也应该知悉, 说明书中所描述的实 施例均属于优选实施例, 所涉及的动作和模块并不一定是本申请所必须 的。 参考图 5 ,示出了本申请的一种注册表操作的执行装置实施例的结构 框图, 具体可以包括以下模块:
请求获取模块 51 , 设置为获取注册表操作请求, 所述请求中包括调 用者输入参数;
内核执行逻辑设置模块 52, 设置为依据所述调用者输入参数设置注 册表内核执行逻辑, 所述内核执行逻辑包括: 篡改点检测修复逻辑和注 册表函数调用逻辑;
篡改点检测修复逻辑执行模块 53 , 设置为执行所述篡改点检测修复 逻辑, 具体为, 检测预置的内核执行流篡改点, 并在所述内核执行流篡
改点的原始值发生变化时, 恢复所述内核执行流篡改点的原始值; 注册表函数调用逻辑执行模块 54 , 设置为釆用所述注册表函数调用 逻辑, 调用对应的注册表函数。
在具体实现中, 所述的装置还可以包括以下模块:
篡改点回写模块 55 , 设置为在调用完所述注册表的函数后, 将所述 内核执行流篡改点的原始值改回变化值。
在本申请的一种优选实施例中, 所述预置的内核执行流篡改点可以 包括:
注册表对象解析例程钩挂;
Cm*注册表实现例程调用第三方驱动时的 CmpCallBack回调机制; Cm*注册表函数内联挂钩;
HvpGetCellPaged/HvpGetCellMapped对象例程钩挂。
在实际中, 所述内核执行流篡改点的原始值可以在初始化时获得, 所述内核执行流篡改点的变化值可以緩存在内核内存中。
在本申请的一种优选实施例中, 所述的装置还可以包括以下模块: 用户态请求发送模块, 设置为发起注册表操作请求, 调用对应的注 册表操作接口例程; 其中, 所述请求中包括调用者输入参数;
控制码发送模块, 设置为依据系统平台的类型构建内核态结构参数, 依据所述内核态结构参数生成相应的注册表操作控制码, 并发送所述注 册表操作控制码至操作系统内核态驱动。
在具体实现中, 所述的装置还可以包括以下模块:
参数校验模块, 设置为依据所述注册表操作请求校验调用者输入参 数, 若校验通过, 则调用内核执行逻辑设置模块。
作为具体应用的一种示例, 所述调用者输入参数具有用户态地址; 所述的装置还可以包括以下模块:
地址重构模块, 设置为重构所述用户态地址至内核态内存空间。 在具体实现中, 所述的装置还可以包括以下模块:
句柄返回模块, 设置为在调用所述注册表的函数成功时, 返回相应
的句柄;
错误码返回模块, 设置为在调用所述注册表的函数失败时, 生成错 误码并返回用户态。
由于所述装置实施例基本相应于前述图 2和图 4所示的方法实施例, 故本实施例的描述中未详尽之处, 可以参见前述实施例中的相关说明, 在此就不赘述了。
本申请实施例还公开了一种在其上记录有用于执行一种注册表操作 的执行方法的程序的计算机可读记录介质, 其中, 所述一种注册表操作 的执行方法可以包括如下步骤:
获取注册表操作请求, 所述请求中包括调用者输入参数;
依据所述调用者输入参数设置注册表内核执行逻辑, 所述内核执行 逻辑包括: 篡改点检测修复逻辑和注册表函数调用逻辑;
执行所述篡改点检测修复逻辑, 具体为, 检测预置的内核执行流篡 改点, 并在所述内核执行流篡改点的原始值发生变化时, 恢复所述内核 执行流篡改点的原始值;
釆用所述注册表函数调用逻辑, 调用对应的注册表函数。
所述计算机可读记录介质包括用于以计算机 (例如计算机 ) 可读的 形式存储或传送信息的任何机制。 例如, 机器可读介质包括只读存储器
( ROM ), 随机存取存储器 (RAM )、 磁盘存储介质、 光存储介质、 闪速 存储介质、 电、 光、 声或其他形式的传播信号 (例如, 载波、 红外信号、 数字信号等) 等。
本申请可用于众多通用或专用的计算系统环境或配置中。 例如: 个 人计算机、 服务器计算机、 手持设备或便携式设备、 平板型设备、 多处 理器系统、 基于微处理器的系统、 置顶盒、 可编程的消费电子设备、 网 络 PC、 小型计算机、 大型计算机、 包括以上任何系统或设备的分布式计 算环境等等。
本申请可以在由计算机执行的计算机可执行指令的一般上下文中描 述, 例如程序模块。 一般地, 程序模块包括执行特定任务或实现特定抽
象数据类型的例程、 程序、 对象、 组件、 数据结构等等。 也可以在分布 式计算环境中实践本申请, 在这些分布式计算环境中, 由通过通信网络 而被连接的远程处理设备来执行任务。 在分布式计算环境中, 程序模块 可以位于包括存储设备在内的本地和远程计算机存储介质中。
以上对本申请所提供的一种注册表操作的执行方法和一种注册表操 作的执行装置进行了详细介绍, 本文中应用了具体个例对本申请的原理 及实施方式进行了阐述, 以上实施例的说明只是设置为帮助理解本申请 的方法及其核心思想; 同时, 对于本领域的一般技术人员, 依据本申请 的思想, 在具体实施方式及应用范围上均会有改变之处, 综上所述, 本 说明书内容不应理解为对本申请的限制。
Claims
1、 一种注册表操作的执行方法, 其特征在于, 包括: 获取注册表操作请求, 所述请求中包括调用者输入参数;
依据所述调用者输入参数设置注册表内核执行逻辑, 所述内核执行 逻辑包括: 篡改点检测修复逻辑和注册表函数调用逻辑;
执行所述篡改点检测修复逻辑, 具体为, 检测预置的内核执行流篡 改点, 并在所述内核执行流篡改点的原始值发生变化时, 恢复所述内核 执行流篡改点的原始值;
釆用所述注册表函数调用逻辑, 调用对应的注册表函数。
2、 如权利要求 1所述的方法, 其特征在于, 还包括:
在调用完所述注册表的函数后, 将所述内核执行流篡改, ^的原始值 改回变化值。
3、 如权利要求 1或 2所述的方法, 其特征在于, 所述预置的内核执 行流篡改点包括:
注册表对象解析例程钩挂;
Cm*注册表实现例程调用第三方驱动时的 CmpCallBack回调机制; Cm*注册表函数内联挂钩;
HvpGetCellPaged/HvpGetCellMapped对象例程钩挂。
4、 如权利要求 3所述的方法, 其特征在于, 所述检测预置的内核执 行流篡改点, 并在内核执行流篡改点的原始值发生变化时恢复所述篡改 点原始值的步骤具体包括:
子步骤 Sl、 检测注册表对象解析例程钩挂的原始值是否发生改变, 若是, 则执行子步骤 S2, 否则, 执行子步骤 S3;
子步骤 S2、 恢复所述注册表对象解析例程钩挂的原始值, 转子步骤
S3;
子步骤 S3、 调用 Cm*注册表实现例程, 检测 Cm*注册表函数内联挂 钩的原始值是否发生改变, 若是, 则执行子步骤 S4, 否则, 执行子步骤 S5; 子步骤 S4、 恢复所述 Cm*注册表函数内联挂钩的原始值, 转子步骤
S5;
子步骤 S5、 阻断 CmpCallBack回调机制, 转子步骤 S6;
子步骤 S6、 检测 HvpGetCellPaged/HvpGetCellMapped对象例程钩挂 的原始值是否发生改变, 若是, 则执行子步骤 S7, 否则结束;
子步骤 S7、 恢复所述 HvpGetCellPaged/HvpGetCellMapped对象例程 钩挂的原始值。
5、 如权利要求 4所述的方法, 其特征在于, 所述内核执行流篡改点 的原始值在初始化时获得, 所述内核执行流篡改点的变化值緩存在内核 内存中。
6、 如权利要求 1或 2所述的方法, 其特征在于, 在获取注册表操作 请求之前, 还包括:
调用者发起注册表操作请求, 调用对应的注册表操作接口例程; 其 中, 所述请求中包括调用者输入参数;
依据系统平台的类型构建内核态结构参数, 依据所述内核态结构参 数生成相应的注册表操作控制码, 并发送所述注册表操作控制码至操作 系统内核态驱动。
7、 如权利要求 6所述的方法, 其特征在于, 各注册表操作接口例程 包括窄字符例程和宽字符例程, 在构建内核态结构参数之前, 所述的方 法还包括:
所述注册表操作接口窄字符例程将调用者输入参数中的 ANSI 相关 参数转换为 UNICODE类型, 并调用对应的注册表操作接口宽字符例程。
8、 如权利要求 7所述的方法, 其特征在于, 在设置注册表内核执行 逻辑之前, 所述的方法还包括:
依据所述注册表操作请求校验调用者输入参数, 若校验通过, 则执 行设置注册表内核执行逻辑的步骤。
9、 如权利要求 8所述的方法, 其特征在于, 所述调用者输入参数具 有用户态地址; 在设置注册表内核执行逻辑之前, 所述的方法还包括: 重构所述用户态地址至内核态内存空间。
10、 如权利要求 7、 8或 9所述的方法, 其特征在于, 还包括: 若调用所述注册表的函数成功, 则返回相应的句柄;
若调用所述注册表的函数失败, 则生成错误码并返回用户态。
11、 如权利要求 6 所述的方法, 其特征在于, 所述注册表操作接口 例程与 WINDOWS 标准 API —致, 包括: 注册表键创建例程 BRegCreateKey、 注册表增强键创建例程 BRegCreateKeyEx、 注册表键打 开例程 BRegOpenKey、 注册表增强键打开例程 BRegOpenKeyEx、 注册表 增强查询值例程 BRegQueryValueEx、注册表设置值例程 BRegSetValueEx、 注册表枚举键例程 BRegEnumKey、 注册表增强枚举键例程 BRegEnumKeyEx, 注册表枚举值例程 BRegEnum Value、 注册表删除键例 程 BRegDeleteKey、 注册表增强删除键例程 BRegDeleteKeyEx、 注册表删 除值例程 BRegDelete Value和 /或注册表关闭句柄例程 BRegCloseKey„
12、 如权利要求 11所述的方法, 其特征在于, 所述控制码包括: 注 册表创建控制码 REGCTL— CREATE— KEY、 注册表打开控制码 REGCTL— OPEN— KEY 、 注 册 表 查 询 值 控 制 码 REGCTL— QUERY— VALUE— KEY 、 注 册 表 设 置 值 控 制 码 REGCTL SET VALUE KEY 、 注 册 表 枚 举 键 控 制 码 REGCTL— ENUMERATE— KEY 、 注 册 表 枚 举 值 控 制 码 REGCTL— ENUMERATE— VALUE— KEY 、 注 册 表删 除键 控 制 码 REGCTL— DELETE— KEY 和 / 或 注 册 表 删 除 值 控 制 码 REGCTL DELETE VALUE KEY。
13、 一种注册表操作的执行装置, 其特征在于, 包括:
请求获取模块, 设置为获取注册表操作请求, 所述请求中包括调用 者输入参数;
内核执行逻辑设置模块, 设置为依据所述调用者输入参数设置注册 表内核执行逻辑, 所述内核执行逻辑包括: 篡改点检测修复逻辑和注册 表函数调用逻辑;
篡改点检测修复逻辑执行模块, 设置为执行所述篡改点检测修复逻 辑, 具体为, 检测预置的内核执行流篡改点, 并在所述内核执行流篡改 点的原始值发生变化时, 恢复所述内核执行流篡改点的原始值;
注册表函数调用逻辑执行模块, 设置为釆用所述注册表函数调用逻 辑, 调用对应的注册表函数。
14、 如权利要求 13所述的装置, 其特征在于, 还包括:
篡改点回写模块, 设置为在调用完所述注册表的函数后, 将所述内 核执行流篡改点的原始值改回变化值。
15、 如权利要求 13或 14所述的装置, 其特征在于, 所述预置的内 核执行流篡改点包括:
注册表对象解析例程钩挂;
Cm*注册表实现例程调用第三方驱动时的 CmpCallBack回调机制; Cm*注册表函数内联挂钩;
HvpGetCellPaged/HvpGetCellMapped对象例程钩挂。
16、 如权利要求 15所述的装置, 其特征在于, 所述内核执行流篡改 点的原始值在初始化时获得, 所述内核执行流篡改点的变化值緩存在内 核内存中。
17、 如权利要求 13或 14所述的装置, 其特征在于, 还包括: 用户态请求发送模块, 设置为发起注册表操作请求, 调用对应的注 册表操作接口例程; 其中, 所述请求中包括调用者输入参数;
控制码发送模块, 设置为依据系统平台的类型构建内核态结构参数, 依据所述内核态结构参数生成相应的注册表操作控制码, 并发送所述注 册表操作控制码至操作系统内核态驱动。
18、 如权利要求 17所述的装置, 其特征在于, 还包括:
参数校验模块, 设置为依据所述注册表操作请求校验调用者输入参 数, 若校验通过, 则调用内核执行逻辑设置模块。
19、 如权利要求 18所述的装置, 其特征在于, 所述调用者输入参数 具有用户态地址; 所述的装置还包括:
地址重构模块, 设置为重构所述用户态地址至内核态内存空间。
20、 如权利要求 18或 19所述的装置, 其特征在于, 还包括: 句柄返回模块, 设置为在调用所述注册表的函数成功时, 返回相应 的句柄;
错误码返回模块, 设置为在调用所述注册表的函数失败时, 生成错 误码并返回用户态。
21、 一种在其上记录有用于执行权利要求 1 所述方法的程序的计 机可读记录介质。
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201110121178.8 | 2011-05-11 | ||
| CN201110121178.8A CN102779030B (zh) | 2011-05-11 | 2011-05-11 | 一种注册表操作的执行方法及装置 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2012152212A1 true WO2012152212A1 (zh) | 2012-11-15 |
Family
ID=47123952
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2012/075155 Ceased WO2012152212A1 (zh) | 2011-05-11 | 2012-05-07 | 一种注册表操作的执行方法及装置 |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN102779030B (zh) |
| WO (1) | WO2012152212A1 (zh) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US11663333B2 (en) | 2020-08-11 | 2023-05-30 | Beijing Didi Infinity Technology And Development Co., Ltd. | Cloud-based systems and methods for detecting and removing rootkit |
Families Citing this family (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN103577237B (zh) * | 2013-11-15 | 2017-09-05 | 北京奇虎科技有限公司 | 应用程序启动的控制方法及装置 |
| CN105653955B (zh) * | 2015-12-30 | 2019-05-10 | 珠海豹趣科技有限公司 | 一种恶意软件处理方法及装置 |
| CN107818034B (zh) * | 2016-09-14 | 2021-02-12 | 华为技术有限公司 | 监测计算机设备中的进程的运行空间的方法以及装置 |
| CN106844081B (zh) * | 2017-01-11 | 2020-07-03 | 深圳软牛科技有限公司 | 一种智能修复iTunes故障的系统 |
| CN107122164B (zh) * | 2017-03-31 | 2023-04-07 | 腾讯科技(深圳)有限公司 | 函数地址获取及应用其的方法、装置、设备及存储介质 |
| CN108920220B (zh) * | 2018-06-06 | 2021-11-30 | 北京奇虎科技有限公司 | 一种函数调用的方法、装置及终端 |
| CN112214757B (zh) * | 2020-07-23 | 2022-08-02 | 国家工业信息安全发展研究中心 | 基于windows驱动技术的终端注册表安全防护方法及系统 |
Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101151617A (zh) * | 2005-04-07 | 2008-03-26 | 皇家飞利浦电子股份有限公司 | 软件保护 |
| US20080127344A1 (en) * | 2006-11-08 | 2008-05-29 | Mcafee, Inc. | Method and system for detecting windows rootkit that modifies the kernel mode system service dispatch table |
| US20090083855A1 (en) * | 2002-01-25 | 2009-03-26 | Frank Apap | System and methods for detecting intrusions in a computer system by monitoring operating system registry accesses |
Family Cites Families (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101414341B (zh) * | 2007-10-15 | 2014-12-10 | 北京瑞星信息技术有限公司 | 一种软件自我保护的方法 |
-
2011
- 2011-05-11 CN CN201110121178.8A patent/CN102779030B/zh active Active
-
2012
- 2012-05-07 WO PCT/CN2012/075155 patent/WO2012152212A1/zh not_active Ceased
Patent Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20090083855A1 (en) * | 2002-01-25 | 2009-03-26 | Frank Apap | System and methods for detecting intrusions in a computer system by monitoring operating system registry accesses |
| CN101151617A (zh) * | 2005-04-07 | 2008-03-26 | 皇家飞利浦电子股份有限公司 | 软件保护 |
| US20080127344A1 (en) * | 2006-11-08 | 2008-05-29 | Mcafee, Inc. | Method and system for detecting windows rootkit that modifies the kernel mode system service dispatch table |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US11663333B2 (en) | 2020-08-11 | 2023-05-30 | Beijing Didi Infinity Technology And Development Co., Ltd. | Cloud-based systems and methods for detecting and removing rootkit |
Also Published As
| Publication number | Publication date |
|---|---|
| CN102779030A (zh) | 2012-11-14 |
| CN102779030B (zh) | 2015-08-19 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| EP3915037B1 (en) | Peripheral device comportability with security circuitry | |
| US10616194B2 (en) | Secure data destruction in a distributed environment using key protection mechanisms | |
| CN102779030B (zh) | 一种注册表操作的执行方法及装置 | |
| Portokalidis et al. | Paranoid android: versatile protection for smartphones | |
| CN102902909B (zh) | 一种防止文件被篡改的系统和方法 | |
| AU2009200459B2 (en) | Systems and Methods for the Prevention Of Unauthorized Use and Manipulation of Digital Content Related Applications | |
| CN100489728C (zh) | 一种建立计算机中可信任运行环境的方法 | |
| CN103679031B (zh) | 一种文件病毒免疫的方法和装置 | |
| US9680808B2 (en) | Preventing persistent storage of cryptographic information using signaling | |
| CN111782416B (zh) | 数据上报方法、装置、系统、终端及计算机可读存储介质 | |
| JP5346608B2 (ja) | 情報処理装置およびファイル検証システム | |
| CN110334512B (zh) | 基于双体系架构的可信计算平台的静态度量方法和装置 | |
| WO2012152210A1 (zh) | 一种文件操作的执行方法及装置 | |
| CN105631355A (zh) | 一种数据处理方法和装置 | |
| CN102930205A (zh) | 一种监测单元及方法 | |
| CN110334509B (zh) | 双体系架构的可信计算平台的构建方法和装置 | |
| CN104903863A (zh) | 用于虚拟环境的控制反转组件服务模型 | |
| CN102236764A (zh) | 用于Android系统的抵御桌面信息攻击的方法和监控系统 | |
| CN108647499A (zh) | 一种防拷贝校验码生成的方法、装置、设备和存储介质 | |
| CN103577237A (zh) | 应用程序启动的控制方法及装置 | |
| CN108334404A (zh) | 应用程序的运行方法和装置 | |
| EP3079057B1 (en) | Method and device for realizing virtual machine introspection | |
| JP7770418B2 (ja) | 読み取り専用メモリ(rom)のセキュリティ | |
| CN103856529B (zh) | 一种锁屏方法、装置及系统 | |
| CN103685259A (zh) | 账户登录的方法及其装置 |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 12781867 Country of ref document: EP Kind code of ref document: A1 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 12781867 Country of ref document: EP Kind code of ref document: A1 |