Описание
TinaCMS Vulnerable to Path Traversal Leading to Arbitrary File Read, Write and Delete
Summary
The TinaCMS CLI development server exposes media endpoints that are vulnerable to path traversal, allowing attackers to read and write arbitrary files on the filesystem outside the intended media directory.
Details
When running tinacms dev, the CLI starts a local HTTP server (default port 4001) exposing endpoints such as:
-
/media/list/*
-
/media/upload/*
-
/media/*
These endpoints process user-controlled path segments using decodeURI() and path.join() without validating that the resolved path remains within the configured media directory.
Vulnerable code
PoC
Arbitrary File Read
Result:
Arbitrary File Write
Result:
Arbitrary File Delete
Impact
An attacker who can reach the TinaCMS CLI dev server can:
-
Read arbitrary files (e.g. /etc/passwd, .env, SSH keys)
-
Write arbitrary files anywhere writable by the server process
-
Delete or overwrite files, depending on endpoint usage
-
Escalate to code execution in realistic development setups by overwriting executable scripts, configuration files, or watched source files
Attack Surface
The dev server binds to localhost by default, but exploitation is realistic in:
-
Cloud IDEs (Codespaces, Gitpod)
-
Docker or VM setups with port forwarding
-
Misconfigured dev environments binding to 0.0.0.0
-
Local malware or malicious dependencies
The server also enables permissive CORS, which may allow browser-based exploitation if the dev server is externally reachable, but CORS is not required for exploitation.
Recommended Fix
-
Resolve paths to absolute form
-
Enforce that resolved paths remain within the media root
-
Reject .. path segments and absolute paths
-
Consider authentication or token protection for dev server endpoints
Пакеты
@tinacms/cli
< 2.1.8
2.1.8
Связанные уязвимости
Tina is a headless content management system. Prior to 2.1.8, the TinaCMS CLI development server exposes media endpoints that are vulnerable to path traversal, allowing attackers to read and write arbitrary files on the filesystem outside the intended media directory. When running tinacms dev, the CLI starts a local HTTP server (default port 4001) exposing endpoints such as /media/list/*, /media/upload/*, and /media/*. These endpoints process user-controlled path segments using decodeURI() and path.join() without validating that the resolved path remains within the configured media directory. This vulnerability is fixed in 2.1.8.