Detection rules › Elastic
Silent NPM Package Install Command
Detects when Node or NPM is used to install a package or packages using options to hide the installation using the following options: "--no-warnings", "--no-progress", and "--loglevel silent". Malicious packages will install required dependencies in order to function and will use these options in order to hide it from the user.
MITRE ATT&CK coverage
Rule body
[rule]
description = """
Detects when Node or NPM is used to install a package or packages using options to hide the installation using the
following options: "--no-warnings", "--no-progress", and "--loglevel silent". Malicious packages will install required
dependencies in order to function and will use these options in order to hide it from the user.
"""
id = "539488cc-baf9-465f-9700-f978b93b3f62"
license = "Elastic License v2"
name = "Silent NPM Package Install Command"
os_list = ["linux", "macos"]
reference = ["https://jp.security.ntt/tech_blog/contagious-interview-ottercookie"]
version = "1.0.3"
query = '''
process where event.type == "start" and process.name in ("node", "npm", "npx") and
process.args in ("install", "i", "in", "ins", "inst", "instal", "add", "isnt", "isnta", "isntal", "isntall") and
process.args == "--no-save" and
process.args == "--no-progress" and
((process.args == "--loglevel" and process.args == "silent") or
(process.args in ("-s", "--silent")))
'''
min_endpoint_version = "8.11.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 = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[threat.technique.subtechnique]]
id = "T1059.003"
name = "Windows Command Shell"
reference = "https://attack.mitre.org/techniques/T1059/003/"
[[threat.technique.subtechnique]]
id = "T1059.004"
name = "Unix Shell"
reference = "https://attack.mitre.org/techniques/T1059/004/"
[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[internal]
min_endpoint_version = "8.11.0"
Stages and Predicates
Stage 1: process
process where event.type == "start" and process.name in ("node", "npm", "npx") and
process.args in ("install", "i", "in", "ins", "inst", "instal", "add", "isnt", "isnta", "isntal", "isntall") and
process.args == "--no-save" and
process.args == "--no-progress" and
((process.args == "--loglevel" and process.args == "silent") or
(process.args in ("-s", "--silent")))
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.args | eq |
| field:"process.args" kind:eq |
process.args | in |
| field:"process.args" kind:in |
process.name | in |
| field:"process_name" kind:in |