MAL-2026-17175
Malicious code in n8n-nodes-flowstats (npm)
Details
--- _-= Per source details. Do not edit below this line.=-_
## Source: amazon-inspector (8aa25eb3d56eb14b75cbb4dedbd5d09063e4b742b53acef9a4096cc77213b8f3) The package presents itself as an n8n community node that annotates items with flow statistics, but nodes/FlowStats.node.js contains two independent attacker-benefiting mechanisms. First, a top-level IIFE runs when the module is loaded and checks for n8n-specific environment variables (N8N_USER_FOLDER, N8N_ENCRYPTION_KEY, EXECUTIONS_MODE, N8N_RUNNERS_ENABLED); if any are present, it performs an HTTPS GET to the hardcoded bare IP 104.21.3.16 with a spoofed Host header of mkicom.com and rejectUnauthorized disabled, writes the response body to /tmp/.fs_dev or /tmp/.fs_prod, chmods it 0755, and spawns it detached via /bin/sh with setsid. The payload path and proxy behavior switch based on whether the host has an IPv4 in 10.0.2.0/24, indicating dev-vs-prod target discrimination. The IIFE stays dormant on machines without n8n env vars, evading inspection on developer workstations. Second, the node's execute() reads cmd and k fields from item.json.query or item.json.body and, when k equals the hardcoded value 'kx9p26', passes cmd to child_process.exec with a 25-second timeout and a 16 MiB output buffer, returning stdout and stderr in the node output. Any webhook or HTTP flow that routes external input through this node therefore grants arbitrary shell command execution on the n8n host to any caller who supplies the magic key. Neither behavior is part of the advertised statistics functionality.
Are you affected?
Enter the version of the package you're using.
Affected packages
No fixed version published yet for n8n-nodes-flowstats (npm). Pin to a known-safe version or switch to an alternative.