Summary
A path traversal vulnerability in Axle-Bucamp MCP-Docusaurus allows attackers to manipulate the DOCS_DIR/path argument in document-related routes to access files outside the intended documentation directory.
When exposed over the network, this can enable remote attackers to read, modify, or delete arbitrary files on the server within the privileges of the application process.
Affected context
This issue affects deployments of Axle-Bucamp MCP-Docusaurus using the update_document, continue_document, delete_document, and get_content routes in app/routes/document.py where user-controlled paths are joined with a base documentation directory (e.g., DOCS_DIR).
The vulnerability typically manifests when the application trusts client-supplied path fragments, such as file names or subdirectories, without robust normalization and enforcement that the final resolved path remains inside the intended documentation root.
Any environment exposing these routes over HTTP/HTTPS, especially in multi-user or internet-facing setups, may be at risk.
Exploit preconditions
- Attack surface: HTTP/HTTPS endpoints mapped to
update_document,continue_document,delete_document, andget_contentinapp/routes/document.py. - Required access: Ability to send crafted requests to the vulnerable routes (no local shell access required; authentication requirements depend on the specific deployment).
- Trigger point: Supplying path values for
DOCS_DIR/path(or equivalent parameters) that include traversal sequences or absolute/relative path tricks, which the server then uses directly for file operations. - Why exploitation is possible: The server-side logic appears to concatenate or otherwise combine user-controlled path fragments with a base directory without consistently normalizing, validating, and enforcing that the final filesystem path remains within the intended documentation directory, enabling traversal outside that directory.
Why this happens
The root cause aligns with CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
The document routes accept path-like input from the client and use it to construct filesystem paths for reading, writing, or deleting documents.
Instead of treating these inputs as untrusted, the implementation likely:
- Joins
DOCS_DIRwith user-supplied path segments, and - Performs insufficient checks against traversal tokens like
../, encoded variants, or absolute paths,
resulting in the ability for an attacker to escape the intended documentation root directory.
This pattern reflects a broader bug class where file APIs are directly driven by user input without strict canonicalization and constraint checks on the final resolved path.
Potential impact
- Read access to files outside the intended documentation directory, potentially exposing configuration files, source code, or sensitive data.
- Modification or deletion of arbitrary files writable by the application process, leading to data corruption or loss.
- Overwriting application or configuration files, which could facilitate further compromise depending on deployment (e.g., influencing future code execution via modified scripts or configuration).
- Disclosure of internal directory structure and system layout, increasing the effectiveness of subsequent attacks.
General mitigation guidance
Effective mitigation focuses on treating all path input as untrusted and constraining file operations to a well-defined directory:
- Canonicalize and normalize user-supplied paths before use (e.g., resolving
.and..) and operate only on the canonical version. - Enforce that the resolved canonical path starts with the expected base directory (e.g.,
DOCS_DIR) before performing any filesystem operations. - Restrict path parameters to a strict, well-defined format (such as whitelisting file names from a known set or enforcing allowed characters and extensions) instead of accepting arbitrary path fragments.
- Decouple user identifiers from raw filesystem paths; map logical document IDs to server-side-managed paths rather than allowing clients to specify paths directly.
- Run the application with least-privilege filesystem permissions so that even if path validation fails, accessible files are minimized.
- Where possible, separate document storage from critical system and configuration files (e.g., using a dedicated volume or chroot-like isolation).
How teams detect issues like this
Organizations can detect and monitor for this class of vulnerability using:
- Static analysis: Rules that flag direct use of request parameters in file APIs (open, read, write, delete, os.path.join, Path operations) without canonicalization and base-path checks.
- Code review: Look for routes or handlers where:
- Path parameters are taken directly from the request, and
- Combined with a base directory using string concatenation or naive joins, and
- No subsequent verification ensures the final resolved path stays inside the intended directory.
- Runtime monitoring: Web application firewalls (WAF) or request filters configured to detect suspicious path patterns (e.g.,
../, URL-encoded traversal tokens, or absolute paths) targeting document routes. - Automated security testing: DAST or fuzzing tools configured to probe file-handling endpoints with traversal patterns and validate responses for unexpected file contents or error messages.

