Currently viewing ATT&CK v7.2 which was live between July 8, 2020 and October 26, 2020. Learn more about the versioning system or see the live site.
Register to stream the next session of ATT&CKcon Power Hour November 12

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
Tactics: Collection, Credential Access
Platforms: Windows
Permissions Required: Administrator, SYSTEM
Data Sources: API monitoring, Binary file metadata, DLL monitoring, Loaded DLLs, Process monitoring, Windows event logs
Version: 1.0
Created: 11 February 2020
Last Modified: 24 March 2020

Procedure Examples

Name Description
Empire

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

FinFisher

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

NOKKI

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

PLATINUM

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

RDFSNIFFER

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

TrickBot

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

Ursnif

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

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.[10]

Zeus Panda

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

ZxShell

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

Mitigations

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

Detection

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

Rootkits detectors[22] can also be used to monitor for various types of hooking activity.

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. Also consider taking snapshots of newly started processes[23] to compare the in-memory IAT to the real addresses of the referenced functions.[24][4]

References