Detection rules › Elastic

Potential Injection via NSIS Installer

Time window
1m
Sequence by
process.entity_id
Source
github.com/elastic/protections-artifacts

Identifies allocation of RWX memory region from a Nullsoft scriptable installer. Adversaries may abuse NSIS installers to deliver malware for initial access.

MITRE ATT&CK coverage

TacticTechniques
Stealth

Rule body

[rule]
description = """
Identifies allocation of RWX memory region from a Nullsoft scriptable installer. Adversaries may abuse NSIS installers
to deliver malware for initial access.
"""
id = "9cffb077-cf13-4a35-a6b1-152ba499edc0"
license = "Elastic License v2"
name = "Potential Injection via NSIS Installer"
os_list = ["windows"]
reference = [
    "https://nsis.sourceforge.io/Features",
    "https://www.fortinet.com/blog/threat-research/locky-nsis-based-ransomware-is-embracing-its-new-end-of-summer-shape",
    "https://medium.com/csg-govtech/meet-the-final-boss-clearing-each-level-of-multi-stage-malware-8779c5272ec7",
]
version = "1.0.4"

query = '''
sequence by process.entity_id with maxspan=1m
 [library where dll.path : "?:\\users\\*\\appdata\\local\\temp\\ns*.tmp\\system.dll" and not process.code_signature.status : "trusted"]
 [api where 
  process.Ext.api.name : ("VirtualAlloc*", "MapViewOfFile*") and process.Ext.api.parameters.protection : "RWX" and process.Ext.api.parameters.size >= 10000 and 
  process.thread.Ext.call_stack_summary : ("*kernelbase.dll|system.dll*", "*kernelbase.dll|Unknown*", "*kernelbase.dll|Unbacked*")]
'''

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 = "T1055"
name = "Process Injection"
reference = "https://attack.mitre.org/techniques/T1055/"


[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"

[internal]
min_endpoint_version = "8.8.0"

Stages and Predicates

Ordered sequence: each step below must occur in order within 1m, correlated by process.entity_id.

Stage 1: library

[library where dll.path : "?:\\users\\*\\appdata\\local\\temp\\ns*.tmp\\system.dll" and not process.code_signature.status : "trusted"]

Stage 2: api

[api where 
  process.Ext.api.name : ("VirtualAlloc*", "MapViewOfFile*") and process.Ext.api.parameters.protection : "RWX" and process.Ext.api.parameters.size >= 10000 and 
  process.thread.Ext.call_stack_summary : ("*kernelbase.dll|system.dll*", "*kernelbase.dll|Unknown*", "*kernelbase.dll|Unbacked*")]

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.code_signature.statuseqtrustedexcludes:process.code_signature.status field:"process.code_signature.status" value:"trusted"

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
dll.pathwildcard
  • ?:\users\*\appdata\local\temp\ns*.tmp\system.dll
field:"ImageLoaded" kind:wildcard value:"?:\users\*\appdata\local\temp\ns*.tmp\system.dll"
process.Ext.api.namewildcard
  • MapViewOfFile* corpus 5 (elastic 5)
  • VirtualAlloc* corpus 4 (elastic 4)
field:"process.Ext.api.name" kind:wildcard
process.Ext.api.parameters.protectionwildcard
  • RWX corpus 4 (elastic 4)
field:"process.Ext.api.parameters.protection" kind:wildcard value:"RWX"
process.Ext.api.parameters.sizege
  • 10000 transforms: number corpus 11 (elastic 11)
field:"process.Ext.api.parameters.size" kind:ge value:"10000"
process.thread.Ext.call_stack_summarywildcard
  • *kernelbase.dll|Unbacked*
  • *kernelbase.dll|Unknown*
  • *kernelbase.dll|system.dll*
field:"process.thread.Ext.call_stack_summary" kind:wildcard