Suspicious Remote Javascript Evaluation via Nodejs
Description
Detects when Node.js makes an outbound network connection followed immediately by the command line evaluation of JavaScript. Threat actors will host a remote JavaScript payload that will be fetched and executed via the Node.js evaluate flag.
Query · eql
sequence with maxspan=20s
[network where event.action == "connection_attempted" and process.name == "node" and
not (
destination.domain in ("registry.npmjs.org", "classic.yarnpkg.com", "platform.claude.com", "api.anthropic.com", "registry.yarnpkg.com", "api.z.ai",
"telemetry.nuxt.com", "api.fontshare.com", "yarnpkg.com",
"chatgpt.com", "bedrock-runtime.us-east-1.amazonaws.com", "api.business.githubcopilot.com", "generativelanguage.googleapis.com",
"api.deepseek.com", "api.mdintegrations.com", "consent.cookiebot.com", "www.googletagmanager.com",
"codeload.github.com", "api.stripe.com") or
destination.domain like ("telemetry*.elastic.co", "*litellm*")
)] by process.entity_id
[process where event.type == "start" and event.action == "exec" and process.name == "node" and
process.args == "-e" and process.args_count == 3 and
not process.command_line : ("*try*require*postinstall*catch*", "*import*postinstall*catch*",
"*try*require*post-install*catch*", "*import*post-install*catch*")] by process.parent.entity_id