Detection rules › Elastic
Oversized Windows Script Execution
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.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"start" |
event.action | ne |
| field:"EventType" kind:ne value:"deletion" |
event0.file.path | starts_with |
| field:"event0.file.path" kind:starts_with value:"process.working_directory" |
file.extension | wildcard |
| field:"file.extension" kind:wildcard |
file.size | ge |
| field:"file.size" kind:ge value:"30000000" |
process.command_line | contains |
| field:"CommandLine" kind:contains value:"event0.file.name" |
process.name | wildcard |
| field:"process_name" kind:wildcard |
process.pe.original_file_name | wildcard |
| field:"OriginalFileName" kind:wildcard |