Detection rules › Elastic
.NET COM object created in non-standard Windows Script Interpreter
Identifies the creation of a .NET COM object in an unexpected Windows script interpreter. Adversaries may utilise .NET to call arbitrary Win32 APIs from scripts.
MITRE ATT&CK coverage
Rule body
[rule]
description = """
Identifies the creation of a .NET COM object in an unexpected Windows script interpreter. Adversaries may utilise .NET
to call arbitrary Win32 APIs from scripts.
"""
id = "1e9ac3fe-edb4-d669-71ab-220acc092982"
license = "Elastic License v2"
name = ".NET COM object created in non-standard Windows Script Interpreter"
os_list = ["windows"]
reference = ["https://github.com/tyranid/DotNetToJScript"]
version = "1.0.10"
query = '''
api where
not process.name : ("cscript.exe", "wscript.exe") and
process.code_signature.trusted == true and
process.code_signature.subject_name like "Microsoft*" and
process.Ext.api.name == "VirtualAlloc" and
process.Ext.api.parameters.allocation_type == "RESERVE" and
process.Ext.api.parameters.protection == "RWX" and
process.thread.Ext.call_stack_summary like (
/* .NET is allocating executable memory on behalf of a WSH script engine
* Note - this covers both .NET 2 and .NET 4 framework variants */
"*|mscoree.dll|combase.dll|jscript.dll|*",
"*|mscoree.dll|combase.dll|vbscript.dll|*",
/* These aren't WSH script engines - but the technique is likely still valid */
"*|mscoree.dll|combase.dll|jscript9.dll|*",
"*|mscoree.dll|combase.dll|chakra.dll|*"
) and
process.parent.executable != null and
not (process.executable : "?:\\Windows\\SysWOW64\\msiexec.exe" and
process.parent.executable : "?:\\Windows\\System32\\msiexec.exe" and
process.thread.Ext.call_stack_summary like "*|mscoree.dll|combase.dll|vbscript.dll|*|rpcrt4.dll|*") and
not (process.name : "mshta.exe" and
process.parent.executable : ("?:\\Program Files (x86)\\Amazon\\Amazon Assistant\\amazonAssistantService.exe",
"?:\\Program Files\\Microsoft Configuration Manager\\AdminConsole\\bin\\Microsoft.ConfigurationManagement.exe",
"?:\\Program Files\\Bentley\\*.exe")) and
not (process.executable : "?:\\Program Files (x86)\\Internet Explorer\\iexplore.exe" and
process.parent.executable : "?:\\Program Files\\Internet Explorer\\iexplore.exe" and
process.thread.Ext.call_stack_summary like "*|combase.dll|jscript9.dll|*") and
/* ASP VBScript */
not (process.executable : "?:\\Windows\\System32\\inetsrv\\w3wp.exe" and
process.thread.Ext.call_stack_summary in ("ntdll.dll|kernelbase.dll|clr.dll|mscoreei.dll|mscoree.dll|combase.dll|vbscript.dll|oleaut32.dll|vbscript.dll|asp.dll|comsvcs.dll|combase.dll|comsvcs.dll|msvcrt.dll|kernel32.dll|ntdll.dll",
"ntdll.dll|kernelbase.dll|clr.dll|mscoreei.dll|mscoree.dll|combase.dll|vbscript.dll|asp.dll|comsvcs.dll|combase.dll|comsvcs.dll|msvcrt.dll|kernel32.dll|ntdll.dll")) and
/* JumpCloud */
not (process.executable : "?:\\Windows\\System32\\LogonUI.exe" and
process.thread.Ext.call_stack_summary like "*|vbscript.dll|*" and
not process.thread.Ext.call_stack_summary like "*Unbacked*") and
not (process.command_line : "\"mshta.exe\" \"C:\\Program Files (x86)\\Amazon\\Amazon Assistant\\aa.hta\"" and
process.parent.executable : "C:\\Program Files (x86)\\Amazon\\Amazon Assistant\\amazonAssistantService.exe") and
not (process.executable : "?:\\Program Files\\Microsoft SQL Server\\*\\DTS\\Binn\\DTExec.exe" and
process.parent.executable : "?:\\Program Files\\Microsoft SQL Server\\*\\MSSQL\\Binn\\SQLAGENT.EXE") and
not (process.executable : "C:\\Program Files\\Microsoft Office\\root\\Office??\\OUTLOOK.EXE" and
process.thread.Ext.call_stack_summary like "*combase.dll|vbscript.dll|mso30win32client.dll*") and
not (process.executable : "C:\\Windows\\System32\\CredentialUIBroker.exe" and
process.parent.executable : "C:\\Windows\\System32\\svchost.exe" and
process.thread.Ext.call_stack_summary == "ntdll.dll|kernelbase.dll|clr.dll|mscoreei.dll|mscoree.dll|combase.dll|jscript.dll|kernel32.dll|ntdll.dll") and
not (process.executable : "C:\\Windows\\System32\\SearchFilterHost.exe" and process.parent.executable : "C:\\Windows\\System32\\SearchIndexer.exe" and
process.thread.Ext.call_stack_summary : "ntdll.dll*|kernelbase.dll|clr.dll|mscoreei.dll|mscoree.dll|combase.dll|*|offfiltx.dll|*|rpcrt4.dll|combase.dll|rpcrt4.dll|ntdll.dll|kernel32.dll|ntdll.dll")
'''
min_endpoint_version = "8.8.0"
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[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/"
[internal]
min_endpoint_version = "8.8.0"
Stages and Predicates
Stage 1: api
api where
not process.name : ("cscript.exe", "wscript.exe") and
process.code_signature.trusted == true and
process.code_signature.subject_name like "Microsoft*" and
process.Ext.api.name == "VirtualAlloc" and
process.Ext.api.parameters.allocation_type == "RESERVE" and
process.Ext.api.parameters.protection == "RWX" and
process.thread.Ext.call_stack_summary like (
/* .NET is allocating executable memory on behalf of a WSH script engine
* Note - this covers both .NET 2 and .NET 4 framework variants */
"*|mscoree.dll|combase.dll|jscript.dll|*",
"*|mscoree.dll|combase.dll|vbscript.dll|*",
"*|mscoree.dll|combase.dll|jscript9.dll|*",
"*|mscoree.dll|combase.dll|chakra.dll|*"
) and
process.parent.executable != null and
not (process.executable : "?:\\Windows\\SysWOW64\\msiexec.exe" and
process.parent.executable : "?:\\Windows\\System32\\msiexec.exe" and
process.thread.Ext.call_stack_summary like "*|mscoree.dll|combase.dll|vbscript.dll|*|rpcrt4.dll|*") and
not (process.name : "mshta.exe" and
process.parent.executable : ("?:\\Program Files (x86)\\Amazon\\Amazon Assistant\\amazonAssistantService.exe",
"?:\\Program Files\\Microsoft Configuration Manager\\AdminConsole\\bin\\Microsoft.ConfigurationManagement.exe",
"?:\\Program Files\\Bentley\\*.exe")) and
not (process.executable : "?:\\Program Files (x86)\\Internet Explorer\\iexplore.exe" and
process.parent.executable : "?:\\Program Files\\Internet Explorer\\iexplore.exe" and
process.thread.Ext.call_stack_summary like "*|combase.dll|jscript9.dll|*") and
not (process.executable : "?:\\Windows\\System32\\inetsrv\\w3wp.exe" and
process.thread.Ext.call_stack_summary in ("ntdll.dll|kernelbase.dll|clr.dll|mscoreei.dll|mscoree.dll|combase.dll|vbscript.dll|oleaut32.dll|vbscript.dll|asp.dll|comsvcs.dll|combase.dll|comsvcs.dll|msvcrt.dll|kernel32.dll|ntdll.dll",
"ntdll.dll|kernelbase.dll|clr.dll|mscoreei.dll|mscoree.dll|combase.dll|vbscript.dll|asp.dll|comsvcs.dll|combase.dll|comsvcs.dll|msvcrt.dll|kernel32.dll|ntdll.dll")) and
not (process.executable : "?:\\Windows\\System32\\LogonUI.exe" and
process.thread.Ext.call_stack_summary like "*|vbscript.dll|*" and
not process.thread.Ext.call_stack_summary like "*Unbacked*") and
not (process.command_line : "\"mshta.exe\" \"C:\\Program Files (x86)\\Amazon\\Amazon Assistant\\aa.hta\"" and
process.parent.executable : "C:\\Program Files (x86)\\Amazon\\Amazon Assistant\\amazonAssistantService.exe") and
not (process.executable : "?:\\Program Files\\Microsoft SQL Server\\*\\DTS\\Binn\\DTExec.exe" and
process.parent.executable : "?:\\Program Files\\Microsoft SQL Server\\*\\MSSQL\\Binn\\SQLAGENT.EXE") and
not (process.executable : "C:\\Program Files\\Microsoft Office\\root\\Office??\\OUTLOOK.EXE" and
process.thread.Ext.call_stack_summary like "*combase.dll|vbscript.dll|mso30win32client.dll*") and
not (process.executable : "C:\\Windows\\System32\\CredentialUIBroker.exe" and
process.parent.executable : "C:\\Windows\\System32\\svchost.exe" and
process.thread.Ext.call_stack_summary == "ntdll.dll|kernelbase.dll|clr.dll|mscoreei.dll|mscoree.dll|combase.dll|jscript.dll|kernel32.dll|ntdll.dll") and
not (process.executable : "C:\\Windows\\System32\\SearchFilterHost.exe" and process.parent.executable : "C:\\Windows\\System32\\SearchIndexer.exe" and
process.thread.Ext.call_stack_summary : "ntdll.dll*|kernelbase.dll|clr.dll|mscoreei.dll|mscoree.dll|combase.dll|*|offfiltx.dll|*|rpcrt4.dll|combase.dll|rpcrt4.dll|ntdll.dll|kernel32.dll|ntdll.dll")
Exclusions
The rule actively suppresses these predicates.
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
process.Ext.api.name | eq |
| field:"process.Ext.api.name" kind:eq value:"VirtualAlloc" |
process.Ext.api.parameters.allocation_type | eq |
| field:"process.Ext.api.parameters.allocation_type" kind:eq value:"RESERVE" |
process.Ext.api.parameters.protection | eq |
| field:"process.Ext.api.parameters.protection" kind:eq value:"RWX" |
process.code_signature.subject_name | wildcard |
| field:"Signature" kind:wildcard value:"Microsoft*" |
process.code_signature.trusted | eq |
| field:"process.code_signature.trusted" kind:eq value:"true" |
process.parent.executable | is_not_null | field:"ParentImage" kind:is_not_null | |
process.thread.Ext.call_stack_summary | wildcard |
| field:"process.thread.Ext.call_stack_summary" kind:wildcard |