Detect Input Capture in Splunk
Adversaries may use methods of capturing user input to obtain credentials or collect information. During normal system usage, users often provide credentials to various different locations, such as login pages/portals or system dialog boxes. Input capture mechanisms may be transparent to the user (e.g. Credential API Hooking) or rely on deceiving the user into providing input into what they believe to be a genuine service (e.g. Web Portal Capture). Common sub-techniques include keylogging via Windows hooks (SetWindowsHookEx), GUI input capture via credential dialog spoofing, web portal capture via fake login pages, and credential API hooking via DLL injection into authentication processes. Threat actors including APT42, Storm-1811, and APT39 have leveraged these techniques, as have malware families such as InvisibleFerret, Chaes, Kobalos, and NPPSPY.
MITRE ATT&CK
- Tactic
- Collection Credential Access
- Technique
- T1056 Input Capture
- Canonical reference
- https://attack.mitre.org/techniques/T1056/
SPL Detection Query
| union
[
search index=wineventlog sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=13
(TargetObject="*\\SYSTEM\\CurrentControlSet\\Control\\NetworkProvider\\Order*"
OR TargetObject="*\\SYSTEM\\CurrentControlSet\\Services\\*\\NetworkProvider*")
NOT (Image="*\\services.exe" OR Image="*\\svchost.exe" OR Image="*\\msiexec.exe" OR Image="*\\TrustedInstaller.exe")
| eval SignalType="NetworkProviderRegistration"
| eval Details=coalesce(Details, RegistryDetails)
| table _time, host, User, Image, TargetObject, Details, SignalType
],
[
search index=wineventlog sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=7
(Image="*\\winlogon.exe" OR Image="*\\lsass.exe" OR Image="*\\LogonUI.exe"
OR Image="*\\consent.exe" OR Image="*\\credui.exe")
NOT (ImageLoaded="C:\\Windows\\System32\\*" OR ImageLoaded="C:\\Windows\\SysWOW64\\*"
OR ImageLoaded="C:\\Program Files\\*" OR ImageLoaded="C:\\Program Files (x86)\\*")
| eval SignalType="SuspiciousDLLInCredentialProcess"
| table _time, host, User, Image, ImageLoaded, Hashes, SignalType
],
[
search index=wineventlog sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1
(CommandLine="*SetWindowsHookEx*" OR CommandLine="*GetAsyncKeyState*" OR CommandLine="*GetKeyState*"
OR CommandLine="*pyWinhook*" OR CommandLine="*WH_KEYBOARD_LL*" OR CommandLine="*WH_MOUSE_LL*"
OR CommandLine="*pynput*" OR CommandLine="*Get-Clipboard*"
OR Image="*keylog*" OR Image="*keycap*" OR Image="*inputcap*")
| eval SignalType="InputCaptureAPIOrTool"
| table _time, host, User, Image, CommandLine, ParentImage, ParentCommandLine, SignalType
],
[
search index=wineventlog sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=8
(TargetImage="*\\winlogon.exe" OR TargetImage="*\\LogonUI.exe"
OR TargetImage="*\\credui.exe" OR TargetImage="*\\consent.exe")
| eval SignalType="RemoteThreadInCredentialProcess"
| table _time, host, SourceImage, SourceCommandLine, TargetImage, StartFunction, SignalType
]
| eval SeverityScore=case(
SignalType="NetworkProviderRegistration", 90,
SignalType="RemoteThreadInCredentialProcess", 95,
SignalType="SuspiciousDLLInCredentialProcess", 85,
SignalType="InputCaptureAPIOrTool", 70,
true(), 50)
| sort - SeverityScore, - _time Multi-signal SPL detection for T1056 Input Capture using Sysmon telemetry. Covers four attack patterns via separate sub-searches united into a single result: (1) Sysmon Event ID 13 (Registry Value Set) detecting network provider DLL registration matching the NPPSPY credential interception technique; (2) Sysmon Event ID 7 (Image Load) detecting non-system DLLs loaded into Winlogon, LSASS, LogonUI, or credential UI processes; (3) Sysmon Event ID 1 (Process Create) detecting processes using known input capture APIs or keyboard hook patterns; (4) Sysmon Event ID 8 (CreateRemoteThread) detecting thread injection into credential management processes. Results include a SeverityScore to prioritize analyst triage.
Data Sources
Required Sourcetypes
False Positives & Tuning
- Legitimate accessibility software (screen readers, Dragon NaturallySpeaking) using SetWindowsHookEx for input monitoring
- Enterprise DLP or PAM agents (CyberArk, BeyondTrust) that load credential provider DLLs into Winlogon
- Third-party credential providers or SSO agents registered in NetworkProvider\Order during software installation
- Password managers with autofill functionality hooking input events in browser or application windows
- Remote administration tools (TeamViewer, AnyDesk) that capture keyboard/mouse for remote sessions
Other platforms for T1056
Testing Methodology
Validate this detection against 5 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.
- Test 1NPPSPY Network Provider Registration (Credential Interception Setup)
Expected signal: Sysmon Event ID 12 (RegistryKeyCreate): TargetObject containing HKLM\SYSTEM\CurrentControlSet\Services\TestNPP. Sysmon Event ID 13 (RegistryValueSet): TargetObject containing NetworkProvider\Order with Details showing 'TestNPP' appended to ProviderOrder. Security Event ID 4657 (Registry value modification) if object access auditing is enabled. MDE DeviceRegistryEvents with ActionType=RegistryKeyCreated and RegistryKeyCreated for both the service key and NetworkProvider\Order.
- Test 2Low-Level Keyboard Hook via PowerShell PInvoke (SetWindowsHookEx WH_KEYBOARD_LL)
Expected signal: Sysmon Event ID 1: Process Create with Image=powershell.exe, CommandLine containing 'SetWindowsHookEx', 'WH_KEYBOARD_LL' or value '13', and 'Add-Type'. PowerShell ScriptBlock Log Event ID 4104 with the full PInvoke code including SetWindowsHookEx. MDE DeviceProcessEvents with ProcessCommandLine matching SetWindowsHookEx pattern.
- Test 3Clipboard Monitoring Loop with File Exfiltration Simulation
Expected signal: Sysmon Event ID 1: Process Create with Image=powershell.exe, CommandLine containing 'Get-Clipboard', 'while', 'Start-Sleep', 'Add-Content', '-WindowStyle Hidden'. Sysmon Event ID 11 (File Create): cb_harvest.txt created in %TEMP%. MDE DeviceProcessEvents with ProcessCommandLine matching clipboard + loop pattern. MDE DeviceFileEvents showing file writes to TEMP directory.
- Test 4SSH Client Trojanization Simulation (Kobalos Pattern — Linux)
Expected signal: Auditd: file modification events on /usr/bin/ssh binary (syscall=rename or write). Syslog: file integrity monitoring alerts if AIDE/Tripwire/OSSEC is configured. If Linux auditd with file watches configured: SYSCALL records for rename/unlink on /usr/bin/ssh. Process execution telemetry showing /usr/bin/ssh spawning /tmp/ssh_real as child process. File creation event for /tmp/.ssh_capture.log.
- Test 5Python Keylogger via pynput (Cross-Platform)
Expected signal: Sysmon Event ID 1: Process Create for pip.exe (pynput installation) and python.exe (keylogger execution). CommandLine of python.exe containing 'pynput', 'keyboard', 'Listener', 'on_press'. Sysmon Event ID 7: Image loads for pynput DLL dependencies into python.exe. Network connection (Sysmon Event ID 3) from pip.exe to PyPI for package download during installation phase. MDE DeviceProcessEvents capturing both pip and python command lines.
References (14)
- https://attack.mitre.org/techniques/T1056/
- https://attack.mitre.org/techniques/T1056/001/
- https://attack.mitre.org/techniques/T1056/002/
- https://attack.mitre.org/techniques/T1056/003/
- https://attack.mitre.org/techniques/T1056/004/
- https://www.huntress.com/blog/credential-interception-via-nppspy
- https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setwindowshookexw
- https://www.welivesecurity.com/2021/01/26/kobalos-complex-linux-threat-high-performance-computing-infrastructure/
- https://unit42.paloaltonetworks.com/contagious-interview-beavertail-invisibleferret/
- https://www.sentinelone.com/labs/metador-technical-appendix/
- https://www.cybereason.com/blog/research/chaes-hunting-the-prey
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1056.001/T1056.001.md
- https://github.com/SigmaHQ/sigma/blob/master/rules/windows/registry/registry_set/registry_set_credentials_stealing_via_network_provider.yml
- http://opensecuritytraining.info/Keylogging_files/The%20Adventures%20of%20a%20Keystroke.pdf
Unlock Pro Content
Get the full detection package for T1056 including response playbook, investigation guide, and atomic red team tests.