Suspicious Image Load via Windows Scripts


Description

Identifies when a Windows script interpreter loads an unsigned or untrusted external library. This may indicate an attempt to evade detection by executing malicious code via uncommon methods.

Query · eql

library where process.name : ("wscript.exe", "cscript.exe", "mshta.exe", "wmic.exe", "cmstp.exe", "msxsl.exe") and

 dll.Ext.relative_file_creation_time <= 500 and

 (dll.code_signature.trusted == false or dll.code_signature.exists == false) and 
 
 not dll.code_signature.status : ("errorChaining", "errorExpired") and 
 
 not dll.path :
       ("?:\\Windows\\assembly\\NativeImages*", 
        "?:\\Windows\\System32\\*",
        "?:\\Windows\\SysWOW64\\*",
        "?:\\Program Files\\*",
        "?:\\Program Files (x86)\\*",
        "?:\\Windows\\WinSxS\\*") and
 not startswith~(process.name, dll.name)
Raw source Suspicious Image Load via Windows Scripts · Elastic TOML
Esc
Published by elastic/protections-artifacts ↗, licensed under Elastic License 2.0 ↗. Reproduced here unmodified.
[rule]
description = """
Identifies when a Windows script interpreter loads an unsigned or untrusted external library. This may indicate an
attempt to evade detection by executing malicious code via uncommon methods.
"""
id = "23e29d07-7584-465e-8a6d-912d9ea254a6"
license = "Elastic License v2"
name = "Suspicious Image Load via Windows Scripts"
os_list = ["windows"]
reference = [
    "https://gist.github.com/code-scrap/d7f152ffcdb3e0b02f7f394f5187f008",
    "https://www.elastic.co/security-labs/Hunting-for-Suspicious-Windows-Libraries-for-Execution-and-Evasion",
]
version = "1.0.23"

query = '''
library where process.name : ("wscript.exe", "cscript.exe", "mshta.exe", "wmic.exe", "cmstp.exe", "msxsl.exe") and

 dll.Ext.relative_file_creation_time <= 500 and

 (dll.code_signature.trusted == false or dll.code_signature.exists == false) and 
 
 not dll.code_signature.status : ("errorChaining", "errorExpired") and 
 
 not dll.path :
       ("?:\\Windows\\assembly\\NativeImages*", 
        "?:\\Windows\\System32\\*",
        "?:\\Windows\\SysWOW64\\*",
        "?:\\Program Files\\*",
        "?:\\Program Files (x86)\\*",
        "?:\\Windows\\WinSxS\\*") and
 not startswith~(process.name, dll.name)
'''

min_endpoint_version = "8.4.0"
optional_actions = []
[[actions]]
action = "kill_process"
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.4.0"

Detection rules belong to the projects that publish them and remain under their own licenses. This site indexes and links to them; it claims no rights in them.