Executive brief
Kilo-Org kilocode, a tool used for code review and file diffing, contains a security flaw in its File Diff API. An attacker can exploit this to bypass directory restrictions and read sensitive files from the server's filesystem, such as configuration files or system credentials. This could lead to the exposure of private data and provide a foothold for further attacks on the hosting environment.
Technical details
A path traversal vulnerability (CWE-22) exists in the File Diff API endpoint of Kilo-Org kilocode. The vulnerability is located in the `detailMeta` function within `packages/opencode/src/kilocode/review/worktree-diff.ts`. The application uses `path.join()` to combine a workspace directory with a user-supplied `file` parameter without proper validation or normalization. An attacker can provide traversal sequences (e.g., `../../`) to escape the intended directory. The resulting path is passed to `Bun.file().text()`, which reads the file and includes its contents in the JSON response. While some metrics suggest low privileges are required, the technical report indicates the `/experimental/worktree/diff/file` endpoint may be accessible to any remote user with network access.
Affected products
- Kilo-Org kilocode <= 7.0.47
Timeline
- 2026-04-04: other: Vulnerability discovered and documented in a private gist
- 2026-05-17: advisory: CVE-2026-8765 published via VulDB/NVD