Powershell Keylogging
Adversaries may log user keystrokes to intercept credentials as the user types them.
Sigma rule (View on GitHub)
1title: Powershell Keylogging
2id: 34f90d3c-c297-49e9-b26d-911b05a4866c
3status: test
4description: Adversaries may log user keystrokes to intercept credentials as the user types them.
5references:
6 - https://github.com/redcanaryco/atomic-red-team/blob/f339e7da7d05f6057fdfcdd3742bfcf365fee2a9/atomics/T1218/T1218.md
7 - https://github.com/redcanaryco/atomic-red-team/blob/f339e7da7d05f6057fdfcdd3742bfcf365fee2a9/atomics/T1056.001/src/Get-Keystrokes.ps1
8author: frack113
9date: 2021-07-30
10modified: 2022-07-11
11tags:
12 - attack.credential-access
13 - attack.collection
14 - attack.t1056.001
15logsource:
16 product: windows
17 category: ps_script
18 definition: 'Requirements: Script Block Logging must be enabled'
19detection:
20 selection_basic:
21 ScriptBlockText|contains: 'Get-Keystrokes'
22 selection_high: # want to run in background and keyboard
23 ScriptBlockText|contains|all:
24 - 'Get-ProcAddress user32.dll GetAsyncKeyState'
25 - 'Get-ProcAddress user32.dll GetForegroundWindow'
26 condition: 1 of selection_*
27falsepositives:
28 - Unknown
29level: medium
30regression_tests_path: regression_data/rules/windows/powershell/powershell_script/posh_ps_keylogging/info.yml
References
Related rules
- Linux Keylogging with Pam.d
- Potential Keylogger Activity
- Automated Collection Command Prompt
- CredUI.DLL Loaded By Uncommon Process
- Cisco BGP Authentication Failures