Summary
A path traversal vulnerability in Eclipse Theia's Agent Mode file-change tools allows model-influenced paths to access files outside the configured workspace. If an attacker can steer model output through indirect prompt injection, the Theia backend may write, replace, or delete files with the backend user's operating-system privileges, potentially enabling code execution.
Affected context
The issue occurs in Eclipse Theia versions that provide Agent Mode file-change operations without enforcing workspace containment for model-supplied paths. Risk is higher when Agent Mode applies file changes without confirmation and the backend process can access sensitive user or host-executed files. The vulnerability depends on model output reaching file-operation helpers without adequate path normalization and boundary checks.
Exploit preconditions
- Attack surface: Theia Agent Mode file-change tools in the backend
- Required access: Access to an Agent Mode workflow or another way to influence the model's generated file-operation arguments
- Trigger point: A write, replacement, state, or delete helper processes a model-supplied path
- Why exploitation is possible: The path is resolved without reliably confirming that the resulting location remains inside the authorized workspace
- Additional conditions: The backend operating-system user must have write or delete permissions for the targeted location; indirect prompt injection may provide a route for influencing model output
Why this happens
The underlying bug is improper restriction of file paths to an intended workspace boundary. Relative traversal, absolute locations, and home-directory expansion can cause a path resolver to produce a destination outside the authorized root when containment is not checked after normalization.
This behavior maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, commonly called path traversal. The insecure pattern is trusting a user- or model-influenced path as a workspace-relative filename without canonicalizing it and verifying that the final destination remains within the permitted directory.
Potential impact
- An attacker may modify or delete files outside the workspace.
- Sensitive configuration, credential, or source files could be overwritten or removed.
- Shell startup or other host-executed files could be changed.
- The backend process could execute attacker-controlled content under its operating-system privileges.
- The development environment or connected systems could be further compromised.
General mitigation guidance
Mitigation typically focuses on enforcing a strong filesystem trust boundary for every Agent Mode file operation.
Common defensive patterns include:
- Resolving and canonicalizing paths before access, then enforcing containment within an approved workspace root.
- Rejecting absolute paths, traversal components, home-directory expansion, symlink escapes, and ambiguous path forms unless explicitly required and controlled.
- Applying the same validation to write, replace, delete, and state-management helpers.
- Using allowlisted workspace roots and capability-limited file APIs rather than general filesystem access.
- Requiring explicit user confirmation for sensitive or out-of-workspace operations.
- Running the backend with least-privilege filesystem permissions and isolating it from host-sensitive locations.
- Treating model output as untrusted input and reducing its authority over filesystem operations.
How teams detect issues like this
Organizations can detect this class of issue through:
- Static analysis rules that flag file APIs receiving model-, user-, or tool-derived paths without canonicalization and containment checks.
- Code review checks for path joining without post-resolution boundary validation.
- Tests covering relative traversal, absolute paths, home-directory expansion, symbolic links, and equivalent normalized paths.
- Runtime policy enforcement that records and blocks file operations outside approved workspace roots.
- Audit monitoring for Agent Mode writes or deletes affecting startup files, SSH configuration, or other sensitive locations.
- Automated security review tools that identify unrestricted filesystem access in AI tool integrations.

