Summary
A path traversal vulnerability in Devika v1.0 allows the Patcher Agent's save_code_to_project function to write files outside the intended project workspace. The issue becomes risky when attacker-controlled or insufficiently validated path values reach the file-writing operation, potentially enabling unauthorized modification of application or system files.
A path traversal vulnerability in Devika v1.0 allows the Patcher Agent's save_code_to_project function to write files outside the intended project workspace. The issue becomes risky when attacker-controlled or insufficiently validated path values reach the file-writing operation, potentially enabling unauthorized modification of application or system files.
Affected context
The vulnerability occurs in Devika v1.0 within the Patcher Agent's project file-writing workflow. It is relevant where file paths are derived from user-controlled, agent-controlled, or otherwise untrusted input without reliable confinement to the configured project workspace. The practical impact depends on the permissions of the Devika process and the files reachable by that process.
The vulnerability occurs in Devika v1.0 within the Patcher Agent's project file-writing workflow. It is relevant where file paths are derived from user-controlled, agent-controlled, or otherwise untrusted input without reliable confinement to the configured project workspace. The practical impact depends on the permissions of the Devika process and the files reachable by that process.
Exploit preconditions
- Attack surface: The Patcher Agent's
save_code_to_projectfile-writing function - Required access: The ability to influence the path or file destination supplied to the agent, directly or through an exposed workflow
- Trigger point: A save operation that processes the attacker-influenced path
- Why exploitation is possible: Path values are not sufficiently constrained to the intended workspace before filesystem access occurs
- Attack surface: The Patcher Agent's
save_code_to_projectfile-writing function - Required access: The ability to influence the path or file destination supplied to the agent, directly or through an exposed workflow
- Trigger point: A save operation that processes the attacker-influenced path
- Why exploitation is possible: Path values are not sufficiently constrained to the intended workspace before filesystem access occurs
Why this happens
The underlying bug is improper neutralization of path elements before constructing a filesystem destination. When a file-writing routine trusts a relative or otherwise manipulated path, traversal components or alternate path representations may cause resolution outside the approved project directory. This maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, commonly called path traversal.
The underlying bug is improper neutralization of path elements before constructing a filesystem destination. When a file-writing routine trusts a relative or otherwise manipulated path, traversal components or alternate path representations may cause resolution outside the approved project directory. This maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, commonly called path traversal.
Potential impact
- An attacker may overwrite or create files outside the project workspace
- Application configuration or source files could be modified
- The Devika process could be used to alter files accessible under its operating-system permissions
- File integrity, availability, or downstream build and deployment processes could be affected
- In some environments, unauthorized file writes could contribute to code execution or broader compromise
- An attacker may overwrite or create files outside the project workspace
- Application configuration or source files could be modified
- The Devika process could be used to alter files accessible under its operating-system permissions
- File integrity, availability, or downstream build and deployment processes could be affected
- In some environments, unauthorized file writes could contribute to code execution or broader compromise
General mitigation guidance
Mitigation generally focuses on enforcing a strong filesystem trust boundary around project writes.
Common defensive patterns include:
- Resolve candidate paths against a fixed workspace and verify that the canonical result remains within that workspace
- Prefer safe file APIs that accept an approved directory handle or constrained destination
- Reject traversal components, absolute paths, alternate separators, and ambiguous path encodings as defense-in-depth
- Use allowlisted project-relative filenames and restrict writable file types where practical
- Run the agent with the least filesystem privilege necessary and isolate project workspaces
- Apply atomic writes, permission controls, and read-only protections to sensitive locations
- Treat agent-generated paths as untrusted even when they originate from an internal workflow
Mitigation generally focuses on enforcing a strong filesystem trust boundary around project writes.
Common defensive patterns include:
- Resolve candidate paths against a fixed workspace and verify that the canonical result remains within that workspace
- Prefer safe file APIs that accept an approved directory handle or constrained destination
- Reject traversal components, absolute paths, alternate separators, and ambiguous path encodings as defense-in-depth
- Use allowlisted project-relative filenames and restrict writable file types where practical
- Run the agent with the least filesystem privilege necessary and isolate project workspaces
- Apply atomic writes, permission controls, and read-only protections to sensitive locations
- Treat agent-generated paths as untrusted even when they originate from an internal workflow
How teams detect issues like this
High-level detection approaches include:
- Static analysis rules for filesystem writes that concatenate or join untrusted input without canonicalization and boundary checks
- Code review checks for missing workspace containment validation in save, export, upload, and archive-extraction functions
- Runtime monitoring for writes outside approved project directories and unexpected modifications to configuration or executable files
- Policy enforcement that limits agent processes to dedicated writable directories through operating-system or container controls
- Tests covering relative traversal, absolute paths, symbolic links, alternate separators, and encoded path representations
- Neutral automated code-review tools can help identify risky path construction patterns, but findings should be validated against deployment-specific controls
High-level detection approaches include:
- Static analysis rules for filesystem writes that concatenate or join untrusted input without canonicalization and boundary checks
- Code review checks for missing workspace containment validation in save, export, upload, and archive-extraction functions
- Runtime monitoring for writes outside approved project directories and unexpected modifications to configuration or executable files
- Policy enforcement that limits agent processes to dedicated writable directories through operating-system or container controls
- Tests covering relative traversal, absolute paths, symbolic links, alternate separators, and encoded path representations
- Neutral automated code-review tools can help identify risky path construction patterns, but findings should be validated against deployment-specific controls
Sources
| Source | Link |
|---|---|
| gist. | gist.github.com/ |
| github. | github.com/ |

