Kernel-Mode APC Injection for Atomic User-Mode Hooking

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Anti-virus software operating in user-mode struggles to hook components in processes until they are loaded, allowing security exploits to evade detection, and advances in operating systems, such as 64-bit systems, hinder the ability to hook kernel-mode components, posing challenges in preventing cyber threats.

Innovation Solution

A kernel-mode component injects a user-mode component to atomically hook system library components, using asynchronous procedure calls (APCs) to modify instructions and allocate memory, enabling the kernel-mode component to hook user-mode processes and obtain information about memory allocations and system calls that cannot be directly accessed from kernel-mode.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If anti-virus software operates in user-mode to hook components, then it can detect security exploits, but it cannot hook components until processes are loaded, allowing exploits to evade detection

Engineering Contradiction:
Improvedetection capabilityVSAvoidhooking delay
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

The kernel-mode component performs preliminary actions by pre-allocating memory regions and pre-positioning hooking mechanisms before user-mode processes are loaded. This allows the anti-virus software to establish detection hooks at the kernel level prior to process execution, eliminating the timing delay that previously allowed exploits to evade detection.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

A kernel-mode component is introduced as an intermediary between the user-mode anti-virus software and the target processes. This intermediary enables the anti-virus software to hook components at the kernel level, bypassing the limitation of user-mode access and allowing detection to occur before processes are fully loaded.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Adaptability or versatility

If anti-virus software uses traditional hooking methods, then it can monitor process functions, but advances in operating systems such as 64-bit systems hinder the ability to hook kernel-mode components

Engineering Contradiction:
Improvecompatibility with 64-bit systemsVSAvoidhooking capability
Core Design Contradiction:
Adaptability or versatilityVSReliability

Solution Approach 1:

The system is segmented into distinct kernel-mode and user-mode components. The kernel-mode component handles the actual hooking of 64-bit system functions, while the user-mode component provides the anti-virus interface. This segmentation allows the solution to adapt to 64-bit operating systems while maintaining reliable hooking capability that would be impossible from user-mode alone.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The invention changes the operational parameters of the anti-virus software by moving critical hooking operations from user-mode to kernel-mode. This parameter change enables compatibility with 64-bit systems, as kernel-mode access provides the necessary privileges to hook 64-bit kernel functions that are inaccessible to user-mode processes.

Inventive Principle:
Principle #35Parameter changes

3Reliability

If thread suspension techniques are used to safely hook functions, then race conditions can be prevented, but the hooking process becomes more complex and time-consuming

Engineering Contradiction:
Improvehooking safetyVSAvoidhooking process complexity
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

Memory regions are pre-allocated and pre-configured with appropriate protection attributes before the actual hooking operation. This preliminary setup eliminates the need for complex runtime synchronization and thread suspension techniques, as the memory is already prepared to receive hook instructions without causing race conditions.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The invention replaces the mechanical approach of thread suspension and synchronization with a memory-based approach using kernel-mode memory allocation and protection attributes. This substitution eliminates the complexity of thread management while maintaining hooking safety, as the kernel can directly manipulate memory without requiring process thread coordination.

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

Data Source

PatentUS10025922B2User-mode component injection and atomic hooking
Publication Date: 2018.07.17 CROWDSTRIKE
  • US10025922B2 patent drawing
  • US10025922B2 patent drawing
  • US10025922B2 patent drawing

AI summary

Techniques are described herein for loading a user-mode component associated with a kernel-mode component based on an asynchronous procedure call (APC) built by the kernel-mode component. The APC is provided to the main thread of a user-mode process while that user-mode process loads, causing the user-mode process to load the user-mode component. The APC also causes allocation of memory at a location adjacent to that of the user-mode process and stores instructions at the allocated memory. The user-mode component then atomically hooks function(s) of the user-mode process, including modifying a single instruction or set of instructions of the function(s) to jump to the allocated memory. When that modified instruction is executed and jumps to the allocated memory, the instructions at the allocated memory request loading of the user-mode component, which receives data from the hooked function. The user-mode component then provides that data to the kernel-mode component.