Detection rules › Elastic

Nodejs Initial Access via VSCode Auto-run Task

Time window
20s
Sequence by
process.entity_id, process.parent.entity_id
Source
github.com/elastic/protections-artifacts

Detects when VSCode spawns Node.js in order to execute a JavaScript file, via an auto-run task, that results in an immediate outbound network connection. This technique has been observed in DPRK-attributed malware campaigns targeting developers.

MITRE ATT&CK coverage

Telemetry coverage

Rule body

[rule]
description = """
Detects when VSCode spawns Node.js in order to execute a JavaScript file, via an auto-run task, that results in an
immediate outbound network connection. This technique has been observed in DPRK-attributed malware campaigns targeting
developers.
"""
id = "cfe9e0b1-bee9-4cdf-9b25-d8f2d72f0056"
license = "Elastic License v2"
name = "Nodejs Initial Access via VSCode Auto-run Task"
os_list = ["macos"]
reference = ["https://kl4r10n.tech/blog/dprk-new-malware"]
version = "1.0.1"

query = '''
sequence with maxspan=20s
[process where event.type == "start" and event.action == "exec" and process.name == "node" and
  process.args_count == 2 and process.parent.name == "Code Helper" and
  process.parent.code_signature.team_id == "UBF8T346G9"] by process.entity_id
[network where event.type == "start" and process.name == "node"] by process.parent.entity_id
'''

min_endpoint_version = "8.16.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0

[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1195"
name = "Supply Chain Compromise"
reference = "https://attack.mitre.org/techniques/T1195/"
[[threat.technique.subtechnique]]
id = "T1195.001"
name = "Compromise Software Dependencies and Development Tools"
reference = "https://attack.mitre.org/techniques/T1195/001/"



[threat.tactic]
id = "TA0001"
name = "Initial Access"
reference = "https://attack.mitre.org/tactics/TA0001/"
[[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.16.0"

Stages and Predicates

Ordered sequence: each step below must occur in order within 20s, correlated by process.entity_id, process.parent.entity_id.

Stage 1: process

[process where event.type == "start" and event.action == "exec" and process.name == "node" and
  process.args_count == 2 and process.parent.name == "Code Helper" and
  process.parent.code_signature.team_id == "UBF8T346G9"] by process.entity_id

Stage 2: network

[network where event.type == "start" and process.name == "node"] by process.parent.entity_id

Indicators

These rows show field, operator, and value matches.