Summary
A path traversal flaw in with-context-mcp affects note ingestion, teleportation, synchronization, and project-folder handling. If a remotely reachable function accepts attacker-controlled path values without adequate containment checks, an attacker may access or modify files outside the intended project directory.
Affected context
The vulnerability occurs in the note and project-folder functions implemented in src/index.ts. It may affect deployments using with-context-mcp versions up to 3.0.7 when these functions process externally influenced file or directory paths and the service is reachable by an attacker. The practical impact depends on the operating-system permissions of the service account and whether the affected operations permit reading, writing, or synchronizing files.
Exploit preconditions
- Attack surface: Remotely reachable MCP functions for note or project-folder operations
- Required access: Access to invoke the affected service functions; authentication requirements depend on deployment configuration
- Trigger point: Processing a path supplied to ingest_notes, teleport_notes, sync_notes, or project_folder
- Why exploitation is possible: Path input may be used without reliably constraining resolution to an approved project directory
Why this happens
The underlying bug is insufficient validation and containment of attacker-influenced filesystem paths. When an application combines a trusted base directory with an untrusted path without canonicalization and boundary checks, traversal elements can cause resolution outside the intended location. This behavior maps to CWE-22, Improper Limitation of a Pathname to a Restricted Directory, commonly called path traversal.
Potential impact
- An attacker may read files outside the intended project directory
- An attacker could modify or overwrite files if the affected operation permits writing
- Sensitive configuration, source code, or credential material may be exposed
- The service account or connected project data may be compromised
- File manipulation could support further compromise of the host or application
General mitigation guidance
Mitigation generally focuses on enforcing a strict filesystem trust boundary for every path-handling operation. Common defensive patterns include resolving paths canonically before use, verifying that the resolved result remains within an approved directory, rejecting ambiguous or unexpected path formats, and preferring opaque file identifiers over client-supplied paths. File operations can be separated by purpose, with read and write permissions minimized and service accounts restricted from sensitive locations. Secure-by-default configurations should limit exposed functions and avoid allowing arbitrary project roots or filesystem locations to be selected by remote callers.
How teams detect issues like this
Detection can include static-analysis rules for path concatenation or filesystem APIs that consume request-derived values without canonicalization and boundary validation. Code review should examine every affected function for trusted-base enforcement, symlink handling, platform-specific path behavior, and consistent validation across read, write, copy, and synchronization paths. Runtime controls can log rejected paths, unexpected directory escapes, and access to files outside approved roots; automated security review tools may help identify these patterns during development.

