Remediation Guide · N8N001–N8N006 · 0-Upload Scanner

How to Fix Unauthenticated n8n Webhooks & Execute Command RCE (N8N001–N8N006)

A single public n8n Webhook with authentication: "none" chained to an Execute Command node turns a workflow into unauthenticated remote code execution. Audit and harden your *.n8n.json locally below with 0 bytes uploaded.

Audit n8n Workflow (0 Upload) Pro Solo $29 → Pro Team (10 seats) — $49 Free .vsix (156 KB)

100% client-side AST engine · 0 bytes sent · One-time Polar.sh license (no subscription) unlocks all 72 rules + CI SARIF 2.1.0.

Vulnerable vs. Hardened n8n Workflow JSON (Before & After)

Compare an exposed webhook + shell injection chain against a hardened workflow using headerAuth, typed HTTP API calls, strict TLS validation, credential store references, and an explicit errorWorkflow.

VULNERABLE — customer-sync.n8n.json N8N001, N8N002, N8N004, N8N005, N8N006
{
  "settings": { "saveDataErrorExecution": "none" },
  "nodes": [
    {
      "type": "n8n-nodes-base.webhook",
      "parameters": {
        "path": "customer-sync",
        "authentication": "none",
        "options": { "allowedOrigins": "*" }
      }
    },
    {
      "type": "n8n-nodes-base.executeCommand",
      "parameters": {
        "command": "=/usr/local/bin/sync.sh {{ $json.customerId }}"
      }
    },
    {
      "type": "n8n-nodes-base.httpRequest",
      "parameters": {
        "url": "http://billing.internal/charge",
        "allowUnauthorizedCerts": true,
        "headerParameters": {
          "parameters": [
            { "name": "Authorization", "value": "Bearer demo_hardcoded_billing_token_8a7b6c5d" }
          ]
        }
      }
    }
  ]
}
HARDENED — customer-sync.n8n.json 0 Critical Findings
{
  "settings": {
    "errorWorkflow": "wf-ops-alerting-01",
    "executionTimeout": 120,
    "saveDataErrorExecution": "all"
  },
  "nodes": [
    {
      "type": "n8n-nodes-base.webhook",
      "parameters": {
        "path": "customer-sync",
        "authentication": "headerAuth",
        "options": { "allowedOrigins": "https://app.example.com" }
      },
      "credentials": { "httpHeaderAuth": { "id": "cred-wh-1", "name": "Webhook Secret" } }
    },
    {
      "type": "n8n-nodes-base.httpRequest",
      "retryOnFail": true,
      "parameters": {
        "url": "https://billing.internal.example/api/charge",
        "authentication": "predefinedCredentialType",
        "allowUnauthorizedCerts": false,
        "options": { "timeout": 10000 }
      }
    }
  ]
}

Audit Your *.n8n.json Locally (All 20 n8n Rules)

100% in-browser · 0 bytes sent · < 10 ms

Paste any exported n8n workflow JSON below to detect unauthenticated webhooks, Execute Command RCE, hardcoded Bearer tokens, TLS bypasses, and missing reliability guardrails locally in your browser.

Enforce all 20 n8n rules + 52 MCP/Docker/Proxy rules in IDE & CI Unlock StackGuard Pro once via Polar.sh (zero subscription) for stackguard-cli, SARIF 2.1.0, and SHA-256 sealed SOC 2 / ISO 27001 / DORA compliance reports.

Exact Remediation Reference: Rules N8N001–N8N006

Rule ID Severity Vulnerability & CWE Exact Fix
N8N001 CRITICAL
Unauthenticated n8n Webhook trigger
CWE-306SOC 2 CC6.1DORA Art. 9(4)
Set authentication to headerAuth, jwtAuth, or basicAuth backed by n8n Credentials, plus HMAC verification for third-party webhooks.
N8N002 CRITICAL
Command injection in n8n Execute Command node
CWE-78SOC 2 CC6.6DORA Art. 9(2)
Remove {{ $json.* }} interpolation from shell strings. Prefer native API/HTTP nodes or validate inputs strictly against an alphanumeric regex.
N8N003 CRITICAL
Dangerous dynamic execution in n8n Code/Function node
CWE-95SOC 2 CC6.1ISO A.8.28
Eliminate eval(), new Function(), and child_process imports in Code nodes; set NODE_FUNCTION_ALLOW_BUILTIN="" in Docker env.
N8N004 HIGH
TLS certificate verification disabled (allowUnauthorizedCerts)
CWE-295SOC 2 CC6.7ISO A.8.24
Set allowUnauthorizedCerts: false and mount your internal CA certificate via NODE_EXTRA_CA_CERTS instead of disabling TLS validation.
N8N005 CRITICAL
Hardcoded API key or Bearer token in n8n workflow JSON
CWE-798SOC 2 CC6.1DORA Art. 9(4)
Move all API keys and Bearer tokens into n8n encrypted Credentials (protected by N8N_ENCRYPTION_KEY) so exports never expose plaintext secrets.
N8N006 MEDIUM
Missing errorWorkflow in n8n workflow settings
CWE-755SOC 2 CC7.2DORA Art. 17
Configure a dedicated settings.errorWorkflow that sends failed execution alerts to Slack, PagerDuty, or email alongside executionTimeout.

Frequently Asked Questions

How do I secure an n8n Webhook trigger without breaking third-party callers?

Use headerAuth or jwtAuth backed by n8n Credentials for internal callers, restrict allowedOrigins, and verify raw-body HMAC signatures for external webhooks (Stripe, Polar.sh, GitHub).

Why is interpolating {{ $json.* }} inside an n8n Execute Command node a critical RCE?

Execute Command invokes a shell; unvalidated JSON fields containing ;, &&, or backticks run arbitrary commands inside the n8n container and can dump N8N_ENCRYPTION_KEY and database credentials.

Does StackGuard upload my exported n8n workflow JSON or credentials?

No. Every check executes inside your browser tab via scanner-bundle.js with zero network calls during scanning.

Need a full self-hosted n8n production architecture?

Pair StackGuard with StackBlueprint for production-hardened Docker Compose, Caddy/Traefik, Postgres, Redis queue-mode, and worker architectures.

Oriancy Local Security Quartet

4 Zero-Upload Scanners · 1 One-Time Bundle
DevSecOps Quartet Bundle — All 4 local CLIs & auditor packs on one-time Polar licenses · oriancy.com