Summary
A path traversal vulnerability in the n8n SQLite node allows database file paths to be supplied through workflow expressions derived from untrusted input. In affected workflows, an attacker may cause the n8n process to open, read from, create, or overwrite SQLite or other files outside the intended database directory.
Affected context
The issue occurs when the SQLite node accepts a database path through a data expression and that expression can be influenced by untrusted workflow input. Risk is highest when a workflow is remotely reachable, processes attacker-controlled values, and the n8n process has access to sensitive or writable files beyond the intended database location.
Exploit preconditions
- Attack surface: An n8n workflow using the SQLite node with a configurable database path
- Required access: Ability to submit or influence input consumed by the workflow; the workflow author must have mapped that input to
db_path - Trigger point: SQLite node execution when the supplied path is opened by the n8n process
- Why exploitation is possible: The path is evaluated from untrusted workflow data without sufficient restriction to an approved database directory
- Environmental dependency: The targeted files must be accessible or writable by the n8n process
Why this happens
The underlying bug is insufficient validation and confinement of a filesystem path derived from untrusted input. A node parameter intended to identify a local SQLite database accepts dynamic expressions without reliably enforcing an allowed base directory or rejecting traversal components. This behavior maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, because attacker-influenced path data can escape the intended filesystem boundary.
Potential impact
- An attacker may read sensitive SQLite databases or other accessible files.
- An attacker could create or overwrite files writable by the n8n process.
- Workflow data, credentials, or application state may be exposed or modified.
- File manipulation could cause denial of service or workflow disruption.
- A subsequent vulnerability or unsafe file-loading behavior could increase the impact.
General mitigation guidance
Mitigation generally focuses on removing attacker control over filesystem locations and enforcing filesystem boundaries.
Common defensive patterns include:
- Resolve database paths against a fixed, approved directory and reject paths that escape it.
- Prefer server-side database identifiers or an allowlist over arbitrary path parameters.
- Treat workflow expressions and upstream values as untrusted, even when they originate within a trusted workflow.
- Validate canonical paths before opening files and reject traversal, absolute-path, and unexpected-link cases.
- Run n8n with least-privilege filesystem permissions and isolate workflow data from sensitive host files.
- Use dedicated storage locations and restrict write access to only the files required by the node.
How teams detect issues like this
Detection can combine source review, runtime monitoring, and policy enforcement:
- Use static analysis to identify filesystem APIs receiving values from workflow expressions or request-derived data.
- Review node parameters that permit dynamic path expressions, especially those passed to database-opening or file-writing APIs.
- Add tests for traversal sequences, absolute paths, symbolic-link escapes, and paths outside the approved directory.
- Monitor n8n processes for unexpected file access, creation, or modification outside designated workflow storage.
- Enforce organization-wide policies that prohibit arbitrary filesystem paths in remotely influenced workflow inputs.
- Automated code review and dependency scanning tools may help identify path-construction and boundary-validation weaknesses.

