Detection rules › Elastic

PowerShell Script with Screen Capture Capability

Source
github.com/elastic/protections-artifacts

Detects PowerShell scripts that can take screenshots, which is a common feature in post-exploitation kits and remote access tools (RATs).

MITRE ATT&CK coverage

Rule body

[rule]
description = """
Detects PowerShell scripts that can take screenshots, which is a common feature in post-exploitation kits and remote
access tools (RATs).
"""
id = "b3f91726-0afa-43e5-a07b-da1c7fa35243"
license = "Elastic License v2"
name = "PowerShell Script with Screen Capture Capability"
os_list = ["windows"]
version = "1.0.9"

query = '''
api where process.Ext.api.name == "AmsiScanBuffer" and
 (process.name in~ ("powershell.exe") or process.Ext.api.parameters.app_name == "PowerShell") and
  process.Ext.api.parameters.buffer : "*.CopyFromScreen(*" and
  process.Ext.api.parameters.buffer : ("*System.Drawing*", "*Drawing.Graphics*") and
  not process.Ext.api.parameters.content_name : ("?:\\Program Files (x86)\\*", "?:\\Program Files\\*", "H:\\Scripts\\*") and
  not process.command_line : "*D:\\Teamboard_Backup\\Teamboard_*" and
  not process.parent.executable : ("C:\\Program Files\\Microsoft VS Code\\Code.exe",
                                   "C:\\Program Files\\RepairTech\\Syncro\\Syncro.Service.Runner.exe",
                                   "C:\\Program Files\\RepairTech\\Syncro\\Syncro.App.Runner.exe") and
  not process.Ext.api.parameters.buffer like "# WPF Color Picker with global Ctrl+LeftClick capture*"
'''

min_endpoint_version = "8.16.0"
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
tree = true

[[optional_actions]]
action = "rollback"
field = "process.entity_id"
state = 0

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[threat.technique.subtechnique]]
id = "T1059.001"
name = "PowerShell"
reference = "https://attack.mitre.org/techniques/T1059/001/"



[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1113"
name = "Screen Capture"
reference = "https://attack.mitre.org/techniques/T1113/"


[threat.tactic]
id = "TA0009"
name = "Collection"
reference = "https://attack.mitre.org/tactics/TA0009/"

[internal]
min_endpoint_version = "8.16.0"

Stages and Predicates

Stage 1: api

api where process.Ext.api.name == "AmsiScanBuffer" and
 (process.name in~ ("powershell.exe") or process.Ext.api.parameters.app_name == "PowerShell") and
  process.Ext.api.parameters.buffer : "*.CopyFromScreen(*" and
  process.Ext.api.parameters.buffer : ("*System.Drawing*", "*Drawing.Graphics*") and
  not process.Ext.api.parameters.content_name : ("?:\\Program Files (x86)\\*", "?:\\Program Files\\*", "H:\\Scripts\\*") and
  not process.command_line : "*D:\\Teamboard_Backup\\Teamboard_*" and
  not process.parent.executable : ("C:\\Program Files\\Microsoft VS Code\\Code.exe",
                                   "C:\\Program Files\\RepairTech\\Syncro\\Syncro.Service.Runner.exe",
                                   "C:\\Program Files\\RepairTech\\Syncro\\Syncro.App.Runner.exe") and
  not process.Ext.api.parameters.buffer like "# WPF Color Picker with global Ctrl+LeftClick capture*"

Exclusions

The rule actively suppresses these predicates.

Indicators

These rows show field, operator, and value matches.