Input Capture: Credential API Hooking

Adversaries may hook into Windows application programming interface (API) functions to collect user credentials. Malicious hooking mechanisms may capture API calls that include parameters that reveal user authentication credentials.[1] Unlike Keylogging, this technique focuses specifically on API functions that include parameters that reveal user credentials. Hooking involves redirecting calls to these functions and can be implemented via:

  • Hooks procedures, which intercept and execute designated code in response to events such as messages, keystrokes, and mouse inputs.[2][3]
  • Import address table (IAT) hooking, which use modifications to a process’s IAT, where pointers to imported API functions are stored.[3][4][5]
  • Inline hooking, which overwrites the first bytes in an API function to redirect code flow.[3][6][5]
ID: T1056.004
Sub-technique of:  T1056
Platforms: Windows
Permissions Required: Administrator, SYSTEM
Version: 1.0
Created: 11 February 2020
Last Modified: 10 November 2020

Procedure Examples

ID Name Description
S0484 Carberp

Carberp has hooked several Windows API functions to steal credentials.[7]

S0363 Empire

Empire contains some modules that leverage API hooking to carry out tasks, such as netripper.[8]

S0182 FinFisher

FinFisher hooks processes by modifying IAT pointers to CreateWindowEx.[9][3]

S0353 NOKKI

NOKKI uses the Windows call SetWindowsHookEx and begins injecting it into every GUI process running on the victim's machine.[10]

G0068 PLATINUM

PLATINUM is capable of using Windows hook interfaces for information gathering such as credential access.[11]

S0416 RDFSNIFFER

RDFSNIFFER hooks several Win32 API functions to hijack elements of the remote system management user-interface.[12]

S0266 TrickBot

TrickBot has the ability to capture RDP credentials by capturing the CredEnumerateA API[13]

S0386 Ursnif

Ursnif has hooked APIs to perform a wide variety of information theft, such as monitoring traffic from browsers.[14]

S0251 Zebrocy

Zebrocy installs an application-defined Windows hook to get notified when a network drive has been attached, so it can then use the hook to call its RecordToFile file stealing method.[15]

S0330 Zeus Panda

Zeus Panda hooks processes by leveraging its own IAT hooked functions.[16]

S0412 ZxShell

ZxShell hooks several API functions to spawn system threads.[17]

Mitigations

This type of attack technique cannot be easily mitigated with preventive controls since it is based on the abuse of system features.

Detection

ID Data Source Data Component Detects
DS0009 Process OS API Execution

Monitor for API calls to the SetWindowsHookEx and SetWinEventHook functions, which install a hook procedure.[2][18] Also consider analyzing hook chains (which hold pointers to hook procedures for each type of hook) using tools[18][19][20] or by programmatically examining internal kernel structures.[21][22]

Process Metadata

Verify integrity of live processes by comparing code in memory to that of corresponding static binaries, specifically checking for jumps and other instructions that redirect code flow.

References