Detection rules › Elastic

Script File Written by Microsoft Office Process

Time window
1m
Sequence by
user.id
Source
github.com/elastic/protections-artifacts

Identifies the execution of a script file written by a Microsoft Office application (Word, PowerPoint, or Excel). Script interpreters are often launched during exploitation of Office applications or from documents containing malicious macros.

MITRE ATT&CK coverage

Rule body

[rule]
description = """
Identifies the execution of a script file written by a Microsoft Office application (Word, PowerPoint, or Excel). Script
interpreters are often launched during exploitation of Office applications or from documents containing malicious
macros.
"""
id = "78e2e5e1-e727-4106-9206-8cf43b9f8919"
license = "Elastic License v2"
name = "Script File Written by Microsoft Office Process"
os_list = ["windows"]
reference = ["https://lolbas-project.github.io/"]
version = "1.0.30"

query = '''
sequence by user.id with maxspan=1m
 [file where event.action != "deletion" and

  /* script dropped by MS Office program */
   file.extension : ("hta", "vbs", "js", "wsf", "vbe", "jse", "ps1", "bat", "cmd", "sct") and
   process.name : ("winword.exe", "excel.exe", "outlook.exe", "powerpnt.exe", "eqnedt32.exe", "fltldr.exe", "mspub.exe", "msaccess.exe")]
 [process where event.action == "start" and
  process.name : ("cscript.exe", "wscript.exe", "mshta.exe", "powershell.exe", "cmd.exe", "regsvr32.exe", "cmstp.exe", "wmic.exe") and not

 /*  descendant of MS office but not a direct child - already covered by ruleId c34a9dca-66cf-4283-944d-1800b28ae690 */
  process.parent.name : ("winword.exe", "excel.exe", "outlook.exe", "powerpnt.exe", "eqnedt32.exe", "fltldr.exe", "mspub.exe",
                         "msaccess.exe", "WmiPrvse.exe", "explorer.exe") and
  descendant of [process where event.action == "start" and
     process.name : ("winword.exe", "excel.exe", "outlook.exe", "powerpnt.exe", "eqnedt32.exe", "fltldr.exe", "mspub.exe", "msaccess.exe")] and
  not (process.name : "cmd.exe" and process.parent.executable : "\\Device\\Mup\\*\\netlogon\\*") and
  not (process.name : "cmd.exe" and process.parent.name : ("chrome.exe", "msedge.exe", "iexplore.exe", "opera.exe", "firefox.exe", "brave.exe")) and
  not (process.command_line : "cmd.exe /c set" and process.parent.executable : "?:\\Program Files (x86)\\eparakstitajs?\\eparakstitajs?.exe") and
  not (process.name : "regsvr32.exe" and process.args : "?:\\Program Files\\Mozilla Firefox\\Accessible*.dll") and
  not process.parent.executable :
                  ("?:\\Program Files\\HP\\Sure Click\\ApplicationSupport\\chrome\\*\\BrChrome.exe",
                   "?:\\Program Files (x86)\\HP\\Sure Click\\ApplicationSupport\\chrome\\*\\BrChrome.exe",
                   "?:\\Program Files (x86)\\Fuji Xerox\\DocuWorks\\bin\\dwviewer.exe",
                   "C:\\Program Files\\Druide\\*\\Connectix.exe",
                   "\\Device\\Mup\\*.exe") and
  not (process.command_line : "cmd.exe /c start outlook" and
       process.parent.executable : "?:\\Program Files\\WindowsApps\\Microsoft.OutlookForWindows_*\\olk.exe") and
  not (process.name : "regsvr32.exe" and
       process.command_line : "?:\\Windows\\sys*\\regsvr32.exe -s \"C:\\Users\\*\\G2MOutlookAddin64.dll\"" and
       process.parent.executable : "?:\\Users\\*\\AppData\\Local\\GoToMeeting\\*\\g2mlauncher.exe")
  ]
'''

min_endpoint_version = "7.15.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 1

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



[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.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 = "T1218"
name = "System Binary Proxy Execution"
reference = "https://attack.mitre.org/techniques/T1218/"
[[threat.technique.subtechnique]]
id = "T1218.005"
name = "Mshta"
reference = "https://attack.mitre.org/techniques/T1218/005/"



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

[internal]
min_endpoint_version = "7.15.0"

Stages and Predicates

Ordered sequence: each step below must occur in order within 1m, correlated by user.id.

Stage 1: file

[file where event.action != "deletion" and
   file.extension : ("hta", "vbs", "js", "wsf", "vbe", "jse", "ps1", "bat", "cmd", "sct") and
   process.name : ("winword.exe", "excel.exe", "outlook.exe", "powerpnt.exe", "eqnedt32.exe", "fltldr.exe", "mspub.exe", "msaccess.exe")]

Stage 2: process

[process where event.action == "start" and
  process.name : ("cscript.exe", "wscript.exe", "mshta.exe", "powershell.exe", "cmd.exe", "regsvr32.exe", "cmstp.exe", "wmic.exe") and not
  process.parent.name : ("winword.exe", "excel.exe", "outlook.exe", "powerpnt.exe", "eqnedt32.exe", "fltldr.exe", "mspub.exe",
                         "msaccess.exe", "WmiPrvse.exe", "explorer.exe") and
  descendant of [process where event.action == "start" and
     process.name : ("winword.exe", "excel.exe", "outlook.exe", "powerpnt.exe", "eqnedt32.exe", "fltldr.exe", "mspub.exe", "msaccess.exe")] and
  not (process.name : "cmd.exe" and process.parent.executable : "\\Device\\Mup\\*\\netlogon\\*") and
  not (process.name : "cmd.exe" and process.parent.name : ("chrome.exe", "msedge.exe", "iexplore.exe", "opera.exe", "firefox.exe", "brave.exe")) and
  not (process.command_line : "cmd.exe /c set" and process.parent.executable : "?:\\Program Files (x86)\\eparakstitajs?\\eparakstitajs?.exe") and
  not (process.name : "regsvr32.exe" and process.args : "?:\\Program Files\\Mozilla Firefox\\Accessible*.dll") and
  not process.parent.executable :
                  ("?:\\Program Files\\HP\\Sure Click\\ApplicationSupport\\chrome\\*\\BrChrome.exe",
                   "?:\\Program Files (x86)\\HP\\Sure Click\\ApplicationSupport\\chrome\\*\\BrChrome.exe",
                   "?:\\Program Files (x86)\\Fuji Xerox\\DocuWorks\\bin\\dwviewer.exe",
                   "C:\\Program Files\\Druide\\*\\Connectix.exe",
                   "\\Device\\Mup\\*.exe") and
  not (process.command_line : "cmd.exe /c start outlook" and
       process.parent.executable : "?:\\Program Files\\WindowsApps\\Microsoft.OutlookForWindows_*\\olk.exe") and
  not (process.name : "regsvr32.exe" and
       process.command_line : "?:\\Windows\\sys*\\regsvr32.exe -s \"C:\\Users\\*\\G2MOutlookAddin64.dll\"" and
       process.parent.executable : "?:\\Users\\*\\AppData\\Local\\GoToMeeting\\*\\g2mlauncher.exe")
  ]

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.argswildcard?:\Program Files\Mozilla Firefox\Accessible*.dllexcludes:process.args field:"process.args" value:"?:\Program Files\Mozilla Firefox\Accessible*.dll"
process.nameeqregsvr32.exeexcludes:process.name field:"process.name" value:"regsvr32.exe"
process.command_lineeqcmd.exe /c setexcludes:process.command_line field:"process.command_line" value:"cmd.exe /c set"
process.parent.executableeq?:\Program Files (x86)\eparakstitajs?\eparakstitajs?.exeexcludes:process.parent.executable field:"process.parent.executable" value:"?:\Program Files (x86)\eparakstitajs?\eparakstitajs?.exe"
process.command_lineeqcmd.exe /c start outlookexcludes:process.command_line field:"process.command_line" value:"cmd.exe /c start outlook"
process.parent.executablewildcard?:\Program Files\WindowsApps\Microsoft.OutlookForWindows_*\olk.exeexcludes:process.parent.executable field:"process.parent.executable" value:"?:\Program Files\WindowsApps\Microsoft.OutlookForWindows_*\olk.exe"
process.command_linewildcard?:\Windows\sys*\regsvr32.exe -s "C:\Users\*\G2MOutlookAddin64.dll"excludes:process.command_line
process.parent.executablewildcard?:\Users\*\AppData\Local\GoToMeeting\*\g2mlauncher.exeexcludes:process.parent.executable field:"process.parent.executable" value:"?:\Users\*\AppData\Local\GoToMeeting\*\g2mlauncher.exe"
process.nameeqcmd.exeexcludes:process.name field:"process.name" value:"cmd.exe"
process.parent.executablewildcard\Device\Mup\*\netlogon\*excludes:process.parent.executable field:"process.parent.executable" value:"\Device\Mup\*\netlogon\*"
process.parent.nameeqchrome.exe, msedge.exe, iexplore.exe, opera.exe, firefox.exe, brave.exeexcludes:process.parent.name
process.parent.executablewildcard?:\Program Files\HP\Sure Click\ApplicationSupport\chrome\*\BrChrome.exe, ?:\Program Files (x86)\HP\Sure Click\ApplicationSupport\chrome\*\BrChrome.exe, ?:\Program Files (x86)\Fuji Xerox\DocuWorks\bin\dwviewer.exe, C:\Program Files\Druide\*\Connectix.exe, \Device\Mup\*.exeexcludes:process.parent.executable
process.parent.nameeqwinword.exe, excel.exe, outlook.exe, powerpnt.exe, eqnedt32.exe, fltldr.exe, mspub.exe, msaccess.exe, WmiPrvse.exe, explorer.exeexcludes:process.parent.name

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • start corpus 391 (elastic 391)
field:"EventType" kind:eq value:"start"
event.actionne
  • deletion corpus 86 (elastic 86)
field:"EventType" kind:ne value:"deletion"
file.extensionwildcard
  • bat corpus 13 (elastic 13)
  • cmd corpus 15 (elastic 15)
  • hta corpus 20 (elastic 20)
  • js corpus 23 (elastic 23)
  • jse corpus 18 (elastic 18)
  • ps1 corpus 9 (elastic 9)
  • sct corpus 7 (elastic 7)
  • vbe corpus 18 (elastic 18)
  • vbs corpus 19 (elastic 19)
  • wsf corpus 10 (elastic 10)
field:"file.extension" kind:wildcard
process.namewildcard
  • cmd.exe corpus 121 (elastic 92, splunk 29)
  • cmstp.exe corpus 25 (elastic 25)
  • cscript.exe corpus 67 (elastic 65, splunk 2)
  • eqnedt32.exe corpus 8 (elastic 8)
  • excel.exe corpus 34 (elastic 34)
  • fltldr.exe corpus 8 (elastic 8)
  • msaccess.exe corpus 19 (elastic 19)
  • mshta.exe corpus 84 (elastic 79, splunk 5)
  • mspub.exe corpus 15 (elastic 15)
  • outlook.exe corpus 9 (elastic 7, splunk 2)
  • powerpnt.exe corpus 31 (elastic 31)
  • powershell.exe corpus 184 (elastic 140, splunk 44)
  • regsvr32.exe corpus 73 (elastic 68, splunk 5)
  • winword.exe corpus 35 (elastic 35)
  • wmic.exe corpus 66 (elastic 39, splunk 27)
  • wscript.exe corpus 83 (elastic 82, splunk 1)
field:"process_name" kind:wildcard