Summary
A combination of directory traversal and overly permissive CORS in the TinaCMS CLI dev server allows a malicious website to abuse a developer's running dev instance from the browser.
If a developer is tricked into visiting an attacker-controlled page while tinacms dev is running, the attacker can enumerate the filesystem and create or delete arbitrary files on the developer's machine.
Affected context
This vulnerability arises in development environments where:
- The TinaCMS CLI dev server is running (e.g.,
tinacms dev) - The dev server exposes HTTP endpoints that touch the local filesystem
- CORS is configured with
Access-Control-Allow-Origin: *, allowing any origin to issue browser requests - Developers are actively browsing the web and may open untrusted sites
In this context, the browser becomes a conduit for cross-origin requests to the local dev server, which is further weakened by a path traversal flaw in file-handling routes.
Exploit preconditions
- Attack surface: HTTP endpoints of the TinaCMS dev server, typically bound to localhost on the developer's machine.
- Required access: Ability to entice a developer to open a malicious webpage in a browser while the dev server is running (no direct network access to the dev server required if the browser can reach it).
- Trigger point: The malicious page issues crafted cross-origin requests (e.g., XHR/fetch) to the dev server endpoints, relying on:
- Permissive CORS headers (
Access-Control-Allow-Origin: *) that allow the browser to send and read responses. - Path traversal parameters or paths that cause the dev server to operate on attacker-chosen filesystem locations.
- Why exploitation is possible: The dev server both:
- Trusts path components enough to allow directory traversal to arbitrary files, and
- Opts into sharing responses with any origin via CORS, turning the victim's browser into an authorized client for sensitive file operations on the local filesystem.
Why this happens
The core issue is the combination of:
- CWE-22: Path Traversal — File operations (read/write/delete) are based on user-controlled paths that are insufficiently sanitized, allowing
../-style traversal to escape intended directories and reach arbitrary filesystem locations. - CWE-942: Overly Permissive Cross-domain Whitelist — The dev server configures CORS with
Access-Control-Allow-Origin: *, effectively trusting all origins and allowing web pages from any domain to make authenticated-feeling requests from the browser.
Abstractly, the dev server exposes filesystem-affecting functionality to HTTP clients and fails to:
- Restrict file paths to a safe, fixed root
- Enforce a constrained set of origins or stronger cross-origin protections
This insecure design enables arbitrary local file access via a drive-by web page, with the browser bridging the network gap to localhost.
Potential impact
- Remote enumeration of the developer's local filesystem structure (e.g., discovering directories and filenames).
- Creation of arbitrary files on the developer's machine, potentially planting malicious scripts, configuration files, or backdoors in project directories.
- Deletion of arbitrary files, causing data loss, project corruption, or disruption of development workflows.
- Modification of project or configuration files that may later be committed, leading to supply-chain risks if compromised content is pushed to shared repositories.
- Indirect execution of malicious configuration or build steps when the developer later runs build, test, or deployment tooling over the tampered files.
General mitigation guidance
Effective mitigation focuses on both filesystem confinement and strict cross-origin controls:
- Harden file path handling:
- Resolve and normalize user-supplied paths and enforce that resulting paths remain within a predefined project root or sandbox directory.
- Avoid directly concatenating user input into filesystem paths; use library utilities to validate and constrain path traversal attempts.
- Restrict file operations to an explicit allowlist of directories or file types needed for dev workflows.
- Tighten CORS and local access:
- Replace
Access-Control-Allow-Origin: *with a more restrictive configuration that either: - Limits origins to an explicit allowlist under your control, or
- Disables cross-origin access where not strictly required.
- Avoid exposing sensitive file-handling endpoints to cross-origin requests at all by design (e.g., disabling CORS on endpoints that touch the filesystem).
- Consider isolating dev tooling behind loopback-only bindings and avoiding patterns that encourage browser-based cross-origin calls to localhost when not needed.
- Reduce impact of compromise:
- Run development services with the least privileges necessary and avoid elevated permissions that broaden filesystem access.
- Separate build artifacts and sensitive personal data from directories accessed by dev servers.
- Encourage developers to treat local dev servers as untrusted from the broader web, and use dedicated browser profiles or network isolation when running sensitive tooling.
How teams detect issues like this
Detection can be approached through code analysis, security review, and runtime monitoring:
- Static analysis patterns:
- Scan for filesystem APIs (e.g., file read/write/delete) that incorporate HTTP request parameters or URL segments into paths.
- Flag uses of
../-sensitive operations without a subsequent normalization-and-check pattern that enforces a fixed root directory. - Identify CORS configuration constructs that set
Access-Control-Allow-Origin: *or dynamically mirror theOriginheader without proper validation.
- Code review signals:
- Dev server routes that:
- Accept arbitrary paths or filenames from query parameters or request bodies.
- Write or delete files outside of clearly documented, constrained directories.
- CORS middleware applied globally to all routes, especially to endpoints performing file operations.
- Lack of clear separation between "safe for cross-origin use" APIs and "local-only, privileged" endpoints.
- Policy and tooling:
- Apply security linters or automated review tools with rules for path traversal and insecure CORS usage.
- Include checks in CI pipelines to prevent introduction of new endpoints that mix filesystem access with wide-open CORS.
- Perform periodic dynamic testing of dev servers to ensure directory traversal and cross-origin constraints are enforced as intended.

