Summary
An expression injection vulnerability in n8n link preview rendering allows a stored field value to be interpreted as JavaScript when another user opens an affected node in the editor. An authenticated member may exploit this behavior to execute script in a victim's authenticated session, depending on the victim's access and the rendered node context.
Affected context
The vulnerability occurs in n8n editor rendering for resource-locator fields that generate link previews from stored values. It becomes risky when the field value is controlled by an authenticated member and is inserted directly into a node type's URL template without recognizing or neutralizing expression syntax before the preview is rendered.
Exploit preconditions
- Attack surface: n8n editor link preview rendering for resource-locator fields
- Required access: Authenticated member access sufficient to store or modify an affected field value
- Trigger point: Another authenticated user opens the affected node in the editor
- Why exploitation is possible: The stored value is incorporated into a URL template without adequate expression-syntax handling, allowing injected expressions to be evaluated in the victim's session
Why this happens
The underlying flaw is insufficient separation between user-controlled data and executable expression syntax. The editor directly splices a stored resource-locator value into a node-specific URL template, allowing expression markers within that value to be interpreted during rendering. This behavior maps to CWE-94: Improper Control of Generation of Code, because data supplied through a field can influence code-like evaluation rather than remaining inert content.
Potential impact
- An attacker may execute JavaScript in another user's authenticated editor session
- A victim's accessible data or actions could be exposed or misused
- An attacker could perform unauthorized operations available to the victim
- Session-associated information could be accessed, depending on browser and application controls
- Additional users or workflows could be targeted through shared or commonly opened nodes
General mitigation guidance
Mitigation generally focuses on preserving a strict boundary between stored values, URL templates, and executable expressions.
Common defensive patterns include:
- Treating resource-locator values as inert data during preview generation
- Avoiding direct interpolation of user-controlled values into expression-bearing templates
- Using context-aware escaping and narrowly scoped URL construction APIs
- Applying explicit allowlists for supported URL schemes and template components
- Separating preview rendering from privileged workflow or editor operations
- Limiting editor and workflow privileges according to user roles
- Requiring revalidation when stored values are rendered in a different security context
How teams detect issues like this
Organizations can look for this class of issue through:
- Static analysis rules that identify user-controlled values concatenated with executable templates
- Code review checks for dynamic expression evaluation in rendering or preview paths
- Tests containing expression markers and special characters in resource-locator fields
- Browser security monitoring for unexpected script execution during editor navigation
- Policy enforcement requiring context-aware escaping and approved URL-construction utilities
- Automated code review tools that flag data-to-code flows across authentication boundaries

