Detection rules › Elastic

Potential Obfuscated Script Execution

Time window
1m
Source
github.com/elastic/protections-artifacts

Detection involves spotting the generation of a file exhibiting high entropy, which is subsequently executed using frequently abused script interpreters. Adversaries may employ script obfuscation techniques to evade static detection methods.

MITRE ATT&CK coverage

Rule body

[rule]
description = """
Detection involves spotting the generation of a file exhibiting high entropy, which is subsequently executed using
frequently abused script interpreters. Adversaries may employ script obfuscation techniques to evade static detection
methods.
"""
id = "a279fa6c-61eb-49ea-926e-704db27855e8"
license = "Elastic License v2"
name = "Potential Obfuscated Script Execution"
os_list = ["windows"]
version = "1.0.12"

query = '''
sequence with maxspan=1m
 [file where event.action == "creation" and 
  not user.id : ("S-1-5-18", "S-1-5-19", "S-1-5-90") and 
  process.pid != 4 and 
  file.path : ("?:\\Users\\*", "?:\\ProgramData\\*", "?:\\Windows\\Temp\\*", "?:\\Windows\\Tasks\\*") and 
  file.Ext.entropy >= 6 and not file.Ext.header_bytes : "4d5a*" and
  not (process.name : "ifa-PM.exe" and file.name : "ifa-PMS.hta") and
  not (process.name : "Code.exe" and file.name : "aws-lsp-codewhisperer.js") and
  not (process.name : ("Setup.exe", "vrpsetup.exe") and
      file.Ext.header_bytes : ("53657420776d6953657276696365203d", "2720436865636b206c6963206265666f")) and
  not (process.code_signature.subject_name : ("BizLink International Corp.", "Adobe Inc.", "Fabrice PARISOT", "Notepad++", "Argus Media Ltd", "Imprivata, Inc.")
       and process.code_signature.trusted == true) and
  not process.executable : ("?:\\Program Files (x86)\\Kovai Ltd\\BizTalk360\\Service\\BHMCollect.exe",
                            "?:\\Program Files (x86)\\BizTalkHealthMonitor\\BHMCollect.exe",
                            "?:\\Program Files\\Common Files\\Voltage Security\\VSManager2.exe",
                            "?:\\Program Files (x86)\\UPS\\CrossWare\\CrossWare.exe",
                            "?:\\Program Files\\Automation Anywhere\\Bot Agent\\jre\\bin\\javaw.exe",
                            "?:\\Program Files\\ForeScout SecureConnector\\SecureConnector.exe",
                            "?:\\Program Files (x86)\\Acronis\\BackupAndRecovery\\mms.exe",
                            "C:\\Program Files (x86)\\Delcam\\FeatureCAM\\Program\\ezfm.exe",
                            "C:\\Program Files\\IPA\\IPA.exe",
                            "?:\\Program Files\\EIZO\\ColorNavigator 7\\ColorNavigator 7.exe",
                            "?:\\Program Files (x86)\\Windev\\AD_Voyager\\AD_voyager.exe",
                            "?:\\Program Files\\BackupClient\\BackupAndRecovery\\mms.exe",
                            "?:\\Program Files\\Velneo\\vClient.exe",
                            "D:\\WINDEV\\AD_Voyager\\AD_voyager.exe",
                            "C:\\Program Files\\Java\\jre8\\bin\\java.exe",
                            "C:\\Program Files (x86)\\SofttechLLC\\FlightVector\\FlightVector.exe",
                            "?:\\Program Files\\Automation Anywhere\\Bot Agent\\jre\\bin\\BotLauncher.exe",
                            "C:\\Program Files\\Eclipse Adoptium\\jdk-*-hotspot\\bin\\java.exe",
                            "C:\\Program Files (x86)\\Imprivata\\OneSign Agent\\x64\\ISXAgent.exe",
                            "C:\\Program Files (x86)\\Microsoft\\EdgeWebView\\Application\\*\\msedgewebview2.exe")] as event0
 [process where event.action == "start" and process.args_count >= 2 and 
  (
   (process.Ext.relative_file_creation_time <= 500 and process.pe.original_file_name : ("node.exe", "AutoIt*.exe")) or 
    (process.pe.original_file_name : ("wscript.exe", "mshta.exe") and
     event0.file.extension : ("js", "vbs", "wsh", "vbe", "jse", "hta"))
  ) and 
  stringcontains~(process.command_line, event0.file.name) and
  not (process.parent.args : "%TEMP%\\Spiceworks\\spiceworks_upload.vbs" and process.parent.name : "cmd.exe") and
  not (process.parent.name : "mshta.exe" and process.parent.args : "\\\\*\\netlogon\\ADSelfService_Enroll.hta") and
  not (process.parent.name : "cmd.exe" and
       process.parent.command_line : "C:\\WINDOWS\\SYSTEM32\\cmd.exe /c \"\"C:\\Program Files (x86)\\BluePoint Solutions\\BPAppLaunch\\ConsoleApp\\Command BPAppLaunch.bat\"\"") and
  not process.parent.executable : ("C:\\Engineer\\Airlock Digital - Allowlisting Auditor v4.1.exe",
                                   "C:\\Program Files (x86)\\Common Files\\Adobe\\Adobe Desktop Common\\HDBox\\Setup.exe")
  ]
'''

min_endpoint_version = "8.4.0"
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 1
tree = true

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

[[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 = "T1027"
name = "Obfuscated Files or Information"
reference = "https://attack.mitre.org/techniques/T1027/"


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

[internal]
min_endpoint_version = "8.4.0"

Stages and Predicates

Stage 1: file

[file where event.action == "creation" and 
  not user.id : ("S-1-5-18", "S-1-5-19", "S-1-5-90") and 
  process.pid != 4 and 
  file.path : ("?:\\Users\\*", "?:\\ProgramData\\*", "?:\\Windows\\Temp\\*", "?:\\Windows\\Tasks\\*") and 
  file.Ext.entropy >= 6 and not file.Ext.header_bytes : "4d5a*" and
  not (process.name : "ifa-PM.exe" and file.name : "ifa-PMS.hta") and
  not (process.name : "Code.exe" and file.name : "aws-lsp-codewhisperer.js") and
  not (process.name : ("Setup.exe", "vrpsetup.exe") and
      file.Ext.header_bytes : ("53657420776d6953657276696365203d", "2720436865636b206c6963206265666f")) and
  not (process.code_signature.subject_name : ("BizLink International Corp.", "Adobe Inc.", "Fabrice PARISOT", "Notepad++", "Argus Media Ltd", "Imprivata, Inc.")
       and process.code_signature.trusted == true) and
  not process.executable : ("?:\\Program Files (x86)\\Kovai Ltd\\BizTalk360\\Service\\BHMCollect.exe",
                            "?:\\Program Files (x86)\\BizTalkHealthMonitor\\BHMCollect.exe",
                            "?:\\Program Files\\Common Files\\Voltage Security\\VSManager2.exe",
                            "?:\\Program Files (x86)\\UPS\\CrossWare\\CrossWare.exe",
                            "?:\\Program Files\\Automation Anywhere\\Bot Agent\\jre\\bin\\javaw.exe",
                            "?:\\Program Files\\ForeScout SecureConnector\\SecureConnector.exe",
                            "?:\\Program Files (x86)\\Acronis\\BackupAndRecovery\\mms.exe",
                            "C:\\Program Files (x86)\\Delcam\\FeatureCAM\\Program\\ezfm.exe",
                            "C:\\Program Files\\IPA\\IPA.exe",
                            "?:\\Program Files\\EIZO\\ColorNavigator 7\\ColorNavigator 7.exe",
                            "?:\\Program Files (x86)\\Windev\\AD_Voyager\\AD_voyager.exe",
                            "?:\\Program Files\\BackupClient\\BackupAndRecovery\\mms.exe",
                            "?:\\Program Files\\Velneo\\vClient.exe",
                            "D:\\WINDEV\\AD_Voyager\\AD_voyager.exe",
                            "C:\\Program Files\\Java\\jre8\\bin\\java.exe",
                            "C:\\Program Files (x86)\\SofttechLLC\\FlightVector\\FlightVector.exe",
                            "?:\\Program Files\\Automation Anywhere\\Bot Agent\\jre\\bin\\BotLauncher.exe",
                            "C:\\Program Files\\Eclipse Adoptium\\jdk-*-hotspot\\bin\\java.exe",
                            "C:\\Program Files (x86)\\Imprivata\\OneSign Agent\\x64\\ISXAgent.exe",
                            "C:\\Program Files (x86)\\Microsoft\\EdgeWebView\\Application\\*\\msedgewebview2.exe")] as event0

Stage 2: process

[process where event.action == "start" and process.args_count >= 2 and 
  (
   (process.Ext.relative_file_creation_time <= 500 and process.pe.original_file_name : ("node.exe", "AutoIt*.exe")) or 
    (process.pe.original_file_name : ("wscript.exe", "mshta.exe") and
     event0.file.extension : ("js", "vbs", "wsh", "vbe", "jse", "hta"))
  ) and 
  stringcontains~(process.command_line, event0.file.name) and
  not (process.parent.args : "%TEMP%\\Spiceworks\\spiceworks_upload.vbs" and process.parent.name : "cmd.exe") and
  not (process.parent.name : "mshta.exe" and process.parent.args : "\\\\*\\netlogon\\ADSelfService_Enroll.hta") and
  not (process.parent.name : "cmd.exe" and
       process.parent.command_line : "C:\\WINDOWS\\SYSTEM32\\cmd.exe /c \"\"C:\\Program Files (x86)\\BluePoint Solutions\\BPAppLaunch\\ConsoleApp\\Command BPAppLaunch.bat\"\"") and
  not process.parent.executable : ("C:\\Engineer\\Airlock Digital - Allowlisting Auditor v4.1.exe",
                                   "C:\\Program Files (x86)\\Common Files\\Adobe\\Adobe Desktop Common\\HDBox\\Setup.exe")
  ]

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
file.Ext.header_byteseq53657420776d6953657276696365203d, 2720436865636b206c6963206265666fexcludes:file.Ext.header_bytes field:"file.Ext.header_bytes" value:"53657420776d6953657276696365203d" field:"file.Ext.header_bytes" value:"2720436865636b206c6963206265666f"
process.nameeqSetup.exe, vrpsetup.exeexcludes:process.name field:"process.name" value:"Setup.exe" field:"process.name" value:"vrpsetup.exe"
file.nameeqaws-lsp-codewhisperer.jsexcludes:file.name field:"file.name" value:"aws-lsp-codewhisperer.js"
process.nameeqCode.exeexcludes:process.name field:"process.name" value:"Code.exe"
file.nameeqifa-PMS.htaexcludes:file.name field:"file.name" value:"ifa-PMS.hta"
process.nameeqifa-PM.exeexcludes:process.name field:"process.name" value:"ifa-PM.exe"
process.code_signature.subject_nameeqBizLink International Corp., Adobe Inc., Fabrice PARISOT, Notepad++, Argus Media Ltd, Imprivata, Inc.excludes:process.code_signature.subject_name
process.code_signature.trustedeqtrueexcludes:process.code_signature.trusted field:"process.code_signature.trusted" value:"true"
file.Ext.header_bytesstarts_with4d5aexcludes:file.Ext.header_bytes field:"file.Ext.header_bytes" value:"4d5a"
process.executablewildcard?:\Program Files (x86)\Kovai Ltd\BizTalk360\Service\BHMCollect.exe, ?:\Program Files (x86)\BizTalkHealthMonitor\BHMCollect.exe, ?:\Program Files\Common Files\Voltage Security\VSManager2.exe, ?:\Program Files (x86)\UPS\CrossWare\CrossWare.exe, ?:\Program Files\Automation Anywhere\Bot Agent\jre\bin\javaw.exe, ?:\Program Files\ForeScout SecureConnector\SecureConnector.exe, ?:\Program Files (x86)\Acronis\BackupAndRecovery\mms.exe, C:\Program Files (x86)\Delcam\FeatureCAM\Program\ezfm.exe, C:\Program Files\IPA\IPA.exe, ?:\Program Files\EIZO\ColorNavigator 7\ColorNavigator 7.exe, ?:\Program Files (x86)\Windev\AD_Voyager\AD_voyager.exe, ?:\Program Files\BackupClient\BackupAndRecovery\mms.exe, ?:\Program Files\Velneo\vClient.exe, D:\WINDEV\AD_Voyager\AD_voyager.exe, C:\Program Files\Java\jre8\bin\java.exe, C:\Program Files (x86)\SofttechLLC\FlightVector\FlightVector.exe, ?:\Program Files\Automation Anywhere\Bot Agent\jre\bin\BotLauncher.exe, C:\Program Files\Eclipse Adoptium\jdk-*-hotspot\bin\java.exe, C:\Program Files (x86)\Imprivata\OneSign Agent\x64\ISXAgent.exe, C:\Program Files (x86)\Microsoft\EdgeWebView\Application\*\msedgewebview2.exeexcludes:process.executable
user.ideqS-1-5-18, S-1-5-19, S-1-5-90excludes:user.id field:"user.id" value:"S-1-5-18" field:"user.id" value:"S-1-5-19" field:"user.id" value:"S-1-5-90"
process.parent.argseq%TEMP%\Spiceworks\spiceworks_upload.vbsexcludes:process.parent.args field:"process.parent.args" value:"%TEMP%\Spiceworks\spiceworks_upload.vbs"
process.parent.nameeqcmd.exeexcludes:process.parent.name field:"process.parent.name" value:"cmd.exe"
process.parent.argswildcard\\*\netlogon\ADSelfService_Enroll.htaexcludes:process.parent.args field:"process.parent.args" value:"\\*\netlogon\ADSelfService_Enroll.hta"
process.parent.nameeqmshta.exeexcludes:process.parent.name field:"process.parent.name" value:"mshta.exe"
process.parent.command_lineeqC:\WINDOWS\SYSTEM32\cmd.exe /c ""C:\Program Files (x86)\BluePoint Solutions\BPAppLaunch\ConsoleApp\Command BPAppLaunch.bat""excludes:process.parent.command_line
process.parent.executableeqC:\Engineer\Airlock Digital - Allowlisting Auditor v4.1.exe, C:\Program Files (x86)\Common Files\Adobe\Adobe Desktop Common\HDBox\Setup.exeexcludes:process.parent.executable field:"process.parent.executable" value:"C:\Engineer\Airlock Digital - Allowlisting Auditor v4.1.exe" field:"process.parent.executable" value:"C:\Program Files (x86)\Common Files\Adobe\Adobe Desktop Common\HDBox\Setup.exe"

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • creation corpus 58 (elastic 58)
  • start corpus 391 (elastic 391)
field:"EventType" kind:eq
event0.file.extensionwildcard
  • hta
  • js
  • jse
  • vbe
  • vbs
  • wsh
field:"event0.file.extension" kind:wildcard
file.Ext.entropyge
  • 6 transforms: number corpus 4 (elastic 4)
field:"file.Ext.entropy" kind:ge value:"6"
file.pathwildcard
  • ?:\ProgramData\* corpus 2 (elastic 2)
  • ?:\Users\* corpus 4 (elastic 4)
  • ?:\Windows\Tasks\* corpus 7 (elastic 7)
  • ?:\Windows\Temp\* corpus 2 (elastic 2)
field:"TargetFilename" kind:wildcard
process.Ext.relative_file_creation_timele
  • 500 transforms: number corpus 28 (elastic 28)
field:"process.Ext.relative_file_creation_time" kind:le value:"500"
process.args_countge
  • 2 transforms: number corpus 18 (elastic 18)
field:"process.args_count" kind:ge value:"2"
process.command_linecontains
  • event0.file.name (field reference) corpus 10 (elastic 10)
field:"CommandLine" kind:contains value:"event0.file.name"
process.pe.original_file_namewildcard
  • AutoIt*.exe corpus 8 (elastic 8)
  • mshta.exe corpus 40 (elastic 21, sigma 13, splunk 6)
  • node.exe corpus 7 (elastic 4, sigma 3)
  • wscript.exe corpus 38 (elastic 21, sigma 17)
field:"OriginalFileName" kind:wildcard
process.pidne
  • 4 transforms: number corpus 44 (elastic 44)
field:"process_id" kind:ne value:"4"