/

CVE-2026-51873

Severity:

HIGH RISK

(8.8)

Directory Traversal (CWE-22) in Devika Coder Function

CVE-2026-51873

Deferred

Vulnerability type

Category:

Directory Traversal

CWE:

CWE-22

Impact:

Arbitrary File Write

Severity:

HIGH RISK

(8.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A directory traversal vulnerability in Devika's Coder.save_code_to_project function may allow attackers to write files outside the intended project workspace. The issue becomes risky when attacker-controlled file paths reach the save operation without sufficient canonicalization and boundary checks.

A directory traversal vulnerability in Devika's Coder.save_code_to_project function may allow attackers to write files outside the intended project workspace. The issue becomes risky when attacker-controlled file paths reach the save operation without sufficient canonicalization and boundary checks.

Affected context

This issue occurs in Devika v1.0 when the Coder component saves generated or supplied code into a project workspace. It may be present where file paths are influenced by untrusted input and the application does not reliably verify that resolved destinations remain within the authorized project directory.

This issue occurs in Devika v1.0 when the Coder component saves generated or supplied code into a project workspace. It may be present where file paths are influenced by untrusted input and the application does not reliably verify that resolved destinations remain within the authorized project directory.

Exploit preconditions

  • Attack surface: The project-code saving functionality exposed by the Devika Coder component
  • Required access: Access to invoke the affected code-saving workflow or submit inputs that influence its file path
  • Trigger point: Coder.save_code_to_project when it constructs and writes the destination file
  • Why exploitation is possible: Insufficient path validation may allow traversal sequences or equivalent path representations to resolve outside the intended workspace
  • Attack surface: The project-code saving functionality exposed by the Devika Coder component
  • Required access: Access to invoke the affected code-saving workflow or submit inputs that influence its file path
  • Trigger point: Coder.save_code_to_project when it constructs and writes the destination file
  • Why exploitation is possible: Insufficient path validation may allow traversal sequences or equivalent path representations to resolve outside the intended workspace

Why this happens

The underlying bug is improper limitation of a filesystem path to an intended directory. When attacker-influenced path components are concatenated or resolved without canonicalization and containment checks, the resulting destination may escape the permitted project workspace. This behavior maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').

The underlying bug is improper limitation of a filesystem path to an intended directory. When attacker-influenced path components are concatenated or resolved without canonicalization and containment checks, the resulting destination may escape the permitted project workspace. This behavior maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').

Potential impact

  • Attackers may write or overwrite files outside the intended project directory
  • Application configuration or source files could be modified
  • Service availability may be affected through destructive or invalid file changes
  • Sensitive application behavior could be altered, potentially enabling further compromise
  • Developer or deployment workflows could be disrupted
  • Attackers may write or overwrite files outside the intended project directory
  • Application configuration or source files could be modified
  • Service availability may be affected through destructive or invalid file changes
  • Sensitive application behavior could be altered, potentially enabling further compromise
  • Developer or deployment workflows could be disrupted

General mitigation guidance

Mitigation generally focuses on treating file paths as untrusted data and enforcing a strict workspace boundary.

Common defensive patterns include:

  • Canonicalizing the candidate path before writing
  • Verifying that the resolved path remains beneath an approved, fixed workspace root
  • Rejecting traversal components, absolute paths, alternate separators, and ambiguous path forms where appropriate
  • Using secure path-join utilities with explicit containment checks
  • Restricting the process account's filesystem permissions and write scope
  • Applying allowlisted filenames or generated identifiers instead of accepting arbitrary destination paths
  • Keeping project and runtime configuration files protected from unintended modification

Mitigation generally focuses on treating file paths as untrusted data and enforcing a strict workspace boundary.

Common defensive patterns include:

  • Canonicalizing the candidate path before writing
  • Verifying that the resolved path remains beneath an approved, fixed workspace root
  • Rejecting traversal components, absolute paths, alternate separators, and ambiguous path forms where appropriate
  • Using secure path-join utilities with explicit containment checks
  • Restricting the process account's filesystem permissions and write scope
  • Applying allowlisted filenames or generated identifiers instead of accepting arbitrary destination paths
  • Keeping project and runtime configuration files protected from unintended modification

How teams detect issues like this

Organizations can detect directory traversal risks through:

  • Static analysis rules for string-based path concatenation followed by file-write operations
  • Code review checks for missing canonicalization and workspace-containment validation
  • Tests using relative traversal, absolute paths, encoded separators, and platform-specific path variants
  • Runtime policy controls that restrict writable directories for the application process
  • File-integrity monitoring on configuration, source, and deployment-related paths
  • Automated security review tools that flag untrusted input flowing into filesystem APIs

Organizations can detect directory traversal risks through:

  • Static analysis rules for string-based path concatenation followed by file-write operations
  • Code review checks for missing canonicalization and workspace-containment validation
  • Tests using relative traversal, absolute paths, encoded separators, and platform-specific path variants
  • Runtime policy controls that restrict writable directories for the application process
  • File-integrity monitoring on configuration, source, and deployment-related paths
  • Automated security review tools that flag untrusted input flowing into filesystem APIs

Sources

SourceLink
gist.github.comgist.github.com/Ro1ME/946b670dfefd594a123ed4527de34088
github.comgithub.com/stitionai/devika/issues/707

Frequently asked

questions

Exploitability depends on how the Devika Coder workflow is exposed. If an attacker can reach the relevant functionality and influence the saved path, exploitation may be possible without direct filesystem access.

The attacker generally needs permission to invoke the affected project-saving operation or control input consumed by it. The exact requirement depends on application authentication and deployment boundaries.

Resolve candidate paths against a fixed workspace root and verify containment before writing. Prefer allowlisted filenames or server-generated paths when arbitrary paths are not required.

Treat all path components as untrusted, apply platform-aware canonicalization and boundary checks, test bypass variants, and run the service with the least filesystem privilege necessary.

Exploitability depends on how the Devika Coder workflow is exposed. If an attacker can reach the relevant functionality and influence the saved path, exploitation may be possible without direct filesystem access.

The attacker generally needs permission to invoke the affected project-saving operation or control input consumed by it. The exact requirement depends on application authentication and deployment boundaries.

Resolve candidate paths against a fixed workspace root and verify containment before writing. Prefer allowlisted filenames or server-generated paths when arbitrary paths are not required.

Treat all path components as untrusted, apply platform-aware canonicalization and boundary checks, test bypass variants, and run the service with the least filesystem privilege necessary.

Find out what's already
exploitable in your codebase.