Detection rules › Elastic

Suspicious Descendant Process Execution via Windows Run

Source
github.com/elastic/protections-artifacts

Identifies the execution of Windows commands via the Windows Run window. Adversaries may use phishing to instruct the victim to copy and paste malicious commands for execution via the Windows Run menu.

MITRE ATT&CK coverage

Rule body

[rule]
description = """
Identifies the execution of Windows commands via the Windows Run window. Adversaries may use phishing to instruct the
victim to copy and paste malicious commands for execution via the Windows Run menu.
"""
id = "9afd4fdc-15bc-4725-9164-dfcc2f1cb5ee"
license = "Elastic License v2"
name = "Suspicious Descendant Process Execution via Windows Run"
os_list = ["windows"]
reference = ["https://blog.sekoia.io/clickfake-interview-campaign-by-lazarus/"]
version = "1.0.4"

query = '''
process where event.action == "start" and
 process.name : ("powershell.exe", "curl.exe", "msiexec.exe", "mshta.exe", "wscript.exe", "rundll32.exe", "certutil.exe", "certreq.exe") and process.args_count >= 2 and
 descendant of [process where event.action == "start" and process.name : ("cmd.exe", "powershell.exe") and
                process.parent.name : "explorer.exe" and
                process.parent.thread.Ext.call_stack_summary like "*|user32.dll|shell32.dll|explorer.exe|shcore.dll|*" and
                _arraysearch(process.parent.thread.Ext.call_stack, $entry, 
                $entry.symbol_info like ("C:\\Windows\\System32\\user32.dll!DialogBoxParamW*", 
                                         "C:\\Windows\\System32\\user32.dll!DialogBoxIndirectParamW*", 
                                         "C:\\Windows\\System32\\shell32.dll!GetFileNameFromBrowse*"))] and
 not (process.name : "powershell.exe" and
      process.args :("-NoProfile", "-Command", "-ExecutionPolicy", "-noexit", "-WindowsStyle", "ls", "*-UseBasicParsing*", "-file", "--version", "*Get-WmiObjec*", "Port", "Test-Path", "Get-*")) and
 not (process.name : "curl.exe" and process.parent.name : ("cmd.exe", "bash.exe")) and
 not (process.name : "curl.exe" and process.args : ("-L", "-F", "POST")) and
 not (process.name : "certutil.exe" and not process.args : ("-urlcache", "-decode")) and
 not (process.name : "rundll32.exe" and process.parent.executable : ("C:\\Windows\\System32\\control.exe", "C:\\$WINDOWS.~BT\\Sources\\SetupHost.exe")) and
 not (process.name : "rundll32.exe" and
      process.command_line :("rundll32  printui.dll PrintUIEntry /im",
                             "rundll32.exe \"C:\\ProgramData\\FastTrack Software\\Admin By Request\\ShellHelper32.dll\",#1",
                             "rundll32.exe \"C:\\ProgramData\\FastTrack Software\\Admin By Request\\ShellHelper64.dll\",#1",
                             "rundll32  printui.dll PrintYUEntry /im")) and
 not (process.name : "rundll32.exe" and
      process.args : ("C:\\Windows\\system32\\inetcpl.cpl,ClearMyTracksByProcess", "url.dll,FileProtocolHandler", "ndfapi.dll,NdfRunDllDiagnoseWithAnswerFile", "inetcpl.cpl",
                      "C:\\Program Files\\Notepad++\\contextmenu\\NppShell.dll,CleanupDll", "user32.dll,*", "printui.dll", "keymgr.dll,*", "url,OpenURL")) and
 not (process.name : "wscript.exe" and process.parent.executable : "C:\\Program Files (x86)\\Beyond Compare ?\\BCompare.exe") and
 not (process.name : "wscript.exe" and process.args : ("*\\Program Files\\*", "C:\\Windows\\system32\\slmgr.vbs", "\\\\*")) and
 not (process.name : "msiexec.exe" and process.args : ("/log", "/passive", "/L*V", "WAZUH_AGENT_GROUP=default", "/x", "D:\\*.msi", "/a", "/uninstall", "/unregister", "/regserver", "USERDOMAIN*", "C:\\Windows\\Temp\\*", "/I{*", "TOKEN=*")) and 
 not process.working_directory : ("?:\\", "?:\\Program Files*", "C:\\Users\\*\\AppData\\Local\\Programs\\Microsoft VS Code\\") and 
 not process.executable : ("C:\\Program Files\\*\\curl.exe", "\\Device\\Mup\\*.exe") and
 not process.parent.executable :  ("\\Device\\Mup\\*.exe", "D:\\*.exe")
'''

min_endpoint_version = "8.10.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1566"
name = "Phishing"
reference = "https://attack.mitre.org/techniques/T1566/"


[threat.tactic]
id = "TA0001"
name = "Initial Access"
reference = "https://attack.mitre.org/tactics/TA0001/"
[[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.technique.subtechnique]]
id = "T1059.003"
name = "Windows Command Shell"
reference = "https://attack.mitre.org/techniques/T1059/003/"


[[threat.technique]]
id = "T1204"
name = "User Execution"
reference = "https://attack.mitre.org/techniques/T1204/"


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

[internal]
min_endpoint_version = "8.10.0"

Stages and Predicates

Stage 1: process

process where event.action == "start" and
 process.name : ("powershell.exe", "curl.exe", "msiexec.exe", "mshta.exe", "wscript.exe", "rundll32.exe", "certutil.exe", "certreq.exe") and process.args_count >= 2 and
 descendant of [process where event.action == "start" and process.name : ("cmd.exe", "powershell.exe") and
                process.parent.name : "explorer.exe" and
                process.parent.thread.Ext.call_stack_summary like "*|user32.dll|shell32.dll|explorer.exe|shcore.dll|*" and
                _arraysearch(process.parent.thread.Ext.call_stack, $entry, 
                $entry.symbol_info like ("C:\\Windows\\System32\\user32.dll!DialogBoxParamW*", 
                                         "C:\\Windows\\System32\\user32.dll!DialogBoxIndirectParamW*", 
                                         "C:\\Windows\\System32\\shell32.dll!GetFileNameFromBrowse*"))] and
 not (process.name : "powershell.exe" and
      process.args :("-NoProfile", "-Command", "-ExecutionPolicy", "-noexit", "-WindowsStyle", "ls", "*-UseBasicParsing*", "-file", "--version", "*Get-WmiObjec*", "Port", "Test-Path", "Get-*")) and
 not (process.name : "curl.exe" and process.parent.name : ("cmd.exe", "bash.exe")) and
 not (process.name : "curl.exe" and process.args : ("-L", "-F", "POST")) and
 not (process.name : "certutil.exe" and not process.args : ("-urlcache", "-decode")) and
 not (process.name : "rundll32.exe" and process.parent.executable : ("C:\\Windows\\System32\\control.exe", "C:\\$WINDOWS.~BT\\Sources\\SetupHost.exe")) and
 not (process.name : "rundll32.exe" and
      process.command_line :("rundll32  printui.dll PrintUIEntry /im",
                             "rundll32.exe \"C:\\ProgramData\\FastTrack Software\\Admin By Request\\ShellHelper32.dll\",#1",
                             "rundll32.exe \"C:\\ProgramData\\FastTrack Software\\Admin By Request\\ShellHelper64.dll\",#1",
                             "rundll32  printui.dll PrintYUEntry /im")) and
 not (process.name : "rundll32.exe" and
      process.args : ("C:\\Windows\\system32\\inetcpl.cpl,ClearMyTracksByProcess", "url.dll,FileProtocolHandler", "ndfapi.dll,NdfRunDllDiagnoseWithAnswerFile", "inetcpl.cpl",
                      "C:\\Program Files\\Notepad++\\contextmenu\\NppShell.dll,CleanupDll", "user32.dll,*", "printui.dll", "keymgr.dll,*", "url,OpenURL")) and
 not (process.name : "wscript.exe" and process.parent.executable : "C:\\Program Files (x86)\\Beyond Compare ?\\BCompare.exe") and
 not (process.name : "wscript.exe" and process.args : ("*\\Program Files\\*", "C:\\Windows\\system32\\slmgr.vbs", "\\\\*")) and
 not (process.name : "msiexec.exe" and process.args : ("/log", "/passive", "/L*V", "WAZUH_AGENT_GROUP=default", "/x", "D:\\*.msi", "/a", "/uninstall", "/unregister", "/regserver", "USERDOMAIN*", "C:\\Windows\\Temp\\*", "/I{*", "TOKEN=*")) and 
 not process.working_directory : ("?:\\", "?:\\Program Files*", "C:\\Users\\*\\AppData\\Local\\Programs\\Microsoft VS Code\\") and 
 not process.executable : ("C:\\Program Files\\*\\curl.exe", "\\Device\\Mup\\*.exe") and
 not process.parent.executable :  ("\\Device\\Mup\\*.exe", "D:\\*.exe")

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.argseq-urlcache, -decodeexcludes:process.args field:"process.args" value:"-urlcache" field:"process.args" value:"-decode"
process.nameeqcertutil.exeexcludes:process.name field:"process.name" value:"certutil.exe"
process.argseq-L, -F, POSTexcludes:process.args field:"process.args" value:"-L" field:"process.args" value:"-F" field:"process.args" value:"POST"
process.nameeqcurl.exeexcludes:process.name field:"process.name" value:"curl.exe"
process.argswildcard*\Program Files\*, C:\Windows\system32\slmgr.vbs, \\*excludes:process.args field:"process.args" value:"*\Program Files\*" field:"process.args" value:"C:\Windows\system32\slmgr.vbs" field:"process.args" value:"\\*"
process.nameeqwscript.exeexcludes:process.name field:"process.name" value:"wscript.exe"
process.argswildcard-NoProfile, -Command, -ExecutionPolicy, -noexit, -WindowsStyle, ls, *-UseBasicParsing*, -file, --version, *Get-WmiObjec*, Port, Test-Path, Get-*excludes:process.args
process.nameeqpowershell.exeexcludes:process.name field:"process.name" value:"powershell.exe"
process.argswildcard/log, /passive, /L*V, WAZUH_AGENT_GROUP=default, /x, D:\*.msi, /a, /uninstall, /unregister, /regserver, USERDOMAIN*, C:\Windows\Temp\*, /I{*, TOKEN=*excludes:process.args
process.nameeqmsiexec.exeexcludes:process.name field:"process.name" value:"msiexec.exe"
process.argswildcardC:\Windows\system32\inetcpl.cpl,ClearMyTracksByProcess, url.dll,FileProtocolHandler, ndfapi.dll,NdfRunDllDiagnoseWithAnswerFile, inetcpl.cpl, C:\Program Files\Notepad++\contextmenu\NppShell.dll,CleanupDll, user32.dll,*, printui.dll, keymgr.dll,*, url,OpenURLexcludes:process.args
process.nameeqrundll32.exeexcludes:process.name field:"process.name" value:"rundll32.exe"
process.command_lineeqrundll32 printui.dll PrintUIEntry /im, rundll32.exe "C:\ProgramData\FastTrack Software\Admin By Request\ShellHelper32.dll",#1, rundll32.exe "C:\ProgramData\FastTrack Software\Admin By Request\ShellHelper64.dll",#1, rundll32 printui.dll PrintYUEntry /imexcludes:process.command_line
process.parent.nameeqcmd.exe, bash.exeexcludes:process.parent.name field:"process.parent.name" value:"cmd.exe" field:"process.parent.name" value:"bash.exe"
process.parent.executableeqC:\Windows\System32\control.exe, C:\$WINDOWS.~BT\Sources\SetupHost.exeexcludes:process.parent.executable field:"process.parent.executable" value:"C:\Windows\System32\control.exe" field:"process.parent.executable" value:"C:\$WINDOWS.~BT\Sources\SetupHost.exe"
process.parent.executableeqC:\Program Files (x86)\Beyond Compare ?\BCompare.exeexcludes:process.parent.executable field:"process.parent.executable" value:"C:\Program Files (x86)\Beyond Compare ?\BCompare.exe"
process.executablewildcardC:\Program Files\*\curl.exe, \Device\Mup\*.exeexcludes:process.executable field:"process.executable" value:"C:\Program Files\*\curl.exe" field:"process.executable" value:"\Device\Mup\*.exe"
process.parent.executablewildcard\Device\Mup\*.exe, D:\*.exeexcludes:process.parent.executable field:"process.parent.executable" value:"\Device\Mup\*.exe" field:"process.parent.executable" value:"D:\*.exe"
process.working_directorywildcard?:\, ?:\Program Files*, C:\Users\*\AppData\Local\Programs\Microsoft VS Code\excludes:process.working_directory field:"process.working_directory" value:"?:\" field:"process.working_directory" value:"?:\Program Files*" field:"process.working_directory" value:"C:\Users\*\AppData\Local\Programs\Microsoft VS Code\"

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • start corpus 391 (elastic 391)
field:"EventType" kind:eq value:"start"
process.argswildcard
  • -decode corpus 2 (elastic 2)
  • -urlcache corpus 3 (elastic 3)
field:"process.args" kind:wildcard
process.args_countge
  • 2 transforms: number corpus 18 (elastic 18)
field:"process.args_count" kind:ge value:"2"
process.namewildcard
  • certreq.exe corpus 20 (elastic 20)
  • certutil.exe corpus 44 (elastic 38, splunk 6)
  • curl.exe corpus 34 (elastic 31, splunk 3)
  • mshta.exe corpus 84 (elastic 79, splunk 5)
  • msiexec.exe corpus 46 (elastic 41, splunk 5)
  • powershell.exe corpus 184 (elastic 140, splunk 44)
  • rundll32.exe corpus 126 (elastic 100, splunk 26)
  • wscript.exe corpus 83 (elastic 82, splunk 1)
field:"process_name" kind:wildcard