Input Capture: Credential API Hooking

Adversaries may hook into Windows application programming interface (API) functions and Linux system functions to collect user credentials. Malicious hooking mechanisms may capture API or function 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.

In Windows, 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]

In Linux and macOS, adversaries may hook into system functions via the LD_PRELOAD (Linux) or DYLD_INSERT_LIBRARIES (macOS) environment variables, which enables loading shared libraries into a program’s address space. For example, an adversary may capture credentials by hooking into the libc read function leveraged by SSH or SCP.[7]

ID: T1056.004
Sub-technique of:  T1056
Platforms: Linux, Windows, macOS
Version: 1.2
Created: 11 February 2020
Last Modified: 24 October 2025

Procedure Examples

ID Name Description
S0484 Carberp

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

S0363 Empire

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

S0182 FinFisher

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

S0353 NOKKI

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

G0068 PLATINUM

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

S0416 RDFSNIFFER

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

S0266 TrickBot

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

S0386 Ursnif

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

S1154 VersaMem

VersaMem hooked and overrided Versa's built-in authentication method, setUserPassword, to intercept plaintext credentials when submitted to the server.[16]

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

S0330 Zeus Panda

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

S0412 ZxShell

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

Mitigations

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

Detection Strategy

ID Name Analytic ID Analytic Description
DET0139 Detection of Credential Harvesting via API Hooking AN0389

Detects credential harvesting via userland API hooking (e.g., SetWindowsHookEx, IAT, or inline patching) by correlating memory modifications with hook installation functions and suspicious module loads in credential-sensitive processes like lsass.exe, explorer.exe, or winlogon.exe.

AN0390

Detects credential interception via malicious LD_PRELOAD-based shared libraries loaded into ssh, sudo, or scp processes. Correlates environment variable injection, unexpected library loads, and memory patching behavior.

AN0391

Detects DYLD_INSERT_LIBRARIES abuse to hook credential-sensitive applications by correlating process spawns with unauthorized library injection and monitoring changes to the __TEXT segment (code) of credential handling binaries.

References