Detection rules › Elastic

Oversized Windows Script Execution

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

Identifies the execution of a Windows script with file size more than 30MB. Adversaries may use large files to bypass online malware sandbox file upload size limitation.

MITRE ATT&CK coverage

Rule body

[rule]
description = """
Identifies the execution of a Windows script with file size more than 30MB. Adversaries may use large files to bypass
online malware sandbox file upload size limitation.
"""
id = "e8dded92-4ef5-4322-8098-98e7cb33994f"
license = "Elastic License v2"
name = "Oversized Windows Script Execution"
os_list = ["windows"]
reference = ["https://www.elastic.co/security-labs/spring-cleaning-with-latrodectus"]
version = "1.0.7"

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

  /* windows script file size is more than 30MB */
  file.extension : ("js", "jse", "vbs", "vbe", "wsh", "hta") and file.size >= 30000000] as event0
 [process where event.action == "start" and
  (process.name : ("wscript.exe", "cscript.exe", "mshta.exe") or process.pe.original_file_name : ("cscript.exe", "wscript.exe", "mshta.exe")) and
   (
    stringcontains~(process.command_line, event0.file.name) or
    startswith~(event0.file.path, process.working_directory)
   )]
'''

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

[[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 = "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 = "8.4.0"

Stages and Predicates

Stage 1: file

[file where event.action != "deletion" and
  file.extension : ("js", "jse", "vbs", "vbe", "wsh", "hta") and file.size >= 30000000] as event0

Stage 2: process

[process where event.action == "start" and
  (process.name : ("wscript.exe", "cscript.exe", "mshta.exe") or process.pe.original_file_name : ("cscript.exe", "wscript.exe", "mshta.exe")) and
   (
    stringcontains~(process.command_line, event0.file.name) or
    startswith~(event0.file.path, process.working_directory)
   )]

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"
event0.file.pathstarts_with
  • process.working_directory (field reference) corpus 4 (elastic 4)
field:"event0.file.path" kind:starts_with value:"process.working_directory"
file.extensionwildcard
  • hta corpus 20 (elastic 20)
  • js corpus 23 (elastic 23)
  • jse corpus 18 (elastic 18)
  • vbe corpus 18 (elastic 18)
  • vbs corpus 19 (elastic 19)
  • wsh corpus 16 (elastic 16)
field:"file.extension" kind:wildcard
file.sizege
  • 30000000 transforms: number
field:"file.size" kind:ge value:"30000000"
process.command_linecontains
  • event0.file.name (field reference) corpus 10 (elastic 10)
field:"CommandLine" kind:contains value:"event0.file.name"
process.namewildcard
  • cscript.exe corpus 67 (elastic 65, splunk 2)
  • mshta.exe corpus 84 (elastic 79, splunk 5)
  • wscript.exe corpus 83 (elastic 82, splunk 1)
field:"process_name" kind:wildcard
process.pe.original_file_namewildcard
  • cscript.exe corpus 32 (sigma 17, elastic 15)
  • mshta.exe corpus 40 (elastic 21, sigma 13, splunk 6)
  • wscript.exe corpus 38 (elastic 21, sigma 17)
field:"OriginalFileName" kind:wildcard