Summary
Eclipse Theia's filesystem backend may allow an unauthenticated client to write an uploaded file to an attacker-selected absolute path outside the workspace. In browser-based deployments, a cross-origin request can trigger this behavior without authentication, potentially enabling remote code execution when the backend process can overwrite a startup-executed or otherwise sensitive file.
Affected context
The issue occurs in Eclipse Theia deployments that enable the @theia/filesystem backend and expose the HTTP file-upload endpoint. It is particularly relevant to browser-based deployments where authentication tokens are enforced for WebSocket upgrades but are not rejected for the associated HTTP request path. Electron mode uses a separate security-token mechanism and is not affected through this specific path.
Exploit preconditions
- Attack surface: HTTP
POST /file-uploadendpoint accepting multipart form data - Required access: No authenticated Theia session is required in the affected browser deployment model
- Trigger point: File-upload handling when the supplied
uriidentifies the destination path - Why exploitation is possible: The backend uses an attacker-controlled absolute path without workspace confinement and performs an overwrite-capable filesystem move
- Additional condition: The backend process must have write permission for the selected destination
- Cross-origin consideration: The multipart request type can be sent cross-origin without requiring a CORS preflight
Why this happens
The underlying flaw combines insufficient path validation with missing authorization on a file-write operation. The upload handler treats a client-controlled absolute URI as a trusted destination and does not constrain it to the workspace or another approved directory before performing an overwrite-capable move. This maps primarily to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, with related weaknesses involving external control of file names or paths, missing authentication, and cross-site request forgery exposure.
Potential impact
- An unauthenticated attacker may overwrite files outside the intended workspace
- The backend process may be forced to modify configuration, credential, or application files
- Startup-executed files could be altered, which may enable remote code execution
- The application environment, host, or dependent services could be compromised
- Existing files may be destroyed or replaced, affecting availability and integrity
General mitigation guidance
Mitigation generally focuses on enforcing authorization and restricting every upload destination to an explicitly approved directory.
Common defensive patterns include:
- Require authentication and authorization before accepting file-upload requests
- Enforce the connection or session token consistently for HTTP requests, not only WebSocket upgrades
- Resolve and canonicalize destinations, then verify they remain within an allowed workspace or upload root
- Reject absolute paths, traversal components, symlink escapes, and destinations outside the configured boundary
- Avoid overwrite-by-default behavior and apply narrowly defined replacement policies
- Use dedicated low-privilege service accounts with minimal filesystem write permissions
- Apply CSRF protections and restrictive origin policies as defense-in-depth for browser-accessible endpoints
- Store uploads in isolated, non-executable locations and separate them from startup or configuration files
How teams detect issues like this
Organizations can look for:
- Static analysis findings involving client-controlled paths passed to filesystem move, copy, write, or rename operations
- Code review signals such as absolute-path acceptance, missing canonical-path checks, and overwrite-enabled file operations
- Endpoint inventories identifying unauthenticated multipart upload handlers
- Integration tests that verify token enforcement for HTTP requests and rejection of destinations outside the workspace
- Runtime monitoring for unexpected writes by the Theia backend process outside approved directories
- Policy checks requiring authentication, origin controls, and least-privilege filesystem access for upload services
Automated security review tools can help identify path-construction and authorization patterns, but deployment-level testing remains important.

