Detect n8n Improper Control of Dynamically-Managed Code Resources (CVE-2025-68613) in Elastic Security
Detects exploitation of CVE-2025-68613, a critical vulnerability in n8n workflow automation platform where improper control of dynamically-managed code resources (CWE-913) allows attackers to execute arbitrary code. This vulnerability is actively exploited in the wild (CISA KEV). Attackers can abuse n8n's Code node or expression evaluation engine to break out of intended sandboxing and execute arbitrary system commands on the underlying host.
MITRE ATT&CK
- Tactic
- Execution Lateral Movement Impact
Elastic Detection Query
sequence by host.id with maxspan=2m
[process where event.type == "start"
and (process.name like~ "node" or process.name like~ "node.exe")
and process.command_line like~ "*n8n*"
] by process.entity_id
[process where event.type == "start"
and process.parent.name like~ "node"
and (
process.name in~ ("sh", "bash", "dash", "zsh", "cmd.exe", "powershell.exe", "pwsh.exe",
"wget", "curl", "python", "python3", "perl", "ruby", "nc", "ncat")
or process.command_line like~ "*whoami*"
or process.command_line like~ "*/etc/passwd*"
or process.command_line like~ "*base64*"
or process.command_line like~ "*chmod +x*"
or process.command_line like~ "*net user*"
)
] by process.parent.entity_id EQL sequence rule detecting n8n parent process followed within 2 minutes by suspicious child process execution, indicating potential CVE-2025-68613 exploitation via the dynamic code execution vulnerability.
Data Sources
Required Tables
False Positives & Tuning
- Authorized n8n Code nodes that intentionally spawn shell processes
- n8n workflow automation legitimately invoking Python scripts for data transformation
- Infrastructure automation n8n instances managing deployment pipelines
- Development environments running n8n with debugging tools
Other platforms for CVE-2025-68613
Testing Methodology
Validate this detection against 4 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.
- Test 1n8n Code Node Shell Command Execution
Expected signal: Sysmon Event ID 1 showing node process spawning sh or bash child process with command arguments containing 'id', 'whoami', 'hostname'
- Test 2n8n Expression Evaluator File Write to Temp Directory
Expected signal: Sysmon Event ID 11 (FileCreate) showing node process creating a .sh file in /tmp, followed by Event ID 1 showing chmod +x execution
- Test 3n8n Code Node Reverse Shell Simulation (Netcat)
Expected signal: Sysmon Event ID 1 showing node.js spawning nc/ncat process with -e flag and IP/port arguments; Sysmon Event ID 3 showing network connection from node process to 127.0.0.1:4444
- Test 4n8n Credential Exfiltration Simulation via HTTP
Expected signal: Sysmon Event ID 1 showing node spawning bash then curl with base64-encoded data arguments; Sysmon Event ID 3 showing network connection from curl to external host on port 9999
Unlock Pro Content
Get the full detection package for CVE-2025-68613 including response playbook, investigation guide, and atomic red team tests.