Detection rules › Elastic
Execution of a File Written by Windows Script Host
Identifies the execution of a file written or modified by Microsoft Windows Script Host processes (cscript or wscript).
MITRE ATT&CK coverage
Rule body
[rule]
description = "Identifies the execution of a file written or modified by Microsoft Windows Script Host processes (cscript or wscript)."
id = "49e47c2a-307f-4591-939a-dfdae6e5156c"
license = "Elastic License v2"
name = "Execution of a File Written by Windows Script Host"
os_list = ["windows"]
version = "1.0.38"
query = '''
sequence with maxspan=5m
[file where event.action != "deletion" and
process.name : ("cscript.exe", "wscript.exe") and
not file.path : ("?:\\Program Files (x86)\\*.exe", "?:\\Program Files\\*.exe")] by file.path
[process where event.action == "start" and
not process.Ext.token.integrity_level_name == "system" and
not process.parent.executable : "?:\\Windows\\System32\\drvinst.exe" and
not (process.code_signature.trusted == true and
process.code_signature.subject_name :
("Microsoft *",
"ESET, spol. s r.o.",
"VORTECH SOLUTIONS PTY LTD",
"Western Union Holdings Inc.",
"KOBIL Systems GmbH")) and
not (process.pe.original_file_name : "Packman.exe" and process.args : "checkCompileErrors=true") and
not process.pe.original_file_name : ("CCCLauncher.exe", "Bginfo.exe") and
not process.executable : ("?:\\Program Files (x86)\\*", "?:\\Program Files\\*") and
not (process.pe.original_file_name == "cognosrcp.exe" and
process.code_signature.subject_name == "IBM Canada Ltd." and process.code_signature.trusted == true) and
not (process.code_signature.subject_name : ("The Qt Company Oy", "ci solution GmbH", "Spotify AB", "Nextech Systems, LLC") and
process.code_signature.trusted == true) and
not process.hash.sha256 :
("9c3b9f4d38e6c7a9614d99260078c8f05f8e187eb25a23f03ea53f0120179494",
"6c6c55cc9411700ad806ca9b2894fd339bfef23e1f836611c1d617485c13d91f",
"dd05bbbbb72b847b7e404a9011404ca058b9144b3a1648ce9cd4edd4868052dc",
"ebdef325ca2c3c6ded43b1e85263746719c609a9f8a0f43927764d80e92a865a")
] by process.executable
'''
min_endpoint_version = "7.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/"
[internal]
min_endpoint_version = "7.15.0"
Stages and Predicates
Ordered sequence: each step below must occur in order within 5m, correlated by file.path, process.executable.
Stage 1: file
[file where event.action != "deletion" and
process.name : ("cscript.exe", "wscript.exe") and
not file.path : ("?:\\Program Files (x86)\\*.exe", "?:\\Program Files\\*.exe")] by file.path
Stage 2: process
[process where event.action == "start" and
not process.Ext.token.integrity_level_name == "system" and
not process.parent.executable : "?:\\Windows\\System32\\drvinst.exe" and
not (process.code_signature.trusted == true and
process.code_signature.subject_name :
("Microsoft *",
"ESET, spol. s r.o.",
"VORTECH SOLUTIONS PTY LTD",
"Western Union Holdings Inc.",
"KOBIL Systems GmbH")) and
not (process.pe.original_file_name : "Packman.exe" and process.args : "checkCompileErrors=true") and
not process.pe.original_file_name : ("CCCLauncher.exe", "Bginfo.exe") and
not process.executable : ("?:\\Program Files (x86)\\*", "?:\\Program Files\\*") and
not (process.pe.original_file_name == "cognosrcp.exe" and
process.code_signature.subject_name == "IBM Canada Ltd." and process.code_signature.trusted == true) and
not (process.code_signature.subject_name : ("The Qt Company Oy", "ci solution GmbH", "Spotify AB", "Nextech Systems, LLC") and
process.code_signature.trusted == true) and
not process.hash.sha256 :
("9c3b9f4d38e6c7a9614d99260078c8f05f8e187eb25a23f03ea53f0120179494",
"6c6c55cc9411700ad806ca9b2894fd339bfef23e1f836611c1d617485c13d91f",
"dd05bbbbb72b847b7e404a9011404ca058b9144b3a1648ce9cd4edd4868052dc",
"ebdef325ca2c3c6ded43b1e85263746719c609a9f8a0f43927764d80e92a865a")
] by process.executable
Exclusions
The rule actively suppresses these predicates.
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" |
process.name | wildcard |
| field:"process_name" kind:wildcard |