Back to skill

Security audit

N8n 1.0.2

Security checks for vulnerabilities and agentic risk

Overview

This n8n skill mostly matches its stated purpose, but it needs review because it can change or trigger automations and has weak safeguards around API-key use.

Review before installing. Use a least-privilege n8n API key, configure only an HTTPS n8n base URL you control, avoid storing the key in synced dotfiles when possible, and require explicit human approval before activating, deactivating, deleting, or manually executing workflows because those actions may affect connected systems.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
Findings (2)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/n8n_api.py:19
Finding
API Key Exposure Through Unvalidated Transport and Redirects<![CDATA[ ## Vulnerability Details **File Location**: `scripts/n8n_api.py`, lines 19-34 **Vulnerability Type**: Unvalidated endpoint and insecure credential transmission **Risk Level**: High ### Vulnerable Code ```python def __init__(self, base_url: str = None, api_key: str = None): self.base_url = base_url or os.getenv('N8N_BASE_URL') self.api_key = api_key or os.getenv('N8N_API_KEY') if not self.api_key: raise ValueError("N8N_API_KEY not found in environment") self.session = requests.Session() self.session.headers.update({ 'X-N8N-API-KEY': self.api_key, 'Accept': 'application/json', 'Content-Type': 'application/json' }) def _request(self, method: str, endpoint: str, **kwargs) -> Dict[str, Any]: """Make API request""" url = f"{self.base_url}/api/v1/{endpoint.lstrip('/')}" response = self.session.request(method, url, **kwargs) ``` ### Technical Analysis The client obtains `N8N_BASE_URL` from an environment variable without validating its scheme, hostname, port, or embedded credentials. It then places the n8n API key in a persistent session header and sends requests to the resulting URL. Consequently, an `http://` base URL causes the API key and API traffic to be transmitted without transport encryption. An attacker able to observe or modify the network path could capture the key or alter API responses. The `requests` library also follows redirects by default. Because the API key is stored in the custom `X-N8N-API-KEY` session header, a redirect may cause sensitive credentials to cross the originally configured trust boundary. The implementation does not disable redirects or verify that redirect destinations retain the expected HTTPS scheme and trusted origin. ### Attack Path 1. A user configures an HTTP n8n URL, or an attacker modifies the `N8N_BASE_URL` environment variable. 2. The client constructs an API URL directly from that value. 3. The client attaches the `X-N8N-API-KE ...[truncated 1038 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Parse the configured URL with `urllib.parse.urlparse`. 2. Require the `https` scheme and reject HTTP, non-network schemes, embedded credentials, malformed hosts, and unexpected ports. 3. Maintain an allowlist of trusted n8n hostnames where deployment constraints permit it. 4. Disable automatic redirects for authenticated requests: ```python response = self.session.request( method, url, allow_redirects=False, timeout=(5, 30), **kwargs, ) ``` 5. If redirects are operationally required, follow them manually only after confirming that the destination uses HTTPS and has exactly the expected trusted origin. 6. Avoid attaching the API key as a global session header when redirect behavior cannot be tightly controlled. Add it only after destination validation. 7. Add tests covering HTTP URLs, cross-origin redirects, HTTPS-to-HTTP redirects, embedded URL credentials, malformed URLs, and unexpected hosts. 8. Use a narrowly scoped n8n API key and rotate it immediately if it may have been transmitted through an untrusted endpoint. ]]>

T08 · Insecure Dependencies

Warning
Location
requirements.txt:1
Finding
Unpinned Third-Party Dependency Permits Non-Reproducible Installation<![CDATA[ ## Vulnerability Details **File Location**: `requirements.txt`, line 1 **Vulnerability Type**: Unpinned dependency and supply-chain exposure **Risk Level**: Medium ### Vulnerable Code ```text requests>=2.28.0 ``` The documented installation procedure executes: ```bash pip install -r requirements.txt ``` ### Technical Analysis The lower-bound-only constraint permits installation of any current or future `requests` release satisfying the specified minimum version. Transitive dependencies are also not locked, and no package hashes are supplied. As a result, separate installations can resolve to different dependency versions. The project cannot reliably verify that installed artifacts are the same versions reviewed or tested by its maintainers. If a permitted package release or package-index account is compromised, a malicious release satisfying the version range could be selected during installation. This finding does not establish that the current `requests` package is malicious. It identifies the absence of controls that constrain and authenticate the dependency set. ### Attack Path 1. An attacker compromises a package release, publishing account, package index, or dependency distribution channel used by the installation environment. 2. A malicious version satisfying `requests>=2.28.0`, or a malicious compatible transitive dependency, becomes available. 3. A user follows the documented setup procedure and runs `pip install -r requirements.txt`. 4. Dependency resolution selects the compromised version because no exact version or artifact hash is required. 5. Malicious package installation or runtime code executes with the privileges of the user running the setup or n8n client. 6. That code may access the process environment, including `N8N_API_KEY`, or modify behavior and files available to that user. ### Impact Assessment A compromised dependency executes within the Python process and therefore receives the same operating-system privileges a ...[truncated 451 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Pin `requests` to a reviewed exact version rather than using an open-ended lower bound. 2. Generate a lock file that records exact versions of all transitive dependencies. 3. Require cryptographic hashes for downloaded artifacts, for example by using a hash-locked requirements file with `pip install --require-hashes`. 4. Obtain packages only from a trusted, explicitly configured package index. 5. Integrate dependency vulnerability and provenance scanning into release and update workflows. 6. Review and deliberately update locked dependencies on a scheduled basis so that security patches are adopted without allowing uncontrolled future versions. 7. Perform installation in an isolated virtual environment under a non-privileged account, as already suggested by the project documentation. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (13)

Tool Parameter Abuse

High
Category
Tool Misuse
Content
#### Delete Workflow
```
DELETE /workflows/{id}
```

### Executions
Confidence
80% confidence
Finding
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Tool Parameter Abuse

High
Category
Tool Misuse
Content
#### Delete Execution
```
DELETE /executions/{id}
```

#### Manual Execution
Confidence
80% confidence
Finding
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Lp3

Medium
Category
MCP Least Privilege
Confidence
88% confidence
Finding
The skill exposes capabilities that rely on environment variables and outbound network access, but it does not declare any explicit tool scope or permissions boundary. That omission increases the chance an agent can use the skill with broader-than-expected access, making credential use and remote API actions less transparent and harder to govern.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The documentation encourages activating, deactivating, and manually executing workflows without warning about production impact, downstream side effects, or the need for operator confirmation. In an automation platform, these actions can send emails, modify data, trigger integrations, or disrupt critical business processes, so omitting safety guidance materially increases operational risk.

Missing User Warnings

Medium
Confidence
92% confidence
Finding
This markdown file documents irreversible delete operations (`DELETE /workflows/{id}`) without warning that they can remove user data or require care before use. Under the markdown-specific warning criteria, destructive behaviors that affect user data or system integrity should be accompanied by an explicit warning.

Missing User Warnings

Medium
Confidence
90% confidence
Finding
The reference includes `DELETE /executions/{id}` but does not warn users that deleting execution records may permanently remove audit or run-history data. For markdown skill documentation, omission of warnings around destructive actions affecting user data is a reportable issue.

Missing User Warnings

Medium
Confidence
84% confidence
Finding
The skill documents manual workflow execution but provides no warning that triggering a workflow can cause real side effects such as sending messages, modifying records, or invoking external systems. In the context of an automation platform, encouraging execution without highlighting side effects increases the chance an agent or user will trigger impactful operations unsafely.

Description-Behavior Mismatch

Medium
Confidence
95% confidence
Finding
The script exposes destructive and administrative actions beyond the manifest’s stated scope, including deleting workflows/executions and creating/updating workflows. This mismatch increases the chance that a caller or higher-level agent invokes sensitive operations without appropriate scrutiny, violating least privilege and creating an integrity risk for automation assets.

Missing User Warnings

Medium
Confidence
90% confidence
Finding
The CLI allows activation, deactivation, and manual execution of workflows immediately when called, with no interactive confirmation, warning, dry-run mode, or higher-level safety checks. In an agent skill context, this is more dangerous because automated or prompt-influenced invocations can cause unintended operational changes or trigger downstream side effects in connected systems.

Missing User Warnings

Low
Confidence
87% confidence
Finding
The setup instructions advise storing the n8n API key in shell startup files but do not warn that these files may be broadly readable, long-lived, or inadvertently exposed through backups, dotfile syncing, shell history, or debugging output. This increases the risk of credential leakage and unauthorized access to workflow management APIs.

Unpinned Dependencies

Low
Category
Supply Chain
Content
requests>=2.28.0
Confidence
98% confidence
Finding
The dependency is specified as `requests>=2.28.0`, which permits installation of many future and past versions rather than a reviewed, fixed release. This weakens supply-chain control and reproducibility, and in an automation skill that makes API calls, an affected or behavior-changing version of `requests` could introduce security regressions or break trust assumptions.

Unverifiable Dependency: requests has 16 known advisory(ies) (CVE-2014-1830 (Exposure of Sensitive Information to an Unauthorized Actor in Requests); CVE-2024-47081 (Requests vulnerable to .netrc credentials leak via malicious URLs); CVE-2024-35195 (Requests `Session` object does not verify requests after making first request wi) +13 more), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
95% confidence
Finding
Because `requests` is not pinned, it is impossible to verify from this manifest whether the installed version includes fixes for known advisories affecting the library. In the context of an n8n management skill that likely handles API endpoints, credentials, and workflow data, unresolved `requests` flaws could contribute to credential leakage, insecure request handling, or other client-side security issues depending on the deployed version.

Description-Behavior Mismatch

Low
Confidence
83% confidence
Finding
The module docstring says it manages workflows, executions, and credentials via the n8n REST API, but the manifest description only covers workflows, executions, automation tasks, triggering, and debugging. Even though no credential-management methods appear in this file, the documented intent is broader than the manifest's stated scope.

Static analysis

No suspicious patterns detected.