Back to API Browser

user32.dll - SetWindowsHookEx

⚠️ High Risk📁 Windows Native Api🏷️ hooking✅ Verified
#windows-native-api#hooking#surveillance

🔧 API Details

Namespace

user32.dll

Language

C/C++ (P/Invoke)

Function

SetWindowsHookEx

📊 Risk Assessment

Severity

High

Prevalence

medium

Ease of Abuse

medium

Likelihood in Real Attacks

60%

🎯 MITRE ATT&CK Techniques

Abuse Scenarios

Keyboard/mouse monitoring

Technique: T1056.004

🚨 Common in Campaigns

Install WH_KEYBOARD_LL or WH_MOUSE_LL hook to capture user input

Code Example:

HHOOK hHook = SetWindowsHookEx(WH_KEYBOARD_LL, KeyboardProc, hModule, 0);
Detection Difficulty: Medium

Process manipulation

Technique: T1546.011

Install WH_GETMESSAGE hook to inject code into other processes

Code Example:

HHOOK hHook = SetWindowsHookEx(WH_GETMESSAGE, GetMsgProc, hModule, 0);
Detection Difficulty: Hard

🔍 Detection Strategies

Sysmon

MEDIUM Effectiveness

Monitor for SetWindowsHookEx calls from unusual processes

EDR

HIGH Effectiveness

Behavioral detection of hook installation and message interception

🛡️ Mitigation Strategies

code

MEDIUM Feasibility

Use modern input handling APIs instead of hooks

policy

MEDIUM Feasibility

Restrict SetWindowsHookEx via policy

🕵️ Threat Intelligence

👥 APT Groups / Threat Actors

APT28

ZooPark

🦠 Malware Families

Poison Ivy

RAT variants

🔨 Tools

Rootkits

📋 Metadata

API ID

9a0984a9-fa6c-4267-a73b-ed6e81024e57

Created

2026-02-02

Author

Claw