Detection rules › Elastic

Suspicious Windows Script Interpreter Child Process

Source
github.com/elastic/protections-artifacts

Identifies unusual windows script interpreter child process which could indicate code injection or other form of malicious code execution via Windows scripts.

MITRE ATT&CK coverage

Rule body

[rule]
description = """
Identifies unusual windows script interpreter child process which could indicate code injection or other form of
malicious code execution via Windows scripts.
"""
id = "83da4fac-563a-4af8-8f32-5a3797a9068e"
license = "Elastic License v2"
name = "Suspicious Windows Script Interpreter Child Process"
os_list = ["windows"]
reference = ["https://www.elastic.co/security-labs/thawing-the-permafrost-of-icedid-summary"]
version = "1.0.41"

query = '''
process where event.type == "start" and
  process.parent.name : ("wscript.exe", "mshta.exe") and
  process.parent.args_count >= 2 and
  not process.Ext.token.integrity_level_name == "system" and
   (
    process.name : ("rundll32.exe", "odbcconf.exe") or

   (process.name : ("cmd.exe", "powershell.exe", "curl.exe") and process.parent.name : "mshta.exe") or

    /* suspicious or unusual paths */
    process.executable : ("?:\\Windows\\Microsoft.NET\\*",
                          "?:\\Users\\Public\\*",
                          "?:\\Windows\\Tasks\\*",
                          "?:\\Windows\\System32\\Tasks\\*") or

     /* potential hollowed trusted system process with no arguments */
    (process.args_count == 1 and
     process.executable : ("?:\\Windows\\System32\\*.exe", "?:\\Windows\\SysWOW64\\*.exe") and
     process.code_signature.trusted == true and process.code_signature.subject_name : "Microsoft *" and
     not process.name : ("conhost.exe", "gpupdate.exe", "logoff.exe", "HOSTNAME.EXE"))
     ) and
     not (process.parent.name : "mshta.exe" and process.parent.args : "?:\\Program Files\\HP\\*\\HPSolutionsPortal.hta") and
     not (process.name : "regsvr32.exe" and process.parent.name : "wscript.exe" and process.parent.command_line : ("*LiteTouch.wsf*", "*LTICleanup.wsf*")) and
     not (process.pe.original_file_name == "acslaunch" and process.executable : "?:\\Users\\Public\\IBM\\*.exe") and
     not (process.name : ("rundll32.exe", "regsvr32.exe") and
          process.args : ("?:\\Program Files\\*", "?:\\Program Files (x86)\\*", "ndfapi.dll,NdfRunDllDiagnoseWithAnswerFile", "?:\\Windows\\sysWOW64\\*.ocx")) and
     not process.executable : ("?:\\WINDOWS\\Microsoft.NET\\Framework\\*\\caspol.exe", "?:\\Windows\\System32\\Vmw.exe") and
     not (process.name : "rundll32.exe" and process.args : "UpdatePerUserSystemParameters" and process.args : "user32.dll,") and
     not (process.executable : "?:\\Windows\\System32\\Vmw.exe" and process.parent.args : "kms_host.vbs") and
     not (process.name : "regsvr32.exe" and process.args : "C:\\nondefault\\System\\*.exe" and process.args : "/u") and 
     not (process.name : ("rundll32.exe", "regsvr32.exe", "regasm.exe") and process.args : ("?:\\Program Files\\*", "?:\\Program Files (x86)\\*")) and
     not process.executable : ("?:\\WINDOWS\\Microsoft.NET\\Framework\\*\\caspol.exe", "?:\\Windows\\System32\\Vmw.exe") and
     not (process.name : "rundll32.exe" and
          process.args : ("printui.dll,PrintUIEntry", "user32.dll,UpdatePerUserSystemParameters", "dfshim.dll,ShArpMaintain")) and
     not (process.name : "regsvr32.exe" and process.args : ("?:\\Windows\\sysWOW64\\*.ocx", "?:\\EQ\\System\\QXLAddInDialogs.exe")) and
     not (process.code_signature.subject_name : "Dassault Systemes SolidWorks Corp." and process.code_signature.trusted == true) and
     not (process.parent.name : "cscript.exe" and
          process.parent.args : "?:\\Windows\\Options\\SWD\\MapHomeDrive_*.vbs" and process.name : "mshta.exe") and
     not (process.name : "rundll32.exe" and process.parent.args : "?:\\Program Files (x86)\\PCMatic\\PC Matic\\registerActiveX.wsf") and
     not process.command_line : "mshta.exe" and
     not (process.name : "wscript.exe" and process.args : "\\\\*\\netlogon\\*.vbe") and
     not (process.name : "rundll32.exe" and process.args: "C:\\ProgramData\\FastTrack Software\\Admin By Request\\ShellHelper32.dll,#1") and
     not (process.name: ("cmd.exe", "regsvr32.exe") and process.parent.executable : "C:\\Windows\\SysWOW64\\mshta.exe") and
     not (process.executable : "?:\\Windows\\System32\\odbcconf.exe" and process.args : "configdsn") and
     not process.hash.sha256 in ("13eacb4b57ac207f7f5c118915359a6e66a7f52f7154f8bb577f54b48b0d5e68", "6e0cb7d79cfc0b51468904701ff5227270180b9c8ff79d181000049ce991fc5a") and
     not (process.parent.name : "mshta.exe" and
          process.executable : ("C:\\Windows\\SysWOW64\\cmd.exe", "C:\\Windows\\SysWOW64\\WindowsPowerShell\\v1.0\\powershell.exe") and
          process.working_directory : ("C:\\Users\\*\\AppData\\Roaming\\DriverPack Notifier\\bin\\", "\\\\*")) and
     not (process.parent.executable : "C:\\Windows\\SysWOW64\\mshta.exe" and process.name : "rundll32.exe" and process.args == "dsquery.dll,OpenQueryWindow") and
     not (process.name : "cmd.exe" and process.command_line : "\"C:\\Windows\\System32\\cmd.exe   /C mklink /D *")
'''

min_endpoint_version = "7.15.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.005"
name = "Visual Basic"
reference = "https://attack.mitre.org/techniques/T1059/005/"

[[threat.technique.subtechnique]]
id = "T1059.007"
name = "JavaScript"
reference = "https://attack.mitre.org/techniques/T1059/007/"



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


[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"

[internal]
min_endpoint_version = "7.15.0"

Stages and Predicates

Stage 1: process

process where event.type == "start" and
  process.parent.name : ("wscript.exe", "mshta.exe") and
  process.parent.args_count >= 2 and
  not process.Ext.token.integrity_level_name == "system" and
   (
    process.name : ("rundll32.exe", "odbcconf.exe") or
   (process.name : ("cmd.exe", "powershell.exe", "curl.exe") and process.parent.name : "mshta.exe") or
    process.executable : ("?:\\Windows\\Microsoft.NET\\*",
                          "?:\\Users\\Public\\*",
                          "?:\\Windows\\Tasks\\*",
                          "?:\\Windows\\System32\\Tasks\\*") or
    (process.args_count == 1 and
     process.executable : ("?:\\Windows\\System32\\*.exe", "?:\\Windows\\SysWOW64\\*.exe") and
     process.code_signature.trusted == true and process.code_signature.subject_name : "Microsoft *" and
     not process.name : ("conhost.exe", "gpupdate.exe", "logoff.exe", "HOSTNAME.EXE"))
     ) and
     not (process.parent.name : "mshta.exe" and process.parent.args : "?:\\Program Files\\HP\\*\\HPSolutionsPortal.hta") and
     not (process.name : "regsvr32.exe" and process.parent.name : "wscript.exe" and process.parent.command_line : ("*LiteTouch.wsf*", "*LTICleanup.wsf*")) and
     not (process.pe.original_file_name == "acslaunch" and process.executable : "?:\\Users\\Public\\IBM\\*.exe") and
     not (process.name : ("rundll32.exe", "regsvr32.exe") and
          process.args : ("?:\\Program Files\\*", "?:\\Program Files (x86)\\*", "ndfapi.dll,NdfRunDllDiagnoseWithAnswerFile", "?:\\Windows\\sysWOW64\\*.ocx")) and
     not process.executable : ("?:\\WINDOWS\\Microsoft.NET\\Framework\\*\\caspol.exe", "?:\\Windows\\System32\\Vmw.exe") and
     not (process.name : "rundll32.exe" and process.args : "UpdatePerUserSystemParameters" and process.args : "user32.dll,") and
     not (process.executable : "?:\\Windows\\System32\\Vmw.exe" and process.parent.args : "kms_host.vbs") and
     not (process.name : "regsvr32.exe" and process.args : "C:\\nondefault\\System\\*.exe" and process.args : "/u") and
     not (process.name : ("rundll32.exe", "regsvr32.exe", "regasm.exe") and process.args : ("?:\\Program Files\\*", "?:\\Program Files (x86)\\*")) and
     not process.executable : ("?:\\WINDOWS\\Microsoft.NET\\Framework\\*\\caspol.exe", "?:\\Windows\\System32\\Vmw.exe") and
     not (process.name : "rundll32.exe" and
          process.args : ("printui.dll,PrintUIEntry", "user32.dll,UpdatePerUserSystemParameters", "dfshim.dll,ShArpMaintain")) and
     not (process.name : "regsvr32.exe" and process.args : ("?:\\Windows\\sysWOW64\\*.ocx", "?:\\EQ\\System\\QXLAddInDialogs.exe")) and
     not (process.code_signature.subject_name : "Dassault Systemes SolidWorks Corp." and process.code_signature.trusted == true) and
     not (process.parent.name : "cscript.exe" and
          process.parent.args : "?:\\Windows\\Options\\SWD\\MapHomeDrive_*.vbs" and process.name : "mshta.exe") and
     not (process.name : "rundll32.exe" and process.parent.args : "?:\\Program Files (x86)\\PCMatic\\PC Matic\\registerActiveX.wsf") and
     not process.command_line : "mshta.exe" and
     not (process.name : "wscript.exe" and process.args : "\\\\*\\netlogon\\*.vbe") and
     not (process.name : "rundll32.exe" and process.args: "C:\\ProgramData\\FastTrack Software\\Admin By Request\\ShellHelper32.dll,#1") and
     not (process.name: ("cmd.exe", "regsvr32.exe") and process.parent.executable : "C:\\Windows\\SysWOW64\\mshta.exe") and
     not (process.executable : "?:\\Windows\\System32\\odbcconf.exe" and process.args : "configdsn") and
     not process.hash.sha256 in ("13eacb4b57ac207f7f5c118915359a6e66a7f52f7154f8bb577f54b48b0d5e68", "6e0cb7d79cfc0b51468904701ff5227270180b9c8ff79d181000049ce991fc5a") and
     not (process.parent.name : "mshta.exe" and
          process.executable : ("C:\\Windows\\SysWOW64\\cmd.exe", "C:\\Windows\\SysWOW64\\WindowsPowerShell\\v1.0\\powershell.exe") and
          process.working_directory : ("C:\\Users\\*\\AppData\\Roaming\\DriverPack Notifier\\bin\\", "\\\\*")) and
     not (process.parent.executable : "C:\\Windows\\SysWOW64\\mshta.exe" and process.name : "rundll32.exe" and process.args == "dsquery.dll,OpenQueryWindow") and
     not (process.name : "cmd.exe" and process.command_line : "\"C:\\Windows\\System32\\cmd.exe   /C mklink /D *")

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.argseq/uexcludes:process.args field:"process.args" value:"/u"
process.argswildcardC:\nondefault\System\*.exeexcludes:process.args field:"process.args" value:"C:\nondefault\System\*.exe"
process.nameeqregsvr32.exeexcludes:process.name field:"process.name" value:"regsvr32.exe"
process.argseqC:\ProgramData\FastTrack Software\Admin By Request\ShellHelper32.dll,#1excludes:process.args field:"process.args" value:"C:\ProgramData\FastTrack Software\Admin By Request\ShellHelper32.dll,#1"
process.nameeqrundll32.exeexcludes:process.name field:"process.name" value:"rundll32.exe"
process.argseqUpdatePerUserSystemParametersexcludes:process.args field:"process.args" value:"UpdatePerUserSystemParameters"
process.argsequser32.dll,excludes:process.args field:"process.args" value:"user32.dll,"
process.argseqconfigdsnexcludes:process.args field:"process.args" value:"configdsn"
process.executableeq?:\Windows\System32\odbcconf.exeexcludes:process.executable field:"process.executable" value:"?:\Windows\System32\odbcconf.exe"
process.argseqdsquery.dll,OpenQueryWindowexcludes:process.args field:"process.args" value:"dsquery.dll,OpenQueryWindow"
process.parent.executableeqC:\Windows\SysWOW64\mshta.exeexcludes:process.parent.executable field:"process.parent.executable" value:"C:\Windows\SysWOW64\mshta.exe"
process.argseqprintui.dll,PrintUIEntry, user32.dll,UpdatePerUserSystemParameters, dfshim.dll,ShArpMaintainexcludes:process.args field:"process.args" value:"printui.dll,PrintUIEntry" field:"process.args" value:"user32.dll,UpdatePerUserSystemParameters" field:"process.args" value:"dfshim.dll,ShArpMaintain"
process.argsstarts_with?:\Program Files\, ?:\Program Files (x86)\excludes:process.args field:"process.args" value:"?:\Program Files\" field:"process.args" value:"?:\Program Files (x86)\"
process.nameeqrundll32.exe, regsvr32.exe, regasm.exeexcludes:process.name field:"process.name" value:"rundll32.exe" field:"process.name" value:"regsvr32.exe" field:"process.name" value:"regasm.exe"
process.argswildcard?:\Program Files\*, ?:\Program Files (x86)\*, ndfapi.dll,NdfRunDllDiagnoseWithAnswerFile, ?:\Windows\sysWOW64\*.ocxexcludes:process.args
process.nameeqrundll32.exe, regsvr32.exeexcludes:process.name field:"process.name" value:"rundll32.exe" field:"process.name" value:"regsvr32.exe"
process.argswildcard?:\Windows\sysWOW64\*.ocx, ?:\EQ\System\QXLAddInDialogs.exeexcludes:process.args field:"process.args" value:"?:\Windows\sysWOW64\*.ocx" field:"process.args" value:"?:\EQ\System\QXLAddInDialogs.exe"
process.argswildcard\\*\netlogon\*.vbeexcludes:process.args field:"process.args" value:"\\*\netlogon\*.vbe"
process.nameeqwscript.exeexcludes:process.name field:"process.name" value:"wscript.exe"
process.code_signature.subject_nameeqDassault Systemes SolidWorks Corp.excludes:process.code_signature.subject_name field:"process.code_signature.subject_name" value:"Dassault Systemes SolidWorks Corp."
process.code_signature.trustedeqtrueexcludes:process.code_signature.trusted field:"process.code_signature.trusted" value:"true"
process.command_linestarts_with"C:\Windows\System32\cmd.exe /C mklink /D excludes:process.command_line
process.nameeqcmd.exeexcludes:process.name field:"process.name" value:"cmd.exe"
process.executableeq?:\Windows\System32\Vmw.exeexcludes:process.executable field:"process.executable" value:"?:\Windows\System32\Vmw.exe"
process.parent.argseqkms_host.vbsexcludes:process.parent.args field:"process.parent.args" value:"kms_host.vbs"
process.executableeqC:\Windows\SysWOW64\cmd.exe, C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exeexcludes:process.executable field:"process.executable" value:"C:\Windows\SysWOW64\cmd.exe" field:"process.executable" value:"C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe"
process.parent.nameeqmshta.exeexcludes:process.parent.name field:"process.parent.name" value:"mshta.exe"
process.working_directorywildcardC:\Users\*\AppData\Roaming\DriverPack Notifier\bin\, \\*excludes:process.working_directory field:"process.working_directory" value:"C:\Users\*\AppData\Roaming\DriverPack Notifier\bin\" field:"process.working_directory" value:"\\*"
process.executablewildcard?:\Users\Public\IBM\*.exeexcludes:process.executable field:"process.executable" value:"?:\Users\Public\IBM\*.exe"
process.pe.original_file_nameeqacslaunchexcludes:process.pe.original_file_name field:"process.pe.original_file_name" value:"acslaunch"
process.nameeqcmd.exe, regsvr32.exeexcludes:process.name field:"process.name" value:"cmd.exe" field:"process.name" value:"regsvr32.exe"
process.nameeqmshta.exeexcludes:process.name field:"process.name" value:"mshta.exe"
process.parent.argswildcard?:\Windows\Options\SWD\MapHomeDrive_*.vbsexcludes:process.parent.args field:"process.parent.args" value:"?:\Windows\Options\SWD\MapHomeDrive_*.vbs"
process.parent.nameeqcscript.exeexcludes:process.parent.name field:"process.parent.name" value:"cscript.exe"
process.parent.command_linematchLiteTouch.wsf, LTICleanup.wsfexcludes:process.parent.command_line field:"process.parent.command_line" value:"LiteTouch.wsf" field:"process.parent.command_line" value:"LTICleanup.wsf"
process.parent.nameeqwscript.exeexcludes:process.parent.name field:"process.parent.name" value:"wscript.exe"
process.parent.argseq?:\Program Files (x86)\PCMatic\PC Matic\registerActiveX.wsfexcludes:process.parent.args field:"process.parent.args" value:"?:\Program Files (x86)\PCMatic\PC Matic\registerActiveX.wsf"
process.parent.argswildcard?:\Program Files\HP\*\HPSolutionsPortal.htaexcludes:process.parent.args field:"process.parent.args" value:"?:\Program Files\HP\*\HPSolutionsPortal.hta"
process.Ext.token.integrity_level_nameeqsystemexcludes:process.Ext.token.integrity_level_name field:"process.Ext.token.integrity_level_name" value:"system"
process.command_lineeqmshta.exeexcludes:process.command_line field:"process.command_line" value:"mshta.exe"
process.executablewildcard?:\WINDOWS\Microsoft.NET\Framework\*\caspol.exe, ?:\Windows\System32\Vmw.exeexcludes:process.executable field:"process.executable" value:"?:\WINDOWS\Microsoft.NET\Framework\*\caspol.exe" field:"process.executable" value:"?:\Windows\System32\Vmw.exe"
process.hash.sha256in13eacb4b57ac207f7f5c118915359a6e66a7f52f7154f8bb577f54b48b0d5e68, 6e0cb7d79cfc0b51468904701ff5227270180b9c8ff79d181000049ce991fc5aexcludes:process.hash.sha256 field:"process.hash.sha256" value:"13eacb4b57ac207f7f5c118915359a6e66a7f52f7154f8bb577f54b48b0d5e68" field:"process.hash.sha256" value:"6e0cb7d79cfc0b51468904701ff5227270180b9c8ff79d181000049ce991fc5a"

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.typeeq
  • start corpus 1078 (elastic 1078)
field:"event.type" kind:eq value:"start"
process.args_counteq
  • 1 transforms: number corpus 49 (elastic 49)
field:"process.args_count" kind:eq value:"1"
process.code_signature.subject_namewildcard
  • Microsoft * corpus 10 (elastic 10)
field:"Signature" kind:wildcard value:"Microsoft *"
process.code_signature.trustedeq
  • true transforms: boolean corpus 14 (elastic 14)
field:"process.code_signature.trusted" kind:eq value:"true"
process.executablewildcard
  • ?:\Users\Public\* corpus 4 (elastic 4)
  • ?:\Windows\Microsoft.NET\* corpus 5 (elastic 5)
  • ?:\Windows\SysWOW64\*.exe corpus 6 (elastic 6)
  • ?:\Windows\System32\*.exe corpus 5 (elastic 5)
  • ?:\Windows\System32\Tasks\* corpus 2 (elastic 2)
  • ?:\Windows\Tasks\* corpus 7 (elastic 7)
field:"Image" kind:wildcard
process.namewildcard
  • cmd.exe corpus 121 (elastic 92, splunk 29)
  • curl.exe corpus 34 (elastic 31, splunk 3)
  • odbcconf.exe corpus 14 (elastic 11, splunk 3)
  • powershell.exe corpus 184 (elastic 140, splunk 44)
  • rundll32.exe corpus 126 (elastic 100, splunk 26)
field:"process_name" kind:wildcard
process.parent.args_countge
  • 2 transforms: number corpus 4 (elastic 4)
field:"process.parent.args_count" kind:ge value:"2"
process.parent.namewildcard
  • mshta.exe corpus 24 (elastic 22, splunk 2)
  • wscript.exe corpus 24 (elastic 23, splunk 1)
field:"parent_process_name" kind:wildcard