Sigma rule: Powershell Keylogging
A detection rule from the SigmaHQ repository, shown as its author published it. Dataset version ref-3f80e8ffab0c, updated 2022-07-11T00:00:00.000Z.
Rule
- Title
- Powershell Keylogging
- Status
- test
- Level
- medium
- Author
- frack113
- Date
- 2021-07-30
- Modified
- 2022-07-11
- File
- rules/windows/powershell/powershell_script/posh_ps_keylogging.yml
- Commit
- ccbb0369507f796db0b0ae6854c8a2be471b9d84
Adversaries may log user keystrokes to intercept credentials as the user types them.
Log source
- product
- windows
- category
- ps_script
- definition
- Requirements: Script Block Logging must be enabled
Detection
selection_basic:
ScriptBlockText|contains: 'Get-Keystrokes'
selection_high: # want to run in background and keyboard
ScriptBlockText|contains|all:
- 'Get-ProcAddress user32.dll GetAsyncKeyState'
- 'Get-ProcAddress user32.dll GetForegroundWindow'
condition: 1 of selection_*False positives (as the rule lists them)
- Unknown
Tags
- attack.credential-access
- attack.collection
- attack.t1056.001
MITRE ATT&CK ids this rule names
References
- https://github.com/redcanaryco/atomic-red-team/blob/f339e7da7d05f6057fdfcdd3742bfcf365fee2a9/atomics/T1218/T1218.md
- https://github.com/redcanaryco/atomic-red-team/blob/f339e7da7d05f6057fdfcdd3742bfcf365fee2a9/atomics/T1056.001/src/Get-Keystrokes.ps1
Read on 2026-11-03T00:58:21.399Z under licence sigma-drl-1.1@d5f4c36a from https://github.com/SigmaHQ/sigma/blob/ccbb0369507f796db0b0ae6854c8a2be471b9d84/rules/windows/powershell/powershell_script/posh_ps_keylogging.yml
Sources and licences
SigmaHQ
"Powershell Keylogging" by frack113 (SigmaHQ). Rule: https://github.com/SigmaHQ/sigma/blob/ccbb0369507f796db0b0ae6854c8a2be471b9d84/rules/windows/powershell/powershell_script/posh_ps_keylogging.yml.
Licensed under the Detection Rule License (DRL) 1.1: https://github.com/SigmaHQ/Detection-Rule-License
Cite this page
Dragons Eye Ransomware Tracker, "Sigma rule: Powershell Keylogging",
entity page, dataset version ref-3f80e8ffab0c, updated 2022-07-11T00:00:00.000Z,
https://ransomware-tracker.com/detections/sigma/34f90d3c-c297-49e9-b26d-911b05a4866c (accessed 2026-11-03).
Underlying source: SigmaHQ rule 34f90d3c-c297-49e9-b26d-911b05a4866c, commit ccbb0369507f796db0b0ae6854c8a2be471b9d84.
Pages change. The dataset version identifies the data, but no archive of old versions is kept, so this citation cannot be replayed later.