Detection rules › Elastic
Execution of a Windows Script Downloaded from the Internet
Identifies the execution of a Windows script that was downloaded from the internet.
MITRE ATT&CK coverage
Rule body
[rule]
description = "Identifies the execution of a Windows script that was downloaded from the internet."
id = "a87d8240-0b80-4255-8680-cee8c68b2d1e"
license = "Elastic License v2"
name = "Execution of a Windows Script Downloaded from the Internet"
os_list = ["windows"]
version = "1.0.5"
query = '''
sequence with maxspan=5m
[file where event.action == "creation" and
file.Ext.windows.zone_identifier == 3 and file.origin_url : "http*" and
file.extension in~ ("js", "jse", "vbs", "vbe", "wsh", "hta") and
not file.origin_url like ("https://www.manageengine.com/products/*",
"https://*.sharepoint.com/*",
"https://artifacts.elastic.co/downloads/*",
"https://ajax.googleapis.com/ajax*",
"https://api.media.atlassian.com/*",
"https://gitlab.com/blooket/blooket-cheats/*",
"https://dl.driverpack.io/test/PROD_Start_DriverPack.hta")
] as event0
[process where event.action == "start" and
(process.name in~ ("wscript.exe", "cscript.exe", "mshta.exe") or
process.pe.original_file_name in ("cscript.exe", "wscript.exe", "MSHTA.EXE")) and
(
/* substring used to remove Zone.Identifier from file.name */
stringcontains~(process.command_line, substring(event0.file.name, 0, length(event0.file.name) - 16)) or
stringcontains~(process.command_line, event0.file.name) or
startswith~(event0.file.path, process.working_directory)
)]
'''
min_endpoint_version = "8.15.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 = "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.15.0"
Stages and Predicates
Stage 1: file
[file where event.action == "creation" and
file.Ext.windows.zone_identifier == 3 and file.origin_url : "http*" and
file.extension in~ ("js", "jse", "vbs", "vbe", "wsh", "hta") and
not file.origin_url like ("https://www.manageengine.com/products/*",
"https://*.sharepoint.com/*",
"https://artifacts.elastic.co/downloads/*",
"https://ajax.googleapis.com/ajax*",
"https://api.media.atlassian.com/*",
"https://gitlab.com/blooket/blooket-cheats/*",
"https://dl.driverpack.io/test/PROD_Start_DriverPack.hta")
] as event0
Stage 2: process
[process where event.action == "start" and
(process.name in~ ("wscript.exe", "cscript.exe", "mshta.exe") or
process.pe.original_file_name in ("cscript.exe", "wscript.exe", "MSHTA.EXE")) and
(
stringcontains~(process.command_line, substring(event0.file.name, 0, length(event0.file.name) - 16)) or
stringcontains~(process.command_line, event0.file.name) or
startswith~(event0.file.path, process.working_directory)
)]
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
file.origin_url | wildcard | https://www.manageengine.com/products/*, https://*.sharepoint.com/*, https://artifacts.elastic.co/downloads/*, https://ajax.googleapis.com/ajax*, https://api.media.atlassian.com/*, https://gitlab.com/blooket/blooket-cheats/*, https://dl.driverpack.io/test/PROD_Start_DriverPack.hta | excludes:file.origin_url |
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq |
event0.file.path | starts_with |
| field:"event0.file.path" kind:starts_with value:"process.working_directory" |
file.Ext.windows.zone_identifier | eq |
| field:"file.Ext.windows.zone_identifier" kind:eq value:"3" |
file.extension | in |
| field:"file.extension" kind:in |
file.origin_url | wildcard |
| field:"file.origin_url" kind:wildcard value:"http*" |
process.command_line | contains |
| field:"CommandLine" kind:contains |
process.name | in |
| field:"process_name" kind:in |
process.pe.original_file_name | in |
| field:"OriginalFileName" kind:in |