/

CVE-2026-88624

Severity:

CRITICAL RISK

(9.1)

Path Traversal (CWE-22) in openCode Worktree.remove

CVE-2026-88624

Deferred

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

Arbitrary Recursive Directory Deletion

Severity:

CRITICAL RISK

(9.1)

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 missing path validation flaw in openCode's Worktree.remove component allows a crafted payload to target directories outside the intended worktree. Successful exploitation may enable arbitrary recursive directory deletion, potentially causing severe data loss and service disruption.

Affected context

The vulnerability occurs in deployments using the Worktree.remove component of openCode v1.18.26 when attacker-controlled or insufficiently trusted path data reaches the deletion operation. Risk is increased when the component runs with access to sensitive directories or when supplied paths are not constrained to an approved worktree boundary.

Exploit preconditions

  • Attack surface: The Worktree.remove path-handling interface
  • Required access: Ability to submit or influence a payload processed by the component
  • Trigger point: A recursive directory-removal operation
  • Why exploitation is possible: The requested path is not adequately validated or confined to the intended directory before deletion

Why this happens

The underlying bug is insufficient canonicalization and boundary validation of a path used in a destructive filesystem operation. When user-controlled path components are accepted without verifying that the resolved target remains within an authorized worktree, an attacker may redirect the operation to unintended locations. This behavior maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').

Potential impact

  • An attacker may delete arbitrary directories recursively
  • Application data and configuration files could be permanently lost
  • Services may become unavailable because required files are removed
  • Backups, credentials, or other sensitive local data could be affected
  • Recovery and operational costs could increase substantially

General mitigation guidance

Mitigation generally focuses on treating deletion paths as untrusted and enforcing a strict filesystem boundary.

Common defensive patterns include:

  • Canonicalizing paths before authorization and deletion
  • Verifying that resolved targets remain within an approved worktree root
  • Rejecting absolute paths, traversal components, links, and ambiguous path forms where appropriate
  • Using an allowlist of removable directories rather than accepting arbitrary paths
  • Separating validation from destructive execution and applying fail-closed behavior
  • Running the component with the least filesystem privileges necessary
  • Adding safeguards such as dry-run checks, deletion scopes, and recovery controls

How teams detect issues like this

Organizations can detect path traversal and unsafe deletion risks through:

  • Static analysis for filesystem deletion calls that use externally influenced paths
  • Code review checks for missing canonicalization, root-boundary validation, or symlink handling
  • Tests covering absolute paths, traversal sequences, symbolic links, nested worktrees, and filesystem boundaries
  • Runtime auditing of recursive deletion operations and unexpected target directories
  • Policy enforcement requiring approved path helpers for destructive filesystem actions

Automated code review and security scanning tools may help identify untrusted path flow into deletion APIs.

Sources

SourceLink
github.comgithub.com/MyselfYangjz/vulnReport/issues/2

Frequently asked

questions

Exploitability depends on how the Worktree.remove component is exposed. A remotely reachable interface may allow remote exploitation, while local-only deployments generally require access to a trusted submission path.

An attacker must be able to influence the path or payload processed by the removal operation. The practical impact also depends on the filesystem permissions of the openCode process.

Resolve and validate the target against an approved worktree root before performing deletion, reject paths that escape that boundary, and apply least-privilege filesystem permissions.

Centralize safe path-handling utilities, test destructive operations against traversal and symlink cases, require security review for filesystem deletion code, and monitor recursive deletion activity.

Find out what's already
exploitable in your codebase.