Detection rules › Elastic

Node.js execution followed by network activity

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

Identifies attempts to execute JavaScript using the Node.js module followed by network connection. Adversaries may abuse this utility to execute malicious JavaScript.

MITRE ATT&CK coverage

Rule body

[rule]
description = """
Identifies attempts to execute JavaScript using the Node.js module followed by network connection. Adversaries may abuse
this utility to execute malicious JavaScript.
"""
id = "e22838d1-b241-4d77-9a00-ca316531cc82"
license = "Elastic License v2"
name = "Node.js execution followed by network activity"
os_list = ["windows"]
reference = ["https://nodejs.org"]
version = "1.0.8"

query = '''
sequence by process.entity_id with maxspan=1m
[process where event.action == "start" and
 (process.Ext.relative_file_creation_time <= 500 or process.Ext.relative_file_name_modify_time <= 500) and
 process.parent.name : ("wscript.exe", "powershell.exe") and
 (process.name : "node.exe" or process.pe.original_file_name == "node.exe" or process.code_signature.subject_name == "OpenJS Foundation") and
 not process.args : ("install", "--prefer-offline", "run-driver") and not process.parent.name : "node.exe" and
 not process.executable :
            ("?:\\Program Files\\*.exe",
             "?:\\Program Files (x86)\\*.exe",
             "?:\\Windows\\Prey\\versions\\*\\bin\\node.exe") and
 not (process.code_signature.subject_name in ("Western Union Holdings Inc.", "Autodesk, Inc.", "Tobii AB") and process.code_signature.trusted == true) and
 not process.hash.sha256 in ("767c9498a55e9a093c75761c69996360b73b19a0d43b68f92a8eaccc6079f666", "80eafa18b85001b1773471414150c96ad52e0dd6985a4c25d7d5083fb04ae4fd")]
[dns where event.action == "lookup_requested" and
 not dns.question.name in ("nodejs.org", "localhost", "fonts.googleapis.com", "www.google-analytics.com", "api2.cursor.sh", "registry.npmjs.org", "api.anthropic.com", "versions-prod.lmstudio.ai") and
 not (process.executable : "D:\\Azure-BuildAgent*\\node.exe" and dns.question.name : "proxy4zscaler.*.ch")]
'''

min_endpoint_version = "8.10.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0
tree = true

[[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.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.10.0"

Stages and Predicates

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

Stage 1: process

[process where event.action == "start" and
 (process.Ext.relative_file_creation_time <= 500 or process.Ext.relative_file_name_modify_time <= 500) and
 process.parent.name : ("wscript.exe", "powershell.exe") and
 (process.name : "node.exe" or process.pe.original_file_name == "node.exe" or process.code_signature.subject_name == "OpenJS Foundation") and
 not process.args : ("install", "--prefer-offline", "run-driver") and not process.parent.name : "node.exe" and
 not process.executable :
            ("?:\\Program Files\\*.exe",
             "?:\\Program Files (x86)\\*.exe",
             "?:\\Windows\\Prey\\versions\\*\\bin\\node.exe") and
 not (process.code_signature.subject_name in ("Western Union Holdings Inc.", "Autodesk, Inc.", "Tobii AB") and process.code_signature.trusted == true) and
 not process.hash.sha256 in ("767c9498a55e9a093c75761c69996360b73b19a0d43b68f92a8eaccc6079f666", "80eafa18b85001b1773471414150c96ad52e0dd6985a4c25d7d5083fb04ae4fd")]

Stage 2: dns

[dns where event.action == "lookup_requested" and
 not dns.question.name in ("nodejs.org", "localhost", "fonts.googleapis.com", "www.google-analytics.com", "api2.cursor.sh", "registry.npmjs.org", "api.anthropic.com", "versions-prod.lmstudio.ai") and
 not (process.executable : "D:\\Azure-BuildAgent*\\node.exe" and dns.question.name : "proxy4zscaler.*.ch")]

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.code_signature.subject_nameinAutodesk, Inc., Tobii AB, Western Union Holdings Inc.excludes:process.code_signature.subject_name field:"process.code_signature.subject_name" value:"Autodesk, Inc." field:"process.code_signature.subject_name" value:"Tobii AB" field:"process.code_signature.subject_name" value:"Western Union Holdings Inc."
process.code_signature.trustedeqtrueexcludes:process.code_signature.trusted field:"process.code_signature.trusted" value:"true"
process.argseqinstall, --prefer-offline, run-driverexcludes:process.args field:"process.args" value:"install" field:"process.args" value:"--prefer-offline" field:"process.args" value:"run-driver"
process.executablewildcard?:\Program Files\*.exe, ?:\Program Files (x86)\*.exe, ?:\Windows\Prey\versions\*\bin\node.exeexcludes:process.executable field:"process.executable" value:"?:\Program Files\*.exe" field:"process.executable" value:"?:\Program Files (x86)\*.exe" field:"process.executable" value:"?:\Windows\Prey\versions\*\bin\node.exe"
process.hash.sha256in767c9498a55e9a093c75761c69996360b73b19a0d43b68f92a8eaccc6079f666, 80eafa18b85001b1773471414150c96ad52e0dd6985a4c25d7d5083fb04ae4fdexcludes:process.hash.sha256 field:"process.hash.sha256" value:"767c9498a55e9a093c75761c69996360b73b19a0d43b68f92a8eaccc6079f666" field:"process.hash.sha256" value:"80eafa18b85001b1773471414150c96ad52e0dd6985a4c25d7d5083fb04ae4fd"
process.parent.nameeqnode.exeexcludes:process.parent.name field:"process.parent.name" value:"node.exe"
dns.question.namewildcardproxy4zscaler.*.chexcludes:dns.question.name field:"dns.question.name" value:"proxy4zscaler.*.ch"
process.executablewildcardD:\Azure-BuildAgent*\node.exeexcludes:process.executable field:"process.executable" value:"D:\Azure-BuildAgent*\node.exe"
dns.question.nameinapi.anthropic.com, api2.cursor.sh, fonts.googleapis.com, localhost, nodejs.org, registry.npmjs.org, versions-prod.lmstudio.ai, www.google-analytics.comexcludes:dns.question.name

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • lookup_requested corpus 8 (elastic 8)
  • start corpus 391 (elastic 391)
field:"EventType" kind:eq
process.Ext.relative_file_creation_timele
  • 500 transforms: number corpus 28 (elastic 28)
field:"process.Ext.relative_file_creation_time" kind:le value:"500"
process.Ext.relative_file_name_modify_timele
  • 500 transforms: number corpus 21 (elastic 21)
field:"process.Ext.relative_file_name_modify_time" kind:le value:"500"
process.code_signature.subject_nameeq
  • OpenJS Foundation corpus 3 (elastic 3)
field:"Signature" kind:eq value:"OpenJS Foundation"
process.namewildcard
  • node.exe corpus 6 (elastic 6)
field:"process_name" kind:wildcard value:"node.exe"
process.parent.namewildcard
  • powershell.exe corpus 39 (elastic 36, kusto 2, splunk 1)
  • wscript.exe corpus 24 (elastic 23, splunk 1)
field:"parent_process_name" kind:wildcard
process.pe.original_file_nameeq
  • node.exe corpus 7 (elastic 4, sigma 3)
field:"OriginalFileName" kind:eq value:"node.exe"