T09 · Insecure Skill Coding Practices
Error
- Location
- SKILL.md:527
- Finding
- Webhook-Controlled Command Injection in n8n Workflow## Vulnerability Details **File Location**: `SKILL.md`, lines 527–529 **Vulnerability Type**: OS command injection through unsafe template interpolation **Risk Level**: High ### Vulnerable Code ```yaml - convert_model: node: Execute Command command: | "C:\DDC\RvtExporter.exe" "{{$json.model_path}}" complete bbox schedule ``` ### Technical Analysis The n8n workflow receives requests through the `/qto-extract` webhook and directly interpolates the request-controlled `model_path` value into a command executed by a shell. Surrounding the value with double quotes does not provide adequate protection: an attacker may inject a closing quote and shell control characters, causing the shell to interpret additional commands. The documented workflow does not authenticate the webhook, canonicalize the supplied path, enforce an approved model directory, restrict the filename extension, reject shell metacharacters, or pass the converter arguments through a non-shell process API. ### Attack Path 1. An attacker sends a request to the `/qto-extract` webhook. 2. The request places a malicious string in `model_path`, containing a closing quote followed by shell command syntax. 3. n8n substitutes the value into the `Execute Command` node. 4. The operating-system shell parses both the intended converter invocation and the injected command. 5. The injected command executes with the privileges of the n8n service account. ### Impact Assessment Successful exploitation permits arbitrary command execution under the n8n process identity. Depending on that account's permissions, an attacker could read or alter BIM models and reports, access other files available to the service, execute programs, manipulate workflow data, or use the host as a foothold for further compromise. The scope is not necessarily administrative, but it includes all resources available to the n8n service account.
- Remediation
- ## Remediation Suggestions - Do not interpolate webhook input into an `Execute Command` shell string. - Invoke the converter through a process API or dedicated n8n integration that passes executable arguments as a structured array without a shell. - Canonicalize the requested path and verify that it remains under a dedicated, approved model directory. - Enforce a strict extension allowlist, such as `.rvt`, and reject unexpected control characters, quotes, separators, and null bytes. - Require authentication and authorization for the webhook. - Run n8n and the converter under a dedicated least-privileged service account. - Restrict filesystem access to the model input and report output directories. - Record and monitor rejected paths and converter executions. - If shell execution cannot be eliminated, use platform-appropriate robust escaping in addition to the allowlist and directory checks; escaping alone should not be the primary defense.
