Summary
A path-confinement bypass in n8n's computer-use file-search tool allows crafted search patterns to escape the configured base directory. When an actor can influence search input, the tool may disclose names and contents of local files readable by the daemon's operating-system user.
Affected context
The vulnerability occurs in n8n deployments using the @n8n/computer-use file-search (search_files) tool when its search input can be influenced by an untrusted or insufficiently trusted actor. Risk depends on the configured search directory, the daemon's filesystem permissions, and whether sensitive files are readable by that operating-system account.
Exploit preconditions
- Attack surface: The n8n computer-use
search_filestool - Required access: The ability to influence or submit a file-search pattern
- Trigger point: Path expansion and confinement checking during file search
- Why exploitation is possible: A crafted pattern can bypass the intended
base-directory restriction and cause searches outside the configured location
- Additional condition: Target files must be readable by the n8n daemon's OS user
Why this happens
The underlying flaw is an incomplete path-confinement check in a file-search operation. The implementation permits specially constructed search patterns to resolve beyond the configured base directory, undermining the boundary intended to restrict filesystem access. This behavior maps to CWE-22, Improper Limitation of a Pathname to a Restricted Directory, because user-influenced path input is not reliably constrained to an authorized directory before filesystem access.
Potential impact
- An attacker may learn the names of files outside the configured search directory.
- An attacker could read contents of local files accessible to the daemon account.
- Sensitive credentials, configuration data, or application metadata could be exposed.
- The disclosed information may support further compromise of the n8n host or connected services.
General mitigation guidance
Mitigation generally focuses on treating search patterns as untrusted input and
enforcing directory boundaries after complete path resolution.
Common defensive patterns include:
- Resolve candidate paths canonically before authorization checks.
- Verify that resolved paths remain within an explicitly permitted directory.
- Reject traversal indicators, ambiguous path forms, and unexpected absolute paths
as defense-in-depth rather than relying on string filtering alone.
- Use an allowlisted search root and expose only the minimum required filesystem data.
- Run the daemon with a dedicated least-privilege OS account and restrict access to
secrets and unrelated application files.
- Apply filesystem isolation, sandboxing, and read-only mounts where practical.
- Avoid exposing file-search tools to actors that do not need them, and enforce
authorization and audit controls at the tool boundary.
How teams detect issues like this
Detection approaches can include:
- Static analysis for filesystem APIs that combine user-controlled patterns with
path joins, glob expansion, or directory traversal.
- Code review checks confirming that canonicalization occurs before containment
validation and file access.
- Tests using relative traversal, absolute paths, encoded separators, symlinks,
and platform-specific path forms to verify confinement behavior.
- Runtime monitoring for file-search requests targeting locations outside the
configured root or producing unusual volumes of file metadata.
- Policy enforcement that limits tool inputs, search roots, daemon privileges, and
filesystem mounts.
- Automated security review tools may help identify path-handling patterns, but
boundary tests and deployment-level controls remain important.

