Detection rules › Elastic
Suspicious Curl Execution via NodeJS
Identifies the execution of the CURL utility from a NodeJS script interpreter. This may indicate an attempt to transfer tools via a malicious JavaScript file.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Command & Control |
Telemetry coverage
Rule body
[rule]
description = """
Identifies the execution of the CURL utility from a NodeJS script interpreter. This may indicate an attempt to transfer
tools via a malicious JavaScript file.
"""
id = "04dc5f8a-8c12-412a-86ca-ef4f2b024531"
license = "Elastic License v2"
name = "Suspicious Curl Execution via NodeJS"
os_list = ["macos", "windows"]
reference = [
"https://www.elastic.co/blog/shai-hulud-worm-npm-supply-chain-compromise",
"https://socket.dev/blog/shai-hulud-strikes-again-v2",
]
version = "1.0.2"
query = '''
process where event.action in ("start", "exec") and
process.parent.name in ("node.exe", "node", "bun", "bun.exe") and
process.name in ("curl", "curl.exe") and process.args in ("-o", "--output") and process.args like "http*" and
process.parent.command_line : "*node_modules*.js*" and not process.command_line : ("*://localhost*", "*://127.0.0.1*")
'''
min_endpoint_version = "7.15.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.007"
name = "JavaScript"
reference = "https://attack.mitre.org/techniques/T1059/007/"
[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1105"
name = "Ingress Tool Transfer"
reference = "https://attack.mitre.org/techniques/T1105/"
[threat.tactic]
id = "TA0011"
name = "Command and Control"
reference = "https://attack.mitre.org/tactics/TA0011/"
[internal]
min_endpoint_version = "7.15.0"
Stages and Predicates
Stage 1: process
process where event.action in ("start", "exec") and
process.parent.name in ("node.exe", "node", "bun", "bun.exe") and
process.name in ("curl", "curl.exe") and process.args in ("-o", "--output") and process.args like "http*" and
process.parent.command_line : "*node_modules*.js*" and not process.command_line : ("*://localhost*", "*://127.0.0.1*")
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.command_line | match | ://localhost, ://127.0.0.1 | excludes:process.command_line field:"process.command_line" value:"://localhost" field:"process.command_line" value:"://127.0.0.1" |
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | in |
| field:"EventType" kind:in |
process.args | in |
| field:"process.args" kind:in |
process.args | wildcard |
| field:"process.args" kind:wildcard value:"http*" |
process.name | in |
| field:"process_name" kind:in |
process.parent.command_line | wildcard |
| field:"ParentCommandLine" kind:wildcard value:"*node_modules*.js*" |
process.parent.name | in |
| field:"parent_process_name" kind:in |