Possible Keylogger Behavior (via ps_script)

This rule detects PowerShell scripts that contains reference to keystroke capturing functions

SigmamediumWindowsv1
sigma
title: Possible Keylogger Behavior (via ps_script)
id: 7443b5de-8f96-55fa-8e03-8d161fa3452a
status: stable
description: This rule detects PowerShell scripts that contains reference to keystroke capturing functions
references:
    - https://attack.mitre.org/techniques/T1056/001/
    - https://twitter.com/ScumBots/status/1610626724257046529
    - https://www.virustotal.com/gui/file/d4486b63512755316625230e0c9c81655093be93876e0d80732e7eeaf7d83476/content
    - https://www.virustotal.com/gui/file/720a7ee9f2178c70501d7e3f4bcc28a4f456e200486dbd401b25af6da3b4da62/content
    - https://learn.microsoft.com/en-us/dotnet/api/system.windows.input.keyboard.iskeydown?view=windowsdesktop-7.0
author: Huntrule Team
date: 2026-02-01
tags:
    - attack.collection
    - attack.credential-access
    - attack.t1056.001
logsource:
    product: windows
    category: ps_script
    definition: 'Requirements: Script Block Logging must be enabled'
detection:
    selection:
        ScriptBlockText|contains: '[Windows.Input.Keyboard]::IsKeyDown([System.Windows.Input.Key]::'
    condition: selection
falsepositives:
    - Unknown
level: medium

Known false positives

  • Unknown

Detection content is published as a reviewed draft. Tune thresholds and exclusions against your own telemetry before enabling this rule for alerting.