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
- Open OpenCode desktop app
- Ask the LLM to output a file:// URL or craft terminal output containing one
- Shift+Click the link in the terminal
- 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.
Description
The
open-linkIPC handler inpackages/desktop/src/main/ipc.tscallsshell.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), wheregetHoveredLinkText()reads URLs from xterm.js output and passes them directly toplatform.openLink(). LLM-generated output could contain malicious URLs that a user opens via Shift+Click.Steps to reproduce
Impact
file:///path/to/executablesmb://URLs on Windowsms-msdt:,ms-settings:, etc.