Skip to content

fix(desktop): shell.openExternal called without URL protocol validation #30613

Description

@alper-dev

Description

The open-link IPC handler in packages/desktop/src/main/ipc.ts calls shell.openExternal(url) without validating the URL protocol. This allows arbitrary protocols (e.g., file:, javascript:, ms-msdt:, smb:) to be opened via the OS default handler.

The primary attack vector is the terminal component (packages/app/src/components/terminal.tsx:340), where getHoveredLinkText() reads URLs from xterm.js output and passes them directly to platform.openLink(). LLM-generated output could contain malicious URLs that a user opens via Shift+Click.

Steps to reproduce

  1. Open OpenCode desktop app
  2. Ask the LLM to output a file:// URL or craft terminal output containing one
  3. Shift+Click the link in the terminal
  4. The OS executes/opens the file:// URL without validation

Impact

  • Arbitrary application execution via file:///path/to/executable
  • NTLM hash leakage via smb:// URLs on Windows
  • Protocol handler abuse via ms-msdt:, ms-settings:, etc.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions